Repository navigation
Add OData import support - #1649
Conversation
|
Hi, thank you for the PR! The docs and tests are pretty long, can you trim them down to what is realistically needed? You can take a look at how the other importers are documented and tested for reference. (In particular, descriptions of the development process like " |
|
Hi Jakob, I've updated the docs and tests now. Let me know what you think! |
jochenchrist
left a comment
There was a problem hiding this comment.
LGTM (appart from jakobs remarks)
|
Hi! I've updated the code and resolved the remarks. If you think anything needs more updating just let me know. For the unmapped OData types (Edm.Binary, Edm.Duration, etc) I don't see any good matching logical type in ODCS. I was considering I'd suggest extending ODCS with a servertype for OData (so we can get better support for it and skip custom properties), and also adding a few more logical types (to cover things such as variable length binary). I don't know the process how to suggest such changes of ODCS, but I'd happily write a proposal. |
jschoedl
left a comment
There was a problem hiding this comment.
Thank you, looks good!
To propose extensions of ODCS, you can create an issue in its repository.
Adds OData 4.x import from CSDL XML or JSON, using URLs or local files. Supports selecting individual EntitySets or importing all advertised EntitySets, with authentication through the existing configuration system.
Sample usage
datacontract import odata \ --service-root-url 'https://xmart-api-public-uat.who.int/refmart/' \ --entity-set ref_country \ --output datacontract.yamlSample generated datacontract
I would suggest to add "odata" as a separate server type in the ODCS so that it can be handled without custom properties. Meanwhile, I have used the server type "api".
Current limitations
This feature implements import only.
Complex types, collection-valued fields, entity or container inheritance, enum types, type definitions and
types outside the table produce errors when used by selected schemas.
Tests pass (
uv run pytest)Code formatted (
uv run ruff check --fix && uv run ruff format)Docs updated (if relevant)
CHANGELOG.md entry added