Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript object model for CSDL #106

Closed
wants to merge 7 commits into from
Closed

Conversation

HeikoTheissen
Copy link
Contributor

@HeikoTheissen HeikoTheissen commented Nov 4, 2024

A collection of Javascript classes with the following properties:

  • JSON.parse(fs.readFileSync("csdl.json"), CSDLReviver) gives an instance of CSDLDocument
  • JSON.stringify(instanceOfCSDLDocument) gives the CSDL JSON format

and the following helper methods:

  • path.target is the model element targeted by the path (possibly in a $Referenced CSDL document)
  • modelElement.targetingPaths() gives a set of paths targeting the model element
  • modelElement.targetingSegments() gives a set of non-final path segments targeting the model element
  • structuredType.effectiveType() gives a structured type including inherited properties

This Javascript object model is meant to help with the generation of additional documents for a CSDL model, like the Markdown documentation or the OpenAPI document. For example

  • the Markdown generation currently employs an adhoc algorithm to compute the effectiveType.
  • the XSLT-based OpenAPI generation currently does not consider whether a property is targeted by a Measures.ISOCurrency annotation.

@ralfhandl
Copy link
Contributor

@HeikoTheissen Is this inspired by or compatible with https://github.com/oasis-tcs/odata-openapi/blob/main/lib/edm.js?

@HeikoTheissen
Copy link
Contributor Author

@HeikoTheissen Is this inspired by or compatible with https://github.com/oasis-tcs/odata-openapi/blob/main/lib/edm.js?

Neither, but thanks for making me aware. I will take a look at that.

@ralfhandl
Copy link
Contributor

Will there be a variant of xml2json that produces an instance of CSDLDocument?

Or will I have to stringify the JSON and then parse it with the CSDLReviver?

@HeikoTheissen
Copy link
Contributor Author

Will there be a variant of xml2json that produces an instance of CSDLDocument?

That's my current plan.

@HeikoTheissen HeikoTheissen deleted the js-object-model branch January 3, 2025 08:14
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