/// <summary>
 /// Serializes a <see cref="OasParameter"/> value according to its components.
 /// </summary>
 /// <param name="key">The <see cref="OasParameterKey"/> component to serialize.</param>
 /// <param name="value">The referable <see cref="OasParameterBody"/> component to serialize.</param>
 /// <returns>The <see cref="JToken"/>.</returns>
 protected virtual JToken SerializeParameter(OasParameterKey key, OasReferable <OasParameterBody> value)
 {
     if (value.IsReference)
     {
         return(SerializeReferable(value));
     }
     return(SerializeParameter(key, value.Value));
 }
Example #2
0
 public MockOasOperation(
     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,
     ulong?operationId = default)
     : base(tags, summary, description, externalDocumentation, operationIdentifier, parameters, requestBody, responses, callbacks, options, security, servers)
 {
     OperationId = operationId;
 }
Example #3
0
 /// <summary>
 /// Sets a property in the specified <see cref="JObject"/>.
 /// </summary>
 /// <param name="container">The object to set the property on.</param>
 /// <param name="key">The property name in <paramref name="container"/>.</param>
 /// <param name="value">The value.</param>
 /// <param name="required">A value indicating whether the property is required.</param>
 protected virtual void SetJsonObject <T>(JObject container, string key, OasReferable <T> value, bool required = false)
     where T : class, IEquatable <T>
 {
     if (!value.HasValue)
     {
         if (required)
         {
             container.Add(key, null);
         }
     }
     else if (value.IsReference)
     {
         container.Add(key, SerializeReferable(value));
     }
     else
     {
         container.Add(key, Serialize(value.Value));
     }
 }