Skip to content

Commit 15f86ba

Browse files
committed
feat: include servers and tags in synth output
1 parent 9e442ce commit 15f86ba

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

lib/api.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { Reference } from './reference.js';
77
import { Schema } from './schema.js';
88
import { SecurityRequirement } from './security-requirement.js';
99
import { SecurityScheme } from './security-scheme.js';
10+
import { Server } from './server.js';
11+
import { Tag } from './tag.js';
1012

1113
export enum OpenApiVersion {
1214
// V2 = '2.0',
@@ -33,6 +35,12 @@ export class Api extends ApiLowLevel {
3335
return {
3436
openapi: this.options.openapi,
3537
info: this.options.info,
38+
servers: this.node.children
39+
.filter((child): child is Server => child instanceof Server)
40+
.map((child) => child.synth()),
41+
tags: this.node.children
42+
.filter((child): child is Tag => child instanceof Tag)
43+
.map((child) => child.synth()),
3644
components: {
3745
schemas: Object.fromEntries(
3846
this.node.children

0 commit comments

Comments
 (0)