Skip to content

fix(adms): align API surface with live ADMS wire format#192

Open
ShiwaliKusum wants to merge 5 commits into
SAP:mainfrom
ShiwaliKusum:feat/pr-184
Open

fix(adms): align API surface with live ADMS wire format#192
ShiwaliKusum wants to merge 5 commits into
SAP:mainfrom
ShiwaliKusum:feat/pr-184

Conversation

@ShiwaliKusum

@ShiwaliKusum ShiwaliKusum commented Jul 1, 2026

Copy link
Copy Markdown

Disclaimer: Do not include SAP-internal or customer-specific information in this PR (e.g. internal system URLs, customer names, tenant IDs, or confidential configurations). This is a public repository.

Description

Aligns the ADMS Python SDK API surface with the live ADM service wire format. Several entity paths, key structures, and method signatures were incorrect — they compiled but failed at runtime (HTTP 400/404) against the real service.

Configuration API fixes:

  • DocumentTypeBusinessObjectTypeMap uses a composite key (DocumentTypeID + BusinessObjectNodeTypeUniqueID), not a single UUID. get_type_mapping, delete_type_mapping, and mark_default updated accordingly.
  • FileExtensionPolicy entity set renamed from FileExtensionPolicy to DocumentTypeFileExtensionPolicy (matches $metadata). Model fields corrected to DocumentTypeID + FileExtension composite key; get_file_extension_policy(uuid) removed as no such UUID key exists in ADM.
  • CreateDocumentTypeBoTypeMapInput wire field names corrected from DocumentTypeId/BusinessObjectNodeTypeUniqueId to DocumentTypeID/BusinessObjectNodeTypeUniqueID.
  • MimeTypePolicy removed from public __init__ exports (no longer referenced by any public model).

Document API fixes:

  • update() (sync + async): removed the implicit follow-up GET — the UpdateDocument action returns the partial response directly from ADM; callers who need the full document should call get() explicitly.
  • get_download_url() (sync + async): doc_content_version_id is now optional (NoneDownloadDocument() for latest version), matching the OData Core.OptionalParameter annotation.

Job API fixes:

  • StartJob and JobStatus called without namespace prefix (unbound action/function imports do not use namespace prefix per OData spec).

Related Issue

Closes #https://jira.tools.sap/browse/RBSADMS-47

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Code refactoring
  • Dependency update

How to Test

  1. Configure credentials: set -a && source .env.adms && set +a
  2. Run unit tests: uv run pytest tests/adms/unit/ -v
  3. Run integration tests against a live ADM instance: uv run pytest tests/adms/integration/ -v
  4. Verify cfl, cmg, cmd, cgf, jz, js commands work against the live tenant using scripts/adms_cli.py

Checklist

  • I have read the Contributing Guidelines
  • I have verified that my changes solve the issue
  • I have added/updated automated tests to cover my changes
  • All tests pass locally
  • I have verified that my code follows the Code Guidelines
  • I have updated documentation (if applicable)
  • I have added type hints for all public APIs
  • My code does not contain sensitive information (credentials, tokens, etc.)
  • I have followed Conventional Commits for commit messages

Breaking Changes

get_type_mapping and delete_type_mapping now require two arguments (document_type_id, business_object_node_type_unique_id) instead of one. However, the previous single-argument version accepted a DocumentTypeBOTypeMapID that the ADM service never supported — every call returned HTTP 400. Since the old signature was non-functional, this is treated as a bug fix rather than a breaking API change.

get_file_extension_policy(uuid) is removed. The ADM entity has no UUID primary key; policies are identified by (DocumentTypeID, FileExtension). The old method would have always returned HTTP 404.

update() no longer performs an implicit GET after updating a document. The return value is now the partial action response from ADM (only changed fields). Callers requiring the full document after an update should call documents.get() explicitly.

Additional Notes

All fixes were validated against a live ADM playground tenant. The scripts/adms_cli.py interactive CLI (kept locally, not included in this PR) was used for end-to-end verification of each endpoint.

adwitiyasushant and others added 3 commits June 24, 2026 10:42
Mirrors cloud-sdk-java contrib-java/adms commit e5dd1da's wire-format
audit. The Java audit identified 12 fixes against the canonical CDS
sources + live ADMS tenant. Cross-verified Python state vs CDS:

  - 7 fixes were already correct in Python (UpdateDocumentInput fields,
    RestoreContentVersion envelope, DeleteContentVersion body shape,
    DownloadDocument GET function, StartJob payload, JobStatus function,
    LateHostBusinessObjectNodeID casing).
  - 5 namespace-prefix fixes were genuinely missing (lock, unlock,
    complete_multipart_upload, generate_upload_urls, mark_default) —
    Python used the short form which CAP accepts leniently but is not
    the canonical OData V4 wire format.

For cross-SDK consistency with Java, ALL 12 bound/unbound action paths
now use the fully-qualified com.sap.adm.{DocumentService,AdminService,
ConfigurationService}.X form:

  DocumentService bound actions on DocumentRelation:
    UpdateDocument, CompleteMultipartUpload,
    RestoreDocumentContentVersion, DeleteDocumentContentVersion,
    LockDocumentAndRelation, UnlockDocumentAndRelation,
    GenerateDocumentUploadURLs, DownloadDocument (function)

  DocumentService unbound:
    StartJob, JobStatus (function)

  AdminService unbound:
    StartJob, JobStatus (function)

  ConfigurationService bound on DocumentTypeBusinessObjectTypeMap:
    markDefault

Test changes:
  - Tightened 7 substring assertions in test_client.py to include the
    namespace prefix so the wire contract is captured in tests.

Also includes prior work on this branch:
  - extra_headers support on sync + async HTTP verbs (for x-subaccount-id
    header on ApplicationTenant operations)
  - subaccount_id parameter on all 4 ApplicationTenant config methods

No API surface changes, no model changes, no behavioural changes —
purely wire-protocol alignment with Java commit e5dd1da.
Interactive CLI for testing all ADMS APIs against a real ADM instance.
Used during this PR's development to verify each of the 12 wire-format
fixes returns the expected response from the live tenant.

WILL BE REMOVED BEFORE MERGE — kept in this PR only as a debugging aid
so reviewers can reproduce the live-tenant verification if desired.

Usage:
  set -a && source .env.adms && set +a
  .venv/bin/python scripts/adms_cli.py
- Remove MimeTypePolicy from __init__.py (renamed to FileExtensionPolicy in _models.py)
- Rename FileExtensionPolicy entity set to DocumentTypeFileExtensionPolicy
- Drop get_file_extension_policy by UUID; delete now uses composite key (DocumentTypeID + FileExtension)
- Fix build_doctype_botype_map_key_path to use composite key (DocumentTypeID + BusinessObjectNodeTypeUniqueID)
- Update get_type_mapping / delete_type_mapping / mark_default to accept composite key params
- Make doc_content_version_id optional in get_download_url (omit parentheses content when None)
- Drop post-update GET in update_document; return partial response from UpdateDocument action directly
- Fix X-SubaccountId header casing
- Align job API namespace constants with canonical server wire format
- Expand adms_cli.py with rfu (full upload) command and additional fixes from live tenant testing
@ShiwaliKusum ShiwaliKusum requested a review from a team as a code owner July 1, 2026 05:31
@cla-assistant

cla-assistant Bot commented Jul 1, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ adwitiyasushant
❌ I766515


I766515 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Comment thread scripts/adms_cli.py Outdated
Comment thread src/sap_cloud_sdk/adms/_configuration_api.py Outdated
@NicoleMGomes

Copy link
Copy Markdown
Contributor

PR description is not following our template. Only raise PRs to us once it's complete.

I766515 added 2 commits July 2, 2026 09:21
…lt type mapping

The ADM DocumentTypeBusinessObjectTypeMap entity uses a composite key
(DocumentTypeID + BusinessObjectNodeTypeUniqueID). The previous single-argument
signature used a fabricated DocumentTypeBOTypeMapID that was never accepted by
the service (HTTP 400), so this signature change is a bug-fix, not a breaking
API change. Added note in docstrings to clarify.
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.

3 participants