Exemplo n.º 1
0
 /// <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));
 }
Exemplo n.º 2
0
        /// <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 <see cref="OasParameterBody"/> component to serialize.</param>
        /// <returns>The <see cref="JToken"/>.</returns>
        protected virtual JToken SerializeParameter(OasParameterKey key, OasParameterBody value)
        {
            if (value is null)
            {
                return(null);
            }

            var json = new JObject();

            SetJsonValue(json, PathConstants.Name, key.Name, true);
            SetJsonValue(json, PathConstants.In, ToJsonValue(key.Location));
            SerializeParameterBody(value, json);

            return(json);
        }