Comments (10)
@FixRM Thanks for trying this tool.
-
there are some settings that you can use to do filter. For example: if set EnableNavigationPropertyPath = false, there will be no navigation property path.
-
IODataPathProvider has the "CanFilter" that is designed for your scenario, but so far, i don't have much requirement, so i haven't exposed it throw "ODataContext".
from openapi.net.odata.
@xuzhg, thanks for quick reply. Can you please give me a sample of how to use IODataPathProvider?
from openapi.net.odata.
@FixRM My design is that you can derive from "ODataPathProvider" and override this virtual method. However, "ODataPathProvider" is used in the ODataContext, that's an internal class.
I'd like to expose an interface in the setting class so developer can create an instance of "his own ODataPathProvider", but it's not supported yet.
from openapi.net.odata.
I see. What other options do I have? I was thinking of filtering while loading XML nodes, but it seems tricky and my VS is dying when I try to load original file into it
from openapi.net.odata.
- use the Capabilities annotation, but this way will change your CSDL
- I expose the Provider at the setting for you to set. Need some time to implement it.
from openapi.net.odata.
If we removed examples as proposed here #68 it would help to reduce the document size.
Also, yaml produces a much more compact format than JSON.
from openapi.net.odata.
@FixRM I think your best option would be to run the CSDL through an XSLT transform first to cut out the parts of the CSDL you don't want to process. We do some preprocessing of our CSDL this way using this approach https://github.com/microsoftgraph/msgraph-metadata/blob/master/transforms/csdl/preprocess_csdl.xsl
from openapi.net.odata.
@darrelmiller, thank you for your suggestion. Can you please help me with the transform?
My CSDL looks like this:
<edmx:Edmx Version="4.0">
<edmx:Reference Uri="http://vocabularies.odata.org/OData.Community.Keys.V1.xml">
<edmx:Include Namespace="OData.Community.Keys.V1" Alias="Keys"/>
<edmx:IncludeAnnotations TermNamespace="OData.Community.Keys.V1"/>
</edmx:Reference>
<edmx:Reference Uri="http://vocabularies.odata.org/OData.Community.Display.V1.xml">
<edmx:Include Namespace="OData.Community.Display.V1" Alias="Display"/>
<edmx:IncludeAnnotations TermNamespace="OData.Community.Display.V1"/>
</edmx:Reference>
<edmx:DataServices>
<Schema Namespace="Microsoft.Dynamics.CRM" Alias="mscrm">
<EntityType Name="crmbaseentity" Abstract="true"/>
<EntityType Name="accountleads" BaseType="mscrm.crmbaseentity">
***
I started with this one, but it generates same document.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="Schema/EntityType[not(@Name='account')]" />
</xsl:stylesheet>
What am I doing wrong?
from openapi.net.odata.
It was namespace problem. Correct transform:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"
xmlns:edm="http://docs.oasis-open.org/odata/ns/edm"
xmlns="http://docs.oasis-open.org/odata/ns/edm">
<xsl:strip-space elements="*"/><!-- Remove empty space after deletions. -->
<xsl:output method="xml" indent="yes"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!--Remove unused entities-->
<!--<xsl:template match="edm:Schema/edm:EntityType[not(@Name='account')]" />-->
<!--Remove unused entity sets-->
<xsl:template match="edm:Schema/edm:EntityContainer/edm:EntitySet[not(@Name='accounts')]" />
<!--Remove unused actions-->
<!--<xsl:template match="edm:Schema/edm:Action" />-->
<!--Remove unused types-->
<!--<xsl:template match="edm:Schema/edm:ComplexType" />-->
<!--Remove unused functions-->
<!--<xsl:template match="edm:Schema/edm:Function" />-->
<!--Remove unused enums-->
<!--<xsl:template match="edm:Schema/edm:EnumType" />-->
</xsl:stylesheet>
from openapi.net.odata.
@FixRM My design is that you can derive from "ODataPathProvider" and override this virtual method. However, "ODataPathProvider" is used in the ODataContext, that's an internal class.
I'd like to expose an interface in the setting class so developer can create an instance of "his own ODataPathProvider", but it's not supported yet.
I also have an EDMX that produces over 6400 paths- and 1800+ schemas -my swagger result is only 17 MB, but Iām also interested in ways to pass in a schema-of-interest and have the rest ignored
from openapi.net.odata.
Related Issues (20)
- Incorrect request body schema for PUT '/servicePrincipals/{servicePrincipal-id}/synchronization/secrets' HOT 1
- Bound operations not appended to non-contained navigation property paths with ExplicitBinding annotations
- Add schema to content types of stream properties that are annotated with a collection of acceptable media types
- [Feature] Retrieve complex properties of derived types
- [Investigate] Investigate growth of paths in `drives` API when composable functions are supported HOT 1
- [Fix] Update `operationId`s of navigation property paths with OData type cast segments
- [Feature] Generate navigation property paths defined in nested complex properties
- Add support for bulk update
- Support for Reference delete scenario on collection valued nav property with index in query parameter. HOT 3
- Expanding navigation properties on alternate keys HOT 2
- add dynamicRef/generic support for collections when openapi 3.1 is supported HOT 1
- Collections of primitive types should be nullable HOT 2
- nullability information for properties that are collections of complex or entity types is inconsistent HOT 9
- Modernization of source code: Update .NET package to version 8
- Generate `$expand` parameter for operations whose return type is a collection
- Add `delete` operation for non-contained nav. props only if explicitly allowed via annotation
- Parameter not defined at path level for composable bound functions.
- Duplicate operation Ids for paths with alternate keys HOT 1
- Duplicate operation Ids if a type cast is defined between an entity and a navigation property for API paths with ``$count`` system query option
- Pageable endpoints with missing schema information
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openapi.net.odata.