Skip to content

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

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

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

Conversation

@ShiwaliKusum

Copy link
Copy Markdown

Summary

  • Remove MimeTypePolicy from public exports (class was renamed to FileExtensionPolicy)
  • Rename FileExtensionPolicy entity set path to DocumentTypeFileExtensionPolicy to match server wire format
  • Drop get_file_extension_policy by UUID; delete_file_extension_policy now uses composite key (DocumentTypeID + FileExtension)
  • Fix build_doctype_botype_map_key_path to use composite key (DocumentTypeID + BusinessObjectNodeTypeUniqueID) instead of single UUID
  • Update get_type_mapping / delete_type_mapping / mark_default signatures accordingly
  • 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 full-upload (rfu) command and fixes validated against live tenant

Test plan

  • uv run python scripts/adms_cli.py starts without ImportError
  • rfu command creates a document relation, generates upload URL, PUTs file bytes, and completes successfully
  • get_all_file_extension_policies hits DocumentTypeFileExtensionPolicy endpoint
  • get_type_mapping / delete_type_mapping use composite key path
  • get_download_url without doc_content_version_id omits version parameter from URL

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.

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