Skip to content

Remove nested relations from swagger #8536

Answered by achrinza
invissiblecat asked this question in Q&A
Discussion options

You must be logged in to vote

OpenAPI/Swagger is at the REST layer, which means you'll need to look inside the respective REST Controller, which would have something similar to this:

@post('...')
function create(
  @requestBody({
      content: {
        'application/json': {
          schema: getModelSchemaRef(Application, {
            title: 'NewApplication',
            exclude: ['id'],
          }),
        },
      },
    })
)

You can modify it as such to exclude relations:

@post('...')
function create(
  @requestBody({
      content: {
        'application/json': {
          schema: getModelSchemaRef(Application, {
            title: 'NewApplication',
            exclude: ['id'],
+          includeRelations: fa…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by invissiblecat
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