forked from Azure/autorest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathServiceDefinition.cs
132 lines (113 loc) · 5.3 KB
/
ServiceDefinition.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using AutoRest.Core.Validation;
using AutoRest.Swagger.Validation;
namespace AutoRest.Swagger.Model
{
/// <summary>
/// Class that represents Swagger 2.0 schema
/// http://json.schemastore.org/swagger-2.0
/// Swagger Object - https://github.com/wordnik/swagger-spec/blob/master/versions/2.0.md#swagger-object-
/// </summary>
[Serializable]
public class ServiceDefinition : SpecObject
{
public ServiceDefinition()
{
Definitions = new Dictionary<string, Schema>();
Schemes = new List<TransferProtocolScheme>();
Consumes = new List<string>();
Produces = new List<string>();
Paths = new Dictionary<string, Dictionary<string, Operation>>();
CustomPaths = new Dictionary<string, Dictionary<string, Operation>>();
Parameters = new Dictionary<string, SwaggerParameter>();
Responses = new Dictionary<string, OperationResponse>();
SecurityDefinitions = new Dictionary<string, SecurityDefinition>();
Security = new List<Dictionary<string, List<string>>>();
Tags = new List<Tag>();
ExternalReferences = new List<string>();
}
/// <summary>
/// Specifies the Swagger Specification version being used.
/// </summary>
public string Swagger { get; set; }
/// <summary>
/// Provides metadata about the API. The metadata can be used by the clients if needed.
/// </summary>
public Info Info { get; set; }
/// <summary>
/// The host (serviceTypeName or ip) serving the API.
/// </summary>
public string Host { get; set; }
/// <summary>
/// The base path on which the API is served, which is relative to the host.
/// </summary>
public string BasePath { get; set; }
/// <summary>
/// The transfer protocol of the API.
/// </summary>
public IList<TransferProtocolScheme> Schemes { get; set; }
/// <summary>
/// A list of MIME types the service can consume.
/// </summary>
public IList<string> Consumes { get; set; }
/// <summary>
/// A list of MIME types the APIs can produce.
/// </summary>
public IList<string> Produces { get; set; }
/// <summary>
/// Key is actual path and the value is serializationProperty of http operations and operation objects.
/// </summary>
public Dictionary<string, Dictionary<string, Operation>> Paths { get; set; }
/// <summary>
/// Key is actual path and the value is serializationProperty of http operations and operation objects.
/// </summary>
[JsonProperty("x-ms-paths")]
[CollectionRule(typeof(XmsPathsMustOverloadPaths))]
public Dictionary<string, Dictionary<string, Operation>> CustomPaths { get; set; }
/// <summary>
/// Key is the object serviceTypeName and the value is swagger definition.
/// </summary>
public Dictionary<string, Schema> Definitions { get; set; }
/// <summary>
/// Dictionary of parameters that can be used across operations.
/// This property does not define global parameters for all operations.
/// </summary>
[CollectionRule(typeof(AnonymousParameterTypes))]
public Dictionary<string, SwaggerParameter> Parameters { get; set; }
/// <summary>
/// Dictionary of responses that can be used across operations. The key indicates status code.
/// </summary>
public Dictionary<string, OperationResponse> Responses { get; set; }
/// <summary>
/// Key is the object serviceTypeName and the value is swagger security definition.
/// </summary>
public Dictionary<string, SecurityDefinition> SecurityDefinitions { get; set; }
/// <summary>
/// A declaration of which security schemes are applied for the API as a whole.
/// The list of values describes alternative security schemes that can be used
/// (that is, there is a logical OR between the security requirements). Individual
/// operations can override this definition.
/// </summary>
public IList<Dictionary<string, List<string>>> Security { get; set; }
/// <summary>
/// A list of tags used by the specification with additional metadata. The order
/// of the tags can be used to reflect on their order by the parsing tools. Not all
/// tags that are used by the Operation Object must be declared. The tags that are
/// not declared may be organized randomly or based on the tools' logic. Each
/// tag name in the list MUST be unique.
/// </summary>
public IList<Tag> Tags { get; set; }
/// <summary>
/// Additional external documentation
/// </summary>
public ExternalDoc ExternalDocs { get; set; }
/// <summary>
/// A list of all external references listed in the service.
/// </summary>
public IList<string> ExternalReferences { get; set; }
}
}