Skip to content

feat(@sap-ux/create): Adds update service-metadata command - #4987

Open
IainSAP wants to merge 40 commits into
mainfrom
feat/create/adds_metadata_update
Open

feat(@sap-ux/create): Adds update service-metadata command#4987
IainSAP wants to merge 40 commits into
mainfrom
feat/create/adds_metadata_update

Conversation

@IainSAP

@IainSAP IainSAP commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds `npx @sap-ux/create@latest update service-metadata ` — refreshes the local `metadata.xml` from a live ABAP backend for a Fiori application
  • Supports both VSCode (stored credentials via `@sap-ux/store`) and SAP Business Application Studio (BTP destination)
  • Supports reentrance-ticket and service-key authentication (BTP Embedded Steampunk) via `createForAbapOnCloud`
  • Also fetches value-help (external) service metadata when present; skip with `--no-value-help`
  • `--simulate` / `-s` does a dry run without writing to disk; `--verbose` / `-v` enables debug output
  • Accepts relative or absolute paths for ``
  • README and MCP skill index (`fiori-mcp-server`) are auto-updated via the existing build pipeline

Test plan

  • Run `update service-metadata` against a real Fiori app in VSCode with a stored system — verify `metadata.xml` is refreshed
  • Run with `--simulate` — verify no files are written, changes are printed
  • Run in BAS with a destination configured — verify `createForDestination` path is taken
  • Run with `--no-value-help` — verify only main metadata is fetched
  • Pass a relative path (e.g. `./my-app`) — verify it resolves correctly
  • Run against a reentrance-ticket system — verify `createForAbapOnCloud` path is taken
  • Unit tests: `pnpm --filter @sap-ux/create test` (all passing)

@changeset-bot

changeset-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a29d6c2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 34 packages
Name Type
@sap-ux/create Minor
@sap-ux/fiori-docs-embeddings Patch
@sap-ux/fiori-mcp-server Patch
@sap-ux/odata-service-writer Patch
@sap-ux/adp-tooling Patch
@sap-ux/fiori-app-sub-generator Patch
@sap-ux/fiori-elements-writer Patch
@sap-ux/fiori-freestyle-writer Patch
@sap-ux/generator-adp Patch
@sap-ux/generator-odata-downloader Patch
@sap-ux/inquirer-common Patch
@sap-ux/odata-service-inquirer Patch
@sap-ux/generator-simple-fe Patch
@sap-ux/abap-deploy-config-sub-generator Patch
@sap-ux/adp-flp-config-sub-generator Patch
@sap-ux/backend-proxy-middleware-cf Patch
@sap-ux/flp-config-inquirer Patch
@sap-ux/preview-middleware Patch
@sap-ux/repo-app-import-sub-generator Patch
@sap-ux/abap-deploy-config-inquirer Patch
@sap-ux/cf-deploy-config-inquirer Patch
@sap-ux/cf-deploy-config-sub-generator Patch
@sap-ux/deploy-config-sub-generator Patch
@sap-ux/deploy-tooling Patch
@sap-ux/flp-config-sub-generator Patch
@sap-ux/ui-service-inquirer Patch
@sap-ux/ui-service-sub-generator Patch
@sap-ux/ui5-application-inquirer Patch
@sap-ux/ui5-library-inquirer Patch
@sap-ux/ui5-library-reference-inquirer Patch
@sap-ux/ui5-test-writer Patch
@sap-ux/ui5-library-sub-generator Patch
@sap-ux/ui5-library-reference-sub-generator Patch
@sap-ux-private/preview-middleware-client Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@IainSAP

IainSAP commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

Back to draft - not clear what the behaviour should be where there are backend annotations under the same foplder structure as the value help. The command is update metadata so the expectation is to ONLY update metadata not local backend annotations.

@heimwege

Copy link
Copy Markdown
Contributor

Back to draft - not clear what the behaviour should be where there are backend annotations under the same foplder structure as the value help. The command is update metadata so the expectation is to ONLY update metadata not local backend annotations.

Hm. But for CAP this is the same because all backend annotations are part of the metadata.xml (sample). Does it really make sense to separate metadata update and annotation update? Are these separate use cases?

@IainSAP

IainSAP commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

Back to draft - not clear what the behaviour should be where there are backend annotations under the same foplder structure as the value help. The command is update metadata so the expectation is to ONLY update metadata not local backend annotations.

Hm. But for CAP this is the same because all backend annotations are part of the metadata.xml (sample). Does it really make sense to separate metadata update and annotation update? Are these separate use cases?

On second thought no - backend annotations and metadata should be in sync. Also its been suggested that the datasource entry in the manifest should also be re-written but not the yamls.

...but, if new value helps appear (where there were none previously - edge case ) they do need yaml updates.

unseen1980
unseen1980 previously approved these changes Jul 30, 2026
@hyperspace-pr-bot

Copy link
Copy Markdown
Contributor

Summary

The following content is AI-generated and provides a summary of the pull request:


Description

Adds a new update service subcommand to the @sap-ux/create CLI that refreshes the local OData service metadata.xml from a live ABAP backend for a SAP Fiori application. This enables developers to keep their local service metadata in sync with backend changes without manually downloading and replacing files.

Key capabilities of npx @sap-ux/create@latest update service <appPath>:

  • Connects to the backend via stored credentials (VSCode) or BTP destination (SAP Business Application Studio)
  • Fetches and updates metadata.xml for the configured OData service
  • Optionally fetches value-help (external) service metadata; skip with --no-value-help
  • Supports --simulate / -s for dry runs (no files written) and --verbose / -v for debug output
  • Accepts --service <name> to target a specific data source from manifest.json
  • Handles both OData V2 (with catalog annotations) and V4 services
  • Resolves relative or absolute app paths

Bug fixes in @sap-ux/odata-service-writer:

  • When annotations is undefined (not fetched), existing remote annotation files and manifest.json dataSource entries are now preserved instead of being deleted
  • The sap-fe-mockserver middleware in ui5-mock.yaml is now regenerated whenever external (value-help) services are written, even when updateMiddlewares=false, ensuring written external metadata remains resolvable

Documentation and MCP skill references (fiori-mcp-server) are updated accordingly, including a new references/update-service.md workflow guide.

Type of change

  • New feature (non-breaking change which adds a new feature)
  • Bug (non-breaking change which fixes an issue)

How have you tested?

  • Unit tests added for all new code paths (15+ new tests in service.test.ts)
  • Tests cover VSCode stored-credentials flow, BAS destination flow, --simulate, --verbose, --no-value-help, --service, error handling, OData V4, relative paths, and ABAP Cloud (reentranceTicket/serviceKeys) scenarios
  • New odata-service-writer tests cover annotation preservation and pruning behavior

Checklist:

  • The code conforms to the general development principles
  • Supplied as many details as possible on this change
  • The code is easy to read and maintainable by others
  • Corresponding changes to the documentation has been done
  • Already existing and new unit tests pass locally

  • 🔄 Regenerate and Update Summary
  • ✏️ Insert as PR Description (deletes this comment)
  • 🗑️ Delete comment
PR Bot Information

Version: 1.29.9

  • Correlation ID: 8e568d50-8ccc-11f1-8485-089989af4a01
  • Output Template: Repository PR Template
  • Event Trigger: pull_request.ready_for_review
  • LLM: anthropic--claude-4.6-sonnet
  • File Content Strategy: Full file content
  • Summary Prompt: Default Prompt

@hyperspace-pr-bot hyperspace-pr-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR introduces a well-structured update service command with good test coverage, but has two recurring bugs: backendConfig.url is used instead of the resolved backendUrl in both the providerConfig.baseURL and the createForAbapOnCloud call, meaning any system with a connectPath will make requests to the wrong base URL. The TLS patch check should also be moved after the early return for cloud auth types to avoid operating on a provider config that is never used. Additionally, the service name validation order should be swapped to guard against invalid explicit names before resolving the default, and the troubleshooting table in the MCP skill doc references an error string that doesn't match what the code actually emits.

PR Bot Information

Version: 1.29.9

  • Correlation ID: 8e568d50-8ccc-11f1-8485-089989af4a01
  • Agent Instructions:
  • Event Trigger: pull_request.ready_for_review
  • LLM: anthropic--claude-4.6-sonnet
  • File Content Strategy: Full file content
  • Experiment Variant: control

Comment thread packages/create/src/cli/update/service.ts
Comment thread packages/create/src/cli/update/service.ts
Comment thread packages/create/src/cli/update/service.ts
Comment thread packages/create/src/cli/update/service.ts

@heimwege heimwege left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the current implementation is fine for EDMXBackend but I'm wondering about CAP apps:

  1. CAP apps have no fiori-tools-proxy backend entry in ui5.yaml. CAP apps use cds-plugin-ui5 for local serving - no backend: section under fiori-tools-proxy.
  2. getBackendConfigsFromFioriToolsProxyMiddleware() returns [] when there's no backend entry (it catches any parse error and returns empty).
  3. backendConfig is undefined - this hits the guard at service.ts:350: No backend configuration found in 'ui5.yaml' for app at '/path/to/app'
  4. And exits cleanly.

But the command description is: Refresh the local OData service metadata.xml from the live backend for a Fiori application.

I see two options. Either we restrict to EDMXBacken only (maybe giving a description how to update the metadata for a cap app via .cdsrc and manifest.json) or we add proper handling of CAP apps.

Reject CAP applications early with a clear error and document the
EDMX-backend-only limitation in the command description and README so
it flows into the fiori-mcp-server docs embeddings.
@IainSAP

IainSAP commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

the current implementation is fine for EDMXBackend but I'm wondering about CAP apps:

  1. CAP apps have no fiori-tools-proxy backend entry in ui5.yaml. CAP apps use cds-plugin-ui5 for local serving - no backend: section under fiori-tools-proxy.
  2. getBackendConfigsFromFioriToolsProxyMiddleware() returns [] when there's no backend entry (it catches any parse error and returns empty).
  3. backendConfig is undefined - this hits the guard at service.ts:350: No backend configuration found in 'ui5.yaml' for app at '/path/to/app'
  4. And exits cleanly.

But the command description is: Refresh the local OData service metadata.xml from the live backend for a Fiori application.

I see two options. Either we restrict to EDMXBacken only (maybe giving a description how to update the metadata for a cap app via .cdsrc and manifest.json) or we add proper handling of CAP apps.

Will add a guard for edmx and and update docs (readme)

@heimwege heimwege left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • changeset ok
  • review comments addressed
  • coverage excellent
  • did NOT test manually

@sonarqubecloud

Copy link
Copy Markdown

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.

5 participants