Code Monkey home page Code Monkey logo

Comments (5)

ralfhandl avatar ralfhandl commented on August 12, 2024

Hi Sam,

No, it doesn’t. We assumed that only OData-aware clients would use the service document and metadata document, and these clients wouldn’t be interested in the OpenAPI document as it contains less information than $metadata.

Do you have situations where OpenAPI clients would be interested in the service or metadata document?

Thanks in advance
Ralf

from odata-openapi.

adriano-campanhola avatar adriano-campanhola commented on August 12, 2024

Hi @ralfhandl, in our use case, we publish the API's on Azure API Management, which will refuse any operation that is not currently defined on the interface. If we try to utilize any of the api's on a SAPUI5/UI5 frontend, those could require the $metadata operation, as the frontend could utilize it on startup.

from odata-openapi.

ralfhandl avatar ralfhandl commented on August 12, 2024

refuse any operation that is not currently defined on the interface

Well, then you've got a problem: the OpenAPI files are intentionally incomplete and only show the most prominent paths, they don't attempt to show all possible paths - given that OData's path syntax is recursive and based on the service's resource model, showing all possible paths is unreasonable.

The containment example shows a potentially endless recursion, and you can reach the contained folders only via their - potentially unlimited - chain of parent folders:

<EntityType Name="Folder">
<Key>
<PropertyRef Name="Name" />
</Key>
<Property Name="Name" Type="Edm.String" Nullable="false" />
<Property Name="Description" Type="Edm.String" />
<NavigationProperty Name="Folders" Type="Collection(self.Folder)" ContainsTarget="true" />
</EntityType>

The generated OpenAPI file stops after five levels:

"/Folders('{Name}')/Folders('{Name_1}')/Folders('{Name_2}')/Folders('{Name_3}')/Folders('{Name_4}')/Folders": {

Would Azure API Management allow to go deeper because paths for level 15 start with a documented prefix, or would it prevent accessing anything below level 5?

from odata-openapi.

adriano-campanhola avatar adriano-campanhola commented on August 12, 2024

Yep, it's a current a limitation from Azure API Management in general, but so far we haven't had to go deeper than a few levels.

from odata-openapi.

ralfhandl avatar ralfhandl commented on August 12, 2024

Recursion - API Management doesn't support definitions defined recursively (for example, schemas referring to themselves).

So this will be problematic:

"components": {
"schemas": {
"Containment.Folder": {
"title": "Folder",
"type": "object",
"properties": {
"Name": {
"type": "string"
},
"Description": {
"type": "string",
"nullable": true
},
"Folders": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Containment.Folder"

Seems like you will have to design your services carefully to match the limitations of your API Management solution, and you'll have to tweak the OpenAPI files or fork this generator to suit its specific needs.

from odata-openapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.