Skip to content

Add support for specifying version of documents#1947

Open
huiyifyj wants to merge 3 commits intoswaggo:masterfrom
huiyifyj:specify-api-version
Open

Add support for specifying version of documents#1947
huiyifyj wants to merge 3 commits intoswaggo:masterfrom
huiyifyj:specify-api-version

Conversation

@huiyifyj
Copy link

Describe the PR
Add --version flag for init subcommand, to specify the version of the API in the generated files.

This can reset the version of API docs with external command lines, such as the following:

$ swag init --version $(git describe --tags `git rev-list --tags --max-count=1`)

Add `--version` flag for `init` subcommand, to specify the version of the API in the generated files.
This can reset the version of API docs with external command lines, such as the following:

$ swag init --version $(git describe --tags `git rev-list --tags --max-count=1`)
@ubogdan
Copy link
Contributor

ubogdan commented Sep 11, 2025

I like the idea so far. This will actualy override the version described in annotation ?
Maybe we should log a warning message in console if the version was set in annotation.

	if config.Version != "" {
                if swagger.Info.Version  != "" {
		    log("Warn: documentation version got overrided by flag --version")
	        }
		swagger.Info.Version = config.Version
	}

Please update Readme.md.

@huiyifyj
Copy link
Author

@ubogdan 👌, done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants