/// <summary> /// Creates a new instance of the <see cref="OasPropertyEncoding"/> class. /// </summary> /// <param name="contentType">The Content-Type for encoding a specific property.</param> /// <param name="headers">The list of headers.</param> /// <param name="style"></param> /// <param name="options"></param> public OasPropertyEncoding( ContentType contentType = default, IReadOnlyDictionary <string, OasReferable <OasParameterBody> > headers = default, OasParameterStyle style = default, OasPropertyEncodingOptions options = default) { ContentType = contentType; Headers = headers ?? ImmutableDictionary <string, OasReferable <OasParameterBody> > .Empty; Style = style; Options = options; }
/// <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> /// Converts the specified <see cref="OasParameterStyle"/> to a <see cref="JToken"/>. /// </summary> /// <param name="parameterStyle">The <see cref="OasParameterStyle"/> to convert.</param> /// <returns>The <see cref="JToken"/>.</returns> protected virtual JToken ToJsonValue(OasParameterStyle parameterStyle) { switch (parameterStyle) { case OasParameterStyle.Default: return(null); case OasParameterStyle.Matrix: return(EnumConstants.Matrix); case OasParameterStyle.Label: return(EnumConstants.Label); case OasParameterStyle.Form: return(EnumConstants.Form); case OasParameterStyle.Simple: return(EnumConstants.Simple); case OasParameterStyle.SpaceDelimited: return(EnumConstants.SpaceDelimited); case OasParameterStyle.PipeDelimited: return(EnumConstants.PipeDelimited); case OasParameterStyle.DeepObject: return(EnumConstants.DeepObject); default: throw new ArgumentOutOfRangeException(nameof(parameterStyle)); } }