Small formatting change, small documentation change, rest seems good!

This commit is contained in:
Ferdi Koomen 2020-10-13 11:24:02 +02:00
parent 7163a521fa
commit 9184b2eb22
5 changed files with 11 additions and 15 deletions

View File

@ -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,
}
```

View File

@ -1,6 +1,3 @@
/**
* Supported extension for enums
*/
export interface WithEnumExtension {
'x-enum-varnames'?: string[];
'x-enum-descriptions'?: string[];

View File

@ -1,6 +1,3 @@
/**
* Supported extension for enums
*/
export interface WithNullableExtension {
'x-nullable'?: boolean;
}

View File

@ -1,6 +1,3 @@
/**
* Supported extension for enums
*/
export interface WithEnumExtension {
'x-enum-varnames'?: string[];
'x-enum-descriptions'?: string[];

View File

@ -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",