Skip to content

OpenAPI response entities: proposal + Phase 0 (refuse Swagger 2.0, document response wiring) - #1535

Open
ako wants to merge 5 commits into
mainfrom
claude/integration-contract-drift-9p6ini
Open

ako wants to merge 5 commits into
mainfrom
claude/integration-contract-drift-9p6ini

Conversation

@ako

@ako ako commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Refs #1234 (mendixlabs#280). This PR does not close the issue: it carries the design and Phase 0 only.

1. Proposal: docs/11-proposals/PROPOSAL_openapi_response_entities.md (draft)

The OpenAPI import wires every JSON response as raw Response: json. The proposal adds an opt-in GenerateEntities: Yes that:

The work is phased. Array roots and nested arrays are blocked on a Studio Pro reference project; the proposal's open questions list what that project needs to show.

2. Phase 0 (this PR's code)

Symptom, measured on the reporter's spec (petstore.swagger.io/v2/swagger.json, Swagger 2.0): describe contract operation from openapi and the create path reported success, but produced:

  • BaseUrl: '';
  • no request bodies;
  • Response: none on every operation;
  • no warning at all.

Cause: openapi.ParseSpec unmarshals into OpenAPI 3 types only, and a 2.0 document parses cleanly into an empty contract.

Fix:

  • A document with a swagger field is refused with a conversion hint (npx swagger2openapi / converter.swagger.io). Full 2.0 support is Phase 4 of the proposal.
  • The rest-client skill and the docs-site now say that the import returns JSON responses as strings, and show how to wire Response: mapping Entity { … }. The reporter's agent wrote entities and import mappings, then left every operation at Response: JSON.

Evidence:

  • Test first: TestParseSpec_RefusesSwagger2 (JSON and YAML). It failed before the fix (a Swagger 2.0 document was accepted (1 paths)).
  • TestParseSpec_AcceptsOpenAPI3 is the control: 3.0 and 3.1 still parse and convert.
  • Real specs: Petstore 2.0 is now refused with the message; Petstore 3.0 output is unchanged.
  • Repro mdl-examples/bug-tests/280-openapi-swagger2-refused.mdl with fixture mdl-examples/openapi-local-specs/petstore-swagger2.json. It is a plain .mdl because mxcli check cannot see an execution-time refusal; the unit test pins the guard.
  • make build, make lint, make test, make check-skill-mdl, make check-skill-index and make check-findings pass. Finding recorded. main is merged in, re-checked after the merge.

Generated by Claude Code

The OpenAPI importer wires every JSON response as raw `Response: json`;
users and agents must hand-write the entities and mapping. Proposes an
opt-in `GenerateEntities: Yes` that creates non-persistent entities and
writes inline `Response: mapping` (Rest$ImplicitMappingResponseHandling,
already supported), phased: P0 stops the silent Swagger 2.0 downgrade
(measured: empty contract, no warning) and adds skill guidance; P1 schema
model; P2 object-rooted generation; P3 array roots (needs a Studio Pro
reference); P4 Swagger 2.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PnpNHdpFqu1sPL7yNAQgTh
… contract

The parser reads only OpenAPI 3 fields, so a Swagger 2.0 spec (the
reporter's petstore.swagger.io/v2) unmarshalled cleanly into an empty
contract: BaseUrl '', request bodies dropped, every response `none`, no
warning. It is now refused with a conversion hint.

Also documents, in the rest-client skill and the docs-site, that the import
returns JSON responses as strings and how to wire `Response: mapping`
instead - the route the reporter's agent got wrong.

Phase 0 of PROPOSAL_openapi_response_entities.md (#1234).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PnpNHdpFqu1sPL7yNAQgTh
…ntract-drift-9p6ini

# Conflicts:
#	.claude/skills/mendix/rest-client/SKILL.md
TestSkillsTeachMDL1 requires every complete script in a skill to start with
`mdl 1;`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PnpNHdpFqu1sPL7yNAQgTh

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants