Skip to content

Commit 588a71a

Browse files
committed
Fix tests
1 parent 1880331 commit 588a71a

File tree

10 files changed

+14
-6
lines changed

10 files changed

+14
-6
lines changed

compiler/src/model/utils.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -654,11 +654,6 @@ export function hoistRequestAnnotations (
654654
const endpoint = mappings[apiName]
655655
assert(jsDocs, endpoint != null, `The api '${apiName}' does not exists, did you mean '${closest(apiName, Object.keys(mappings))}'?`)
656656

657-
if (endpoint.availability.stack?.visibility !== 'private') {
658-
assert(jsDocs, tags.doc_id !== '' && tags.doc_id !== null && tags.doc_id !== undefined,
659-
`Request ${request.name.name} needs a @doc_id annotation`)
660-
}
661-
662657
endpoint.request = request.name
663658
endpoint.response = response
664659

@@ -729,6 +724,11 @@ export function hoistRequestAnnotations (
729724
assert(jsDocs, false, `Unhandled tag: '${tag}' with value: '${value}' on request ${request.name.name}`)
730725
}
731726
})
727+
728+
if (endpoint.availability.stack?.visibility !== 'private') {
729+
assert(jsDocs, tags.doc_id !== '' && tags.doc_id !== null && tags.doc_id !== undefined,
730+
`Request ${request.name.name} needs a @doc_id annotation`)
731+
}
732732
}
733733

734734
/** Lifts jsDoc type annotations to fixed properties on Type */

compiler/test/body-codegen-name/specification/_global/index/request.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
/**
2121
* @rest_spec_name index
2222
* @availability stack since=0.0.0 stability=stable
23+
* @doc_id docs-index
2324
*/
2425
export interface Request {
2526
body: Foo

compiler/test/duplicate-body-codegen-name/specification/_global/index/request.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
/**
2121
* @rest_spec_name index
2222
* @availability stack since=0.0.0 stability=stable
23+
* @doc_id docs-index
2324
*/
2425
export interface Request {
2526
path_parts: {

compiler/test/no-body/specification/_global/info/request.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
/**
2121
* @rest_spec_name info
2222
* @availability stack since=0.0.0 stability=stable
23+
* @doc_id api-root
2324
*/
2425
export interface Request {
2526
body: {

compiler/test/request-availability/specification/_global/index/request.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* @rest_spec_name index
2222
* @availability serverless visibility=private stability=experimental
2323
* @availability stack stability=beta since=1.2.3 visibility=feature_flag feature_flag=abc
24+
* @doc_id docs-index
2425
*/
2526
export interface Request<TDocument> {
2627
path_parts: {

compiler/test/request-fields/specification/_global/index/request.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
/**
2121
* @rest_spec_name index
2222
* @availability stack stability=stable since=0.0.0
23+
* @doc_id docs-index
2324
*/
2425
export interface Request<TDocument> {
2526
path_parts: {

compiler/test/types/specification/_global/info/request.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@
2020
/**
2121
* @rest_spec_name info
2222
* @availability stack since=0.0.0 stability=stable
23+
* @doc_id api-root
2324
*/
2425
export interface Request {}

compiler/test/types/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ test('type_alias', t => {
9292
test('request', t => {
9393
const definition = model.types.find(t => t.kind === 'request') as Model.Request
9494
t.assert(definition)
95-
t.true(definition?.specLocation.endsWith('test/types/specification/_global/info/request.ts#L20-L24'))
95+
t.true(definition?.specLocation.endsWith('test/types/specification/_global/info/request.ts#L20-L25'))
9696
t.deepEqual(definition?.name, {
9797
name: 'Request',
9898
namespace: '_global.info'

compiler/test/writes-to-output/specification/_global/index/request.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@
2020
/**
2121
* @rest_spec_name index
2222
* @availability stack since=0.0.0 stability=stable
23+
* @doc_id docs-index
2324
*/
2425
export interface Request {}

compiler/test/wrong-namespace/specification/_global/foobar/request.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@
2020
/**
2121
* @rest_spec_name info
2222
* @availability stack since=0.0.0 stability=stable
23+
* @doc_id api-root
2324
*/
2425
export interface Request {}

0 commit comments

Comments
 (0)