0

I have the following versions:

fastify (3.20.1) and fastify-swagger(4.8.4)

I am using fastify in a Node js/JavaScript environment.

Now in my route.js, while I am specifying the fastify.route -- I am writing these two additional tags (after the response: section):

"x-doc": {
                title: 'foo1',
                category: 'NSS',
                filename: 'bar1',
            },

"my-custom-tag": {
                title: 'foo2',
                category: 'NSS',
                filename: 'bar2',
            },

Result:

enter image description here

However in the generated JSON (swagger.json or swagger.yaml), I can see the x-doc is appearing, but not the my-custom-tag.

Of course, as I did not using custom swagger-ui, I did not expect none of these stuffs (x-doc or my-custom-tag) to appear in the swagger html, while viewing from browser.

However I would like to know the reason behind partcularly x-doc to appear in resultant JSON, but not my-custom-tag.

And what I need to do if I want to make my-custom-tag also appears in resultant JSON/yaml?

Pradip
  • 509
  • 1
  • 5
  • 22

1 Answers1

1

As per comment from @Helen above, putting a "x-" makes the difference.

In swagger specification:

 'x-doc': {
                field1: 'property1',
                field2: 'property2',
                field3: 'property3',
            },
            'x-my-custom-tag': {
                field1: 'property1_custom',
                field2: 'property2_custom',
                field3: 'property3_custom',
            }

Generated JSON.

enter image description here

Pradip
  • 509
  • 1
  • 5
  • 22