elasticio / odata2openapi

OData to OpenAPI Converter
https://www.elastic.io
MIT License
33 stars 23 forks source link

Support OpenApi summary and description #43

Open snebjorn opened 5 years ago

snebjorn commented 5 years ago

I'm consuming an OData endpoint from SAP and I've noticed that if I query the metadata like this /$metadata??sap-documentation=all stuff like this shows up.

<Documentation>
    <Summary>
        This is a summary.
    </Summary>
    <LongDescription>
        This is a long description.
    </LongDescription>
</Documentation>

Example

<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" 
    xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" 
    xmlns:sap="http://www.sap.com/Protocols/SAPData" Version="1.0">
    <edmx:DataServices m:DataServiceVersion="2.0">
        <Schema xmlns="http://schemas.microsoft.com/ado/2008/09/edm" Namespace="MEH" xml:lang="en" sap:schema-version="1">
            <EntityType Name="Foo" sap:content-version="1">
                <Key>
                    <PropertyRef Name="fooNumber"/>
                </Key>
                <Property Name="fooCategory" Type="Edm.String" Nullable="false" MaxLength="1" sap:unicode="false" sap:label="fooCategory" sap:heading="C" sap:quickinfo="Foo category" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false">
                    <Documentation>
                        <Summary>
                            This is a summary.
                        </Summary>
                        <LongDescription>
                            This is a long description.
                        </LongDescription>
                    </Documentation>
                </Property>
            </EntityType>
        </Schema>
    </edmx:DataServices>
</edmx:Edmx>

It would be really cool if that could be placed into the description and summary fields in the generated OpenAPI.

I don't know what is supposed to go into where, and I don't know if the <Documentation> element is an official OData Schema element.