alexjomin / openapi-parser

Simple and still naive openapi documentation generator from comments of your Go code.
18 stars 8 forks source link

Empty infos fields in the Openapi file #14

Closed fhgbaguidi closed 6 years ago

fhgbaguidi commented 6 years ago

Hello,

In the generated file openapi.yaml the info fields are empty:

info:
  version: ""
  title: ""
  description: ""

The goal of this issue is to find a way to fill these fields. I have two proposition:

Use tags

The usage will be like:

// @openapi:info
//  version: 1.0.1
//  title: Some cool title
//  description: Awesome description about what my app do

This block of comment should be present in one file in the sources files. The main.go seems to be the better place ;) In this case the parser will use the first @openapi:info content to fill these data.

Use a yaml file

The user of the parser needs to have at the root of the project a file named openapi-info.yml with the content:

info:
  version: "1.0.1"
  title: "Some cool title"
  description: "Awesome description about what my app do"

This file will be used to fill the info fields during the parsing operation.

What do you think about these solutions? Which of them seems more relevant to you? Or maybe you already think about another way to solve this issue. In advance thanks

alexjomin commented 6 years ago

Hello,

This tool is born in a microservices architecture, so I had to merge N openapi files into one file.

So that's why there is already a merge command. It takes 1 "master" openapi file with the version, title, etc... that you mentioned above, and N openapi files that will be merged into this master file. It's a first step towards your second suggestion.

fhgbaguidi commented 6 years ago

Great!! Seems good. Let me test this solution.

fhgbaguidi commented 6 years ago

That is a good workaround solution. But with this solution we have to make the generation first and use the merge cli after this with another yaml file. I think the tag solution will be more consistent.