feat: import consumed REST client from OpenAPI 3.0 spec#286
Merged
Conversation
Add `OpenAPI: 'path/or/url'` property to `CREATE REST CLIENT` that auto-generates a consumed REST service document from an OpenAPI 3.0 spec (JSON or YAML). Operations, path/query parameters, request bodies, response types, resource groups (tags), and Basic auth are all derived from the spec. The spec content is stored in OpenApiFile for Studio Pro parity. Also adds `DESCRIBE CONTRACT OPERATION FROM OPENAPI` for previewing the import without writing to the project. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…OR MODIFY - writer_rest.go: drop the else-branch that wrote OpenApiFile=nil for manually-created REST clients; Studio Pro omits this field entirely for non-spec services, so writing an explicit null can corrupt existing projects - cmd_rest_clients.go: preserve the existing UnitID on CREATE OR MODIFY so any SEND REST REQUEST microflows that reference the service by ID remain valid after a re-import; applies to both the spec-driven and manual paths Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tizeIdent - fetchSpecBytes: wrap resp.Body in io.LimitReader(10 MiB) before ReadAll to prevent memory exhaustion from oversized or malicious spec URLs - sanitizeModuleName: add comment explaining intentional PascalCase vs snake_case difference relative to openapi.sanitizeIdent (service names vs operation names follow different Mendix naming conventions) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Apply go fmt to 7 syntax feature registry files (struct field alignment) and cmd_odata.go (tabs vs spaces in fetchODataMetadata). These were reformatted during the OpenAPI import session but not staged at commit time. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…kill Add BaseUrl override example and explanation to both MDL_QUICK_REFERENCE.md and .claude/skills/mendix/rest-client.md. The behavior (BaseUrl overrides servers[0].url from the spec) was already implemented and tested but missing from both doc locations. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ests
- cmd_rest_clients.go: propagate ListConsumedRestServices error in both
createRestClient and createRestClientFromSpec instead of silently
discarding it with _. A listing failure now returns an error rather
than silently creating a duplicate on OR MODIFY.
- cmd_rest_openapi_mock_test.go: 6 new mock-based executor tests for
the OpenAPI import path using an embedded httptest server (no network):
- Create from spec (verifies name, BaseUrl, operations, OpenApiContent)
- BaseUrl override (replaces servers[0].url)
- OR MODIFY preserves existing UnitID
- Duplicate without OR MODIFY returns error
- ListConsumedRestServices error propagates
- DESCRIBE CONTRACT OPERATION FROM OPENAPI previews MDL output
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
AI Code ReviewModerate IssuesMissing Test Coverage
Incomplete Full-Stack Verification
What Looks GoodDocumentation Quality
Syntax Compliance
Code Consistency
RecommendationRequest changes to add the missing doctype test examples for the new MDL syntax before approval. Specifically:
Once these test examples are added, the PR would be ready for approval as it otherwise follows all MDL syntax guidelines and maintains good documentation standards. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rebased version of #268 (original PR by @khode-mx — original had merge conflicts against main).
Changes
make grammarafter rebasemake build && make test)Summary
CREATE REST CLIENTnow acceptsOpenAPI: 'path/or/url'to auto-generate a consumed REST service document from an OpenAPI 3.0 spec (JSON or YAML). Operations, path/query parameters, request bodies, response types, resource groups (tags), and Basic auth are derived automatically.DESCRIBE CONTRACT OPERATION FROM OPENAPIpreviews what would be generated without writing to the project.Closes #207. Supersedes #268.
Co-authored-by: Dennis Kho dennis.kho@mendix.com
🤖 Generated with Claude Code