Skip to content

feat: Support file:// URLs for OData metadata in CREATE ODATA CLIENT #206

@dionesiusap

Description

@dionesiusap

Problem

When creating consumed OData services with CREATE ODATA CLIENT, the MetadataUrl parameter currently only supports HTTP/HTTPS URLs. This creates friction in several scenarios:

  • Offline development — developers working without network access cannot create OData clients
  • Testing and CI/CD — test environments often use local metadata snapshots to ensure reproducibility
  • Version-pinned metadata — teams want to lock to a specific metadata version rather than fetching from a live service
  • Pre-production services — metadata for services under development may only exist as files, not deployed endpoints

Proposed Solution

Allow MetadataUrl to accept file:// URLs pointing to local XML metadata files:

```mdl
-- Absolute path
CREATE ODATA CLIENT MyModule.ExternalAPI (
MetadataUrl: 'file:///Users/username/projects/metadata/service.xml'
);

-- Relative path (relative to project .mpr directory)
CREATE ODATA CLIENT MyModule.LocalService (
MetadataUrl: 'file://./metadata/local-service.xml'
);
```

Key Behavior

  1. Protocol detection — If MetadataUrl starts with file://, read from local filesystem instead of HTTP
  2. Path resolution:
    • file:///absolute/path → absolute path
    • file://./relative/path → relative to .mpr file directory
  3. Hash calculation — SHA256 hash computed identically to HTTP-fetched metadata (for change detection)
  4. Backwards compatible — existing HTTP/HTTPS URLs work unchanged

Benefits

  • Offline development — no network required to set up OData clients
  • Reproducibility — metadata snapshots ensure consistent test/CI behavior
  • Team collaboration — commit metadata files alongside code in version control
  • Pre-production integration — test against upcoming API changes before deployment
  • Firewall-friendly — works in locked-down corporate environments

Implementation Details

See full proposal: `docs/11-proposals/PROPOSAL_odata_local_metadata.md`

Estimated effort: 2-3 hours

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions