Skip to content

Commit 047d2f2

Browse files
Merge pull request #1001 from ericcrosson-bitgo/feat-add-test-case-for-private-headers-with-x-internal-tag
feat: Add test case for private headers with x-internal tag
2 parents 486df33 + 99e5ee6 commit 047d2f2

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

packages/openapi-generator/test/openapi/jsdoc.test.ts

+72
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,78 @@ testCase('schema parameter with title tag', TITLE_TAG, {
139139
},
140140
});
141141

142+
const ROUTE_WITH_PRIVATE_HEADERS = `
143+
import * as t from 'io-ts';
144+
import * as h from '@api-ts/io-ts-http';
145+
146+
export const route = h.httpRoute({
147+
path: '/foo',
148+
method: 'GET',
149+
request: h.httpRequest({
150+
headers: {
151+
/**
152+
* A private header
153+
* @private
154+
*/
155+
'x-private-header': t.string,
156+
'public-header': t.string
157+
}
158+
}),
159+
response: {
160+
200: t.string
161+
},
162+
});
163+
`;
164+
165+
testCase("route with private headers", ROUTE_WITH_PRIVATE_HEADERS, {
166+
openapi: '3.0.3',
167+
info: {
168+
title: 'Test',
169+
version: '1.0.0'
170+
},
171+
paths: {
172+
'/foo': {
173+
get: {
174+
parameters: [
175+
{
176+
'x-internal': true,
177+
description: 'A private header',
178+
in: 'header',
179+
name: 'x-private-header',
180+
required: true,
181+
schema: {
182+
type: 'string'
183+
}
184+
},
185+
{
186+
in: 'header',
187+
name: 'public-header',
188+
required: true,
189+
schema: {
190+
type: 'string'
191+
}
192+
}
193+
],
194+
responses: {
195+
'200': {
196+
description: 'OK',
197+
content: {
198+
'application/json': {
199+
schema: {
200+
type: 'string'
201+
}
202+
}
203+
}
204+
}
205+
}
206+
}
207+
}
208+
},
209+
components: {
210+
schemas: {}
211+
}
212+
});
213+
142214

143215
const ROUTE_WITH_RESPONSE_EXAMPLE_STRING = `
144216
import * as t from 'io-ts';

0 commit comments

Comments
 (0)