A language for describing resource-oriented APIs & turning them into Swagger or resource diagrams. Oriented around the concepts we want to expose in the APIs.
RFC API-3 dictates that pagination fields and hyperlinks are nullable (not undefined) in certain cases. This PR adds a nullable field to the generated OpenAPI, which is the correct way in OpenAPI 3.0.x (docs).
Thanks @zhesah for reporting this.
Test
Using buyer-api-v2 to test, I generated new swagger with:
Finally, confirmed that the interfaces have nullable strings. For example, in generated-sources/openapi/model/v2SegmentMultiResponsePagination.ts:
export class V2SegmentMultiResponsePagination {
/**
* This field is a cursor to be passed as a query parameter in subsequent, paginated searches. It allows the next request to begin from where the current search left off. When \"after\" is null, there are no more records to fetch for this search.
*/
'after'?: string | null;
static discriminator: string | undefined = undefined;
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
"name": "after",
"baseName": "after",
"type": "string"
} ];
static getAttributeTypeMap() {
return V2SegmentMultiResponsePagination.attributeTypeMap;
}
}
Description
RFC API-3 dictates that pagination fields and hyperlinks are nullable (not undefined) in certain cases. This PR adds a nullable field to the generated OpenAPI, which is the correct way in OpenAPI 3.0.x (docs).
Thanks @zhesah for reporting this.
Test
Using buyer-api-v2 to test, I generated new swagger with:
and confirmed that it has nullable pagination fields:
Then I generated typescript code with
Finally, confirmed that the interfaces have nullable strings. For example, in
generated-sources/openapi/model/v2SegmentMultiResponsePagination.ts
: