Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn about unexpected properties in HTTP schemas #374

Open
diego-aquino opened this issue Aug 29, 2024 · 1 comment
Open

Warn about unexpected properties in HTTP schemas #374

diego-aquino opened this issue Aug 29, 2024 · 1 comment
Labels
blocked Blocked feature New feature or request

Comments

@diego-aquino
Copy link
Member

Currently, the following declaration does not generate any warnings or errors:

import { type HttpSchema } from '@/http';

type MySchema = HttpSchema<{
  '/users': {
    GET: {
      searchParams: {
        name?: string;
      };
      response: {
        200: {
          body: { id: string; name: string }[];
        };
      };
    };
  };
}>;

Even though, the searchParams are declared outside the field request and won't be considered when typing interceptors.

Proposal

We should warn users or show a type error if invalid properties are passed in HTTP schema declarations. By not showing any indicating of a schema with unknown properties, we make it harder for users to realize something is not right in the declaration.

@github-project-automation github-project-automation bot moved this to To do in Zimic Aug 29, 2024
@diego-aquino diego-aquino added the bug Something isn't working label Aug 29, 2024
@diego-aquino diego-aquino modified the milestones: v0.9.2, v0.11.0 Aug 29, 2024
@diego-aquino
Copy link
Member Author

Marking as "blocked" as I see no way of implementing this due to TypeScript's structural typing. Ideas are welcome!

@diego-aquino diego-aquino added the blocked Blocked label Aug 29, 2024
@diego-aquino diego-aquino removed this from the v0.11.0 milestone Aug 29, 2024
@diego-aquino diego-aquino moved this from To do to Backlog in Zimic Aug 29, 2024
@diego-aquino diego-aquino added feature New feature or request and removed bug Something isn't working labels Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Blocked feature New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

1 participant