ODataSamples icon indicating copy to clipboard operation
ODataSamples copied to clipboard

swagger json generation for WebAPI OData

Open joshbooker opened this issue 10 years ago • 10 comments

How did you generate swagger trippin.json for OData?

We need a tool for this, like OData swagger generator, so any WebAPI OData project can easily be used in Azure AppService.

More info:

https://github.com/OData/WebApi/issues/278

https://social.msdn.microsoft.com/Forums/en-US/7363e392-86d8-4b60-99fd-af98e128ab06/whats-the-odata-story?forum=AzureAPIApps

joshbooker avatar Mar 30 '15 17:03 joshbooker

We have a internal tool to generate swagger file from OData model. We'll publish the tool in GitHub soon.

xuubin avatar Apr 01 '15 01:04 xuubin

Thanks for your reply. Any update on when this tool will be published?

joshbooker avatar Apr 10 '15 13:04 joshbooker

@bixu-ms Hi, did you upload the tool you mentionned ?? Thanks a lot

fabm22 avatar Sep 16 '15 20:09 fabm22

@bixu-ms When will you upload the tool you mentioned?

OzBob avatar Oct 05 '15 04:10 OzBob

@fabm22 & @OzBob The internal tool is here: https://github.com/OData/lab/blob/master/odata2swagger It would be swell if this made it into WebAPI OData.

joshbooker avatar Oct 23 '15 18:10 joshbooker

@joshbooker FYI, I have added Swashbuckle support for OData v4.0. Try out Swashbuckle.OData.

And see it in action here: http://swashbuckleodata.azurewebsites.net/swagger

Feedback is welcome.

ghost avatar Nov 24 '15 02:11 ghost

@rbeauchamp-lendingtree @rbeauchamp Nice! Hope WebAPI will build https://github.com/rbeauchamp/Swashbuckle.OData into their implementation https://github.com/OData/WebApi/issues/302 https://github.com/OData/WebApi/pull/520 https://github.com/OData/WebApi/pull/552

joshbooker avatar Nov 24 '15 16:11 joshbooker

@rbeauchamp-lendingtree I have not checked latest, but last time I was trying the code, I think the $filter param was missing from the swagger UI to test the REST API. Oh I think I see the filter on the demo page.. How are things going on that?

chauey avatar Dec 14 '15 17:12 chauey

@chauey The demo page runs against the latest code, so a $filter param should be available to you too from the latest NuGet package.

ghost avatar Dec 14 '15 17:12 ghost

This project from Microsoft can generate OpenAPI document from OData CSDL: https://github.com/microsoft/OpenAPI.NET.OData

public static void GenerateOpenApiDescription()
{
    IEdmModel model = GetEdmModel();
    OpenApiConvertSettings settings = new OpenApiConvertSettings
    {
        // configuration
    };
    OpenApiDocument document = model.ConvertToOpenApi(settings);
    var outputJSON = document.SerializeAsJson(OpenApiSpecVersion.OpenApi3_0);
    var outputYAML = document.SerializeAsYaml(OpenApiSpecVersion.OpenApi3_0);
}

allantargino avatar Aug 20 '20 01:08 allantargino