Skip to content

Commit

Permalink
Use consistent name format
Browse files Browse the repository at this point in the history
  • Loading branch information
TinaHeiligers committed Sep 11, 2024
1 parent a596161 commit ad70d21
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('Router', () => {
validate: { body: validation, query: validation, params: validation },
options: {
deprecated: true,
x_discontinued: 'post test x_discontinued',
'x-discontinued': 'post test x-discontinued',
summary: 'post test summary',
description: 'post test description',
},
Expand All @@ -67,7 +67,7 @@ describe('Router', () => {
isVersioned: false,
options: {
deprecated: true,
x_discontinued: 'post test x_discontinued',
'x-discontinued': 'post test x-discontinued',
summary: 'post test summary',
description: 'post test description',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('Versioned router', () => {
path: '/test/{id}',
access: 'internal',
deprecated: true,
x_discontinued: 'x.y.z',
'x-discontinued': 'x.y.z',
});
versionedRouter.post({
path: '/test',
Expand All @@ -54,7 +54,7 @@ describe('Versioned router', () => {
"options": Object {
"access": "internal",
"deprecated": true,
"x_discontinued": "x.y.z",
"'x-discontinued'": "x.y.z",
},
"path": "/test/{id}",
},
Expand Down
2 changes: 1 addition & 1 deletion packages/core/http/core-http-server/src/router/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export interface RouteConfigOptions<Method extends RouteMethod> {
*
* @remarks This will be surfaced in OAS documentation.
*/
x_discontinued?: string;
'x-discontinued'?: string;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export type VersionedRouteConfig<Method extends RouteMethod> = Omit<
*
* @default undefined
*/
x_discontinued?: string;
'x-discontinued'?: string;
};

/**
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const sharedOas = {
'/bar': {
get: {
deprecated: true,
'x-discontinued': 'route discontinued version or date',
// 'x-discontinued': 'route x-discontinued version or date',
operationId: '%2Fbar#0',
parameters: [
{
Expand Down
4 changes: 3 additions & 1 deletion packages/kbn-router-to-openapispec/src/process_router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ export const processRouter = (
tags: route.options.tags ? extractTags(route.options.tags) : [],
...(route.options.description ? { description: route.options.description } : {}),
...(route.options.deprecated ? { deprecated: route.options.deprecated } : {}),
...(route.options.x_discontinued ? { 'x-discontinued': route.options.x_discontinued } : {}),
...(route.options['x-discontinued']
? { 'x-discontinued': route.options['x-discontinued'] }
: {}),
requestBody: !!validationSchemas?.body
? {
content: {
Expand Down

0 comments on commit ad70d21

Please sign in to comment.