fix: rewrite dtm spec paths to include /service/dtm prefix at build time#27
Merged
Conversation
DTM OpenAPI spec paths are relative to the service root (e.g. /assets, /definitions/properties) but the actual Cumulocity endpoints live at /service/dtm/.... Without the prefix the agent would attempt requests against non-existent tenant-root paths and always get 404s. Add servicePrefix to openapi-builds.json DTM source entries. In tsdown.config.ts, rewriteSpecPaths() rewrites every spec path key and the servers[0].url placeholder at bundle time when a servicePrefix is configured. The core spec has no prefix and is unchanged. BUNDLED_OPENAPI_OPERATIONS now generates /service/dtm/... patterns so createOpenApiPartRestrictionRules correctly blocks DTM endpoints when DTM is disabled. Update tests to match the new canonical paths.
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.
DTM OpenAPI spec paths are relative to the service root (e.g. /assets, /definitions/properties) but the actual Cumulocity endpoints live at /service/dtm/.... Without the prefix the agent would attempt requests against non-existent tenant-root paths and always get 404s.
Add servicePrefix to openapi-builds.json DTM source entries. In tsdown.config.ts, rewriteSpecPaths() rewrites every spec path key and the servers[0].url placeholder at bundle time when a servicePrefix is configured. The core spec has no prefix and is unchanged.
BUNDLED_OPENAPI_OPERATIONS now generates /service/dtm/... patterns so createOpenApiPartRestrictionRules correctly blocks DTM endpoints when DTM is disabled. Update tests to match the new canonical paths.