-
Notifications
You must be signed in to change notification settings - Fork 92
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
New module: openapi-adoc #1233
New module: openapi-adoc #1233
Conversation
# Conflicts: # gradle/libs.versions.toml # openapi-common/build.gradle # openapi-to-adoc/build.gradle # openapi-to-adoc/src/main/java/io/micronaut/openapi/adoc/TemplatePaths.java # openapi-to-adoc/src/main/java/io/micronaut/openapi/adoc/md/ToAsciiDocSerializer.java # openapi-to-adoc/src/main/java/io/micronaut/openapi/adoc/utils/SwaggerUtils.java
241e1d1
to
a87925d
Compare
# Conflicts: # openapi/src/main/java/io/micronaut/openapi/view/SwaggerUIConfig.java
@graemerocher and what about this new module? Created 2 weeks ago, but nobody review it :-( |
* | ||
* @since 5.2.0 | ||
*/ | ||
public final class CollectionUtils { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this needed there is already this type in micronaut-core
module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I know, but the idea is to not depend on this library.
By the way, I saw that it will still appear in the dependencies, because... it is added by the Build plugin. How to correctly remove this background dependency?
same problem in other modules: openapi-annotations
, openapi-generator
...
} | ||
|
||
public static String loadFileFromClasspath(String location) { | ||
String file = location.replaceAll("\\\\", "/"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to check there are no path traversal vulnerabilities here. //cc @yawkat
public static OpenAPI readOpenApiFromLocation(String location) { | ||
|
||
var isJson = location.endsWith(".json"); | ||
var adjustedLocation = location.replaceAll("\\\\", "/").toLowerCase(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here with path traversal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm.. i still don't understand, what problem with my code? Your example is not the same, as my case. My location can be in URI format, can be just file system path, can be pah inside jar or classpath. This is the easiest and fastest way to get rid of problems with different slashes in the path and OS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok since this is build time only it is probably fine
See micronaut-projects/micronaut-object-storage@ac16eb7#diff-20cca42a45e0a0ce9f0ca51935262795061b156de0b3b5940c7b9f89517583c7R227 for how to prevent path traversal |
Sorry for the delay in reviewing PRs, appreciate all your work which is a significant contribution! |
Introduce new module to convert openAPI json and yml format to Asciidoc format. After it you can convert it to Markdown, HTML, PDF or DOCX.
Base template looks like this (PDF format):
You can customize full template or only part of it.
I integrated it with annotation processor as a optional module. To use it you just need add dependency to annotation processor classpath:
annotationProcessor("io.micronaut.openapi:micronaut-openapi-adoc")
Need to merge it first: micronaut-projects/micronaut-build#623