lambda-api icon indicating copy to clipboard operation
lambda-api copied to clipboard

Swagger Decorators for API Documentation

Open Jeremias-Tecnom opened this issue 6 years ago • 4 comments

I would be great if we could add decorators to methods and params in order to export API documentation.

I've founded this package: https://github.com/TypedProject/ts-express-decorators/tree/master/packages/swagger which is for TS.ed (express TS extensions).

Maybie we can replicate something like this.

I will try to build something similar for lambda-api. I never used custom decorators before, so if someone wants to help me or constribute to this it will be welcomed :D

Jeremias-Tecnom avatar Jul 31 '19 14:07 Jeremias-Tecnom

have you made any progress on this?

steve-mathem avatar Nov 20 '19 15:11 steve-mathem

have you made any progress on this?

Steve, i could not find any extra time to do this yet. BUT What I am doing now is declaring the API with updated SAM resources, now you can declare request models in a short way and add auth to APIs without having to declare swagger.

Auth Request Model ServerlessAPI (Where u declare models, and then you relate API events with this api declaration)

So I declare api events in SAM template with Request Models, and after deploy I export swagger documentation from API Gateway console.

Its not the best solution but is something. The only caveat is that you cant define response models, but i think they will soon add it.

If you have any doubts just ask!

Jeremias-Tecnom avatar Nov 21 '19 19:11 Jeremias-Tecnom

cool, might check that out

I'm gonna look into going the decorator route, already have a basic poc implementation, both for swagger export and also to simplify route declaration

steve-mathem avatar Nov 22 '19 08:11 steve-mathem

cool, might check that out

I'm gonna look into going the decorator route, already have a basic poc implementation, both for swagger export and also to simplify route declaration

If you wanna share it maybie i can help you!

Jeremias-Tecnom avatar Nov 25 '19 20:11 Jeremias-Tecnom