Created
March 3, 2020 13:07
-
-
Save jnnwnk/6ee8d7c2102725aa367fc2135648027a to your computer and use it in GitHub Desktop.
See camelCase as PascalCase on open API generation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"packageName": "My.Sample.Project", | |
"packageVersion": "0.0.1", | |
"useDateTimeOffset": true, | |
"useCollection" : false, | |
"returnICollection" : false | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{>partial_header}} | |
using System; | |
using System.Linq; | |
using System.IO; | |
using System.Text; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Collections.ObjectModel; | |
using System.ComponentModel.DataAnnotations; | |
using System.Runtime.Serialization; | |
using Newtonsoft.Json; | |
{{#models}} | |
{{#model}} | |
namespace {{packageName}}.Models | |
{ {{#isEnum}}{{>enumClass}}{{/isEnum}}{{^isEnum}} | |
/// <summary> | |
/// {{description}} | |
/// </summary> | |
[DataContract] | |
public partial class {{classname}} : {{#parent}}{{{parent}}}, {{/parent}}IEquatable<{{classname}}> | |
{ {{#vars}}{{#isEnum}}{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}{{>enumClass}}{{/items}}{{/items.isEnum}} | |
/// <summary> | |
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} | |
/// </summary> | |
{{#description}} | |
/// <value>{{description}}</value> | |
{{/description}} | |
{{#required}} | |
[Required] | |
{{/required}} | |
[DataMember(Name="{{baseName}}")] | |
{{#isEnum}} | |
public {{{datatypeWithEnum}}}{{#isEnum}}{{^isContainer}}?{{/isContainer}}{{/isEnum}} {{name}} { get; set; } | |
{{/isEnum}} | |
{{^isEnum}} | |
public {{{dataType}}} {{nameInCamelCase}} { get; set; } | |
{{/isEnum}} | |
{{#hasMore}} | |
{{/hasMore}} | |
{{/vars}} | |
} | |
{{/isEnum}} | |
{{/model}} | |
{{/models}} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"openapi" : "3.0.1", | |
"info" : { | |
"title" : "Sample API", | |
"description" : "Description for sample API.", | |
"version" : "0.0.1", | |
"x-audience" : "company-internal" | |
}, | |
"servers" : [ { | |
"url" : "http://localhost:8080/api" | |
} ], | |
"paths" : { | |
"/my/sample/call" : { | |
"get" : { | |
"summary" : "Sample summary.", | |
"responses" : { | |
"200" : { | |
"description" : "My sample description.", | |
"content" : { | |
"application/json" : { | |
"schema" : { | |
"$ref" : "#/components/schemas/MySampleObject" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"components" : { | |
"schemas" : { | |
"MySampleObject" : { | |
"properties" : { | |
"myVariableName" : { | |
"type" : "string" | |
} | |
}, | |
"description" : "My sample object", | |
"example" : { | |
"myVariableName" : "myVariableName" | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment