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

Required in path converts to required in query too #2093

Open
1 of 2 tasks
jensjakob opened this issue Jan 7, 2025 · 0 comments
Open
1 of 2 tasks

Required in path converts to required in query too #2093

jensjakob opened this issue Jan 7, 2025 · 0 comments
Labels
bug Something isn't working openapi-ts Relevant to the openapi-typescript library

Comments

@jensjakob
Copy link

openapi-typescript version

7.4.4

Node.js version

22.6.0

OS + version

macOS 15.1.1

Description

It seems like openapi-typescript converts an OpenAPI Schema where the required is part of the in: path to be required for both path and query for typescript.

Example:

- in: path
  name: site_id
  schema:
    type: string
    format: uuid
  required: true

gets converted to:

params: {
  path: {
    site_id: string;
  };
  query: {
    site_id: string;
  };
}

even if it's not a required part of the query, only required in path

Can someone confirm and fix this?

Reproduction

sorry, I am not yet allowed to share the full schema, is there any small template schema I can adjust and share? The Redocly gives me unrelated errors

Expected result

params: {
  path: {
    site_id: string;
  };
}

Required

  • My OpenAPI schema is valid and passes the Redocly validator (npx @redocly/cli@latest lint)

Extra

@jensjakob jensjakob added bug Something isn't working openapi-ts Relevant to the openapi-typescript library labels Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working openapi-ts Relevant to the openapi-typescript library
Projects
None yet
Development

No branches or pull requests

1 participant