New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replacing init in doc.go as a Register method #1113
Comments
I will implement it by myself if its okay by you @bojand |
@Ferrany1 that's a great idea but we can't break compatibility. This may be a feature to add maybe in v2.x.x. |
Cant it be configured thorough a cli for now? (to not break current usages) |
I'm looking at the pr you make and I'm not sure what exactly do you want to accomplish. I've understood the fact you may like to have 2 swagger docs in the same packages. Still not sure what is wrong with init function ? I'm worried because it looks like we are adding possible unnecessary complexity ... |
@ubogdan No, I want to have 1 doc file and make a direct call for register to handle error and get doc name to handle in ReadDoc later while using my middleware. |
So then why are u naming the files by instance name ? |
Because in my case I have different microservices stored in monorepo and all documentation stored in doc folder, so in this case each doc will overwrite previous, that's why instance name may be necessary in monorepo cases |
The init method allows you to register multiple instance names. Why can't you use that? |
I want to get instance name as a string as well to pass to handler for ReadDoc method |
Okay, but we can introduce breaking changes. As you may see this repo has 5k followers, you can imagine there are over 5k projects depending on it. |
But right now I'm not proposing to break contract, just to make option to make a modification |
It's up to user now handle error or not, this won't break any current repos |
If you look closer, the same pattern was used by the SQL drivers. See MySQL implementation
That's been said, the Register method signature cannot be changed and the init method will not be removed. Please figure out a different way to implement this. Documentation that was generated with an older version of swagger will stop compiling after a library update because you changed the Register function signature. This is called a breaking change and we can't accept it. |
Is your feature request related to a problem? Please describe.
As for it would be easier to register swagger by myself through a direct import
Describe the solution you'd like
Replacing init with Register method
Describe alternatives you've considered
Adding a configuration (by default keep init) else self register
The text was updated successfully, but these errors were encountered: