Replies: 3 comments 2 replies
-
Hi, Do you mean this? https://pb33f.io/libopenapi/modifying/ |
Beta Was this translation helpful? Give feedback.
-
Thanks for your response @daveshanley I am not looking for the above. General usecase is similar to the one that goswagger supports here: https://goswagger.io/generate/spec.html (doesnt support openapi 3, 3.1 and json schema) Basically: annotate actual go structs with some comments or tags (like jsonschema tags) and get a schema doc (yaml or json) out, then use that schema doc using the libraries in this repo to validate and decode incoming requests to the same structs. This way source of truth remains go code only and openapi serves as a IDL and consistent contract definition. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the response. Goal of the feature
Functionality invocation
AnnotationsAPI metadataAdd openapi schema level metadata as a top level comment in a doc.go or main.go file. E.g: Similar to what is provided here, but compatible with openapi 3.x Annotation: openapi:meta
Operation infoAdd a comment at the interface implementing the operation or the path string literal. Can add adhoc things as required in yaml format E.g: Similar to what is provided here, but compatible with openapi 3.x Annotation: openapi:operation [method] [path pattern] [?tag1 tag2 tag3] [operation id]
Request info (params, queries, headers, json schema tags).Annotate the struct which will hold the constants for the request params accordingly. The struct comment can hold the operation id comment and the struct itself can hold further details Annotation: openapi:request [operation id1 operation id 2]
Response infoAnnotate response struct as model Annotation: openapi:model [operation id1 operation id 2]
|
Beta Was this translation helpful? Give feedback.
-
Hi,
Do you support generating spec from code? I see parsing, validation, etc but not sure if code to spec is supported here.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions