docs: refine openapi null response schema
This commit is contained in:
parent
835686d886
commit
c062850e83
@ -27,7 +27,7 @@ const nullDataEnvelopeSchema = {
|
|||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
data: {
|
data: {
|
||||||
nullable: true,
|
type: 'null',
|
||||||
},
|
},
|
||||||
meta: {
|
meta: {
|
||||||
$ref: getSchemaPath(PortfolioResponseMetaDto),
|
$ref: getSchemaPath(PortfolioResponseMetaDto),
|
||||||
|
|||||||
@ -93,4 +93,16 @@ describe('checked-in OpenAPI artifacts', () => {
|
|||||||
).toBeDefined();
|
).toBeDefined();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('portfolio delete operations document a null data envelope', () => {
|
||||||
|
for (const [method, path, status] of [
|
||||||
|
['delete', '/api/v1/portfolios/{id}', 200],
|
||||||
|
['delete', '/api/v1/portfolios/{id}/positions/{positionId}', 200],
|
||||||
|
] as const) {
|
||||||
|
expect(
|
||||||
|
openapi.paths[path][method].responses[status].content['application/json'].schema.properties
|
||||||
|
.data,
|
||||||
|
).toMatchObject({ type: 'null' });
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1171,7 +1171,7 @@ export interface operations {
|
|||||||
};
|
};
|
||||||
content: {
|
content: {
|
||||||
'application/json': {
|
'application/json': {
|
||||||
data: unknown;
|
data: null;
|
||||||
meta: components['schemas']['PortfolioResponseMetaDto'];
|
meta: components['schemas']['PortfolioResponseMetaDto'];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -1246,7 +1246,7 @@ export interface operations {
|
|||||||
};
|
};
|
||||||
content: {
|
content: {
|
||||||
'application/json': {
|
'application/json': {
|
||||||
data: unknown;
|
data: null;
|
||||||
meta: components['schemas']['PortfolioResponseMetaDto'];
|
meta: components['schemas']['PortfolioResponseMetaDto'];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -586,7 +586,7 @@ paths:
|
|||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
data:
|
data:
|
||||||
nullable: true
|
type: 'null'
|
||||||
meta:
|
meta:
|
||||||
$ref: '#/components/schemas/PortfolioResponseMetaDto'
|
$ref: '#/components/schemas/PortfolioResponseMetaDto'
|
||||||
required:
|
required:
|
||||||
@ -678,7 +678,7 @@ paths:
|
|||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
data:
|
data:
|
||||||
nullable: true
|
type: 'null'
|
||||||
meta:
|
meta:
|
||||||
$ref: '#/components/schemas/PortfolioResponseMetaDto'
|
$ref: '#/components/schemas/PortfolioResponseMetaDto'
|
||||||
required:
|
required:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user