Giter VIP home page Giter VIP logo

Comments (10)

xuzhg avatar xuzhg commented on May 22, 2024 1

@FixRM Thanks for trying this tool.

  1. there are some settings that you can use to do filter. For example: if set EnableNavigationPropertyPath = false, there will be no navigation property path.

  2. 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.

FixRM avatar FixRM commented on May 22, 2024

@xuzhg, thanks for quick reply. Can you please give me a sample of how to use IODataPathProvider?

from openapi.net.odata.

xuzhg avatar xuzhg commented on May 22, 2024

@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.

FixRM avatar FixRM commented on May 22, 2024

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.

xuzhg avatar xuzhg commented on May 22, 2024
  1. use the Capabilities annotation, but this way will change your CSDL
  2. I expose the Provider at the setting for you to set. Need some time to implement it.

from openapi.net.odata.

darrelmiller avatar darrelmiller commented on May 22, 2024

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.

darrelmiller avatar darrelmiller commented on May 22, 2024

@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.

FixRM avatar FixRM commented on May 22, 2024

@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.

FixRM avatar FixRM commented on May 22, 2024

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.

bkwdesign avatar bkwdesign commented on May 22, 2024

@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)

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.