/// <summary> /// Creates a new instance of the <see cref="OasOperation"/> 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 OasOperation( IReadOnlyList <string> tags = default, string summary = default, string description = default, OasExternalDocumentation externalDocumentation = default, string operationIdentifier = default, IReadOnlyDictionary <OasParameterKey, OasReferable <OasParameterBody> > parameters = default, OasReferable <OasRequestBody> requestBody = default, IReadOnlyDictionary <OasResponseKey, OasReferable <OasResponse> > responses = default, IReadOnlyDictionary <string, OasReferable <OasCallback> > callbacks = default, OasOperationOptions options = default, IReadOnlyList <OasSecurityScheme> security = default, IReadOnlyList <OasServer> servers = default) { Tags = tags ?? Array.Empty <string>(); Summary = summary; Description = description; ExternalDocumentation = externalDocumentation; OperationIdentifier = operationIdentifier; Parameters = parameters ?? ImmutableDictionary <OasParameterKey, OasReferable <OasParameterBody> > .Empty; RequestBody = requestBody; Responses = responses ?? ImmutableDictionary <OasResponseKey, OasReferable <OasResponse> > .Empty; Callbacks = callbacks ?? ImmutableDictionary <string, OasReferable <OasCallback> > .Empty; Options = options; Security = security ?? Array.Empty <OasSecurityScheme>(); Servers = servers ?? Array.Empty <OasServer>(); }
/// <summary> /// Creates a new instance of the <see cref="OasMediaType"/> 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 OasMediaType( OasReferable <OasSchema> schema = default, IReadOnlyDictionary <string, OasReferable <OasExample> > examples = default, IReadOnlyDictionary <string, OasPropertyEncoding> encoding = default) { Schema = schema; Examples = examples ?? ImmutableDictionary <string, OasReferable <OasExample> > .Empty; Encoding = encoding ?? ImmutableDictionary <string, OasPropertyEncoding> .Empty; }
/// <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(OasReferable <T> other) { if (IsReference != other.IsReference) { return(false); } if (IsReference) { return(Reference.Equals(other.Reference)); } return(EqualityComparer <T> .Default.Equals(Value, other.Value)); }
/// <summary> /// Creates a new instance of the <see cref="OasParameterBody"/> 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 OasParameter( string name = default, OasParameterLocation location = default, string description = default, OasParameterOptions options = default, OasParameterStyle style = default, OasReferable <OasSchema> schema = default, IReadOnlyDictionary <ContentType, OasReferable <OasExample> > examples = default, IReadOnlyDictionary <ContentType, OasMediaType> content = default) : base(description, options, style, schema, examples, content) { Name = name; Location = location; }
/// <summary> /// Creates a new instance of the <see cref="OasParameterBody"/> 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 OasParameterBody( string description = default, OasParameterOptions options = default, OasParameterStyle style = default, OasReferable <OasSchema> schema = default, IReadOnlyDictionary <ContentType, OasReferable <OasExample> > examples = default, IReadOnlyDictionary <ContentType, OasMediaType> content = default) { Description = description; Options = options; Style = style; Schema = schema; Examples = examples ?? ImmutableDictionary <ContentType, OasReferable <OasExample> > .Empty; Content = content ?? ImmutableDictionary <ContentType, OasMediaType> .Empty; }
/// <summary> /// Creates a new <see cref="OasSchema"/> 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 OasSchema( OasSchemaType type = default, string format = null, string title = null, string description = null, NumberConstraint numberRange = default, CountConstraint itemsRange = default, CountConstraint lengthRange = default, CountConstraint propertiesRange = default, OasSchemaOptions options = default, string pattern = default, IReadOnlyList<OasScalarValue> @enum = default, IReadOnlyList<OasReferable<OasSchema>> allOf = default, IReadOnlyList<OasReferable<OasSchema>> oneOf = default, IReadOnlyList<OasReferable<OasSchema>> anyOf = default, IReadOnlyList<OasReferable<OasSchema>> not = default, OasReferable<OasSchema> items = default, IReadOnlyDictionary<string, OasReferable<OasSchema>> properties = default, IReadOnlyDictionary<string, OasReferable<OasSchema>> additionalProperties = default, OasExternalDocumentation 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<OasScalarValue>(); AllOf = allOf ?? Array.Empty<OasReferable<OasSchema>>(); OneOf = oneOf ?? Array.Empty<OasReferable<OasSchema>>(); AnyOf = anyOf ?? Array.Empty<OasReferable<OasSchema>>(); Not = not ?? Array.Empty<OasReferable<OasSchema>>(); Items = items; Properties = properties ?? ImmutableDictionary<string, OasReferable<OasSchema>>.Empty; AdditionalProperties = additionalProperties ?? ImmutableDictionary<string, OasReferable<OasSchema>>.Empty; ExternalDocumentation = externalDocumentation; }
/// <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(OasExpression key, out OasReferable <OasPath> value) => _dictionary.TryGetValue(key, out value);