Update README.md

This commit is contained in:
Sam Xu 2018-09-27 11:23:25 -07:00 committed by GitHub
parent 9ff3653861
commit 018cfb84fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,38 +35,38 @@ The following sample code illustrates the use of the library
```csharp
public static void GenerateOpenApiDescription()
{
IEdmModel model = GetEdmModel();
OpenApiDocument document = model.ConvertToOpenApi();
var outputJSON = openapiObject.SerializeAsJson(OpenApiSpecVersion.OpenApi3_0));
var outputYAML = openapiObject.SerializeAsYaml(OpenApiSpecVersion.OpenApi3_0));
}
{
IEdmModel model = GetEdmModel();
OpenApiDocument document = model.ConvertToOpenApi();
var outputJSON = openapiObject.SerializeAsJson(OpenApiSpecVersion.OpenApi3_0));
var outputYAML = openapiObject.SerializeAsYaml(OpenApiSpecVersion.OpenApi3_0));
}
public static IEdmModel GetEdmModel()
{
{
// load EDM model here...
}
}
```
Or with the convert settings:
```csharp
public static void GenerateOpenApiDescription()
{
IEdmModel model = GetEdmModel();
OpenApiConvertSettings settings = new OpenApiConvertSettings
{
IEdmModel model = GetEdmModel();
OpenApiConvertSettings settings = new OpenApiConvertSettings
{
// configuration
};
OpenApiDocument document = model.ConvertToOpenApi(settings);
var outputJSON = openapiObject.SerializeAsJson(OpenApiSpecVersion.OpenApi3_0));
var outputYAML = openapiObject.SerializeAsYaml(OpenApiSpecVersion.OpenApi3_0));
}
};
OpenApiDocument document = model.ConvertToOpenApi(settings);
var outputJSON = openapiObject.SerializeAsJson(OpenApiSpecVersion.OpenApi3_0));
var outputYAML = openapiObject.SerializeAsYaml(OpenApiSpecVersion.OpenApi3_0));
}
public static IEdmModel GetEdmModel()
{
{
// load EDM model here...
}
}
```
The `GetEdmModel()` method can load a model in 3 ways:
@ -111,4 +111,4 @@ provided by the bot. You will only need to do this once across all repos using o
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.