Skip to content
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

v1.8.10 : Operations parsing in dependencies #1451

Open
maitredede opened this issue Jan 25, 2023 · 9 comments
Open

v1.8.10 : Operations parsing in dependencies #1451

maitredede opened this issue Jan 25, 2023 · 9 comments

Comments

@maitredede
Copy link
Contributor

maitredede commented Jan 25, 2023

Describe the bug

With update 1.8.19 #1432, our swag generation goes empty, since all our operations are defined in sub-packages.

To Reproduce

  1. Create a package with cmd/api with files main.go (with gin router init and run) and swag.go (with go:generate and swag comments`
  2. Create subpackages pkg/api/user, pkg/api/todolist, with gin handlers and swaggo comments.
  3. go generate ./...

Expected behavior

Generated docs should contains oeprations, but it does not.

Your swag version

v1.8.10

Your go version

go1.19.5 linux/amd64

Additional context

A solution proposal : add a cli flag that allows to revert #1432 behavior (keeps #1432 behavior by default).

@maitredede maitredede changed the title v1.18.10 : Operations parsing in dependencies v1.8.10 : Operations parsing in dependencies Jan 25, 2023
@Jictyvoo
Copy link

I have the same problem here, as all my operations are defined in another modules that are inside my project monorepo

@bastianwegge
Copy link

@sdghchj we really appreciate your work, swaggo has done a great job for our swagger specs. Is there any chance to
enable dependency parsing with the flag that maitredede proposed? We're generating >500 routes into a generated package and mounting these inside of our app that generates the swagger specs. #1432 is a dealbreaker for us to use swaggo.

@sdghchj
Copy link
Member

sdghchj commented Mar 10, 2023

Hi,everyone,sorry to have made this trouble to you。But it may not be a breakup,just to change you swag cmd to fix, as swag has a cmd line flag -d to set multiple directories separated by comma.
for example:
swag init -g main.go -d cmd/api,pkg/api

@sdghchj
Copy link
Member

sdghchj commented Mar 10, 2023

it is suggested that if you want to parse apis in some external packges,just explicitly include them with flag -d

@matdurand
Copy link

The problem here is that it seems like a major breaking change to stop including operations in dependencies, and this was included in a revision release. Very confusing for anyone just casually updating their dependencies.

@arminbhy
Copy link

Hi,everyone,sorry to have made this trouble to you。But it may not be a breakup,just to change you swag cmd to fix, as swag has a cmd line flag -d to set multiple directories separated by comma. for example: swag init -g main.go -d cmd/api,pkg/api

Seems like with the change here the --pd is not working anymore, assume it would if you vendor the dependencies and include the vendor path in the -d but not if you are not vendoring.

@Jictyvoo
Copy link

Hi,everyone,sorry to have made this trouble to you。But it may not be a breakup,just to change you swag cmd to fix, as swag has a cmd line flag -d to set multiple directories separated by comma. for example: swag init -g main.go -d cmd/api,pkg/api

Seems like with the change here the --pd is not working anymore, assume it would if you vendor the dependencies and include the vendor path in the -d but not if you are not vendoring.

Yes, tried here with new version and still have this same behavior, deleting all my swagger docs, but it works on version v1.8.9

@apawelec
Copy link

apawelec commented Jun 8, 2023

Is there any progress on this? Due to this behaviour I stuck on v1.8.9.

@terev
Copy link

terev commented Jun 9, 2023

Also stuck on v1.8.9. Very curious for the real reason this feature was removed. Especially since this was done in a patch release. Also it kinda seems like the maintiners are against adding it back?

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

No branches or pull requests

8 participants