Ejemplo n.º 1
0
 /// <summary>
 /// Creates a new instance of the <see cref="Operation"/> class.
 /// </summary>
 /// <param name="tags">The list of tags for API documentation control.</param>
 /// <param name="summary">The short summary of what the operation does.</param>
 /// <param name="description">The verbose explanation of the operation behavior.</param>
 /// <param name="externalDocumentation">The additional external documentation for this operation.</param>
 /// <param name="operationIdentifier">The unique string used to identify the operation.</param>
 /// <param name="parameters">The list of parameters that are applicable for this operation.</param>
 /// <param name="requestBody">The request body applicable for this operation.</param>
 /// <param name="responses">The list of possible responses as they are returned from executing this operation.</param>
 /// <param name="callbacks">The map of possible out-of band callbacks related to the parent operation.</param>
 /// <param name="options">The flags that indicate what options are set on the operation.</param>
 /// <param name="security">The declaration of which security mechanisms can be used for this operation.</param>
 /// <param name="servers">The alternative server list to service this operation.</param>
 public Operation(
     IReadOnlyList <string> tags = default,
     string summary     = default,
     string description = default,
     ExternalDocumentation externalDocumentation = default,
     string operationIdentifier = default,
     IReadOnlyDictionary <ParameterKey, Referable <ParameterBody> > parameters = default,
     Referable <RequestBody> requestBody = default,
     IReadOnlyDictionary <ResponseKey, Referable <Response> > responses = default,
     IReadOnlyDictionary <string, Referable <Callback> > callbacks      = default,
     OperationOptions options = default,
     IReadOnlyList <SecurityScheme> security = default,
     IReadOnlyList <Server> servers          = default)
 {
     Tags                  = tags ?? Array.Empty <string>();
     Summary               = summary;
     Description           = description;
     ExternalDocumentation = externalDocumentation;
     OperationIdentifier   = operationIdentifier;
     Parameters            = parameters ?? ReadOnlyDictionary.Empty <ParameterKey, Referable <ParameterBody> >();
     RequestBody           = requestBody;
     Responses             = responses ?? ReadOnlyDictionary.Empty <ResponseKey, Referable <Response> >();
     Callbacks             = callbacks ?? ReadOnlyDictionary.Empty <string, Referable <Callback> >();
     Options               = options;
     Security              = security ?? Array.Empty <SecurityScheme>();
     Servers               = servers ?? Array.Empty <Server>();
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a new instance of the <see cref="MediaType"/> class.
 /// </summary>
 /// <param name="schema">The schema defining the type used for the request body.</param>
 /// <param name="examples">Gets the examples of the media type.</param>
 /// <param name="encoding">Gets the map between a property name and its encoding information.</param>
 public MediaType(
     Referable <Schema> schema = default,
     IReadOnlyDictionary <string, Referable <Example> > examples = default,
     IReadOnlyDictionary <string, PropertyEncoding> encoding     = default)
 {
     Schema   = schema;
     Examples = examples ?? ReadOnlyDictionary.Empty <string, Referable <Example> >();
     Encoding = encoding ?? ReadOnlyDictionary.Empty <string, PropertyEncoding>();
 }
Ejemplo n.º 3
0
 /// <summary>Indicates whether the current object is equal to another object of the same type.</summary>
 /// <param name="other">An object to compare with this object.</param>
 /// <returns>true if the current object is equal to the <paramref name="other">other</paramref> parameter; otherwise, false.</returns>
 public bool Equals(Referable <T> other)
 {
     if (IsReference != other.IsReference)
     {
         return(false);
     }
     if (IsReference)
     {
         return(Reference.Equals(other.Reference));
     }
     return(EqualityComparer <T> .Default.Equals(Value, other.Value));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Creates a new instance of the <see cref="ParameterBody"/> class.
 /// </summary>
 /// <param name="name">The name of the parameter.</param>
 /// <param name="location">The location of the parameter.</param>
 /// <param name="description">The brief description of the parameter.</param>
 /// <param name="options">The parameter options.</param>
 /// <param name="style">The value which indicates how the parameter value will be serialized depending on the type of the parameter value.</param>
 /// <param name="schema">The schema defining the type used for the parameter.</param>
 /// <param name="examples">The list of examples of the parameter.</param>
 /// <param name="content">The map containing the representations for the parameter.</param>
 public Parameter(
     string name = default,
     ParameterLocation location = default,
     string description         = default,
     ParameterOptions options   = default,
     ParameterStyle style       = default,
     Referable <Schema> schema  = default,
     IReadOnlyDictionary <ContentType, Referable <Example> > examples = default,
     IReadOnlyDictionary <ContentType, MediaType> content             = default)
     : base(description, options, style, schema, examples, content)
 {
     Name     = name;
     Location = location;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Creates a new instance of the <see cref="ParameterBody"/> class.
 /// </summary>
 /// <param name="description">The brief description of the parameter.</param>
 /// <param name="options">The parameter options.</param>
 /// <param name="style">The value which indicates how the parameter value will be serialized depending on the type of the parameter value.</param>
 /// <param name="schema">The schema defining the type used for the parameter.</param>
 /// <param name="examples">The list of examples of the parameter.</param>
 /// <param name="content">The map containing the representations for the parameter.</param>
 public ParameterBody(
     string description        = default,
     ParameterOptions options  = default,
     ParameterStyle style      = default,
     Referable <Schema> schema = default,
     IReadOnlyDictionary <ContentType, Referable <Example> > examples = default,
     IReadOnlyDictionary <ContentType, MediaType> content             = default)
 {
     Description = description;
     Options     = options;
     Style       = style;
     Schema      = schema;
     Examples    = examples ?? ReadOnlyDictionary.Empty <ContentType, Referable <Example> >();
     Content     = content ?? ReadOnlyDictionary.Empty <ContentType, MediaType>();
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Creates a new <see cref="Schema"/> value.
 /// </summary>
 /// <param name="type">The general type of the schema.</param>
 /// <param name="format">The specific type of the schema/</param>
 /// <param name="title">The title of the schema.</param>
 /// <param name="description">The description of the schema.</param>
 /// <param name="numberRange">The range of valid numbers.</param>
 /// <param name="itemsRange">The range of valid item counts.</param>
 /// <param name="lengthRange">The range of valid lengths.</param>
 /// <param name="propertiesRange">The range of valid property counts.</param>
 /// <param name="options">The schema options.</param>
 /// <param name="pattern">The regex validation for string values.</param>
 /// <param name="enum">The valid enum values.</param>
 /// <param name="allOf">The list of schemas that this schema must conform to.</param>
 /// <param name="oneOf">The list of schemas that, from which exactly one, this schema must conform to.</param>
 /// <param name="anyOf">The list of schemas that, from which one or more, this schema must conform to.</param>
 /// <param name="not">The list of schemas that this schema must not conform to.</param>
 /// <param name="items">The list of schemas that represent the array items that this schema must contain.</param>
 /// <param name="properties">The list of valid properties.</param>
 /// <param name="additionalProperties">The list of valid properties for children.</param>
 /// <param name="externalDocumentation">The external documentation.</param>
 public Schema(
     SchemaType type                           = default,
     string format                             = null,
     string title                              = null,
     string description                        = null,
     NumberRange numberRange                   = default,
     CountRange itemsRange                     = default,
     CountRange lengthRange                    = default,
     CountRange propertiesRange                = default,
     SchemaOptions options                     = default,
     string pattern                            = default,
     IReadOnlyList <ScalarValue> @enum         = default,
     IReadOnlyList <Referable <Schema> > allOf = default,
     IReadOnlyList <Referable <Schema> > oneOf = default,
     IReadOnlyList <Referable <Schema> > anyOf = default,
     IReadOnlyList <Referable <Schema> > not   = default,
     Referable <Schema> items                  = default,
     IReadOnlyDictionary <string, Referable <Schema> > properties           = default,
     IReadOnlyDictionary <string, Referable <Schema> > additionalProperties = default,
     ExternalDocumentation externalDocumentation = default)
 {
     JsonType              = type;
     Title                 = title;
     Format                = format;
     Description           = description;
     NumberRange           = numberRange;
     ItemsRange            = itemsRange;
     LengthRange           = lengthRange;
     PropertiesRange       = propertiesRange;
     Options               = options;
     Pattern               = pattern;
     Enum                  = @enum ?? Array.Empty <ScalarValue>();
     AllOf                 = allOf ?? Array.Empty <Referable <Schema> >();
     OneOf                 = oneOf ?? Array.Empty <Referable <Schema> >();
     AnyOf                 = anyOf ?? Array.Empty <Referable <Schema> >();
     Not                   = not ?? Array.Empty <Referable <Schema> >();
     Items                 = items;
     Properties            = properties ?? Dictionary.ReadOnlyEmpty <string, Referable <Schema> >();
     AdditionalProperties  = additionalProperties ?? Dictionary.ReadOnlyEmpty <string, Referable <Schema> >();
     ExternalDocumentation = externalDocumentation;
 }
Ejemplo n.º 7
0
 /// <summary>Gets the value that is associated with the specified key.</summary>
 /// <param name="key">The key to locate.</param>
 /// <param name="value">When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.</param>
 /// <returns>true if the object that implements the <see cref="T:System.Collections.Generic.IReadOnlyDictionary`2"></see> interface contains an element that has the specified key; otherwise, false.</returns>
 /// <exception cref="T:System.ArgumentNullException">
 ///   <paramref name="key">key</paramref> is null.</exception>
 public bool TryGetValue(CompoundExpression key, out Referable <Path> value) => _dictionary.TryGetValue(key, out value);