You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With swag/endpoint's API, you can do something like this using endpoint.Query function:
varPostSession=endpoint.New("post", "/session/", "Create a new session on your manager",
endpoint.Query("name", "string", "the name for this session", false),
endpoint.Query("scheduler", "string", "the VNF scheduler for this session (system, docker)", false),
endpoint.Handler(NewSession),
endpoint.Response(http.StatusCreated, types.Session{}, "Successfully created a new session"),
endpoint.Description("Session creation in your manager"),
endpoint.Tags("Session"),
)
which is already expressive enough. What I would like to do, is having the (system, docker) comment as an enum instead. This would then make initial control over the choices the user does, instead of doing it in the code (which is far from being painful or anything, just a nice thing to have if possible). I guess replacing the "typ" in the Query function by a schema struct would do the trick. Something like this:
Hi,
Thanks for this project. Great job, well written documentation and really useful for my work.
I was wondering whether it was possible to define an enum in an in-path query (https://swagger.io/docs/specification/2-0/enums/).
In swagger, you can write something like this:
With swag/endpoint's API, you can do something like this using endpoint.Query function:
which is already expressive enough. What I would like to do, is having the (system, docker) comment as an enum instead. This would then make initial control over the choices the user does, instead of doing it in the code (which is far from being painful or anything, just a nice thing to have if possible). I guess replacing the "typ" in the Query function by a schema struct would do the trick. Something like this:
Or for more simplicity, modifying the function itself with something like this;
Do you think it's worth a pull request ?
Thanks for your feedback on this.
Sofiane
The text was updated successfully, but these errors were encountered: