Beispiel #1
0
 /// <summary>
 /// Creates a new instance of the <see cref="OasSchemaBuilder"/> class.
 /// </summary>
 /// <param name="value">The <see cref="OasSchema"/> to copy values from.</param>
 public OasSchemaBuilder(OasSchema value)
 {
     if (value is null)
     {
         throw new ArgumentNullException(nameof(value));
     }
     JsonType              = value.JsonType;
     Format                = value.Format;
     Title                 = value.Title;
     Description           = value.Description;
     NumberRange           = value.NumberRange;
     ItemsRange            = value.ItemsRange;
     LengthRange           = value.LengthRange;
     PropertiesRange       = value.PropertiesRange;
     Options               = value.Options;
     Pattern               = value.Pattern;
     Enum                  = new List <OasScalarValue>(value.Enum);
     AllOf                 = new List <OasReferable <OasSchema> >(value.AllOf);
     OneOf                 = new List <OasReferable <OasSchema> >(value.OneOf);
     AnyOf                 = new List <OasReferable <OasSchema> >(value.AnyOf);
     Not                   = new List <OasReferable <OasSchema> >(value.Not);
     Items                 = value.Items;
     Properties            = new Dictionary <string, OasReferable <OasSchema> >(value.Properties);
     AdditionalProperties  = new Dictionary <string, OasReferable <OasSchema> >(value.AdditionalProperties);
     ExternalDocumentation = value.ExternalDocumentation;
 }
Beispiel #2
0
 /// <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>();
 }
Beispiel #3
0
 /// <summary>
 /// Creates a new instance of the <see cref="OasTag"/> class.
 /// </summary>
 /// <param name="name">The name of the tag.</param>
 /// <param name="description">The short description for the tag.</param>
 /// <param name="externalDocumentation">The additional external documentation for the tag.</param>
 public OasTag(
     string name        = default,
     string description = default,
     OasExternalDocumentation externalDocumentation = default)
 {
     Name                  = name;
     Description           = description;
     ExternalDocumentation = externalDocumentation;
 }
Beispiel #4
0
 /// <summary>
 /// Creates a new instance of the <see cref="OasTagBuilder"/> class.
 /// </summary>
 /// <param name="value">The <see cref="OasTag"/> to copy values from.</param>
 public OasTagBuilder(OasTag value)
 {
     if (value is null)
     {
         throw new ArgumentNullException(nameof(value));
     }
     Name                  = value.Name;
     Description           = value.Description;
     ExternalDocumentation = value.ExternalDocumentation;
 }
 /// <summary>
 /// Creates a new instance of the <see cref="OasDocumentBuilder"/> class.
 /// </summary>
 /// <param name="value">The <see cref="OasDocument"/> to copy values from.</param>
 public OasDocumentBuilder(OasDocument value)
 {
     if (value is null)
     {
         throw new ArgumentNullException(nameof(value));
     }
     Version               = value.Version;
     Info                  = value.Info;
     Servers               = new List <OasServer>(value.Servers);
     Paths                 = new Dictionary <string, OasReferable <OasPath> >(value.Paths);
     Components            = value.Components;
     Security              = new List <OasReferable <OasSecurityScheme> >(value.Security);
     Tags                  = new List <OasTag>(value.Tags);
     ExternalDocumentation = value.ExternalDocumentation;
 }
Beispiel #6
0
 /// <summary>
 /// Creates a new instance of the <see cref="OasDocument"/> class.
 /// </summary>
 /// <param name="version">The semantic version number of the OpenAPI Specification version that the OpenAPI document uses. The default is 3.0.0.</param>
 /// <param name="info">The metadata about the API.</param>
 /// <param name="servers">The list of <see cref="OasServer"/> instances, which provide connectivity information to a target server.</param>
 /// <param name="paths">The available paths and operations for the API.</param>
 /// <param name="components">The list that holds various schemas for the specification.</param>
 /// <param name="security">The declaration of which security mechanisms can be used across the API.</param>
 /// <param name="tags">The list of tags used by the specification with additional metadata.</param>
 /// <param name="externalDocumentation">The external documentation.</param>
 public OasDocument(
     SemanticVersion?version           = default,
     OasInformation info               = default,
     IReadOnlyList <OasServer> servers = default,
     IReadOnlyDictionary <string, OasReferable <OasPath> > paths = default,
     OasComponents components = default,
     IReadOnlyList <OasReferable <OasSecurityScheme> > security = default,
     IReadOnlyList <OasTag> tags = default,
     OasExternalDocumentation externalDocumentation = default)
 {
     Version               = version ?? new SemanticVersion(3, 0, 0);
     Info                  = info;
     Servers               = servers ?? Array.Empty <OasServer>();
     Paths                 = paths ?? ImmutableDictionary <string, OasReferable <OasPath> > .Empty;
     Components            = components;
     Security              = security ?? Array.Empty <OasReferable <OasSecurityScheme> >();
     Tags                  = tags ?? Array.Empty <OasTag>();
     ExternalDocumentation = externalDocumentation;
 }
Beispiel #7
0
 /// <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;
 }