-
Notifications
You must be signed in to change notification settings - Fork 81
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
Could it be possible to generate for a part of the odataModel ? #263
Comments
How to deal with navigation outside of the "wanted" set? Assume Customer -> Order -> Product -> Supplier in the model, and Should the OpenAPI contain
I kind of like 4. because it doesn't hide the fact that there is more, it just doesn't describe the shape of the "unwanted" stuff. And it is probably easy to implement 😄 |
Ideally I would like a way to tell I want Customer and Order. Thanks |
Ok, assume the model looks like this, with three entity sets and their entity types, a containment navigation from classDiagram
class Customers {<<EntitySet>>}
class Orders{<<EntitySet>>}
class Products {<<EntitySet>>}
class Customer
class Order
class OrderItem
class Product
Customers o-- Customer
Orders o-- Order
Products o-- Product
Customer "1" -- "*" Order
Order *-- "*" OrderItem
OrderItem --> "1" Product
If the tool is now called with options
Would that meet your expectations? |
Hi, That would be a perfect start. Thanks. In my case I have more than 200 entities and need only 10 of them. The way to select the "wanted" entities is ok for me. Maybe we could also have a way to exclude . For instance --exclude OrderItem could allow to choose not to include OrderItem relationship. The next thing will be about the properties and could be trickier. Each entities has 100 to 360 properties, including many technical attributes not needed. Would it be possible to say Customer[property1,...,property10] to retain only the 10 properties listed ? |
What would be the benefit of hiding most properties in the OpenAPI file? A |
You are definitely right if we were using a normal OData model :) . But CRM form microsoft has created a model with more than 300 to 500 properties in many entities so the select part is polluted by all the names , not to mention the orderby that doubles it. |
What is your use case, and how will a reduced OpenAPI description help? |
My use case is CRM Odata API . too much entities. And the opportunity Entity has 364 attibutes, including much technical non business data and many relations that proves irrelevant to expected usage. If I take the initial CRM Odata model (15Mo of emx xml model) the openapi tool is generating 2,2 Go of openAPI with near to 50000 paths. This cannot be used by any tooling that I know of. Using jq I have been able to remove unwanted paths and retain only the entities I want but it is time consuming. If the model can be stripped upstream it would really be helpful. |
The problem with omitting properties is that it looks neat in Swagger UI until someone presses "Try out" and gets hundreds of properties back that aren't documented. Worse if the reduced OpenAPI file is used for generating client code where unexpected properties may result in runtime exceptions. |
you are right. I had'nt thought of this. I will think about it. Let's focus on the initial entities "viewport" issue. |
Hi there, Thanks ! I might need help to setup my env. I have done the git clone and branch and install. It goes ok saying But whenever I try odata-openapi3 (with or without -k) it says it is missing the csdl lib wich is present in my lib directory.
Should I update some metadata info ? |
lib directory contains my installs :
|
Please try |
I have tried with a list of entities and then with only one but it has removed all the entities.
the result contains no operations (since I have kept no action I suppose) and no shemas other than error and count. |
The tool expects entity set names, which don't contain dots. Look for |
it works. I will try and use it more thorougly to give you more feedback :) Thank you ! |
The diagram feature seems not affected by the entitysets selection. It includes everything. |
Hello, I am very happy with the feature. The only thing that could be enhanced is the reduction of the diagram to the selected entitySets. Could it be possible or could you point me to the right way to try to do it ? Thanks |
Hi Cyril, reducing the diagram is definitely possible, and it's on the todo list in PR #271, after some known gaps that maybe don't affect your use case. I haven't started on it yet because the easy solution would be to duplicate the exclusion conditions, and I dislike repeating myself 😄 If you want to give it a try, please open a PR against PR #271 to reduce the diagram. Thanks in advance |
Hi Cyril, I've now added diagram reduction, with a small and intentional deviation from the OpenAPI description:
Please try out whether this works for you. Thanks in advance! |
Hi; I have tested the feature and it seems strange but I might use it wrongly. first thing I have tried is to select 2 entity sets : opportunities and contacts. It has some issues ; [opportunities%20{bg:lawngreen}]++->[opportunity]contacts%20{bg:lawngreen}]++->[contact] The resulting graph is maybe too much reduced ? I have seen the Stub elements. I do not know if it is usefull to replace or anonymyze the underlying entity. I like the reduced diagram (removing the issues) but maybe the stub is too destructive. Thank you again for this work. Do you want me to test with tripin so we are sure to share the same material ? |
@crognon Hi Cyril, A test with TripPin would be really helpful, my unit test cases are apparently too trivial to run into the issues you describe. Thanks in advance |
Hi again. Tripin sample works like a charm. no issues whatsoever. Thanks issues are coming from the ultra complex model from microsoft CRM. I do not know if I can disclose it but I will keep you posted. Thanks again. |
@crognon Please try again with current state, found some bugs when testing against the MS Graph API, which is also somewhat complex. |
Hi, Tested and it works for the first usages. Thx. Still my model is so big I will have to let the diagram out of the result. Thank you for this work ! |
One remark : I have still found a stub object in the Result. I thou=ght you had removed them from the target ? Thanks |
Navigation to entity types not in the keep list still needs to be stubbed. Currently this is done by referencing a stub schema, for example two: { $ref: "#/components/schemas/stub" }, Alternatively I could use an inline "stub" two: { type: "object" }, Which alternative do you prefer? |
Would it help to omit entity types from the diagram that are not in the keep list? Or would the models still be too big? |
Hi, sorry for the delay. thanks |
Replaced stub reference with inlined stub object: two: { type: "object", description: "Stub for <original type>" }, |
Hi all,
thank you for this amazing tool.
I have encountered a huge OdataModel (D365) and the Odatamodel is 15Mo large.
50k endpoints included.
My question is : I could isolate some 10 to 15 entities useful to expose. Could it be possible to exclude all other entities and generate an OpenAPI for a subset of the model ?
Thanks
Cyril
The text was updated successfully, but these errors were encountered: