Skip to content

Add Body Input / Output to Route [feature]  #677

Open
@deBarrosS

Description

@deBarrosS

Description of the solution I'd like

How would it work? How would it change the API?

By walking the Router we are able to Get Routes' PathTemplates, QueriesTemplates, etc.
But we are not able(at least I haven't been) to get the body accepted by the request neither the possible responses' bodies. This could really come in handy when automating the writing of API Documentations as well as validating the requests received.

By adding the functions like BodyInput( ) and BodyOutput( ) to a Route, we'd be able to set Input/Output body parameters (add Headers as well?). Therefore, by adding a function GetBodyInput() and GetBodyOutput() it'd be possible to read them. To the output nevertheless, the question to be made is : do we only set the 200 status response or do we set a map with codes as keys?

Alternatives I've considered

As to the alternatives, I'm trying to create an struct containing the routes, the parameters and the outputs to gaether them all in one place, but it seems to me that I'd be quite usefull to have them set on the Route itself.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions