Skip to content

fix(client): read the OpenAPI document of openapi-spec-for-spring 1.0.2 - #57

Merged
grubmeshi merged 3 commits into
mainfrom
feature/openapi-shared-path-parameters
Oct 28, 2026
Merged

grubmeshi merged 3 commits into
mainfrom
feature/openapi-shared-path-parameters

Conversation

@grubmeshi

@grubmeshi grubmeshi commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

openapi-shared-path-parameters

meshStack now writes its OpenAPI document with openapi-spec-for-spring 1.0.2. The new document has a different shape, and the CLI could not read it:

  • Path parameters that all operations of a path share are now in the path item, as a parameters key next to get and delete. Parse read every key of a path item as an HTTP method and failed on that array.
  • Parameters and responses are $refs into components/parameters and components/responses. Some shared responses hold the versioned media types, so without following the refs an operation lost its API version, and meshStack answered 406 or 415.

This PR:

  • Parse reads only the HTTP methods of a path item, adds the path-level parameters to each operation (the operation's own parameter of the same name and in wins), and follows $ref chains of parameters, request bodies and responses.
  • A media type without a kind, such as application/vnd.meshcloud.api.v1.hal+json of GET /api, now has an API version.
  • openapi.Parameter.PathKey holds x-meshstack-path-key, the metadata field that fills a path parameter.
  • The hidden MESHSTACK_API_DOCS_URL also takes a file:// URL, so the acceptance suite tests against the spec of the meshStack it runs against. TestAccApiDocs checks that spec, and the GET test fills path parameters from PathKey, because the new spec names them after their kind ({workspace}, {tenant}).

The acceptance suite passes against a spec generated from meshStack's develop branch.

Released CLIs v0.3.0 to v0.6.0 cannot read the new document. Once docs.meshcloud.io serves it, they send no versioned media type and get 406 on meshObject GETs. The release notes of the next release must tell users to upgrade.

Cross-repo PRs

  • meshcloud/meshstack-cli — this PR
  • meshcloud/meshfed-release#11524 (meshcloud-internal) — runs the satellite suite on the generated spec. Merge both together.

🤖 Generated with Claude Code

grubmeshi and others added 3 commits October 28, 2026 10:33
…napi-spec-for-spring 1.0.2

meshStack now puts the path parameters that all operations of a path share into the path item, and
refers to shared parameters and responses with $ref. Parse failed on the parameters of a path item,
and without the responses an operation lost its API version, so meshStack answered 406 or 415.

Parse now reads only the HTTP methods of a path item, adds its parameters to each operation, and
follows the $ref chains of parameters, request bodies and responses. A media type without a kind,
such as application/vnd.meshcloud.api.v1.hal+json of GET /api, now has an API version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Parameter.PathKey holds x-meshstack-path-key, such as metadata.uuid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… test

MESHSTACK_API_DOCS_URL also takes a file:// URL, which the satellite run of meshfed-release sets to
the spec it generates. TestAccApiDocs checks that spec, and the GET test fills a path parameter
from its x-meshstack-path-key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@grubmeshi
grubmeshi requested a review from j0g3sc October 28, 2026 09:33
@sonarqubecloud

Copy link
Copy Markdown

@meshcloud-gh-actions

Copy link
Copy Markdown

Coverage of the acceptance run against the meshStack backend, on 6079fc0d4888f7539ea1f7d8422aa4e6fb1b4513.

Scope Coverage
Unit tests 77.9%
Acceptance tests 55.6%
Combined 80.5%
Uncovered functions
client/api_key.go:55: meshApiKeyClient.Create 0.0%
client/api_key.go:59: meshApiKeyClient.Read 0.0%
client/api_key.go:63: meshApiKeyClient.Update 0.0%
client/api_key.go:71: meshApiKeyClient.Delete 0.0%
client/api_key_permissions.go:20: ApiKeyPermissions.AllCodes 0.0%
client/api_key_permissions.go:33: ApiKeyPermissions.WorkspaceCodes 0.0%
client/api_key_permissions.go:295: AllApiKeyPermissions 0.0%
client/api_key_permissions.go:299: WorkspacePermissionCodes 0.0%
client/building_block_definition.go:71: MeshBuildingBlockDefinitionApprovalPolicies.NothingRequiresApproval 0.0%
client/building_block_definition.go:82: DisabledSchedule 0.0%
client/building_block_definition.go:89: MeshBuildingBlockDefinitionSchedule.IsDisabled 0.0%
client/building_block_definition.go:93: MeshBuildingBlockDefinitionSpec.HasNeutralPolicies 0.0%
client/building_block_definition.go:97: MeshBuildingBlockDefinitionSpec.WithNeutralPolicies 0.0%
client/building_block_definition.go:166: meshBuildingBlockDefinitionClient.List 0.0%
client/building_block_definition.go:173: meshBuildingBlockDefinitionClient.Read 0.0%
client/building_block_definition.go:177: meshBuildingBlockDefinitionClient.Create 0.0%
client/building_block_definition.go:181: meshBuildingBlockDefinitionClient.Update 0.0%
client/building_block_definition.go:185: meshBuildingBlockDefinitionClient.Delete 0.0%
client/building_block_definition_version.go:100: MeshBuildingBlockType.TagInputTargets 0.0%
client/building_block_definition_version.go:245: meshBuildingBlockDefinitionVersionClient.Create 0.0%
client/building_block_definition_version.go:254: meshBuildingBlockDefinitionVersionClient.Update 0.0%
client/building_block_definition_version_implementation.go:80: MeshBuildingBlockDefinitionImplementation.InferType 0.0%
client/building_block_definition_version_implementation.go:94: MeshBuildingBlockDefinitionImplementation.MarshalJSON 0.0%
client/building_block_definition_version_implementation.go:107: *MeshBuildingBlockDefinitionImplementation.UnmarshalJSON 0.0%
client/building_block_runner.go:87: meshBuildingBlockRunnerClient.Create 0.0%
... and 129 more

covdata func names a method without its receiver, so an entry can belong to an implementation nothing selects rather than to a function the tests never reached. Open the file and line before reading one as a coverage gap.

@grubmeshi
grubmeshi merged commit 6079fc0 into main Oct 28, 2026
13 checks passed
@grubmeshi
grubmeshi deleted the feature/openapi-shared-path-parameters branch October 28, 2026 10:20
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.

1 participant