Update OpenAPI spec generation process - #565
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/api/generator/APIGenerator.java`:
- Around line 145-148: Update the API generation branch that handles
isProvidedVersionTypeNone() so it clears the serialized version value when
versionType is none. Ensure providedVersion is not propagated into the API model
or output in this case, while preserving existing behavior for context and url
version types.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 23cd87c5-5fc4-4683-8ec4-805dc0a00d1f
📒 Files selected for processing (5)
org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/api/generator/APIGenerator.javaorg.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/api/generator/GenericApiObjectDefinition.javaorg.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/api/generator/RestApiAdmin.javaorg.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/api/generator/SwaggerConstants.javaorg.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/api/generator/pojo/GenerateAPIParam.java
| if (!versionTypeNone) { | ||
| // Match against the swagger-declared version (not the provided one) so a stale version in the URL is stripped correctly. | ||
| String versionInPath = StringUtils.isNotBlank(swaggerVersion) ? swaggerVersion : version; | ||
| if (StringUtils.isNotEmpty(versionInPath) && apiContext.endsWith(versionInPath)) { |
There was a problem hiding this comment.
Is stripping the version for versionType="context" correct? Don't we need to have a check for that?
| } | ||
| } | ||
| String version = versionTypeNone ? StringUtils.EMPTY : | ||
| (StringUtils.isNotBlank(providedVersion) ? providedVersion : (StringUtils.isNotBlank(swaggerVersion) ? swaggerVersion : StringUtils.EMPTY)); |
There was a problem hiding this comment.
It seems this line is longer than 120 characters. Shall we format it?
This PR will give priority to the user given context and version when generating an API via an OpenAPI definition. This will also remove the existing behaviour of modifying query params in an OpenAPI definition based on the url-mapping of a resource.