swag icon indicating copy to clipboard operation
swag copied to clipboard

Bug: If the parsed package does not have a package name?

Open lifegit opened this issue 4 years ago • 8 comments

RT. image

fix: #903

lifegit avatar Jul 30 '21 08:07 lifegit

conflict: packageNameStructName(use camelCase). example: apiJsonResult. no conflict: structName. example: JsonResult.

lifegit avatar Jul 30 '21 08:07 lifegit

What sense does it make ?

sdghchj avatar Aug 02 '21 01:08 sdghchj

  1. Some tools may not recognize . well .
  2. All generated models have package names . I think it's not intuitive and redundant .

image

lifegit avatar Aug 02 '21 01:08 lifegit

As swagger 2.0 support dot in models, it is a bug of the tools you mentioned, I think.

sdghchj avatar Aug 02 '21 02:08 sdghchj

  1. Some tools may not recognize . well .
  2. All generated models have package names . I think it's not intuitive and redundant .

image

Excuse me, How you generate model.Tag and model.Tag 1

To-echo avatar Nov 04 '21 13:11 To-echo

@To-echo Would you mind coming back with a code sample and explaining the issue as better you can if you need help?

ubogdan avatar Nov 04 '21 15:11 ubogdan

@To-echo Would you mind coming back with a code sample and explaining the issue as better you can if you need help?

Thank you for your reply, I just want to use swag to generate swagger.json and import it into YApi, but YApi does not support public struct, see: https://github.com/YMFE/yapi/issues/352, so I need to customize swap struct name generation rules, currently use URI as part of the structure name, see: https://github.com/To-echo/swag/commit/4af1b6a54c31a5c88c09feac5abbc00ce69c5ce7

To-echo avatar Nov 09 '21 03:11 To-echo

Unfortunately, there is no way to configure struct name generation. Removing the package name from the definition will lead to struct overlap and conflicts.

ubogdan avatar Jun 18 '22 13:06 ubogdan