public Swasey(GeneratorOptions opts, string ver) { Options = opts; switch (ver) { case null: throw new Exception("Version is null."); case "1.0": throw new SwaseyException( "Howdy! Version 1.0 not implemented - yet. In the mean time check out one of the super cool implemented versions."); case "1.1": throw new SwaseyException( "Howdy! Version 1.1 not implemented - yet. In the mean time check out one of the super cool implemented versions."); case "1.2": SwaggerVersion = SwaggerVersion.Version12; break; case "2.0": SwaggerVersion = SwaggerVersion.Version20; break; default: throw new Exception("I don't recognize that version. Sure you got it right?"); } }
/// <summary> /// Initialize the document of Swagger model. /// </summary> protected virtual void InitializeDocument() { SwaggerDocument = new JObject() { { "swagger", SwaggerVersion.ToString() }, { "info", new JObject() { { "title", "OData Service" }, { "description", "The OData Service at " + MetadataUri }, { "version", "0.1.0" }, { "x-odata-version", "4.0" } } }, { "host", Host }, { "schemes", new JArray("http") }, { "basePath", BasePath }, { "consumes", new JArray("application/json") }, { "produces", new JArray("application/json") }, }; }
public static string Version(this SwaggerVersion This) { switch (This) { case SwaggerVersion.Version10: return("1.0"); case SwaggerVersion.Version11: return("1.1"); case SwaggerVersion.Version12: return("1.2"); case SwaggerVersion.Version20: return("2.0"); default: throw new ArgumentOutOfRangeException(string.Format("I don't know what version this is: {0}", This)); } }
public CustomerRouterAttribute(SwaggerVersion version, string controller = "[controller]") : base($"/api/{version}/{controller}") { GroupName = version.ToString(); }