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

Support setting directories for property 'swaggerInput' #41

Closed
marcelstoer opened this issue Feb 14, 2018 · 12 comments
Closed

Support setting directories for property 'swaggerInput' #41

marcelstoer opened this issue Feb 14, 2018 · 12 comments
Milestone

Comments

@marcelstoer
Copy link
Contributor

It's rather limiting that swaggerInput cannot be the path to a folder that contains Swagger files. True, the plugin can be configured multiple times as a workaround but that's really ugly.

Ideally I could set a directory for swaggerInput and have the plugin deep-scan it for Swagger files.

@RobWin
Copy link
Member

RobWin commented Feb 14, 2018

Would you like to contribute this functionality?

@marcelstoer
Copy link
Contributor Author

marcelstoer commented Feb 14, 2018

I work with open-source extensively, mostly on GitHub. Hence, I half-expected this to be the first initial comment 😜

I'm thinking about it as I definitely have to implement this functionality anyhow.

@RobWin
Copy link
Member

RobWin commented Feb 14, 2018

😁👍

@marcelstoer
Copy link
Contributor Author

marcelstoer commented Feb 15, 2018

@RobWin it'd be helpful if you could give me an indication whether the PR meets your expectations. And if so, in what time frame can you image merging it to release a new version? That would allow us to assess whether we need to temporarily deploy my fork for the time being.

@RobWin
Copy link
Member

RobWin commented Feb 15, 2018

Thx. Could you please add a test to show what happens when two Swagger files (swagger1.json and swagger2.json) reside in the same folder like /docs/swagger?
I think we should generate sub foldesr based on the name of the Swagger spec file? What do you think.

@marcelstoer
Copy link
Contributor Author

Good point, that use case is currently not supported (i.e. markdown files would get overwritten).

I think we should generate sub foldesr based on the name of the Swagger spec file?

Yes, something like that - but only if there really are multiple files in the same folder. Otherwise the directory structure in the output dir is too deeply nested. I'll take a stab at it later today.

@RobWin
Copy link
Member

RobWin commented Feb 20, 2018

The tests shouldConvertIntoDirectoryIfInputIsDirectory and shouldConvertIntoSubDirectoryIfMultipleSwaggerFilesInSameInput seem to fail on windows.

@RobWin RobWin reopened this Feb 20, 2018
@RobWin
Copy link
Member

RobWin commented Feb 20, 2018

The code seems to generate a strange URI:

Caused by: java.nio.file.InvalidPathException: Illegal char <:> at index 85: C:\Users\robwi\Documents\projects\swagger2markup-maven-plugin\target\generated-docs\C:\Users\robwi\Documents\projects\swagger2markup-maven-plugin\src\test\resources\docs\swagger\swagger.json\swagger
	at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
	at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
	at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
	at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
	at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
	at java.io.File.toPath(File.java:2234)
	at io.github.swagger2markup.Swagger2MarkupMojo.swaggerToMarkup(Swagger2MarkupMojo.java:106)

@marcelstoer
Copy link
Contributor Author

marcelstoer commented Feb 20, 2018

Sorry, had to get a hold of a Windows environment first. I'm glad you seem to have tried to release from a Windows box otherwise this bug would likely have slipped through.

@RobWin
Copy link
Member

RobWin commented Feb 20, 2018

V1.3.4 has been released. Would you like to verify that it works.
Sometimes I have issues to generate the correct maven plugin files. :(

@marcelstoer
Copy link
Contributor Author

Sometimes I have issues to generate the correct maven plugin files

Indeed, you released from the "wrong" revision. https://github.com/Swagger2Markup/swagger2markup-maven-plugin/releases/tag/v1.3.4 shows that there are "3 commits to master since this release" with one of which being the essential fix.

@RobWin
Copy link
Member

RobWin commented Feb 20, 2018

The release contains the commits. I tagged too early. I corrected it.
The new tag contains your commits as well: https://github.com/Swagger2Markup/swagger2markup-maven-plugin/blob/v1.3.4/src/main/java/io/github/swagger2markup/Swagger2MarkupMojo.java#L119

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

No branches or pull requests

2 participants