mirror of
https://github.com/ferdikoomen/openapi-typescript-codegen.git
synced 2025-12-08 20:16:21 +00:00
Small formatting change, small documentation change, rest seems good!
This commit is contained in:
parent
7163a521fa
commit
9184b2eb22
13
README.md
13
README.md
@ -328,8 +328,11 @@ enum EnumWithStrings {
|
||||
}
|
||||
```
|
||||
|
||||
### Nullable in OpenApi v2
|
||||
You can use the unofficial `x-nullable` backport in your specification to generate nullable properties in OpenApi v2.
|
||||
|
||||
### Nullable in OpenAPI v2
|
||||
In the OpenAPI v3 spec you can create properties that can be NULL, by providing a `nullable: true` in your schema.
|
||||
However, the v2 spec does not allow you to do this. You can use the unofficial `x-nullable` in your specification
|
||||
to generate nullable properties in OpenApi v2.
|
||||
|
||||
```json
|
||||
{
|
||||
@ -346,7 +349,7 @@ You can use the unofficial `x-nullable` backport in your specification to genera
|
||||
"requiredProp": {
|
||||
"description": "This is a simple string property",
|
||||
"type": "string",
|
||||
"x-nullable": true,
|
||||
"x-nullable": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -355,9 +358,9 @@ You can use the unofficial `x-nullable` backport in your specification to genera
|
||||
|
||||
Generated code:
|
||||
```typescript
|
||||
enum ModelWithNullableString {
|
||||
interface ModelWithNullableString {
|
||||
prop?: string | null,
|
||||
requiredProp: string | null
|
||||
requiredProp: string | null,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
/**
|
||||
* Supported extension for enums
|
||||
*/
|
||||
export interface WithEnumExtension {
|
||||
'x-enum-varnames'?: string[];
|
||||
'x-enum-descriptions'?: string[];
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
/**
|
||||
* Supported extension for enums
|
||||
*/
|
||||
export interface WithNullableExtension {
|
||||
'x-nullable'?: boolean;
|
||||
}
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
/**
|
||||
* Supported extension for enums
|
||||
*/
|
||||
export interface WithEnumExtension {
|
||||
'x-enum-varnames'?: string[];
|
||||
'x-enum-descriptions'?: string[];
|
||||
|
||||
@ -861,7 +861,9 @@
|
||||
"ModelWithNullableString": {
|
||||
"description": "This is a model with one string property",
|
||||
"type": "object",
|
||||
"required": ["nullableRequiredProp"],
|
||||
"required": [
|
||||
"nullableRequiredProp"
|
||||
],
|
||||
"properties": {
|
||||
"nullableProp": {
|
||||
"description": "This is a simple string property",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user