Skip to content

How can I add description to the root of Generated Document? #1318

Answered by RobinTail
huyhoang160593 asked this question in Q&A
Discussion options

You must be logged in to vote

The Documentation class extents the OpenApiBuilder (3.0) from openapi3-ts library.
According to the type of the OpenApiObject, top level description that you refer to, is most likely the one located in info object:
https://github.com/metadevpro/openapi3-ts/blob/e470c7c7c60b7c75e24e1c824ca49e55d025d9ef/src/model/openapi30.ts#L24

You can set it and any other properties you need to the instance of Documentation. Try this, @huyhoang160593 :

const documentation = new Documentation({ ... });
documentation.info.description = "Your description here";
console.log( documentation. getSpecAsYaml() );

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by RobinTail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants