OData / ODataSamples

Samples: For ODataLib, OData Web API, RESTier, etc.
http://odata.github.io/
Other
297 stars 223 forks source link

swagger json generation for WebAPI OData #13

Open joshbooker opened 9 years ago

joshbooker commented 9 years ago

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

xuubin commented 9 years ago

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

joshbooker commented 9 years ago

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

fabm22 commented 9 years ago

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

OzBob commented 9 years ago

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

joshbooker commented 9 years ago

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

ghost commented 8 years ago

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

joshbooker commented 8 years ago

@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

chauey commented 8 years ago

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

ghost commented 8 years ago

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

allantargino commented 4 years ago

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);
}