docs: refine openapi null response schema

This commit is contained in:
Sergey Krylov 2026-06-15 19:54:31 +03:00
parent 835686d886
commit c062850e83
4 changed files with 17 additions and 5 deletions

View File

@ -27,7 +27,7 @@ const nullDataEnvelopeSchema = {
type: 'object',
properties: {
data: {
nullable: true,
type: 'null',
},
meta: {
$ref: getSchemaPath(PortfolioResponseMetaDto),

View File

@ -93,4 +93,16 @@ describe('checked-in OpenAPI artifacts', () => {
).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' });
}
});
});

View File

@ -1171,7 +1171,7 @@ export interface operations {
};
content: {
'application/json': {
data: unknown;
data: null;
meta: components['schemas']['PortfolioResponseMetaDto'];
};
};
@ -1246,7 +1246,7 @@ export interface operations {
};
content: {
'application/json': {
data: unknown;
data: null;
meta: components['schemas']['PortfolioResponseMetaDto'];
};
};

View File

@ -586,7 +586,7 @@ paths:
type: object
properties:
data:
nullable: true
type: 'null'
meta:
$ref: '#/components/schemas/PortfolioResponseMetaDto'
required:
@ -678,7 +678,7 @@ paths:
type: object
properties:
data:
nullable: true
type: 'null'
meta:
$ref: '#/components/schemas/PortfolioResponseMetaDto'
required: