NelmioApiDocBundle icon indicating copy to clipboard operation
NelmioApiDocBundle copied to clipboard

Documentation for versioned api

Open MatGor7 opened this issue 6 years ago • 10 comments

Hi, I'm thinking what is your solution to document versioned api. For example I have api in version 1.0 and i want to upgrade api to 1.1. In new version I add new field which is returned via api, how can I show it in documentation. I'm not sure how to create documentation depends on api version. Do you have some idea?

MatGor7 avatar Jan 09 '19 09:01 MatGor7

You can use areas (for the endpoints)

goetas avatar Jan 09 '19 09:01 goetas

Regarding fields, if you are using JMS, it supports versioning, but is not reflected yet on the docs

goetas avatar Jan 09 '19 09:01 goetas

@goetas Thanks for answer, I'm using JMS and versioning annotations work very well. I have problems with showing it in documentation. I thought about areas, but I think I must create new endpoint with specific url in this solution. What about using versioning via HTTP header? Now I use annotations to create documentation. Maybe i should create files in yml format where i can describe documentation manually for versions, but i hoped that there is a solution to do it in more automatic way.

MatGor7 avatar Jan 09 '19 10:01 MatGor7

Hmm. I think this feature is not yet available in nelmio. @GuilhemN am i right?

goetas avatar Jan 09 '19 10:01 goetas

Is this a request to add jms versioning support? If so it's not supported right now indeed. I think adding a setVersion method to the ApiDocGenerator and the JmsModelDescriber called in the controller would do it fine.

GuilhemN avatar Jan 09 '19 22:01 GuilhemN

I think adding a setVersion method to the ApiDocGenerator and the JmsModelDescriber called in the controller would do it fine.

Sounds a very good idea.

Shouldn't be part of the model as well? should be considered as if it is something similar to groups IMO...

goetas avatar Jan 10 '19 08:01 goetas

Sure, we could add that as well.

GuilhemN avatar Jan 10 '19 11:01 GuilhemN

Anything new happened here?

mu4ddi3 avatar Feb 11 '20 19:02 mu4ddi3

@mu4ddi3 No, if you'd like to submit one, a PR would be welcome.

GuilhemN avatar Jul 24 '20 14:07 GuilhemN

What about documentation.info.version in case we use areas for API versioning? Shouldn't it represent the current API version? It seems it is impossible to have multiple documentation.info.version in nelmio_api_doc.yaml.

randomsymbols avatar Aug 07 '20 13:08 randomsymbols