Skip to content

x-nullable does not work (anymore) ? #923

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

Closed
raskyer opened this issue Jul 9, 2022 · 1 comment
Closed

x-nullable does not work (anymore) ? #923

raskyer opened this issue Jul 9, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@raskyer
Copy link

raskyer commented Jul 9, 2022

Hi there,

I have an API Swagger 2.0 schema auto generated from Azure API. To have a nullable property, Azure only supports "x-nullable" so the definition of one property in model migth look like :

"description": {
  "type": "string",
  "x-nullable": true
},

But when I do : npx openapi-typescript ..\schema.json --output .\services\api.ts --version 2

The typescript definition look like :

Model: {
  description: string;
};
@drwpow drwpow added the bug Something isn't working label Aug 6, 2022
@drwpow
Copy link
Contributor

drwpow commented Nov 4, 2022

In v6 and beyond we’re dropping Swagger 2.0 support (#961). And in newer versions, x-* properties are ignored and should be handled by the consumer.

You can provide an override either with the format() option (v5) or the transform()/postTransform() options (v6) so you can control exactly what gets generated.

@drwpow drwpow closed this as completed Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants