/// <summary> /// Write Any object to the given writer. /// </summary> /// <param name="writer">The writer.</param> public void Write(IOpenApiWriter writer) { if (writer == null) { throw Error.ArgumentNull("writer"); } // { for json, empty for YAML writer.WriteStartObject(); // authorizationUrl writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocAuthorizationUrl, AuthorizationUrl?.OriginalString); // tokenUrl writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocTokenUrl, TokenUrl?.OriginalString); // refreshUrl writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocRefreshUrl, RefreshUrl?.OriginalString); // scopes writer.WriteOptionalDictionary(OpenApiConstants.OpenApiDocScopes, Scopes); // specification extensions writer.WriteDictionary(Extensions); // } for json, empty for YAML writer.WriteEndObject(); }
/// <summary> /// Write media type object to the given writer. /// </summary> /// <param name="writer">The writer.</param> public virtual void Write(IOpenApiWriter writer) { if (writer == null) { throw Error.ArgumentNull("writer"); } // { for json, empty for YAML writer.WriteStartObject(); // schema writer.WriteOptionalObject(OpenApiConstants.OpenApiDocSchema, Schema); // example writer.WriteOptionalObject(OpenApiConstants.OpenApiDocExample, Example); // examples writer.WriteOptionalDictionary(OpenApiConstants.OpenApiDocExamples, Examples); // encoding writer.WriteOptionalDictionary(OpenApiConstants.OpenApiDocEncoding, Encoding); // specification extensions writer.WriteDictionary(Extensions); // } for json, empty for YAML writer.WriteEndObject(); }
/// <summary> /// Write Any object to the given writer. /// </summary> /// <param name="writer">The writer.</param> public void Write(IOpenApiWriter writer) { if (writer == null) { throw Error.ArgumentNull("writer"); } // { for json, empty for YAML writer.WriteStartObject(); // implicit writer.WriteOptionalObject(OpenApiConstants.OpenApiDocImplicit, Implicit); // password writer.WriteOptionalObject(OpenApiConstants.OpenApiDocPassword, Password); // clientCredentials writer.WriteOptionalObject(OpenApiConstants.OpenApiDocClientCredentials, ClientCredentials); // authorizationCode writer.WriteOptionalObject(OpenApiConstants.OpenApiDocAuthorizationCode, AuthorizationCode); // specification extensions writer.WriteDictionary(Extensions); // } for json, empty for YAML writer.WriteEndObject(); }
/// <summary> /// Write Open API tag object. /// </summary> /// <param name="writer">The Open API Writer.</param> public virtual void Write(IOpenApiWriter writer) { if (writer == null) { throw Error.ArgumentNull("writer"); } // { for JSON, empty for YAML writer.WriteStartObject(); // name writer.WriteRequiredProperty(OpenApiConstants.OpenApiDocName, Name); // description writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocDescription, Description); // External Docs writer.WriteOptionalObject(OpenApiConstants.OpenApiDocExternalDocs, ExternalDocs); // specification extensions writer.WriteDictionary(Extensions); // } for JSON, empty for YAML writer.WriteEndObject(); }
/// <summary> /// Write Open API Contact object to the given writer. /// </summary> /// <param name="writer">The writer.</param> public virtual void Write(IOpenApiWriter writer) { if (writer == null) { throw Error.ArgumentNull("writer"); } // { for json, empty for YAML writer.WriteStartObject(); // name writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocName, Name); // url writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocUrl, Url?.OriginalString); // email writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocEmail, Email); // specification extensions writer.WriteDictionary(Extensions); // } for json, empty for YAML writer.WriteEndObject(); }
/// <summary> /// Write Open API server variable object. /// </summary> /// <param name="writer">The Open API Writer.</param> public virtual void Write(IOpenApiWriter writer) { if (writer == null) { throw Error.ArgumentNull("writer"); } // { for JSON, empty for YAML writer.WriteStartObject(); // default writer.WriteRequiredProperty(OpenApiConstants.OpenApiDocDefault, Default); // description writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocDescription, Description); // enums if (Enums != null && Enums.Any()) { writer.WritePropertyName(OpenApiConstants.OpenApiDocEnum); writer.WriteStartArray(); foreach (string item in Enums) { writer.WriteValue(item); } writer.WriteEndArray(); } // specification extensions writer.WriteDictionary(Extensions); // } for JSON, empty for YAML writer.WriteEndObject(); }
/// <summary> /// Write Any object to the given writer. /// </summary> /// <param name="writer">The writer.</param> public void Write(IOpenApiWriter writer) { if (writer == null) { throw Error.ArgumentNull("writer"); } // { for json, empty for YAML writer.WriteStartObject(); // description writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocDescription, Description); // content writer.WriteRequiredDictionary(OpenApiConstants.OpenApiDocContent, Content); // required writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocRequired, Required); // specification extensions writer.WriteDictionary(Extensions); // } for json, empty for YAML writer.WriteEndObject(); }
/// <summary> /// Write Encoding object to the given writer. /// </summary> /// <param name="writer">The writer.</param> public void Write(IOpenApiWriter writer) { if (writer == null) { throw Error.ArgumentNull("writer"); } // { for json, empty for YAML writer.WriteStartObject(); // contentType writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocContentType, ContentType); // headers writer.WriteOptionalDictionary(OpenApiConstants.OpenApiDocHeaders, Headers); // style writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocStyle, Style?.ToString()); // explode writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocExplode, Explode); // allowReserved writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocAllowReserved, AllowReserved); // specification extensions writer.WriteDictionary(Extensions); // } for json, empty for YAML writer.WriteEndObject(); }
/// <summary> /// Write Open API server object. /// </summary> /// <param name="writer">The Open API Writer.</param> public virtual void Write(IOpenApiWriter writer) { if (writer == null) { throw Error.ArgumentNull("writer"); } // { for JSON, empty for YAML writer.WriteStartObject(); // name writer.WriteRequiredProperty(OpenApiConstants.OpenApiDocUrl, Url.OriginalString); // description writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocDescription, Description); // variables writer.WriteOptionalDictionary(OpenApiConstants.OpenApiDocVariables, Variables); // specification extensions writer.WriteDictionary(Extensions); // } for JSON, empty for YAML writer.WriteEndObject(); }
private void WriteInternal(IOpenApiWriter writer) { // { for JSON, empty for YAML writer.WriteStartObject(); // operationRef writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocOperationRef, OperationRef); // operationId writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocOperationId, OperationId); // parameters writer.WriteOptionalDictionary(OpenApiConstants.OpenApiDocParameters, Parameters); // requestBody writer.WriteOptionalObject(OpenApiConstants.OpenApiDocRequestBody, RequestBody); // description writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocDescription, Description); // server writer.WriteOptionalObject(OpenApiConstants.OpenApiDocServer, Server); // specification extensions writer.WriteDictionary(Extensions); // } for JSON, empty for YAML writer.WriteEndObject(); }
private void WriteInternal(IOpenApiWriter writer) { Debug.Assert(writer != null); // { for json, empty for YAML writer.WriteStartObject(); // description writer.WriteRequiredProperty(OpenApiConstants.OpenApiDocDescription, Description); // headers writer.WriteOptionalDictionary(OpenApiConstants.OpenApiDocHeaders, Headers); // content writer.WriteOptionalDictionary(OpenApiConstants.OpenApiDocContent, Content); // headers writer.WriteOptionalDictionary(OpenApiConstants.OpenApiDocLinks, Links); // Extensions writer.WriteDictionary(Extensions); // } for json, empty for YAML writer.WriteEndObject(); }
/// <summary> /// Write Open API Info to the given writer. /// </summary> /// <param name="writer">The writer.</param> public virtual void Write(IOpenApiWriter writer) { if (writer == null) { throw Error.ArgumentNull("writer"); } // { for json, empty for YAML writer.WriteStartObject(); // title writer.WriteRequiredProperty(OpenApiConstants.OpenApiDocTitle, Title); // description writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocDescription, Description); // termsOfService writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocTermsOfService, TermsOfService?.OriginalString); // contact object writer.WriteOptionalObject(OpenApiConstants.OpenApiDocContact, Contact); // license object writer.WriteOptionalObject(OpenApiConstants.OpenApiDocLicense, License); // version writer.WriteRequiredProperty(OpenApiConstants.OpenApiDocVersion, Version?.ToString()); // specification extensions writer.WriteDictionary(Extensions); // } for json, empty for YAML writer.WriteEndObject(); }
private void WriteInternal(IOpenApiWriter writer) { Debug.Assert(writer != null); // { for json, empty for YAML writer.WriteStartObject(); // name writer.WriteRequiredProperty(OpenApiConstants.OpenApiDocName, Name); // in writer.WriteRequiredProperty(OpenApiConstants.OpenApiDocIn, In.ToString()); // description writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocDescription, Description); // required if (In == ParameterLocation.path) { writer.WriteRequiredProperty(OpenApiConstants.OpenApiDocRequired, true); } else { writer.WriteBooleanProperty(OpenApiConstants.OpenApiDocRequired, Required, false); } // deprecated writer.WriteBooleanProperty(OpenApiConstants.OpenApiDocDeprecated, Deprecated, false); // allowEmptyValue writer.WriteBooleanProperty(OpenApiConstants.OpenApiDocDeprecated, AllowEmptyValue, false); // style writer.WriteRequiredProperty(OpenApiConstants.OpenApiDocStyle, Style.ToString()); // explode writer.WriteBooleanProperty(OpenApiConstants.OpenApiDocExplode, Explode, false); // allowReserved writer.WriteBooleanProperty(OpenApiConstants.OpenApiDocAllowReserved, AllowReserved, false); // schema writer.WriteOptionalObject(OpenApiConstants.OpenApiDocSchema, Schema); // example writer.WriteOptionalObject(OpenApiConstants.OpenApiDocExample, Example); // examples writer.WriteOptionalDictionary(OpenApiConstants.OpenApiDocExamples, Examples); // content writer.WriteOptionalDictionary(OpenApiConstants.OpenApiDocContent, Content); // specification extensions writer.WriteDictionary(Extensions); // } for json, empty for YAML writer.WriteEndObject(); }
/// <summary> /// Write something after. /// </summary> /// <param name="writer">The writer.</param> public override void WriteBeforeEnd(IOpenApiWriter writer) { if (writer == null) { throw Error.ArgumentNull("writer"); } // specification extensions writer.WriteDictionary(Extensions); }
private void WriteInternal(IOpenApiWriter writer) { if (writer == null) { throw Error.ArgumentNull("writer"); } // { for json, empty for YAML writer.WriteStartObject(); // summary writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocSummary, Summary); // description writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocDescription, Description); // get writer.WriteOptionalObject(OpenApiConstants.OpenApiDocGet, Get); // put writer.WriteOptionalObject(OpenApiConstants.OpenApiDocPut, Put); // post writer.WriteOptionalObject(OpenApiConstants.OpenApiDocPost, Post); // delete writer.WriteOptionalObject(OpenApiConstants.OpenApiDocDelete, Delete); // options writer.WriteOptionalObject(OpenApiConstants.OpenApiDocOptions, Options); // head writer.WriteOptionalObject(OpenApiConstants.OpenApiDocHead, Head); // patch writer.WriteOptionalObject(OpenApiConstants.OpenApiDocPatch, Patch); // trace writer.WriteOptionalObject(OpenApiConstants.OpenApiDocTrace, Trace); // servers writer.WriteOptionalCollection(OpenApiConstants.OpenApiDocServers, Servers); // parameters writer.WriteOptionalCollection(OpenApiConstants.OpenApiDocParameters, Parameters); // specification extensions writer.WriteDictionary(Extensions); // } for json, empty for YAML writer.WriteEndObject(); }
/// <summary> /// Write Open API operation object. /// </summary> /// <param name="writer">The Open API Writer.</param> public virtual void Write(IOpenApiWriter writer) { if (writer == null) { throw Error.ArgumentNull("writer"); } // { for json, empty for YAML writer.WriteStartObject(); // summary writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocSummary, Summary); // tags writer.WriteOptionalCollection(OpenApiConstants.OpenApiDocTags, Tags); // description writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocDescription, Description); // externalDocs writer.WriteOptionalObject(OpenApiConstants.OpenApiDocExternalDocs, ExternalDocs); // operationId writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocOperationId, OperationId); // parameters writer.WriteOptionalCollection(OpenApiConstants.OpenApiDocParameters, Parameters); // requestBody writer.WriteOptionalObject(OpenApiConstants.OpenApiDocRequestBody, RequestBody); // responses writer.WriteOptionalObject(OpenApiConstants.OpenApiDocResponses, Responses); // callbacks writer.WriteOptionalDictionary(OpenApiConstants.OpenApiDocCallbacks, Callbacks); // deprecated writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocDeprecated, Deprecated); // security writer.WriteOptionalCollection(OpenApiConstants.OpenApiDocSecurity, Security); // servers writer.WriteOptionalCollection(OpenApiConstants.OpenApiDocServers, Servers); // specification extensions writer.WriteDictionary(Extensions); // } for json, empty for YAML writer.WriteEndObject(); }
/// <summary> /// Write Any object to the given writer. /// </summary> /// <param name="writer">The writer.</param> public void Write(IOpenApiWriter writer) { if (writer == null) { throw Error.ArgumentNull("writer"); } // { for json, empty for YAML writer.WriteStartObject(); // specification extensions writer.WriteDictionary(Extensions); // } for json, empty for YAML writer.WriteEndObject(); }
/// <summary> /// Write Open API document to the given writer. /// </summary> /// <param name="writer">The writer.</param> public virtual void Write(IOpenApiWriter writer) { if (writer == null) { throw Error.ArgumentNull("writer"); } // { for json, empty for YAML writer.WriteStartObject(); // openapi:3.0.0 writer.WriteRequiredProperty(OpenApiConstants.OpenApiDocOpenApi, OpenApi.ToString()); // info writer.WriteRequiredObject(OpenApiConstants.OpenApiDocInfo, Info); // servers writer.WriteOptionalCollection(OpenApiConstants.OpenApiDocServers, Servers); // paths writer.WriteRequiredObject(OpenApiConstants.OpenApiDocPaths, Paths); // components writer.WriteOptionalObject(OpenApiConstants.OpenApiDocComponents, Components); // security writer.WriteOptionalCollection(OpenApiConstants.OpenApiDocSecurity, Security); // tags writer.WriteOptionalCollection(OpenApiConstants.OpenApiDocTags, Tags); // external docs writer.WriteOptionalObject(OpenApiConstants.OpenApiDocExternalDocs, ExternalDoc); // specification extensions writer.WriteDictionary(Extensions); // } for json, empty for YAML writer.WriteEndObject(); // flush writer.Flush(); }
/// <summary> /// Write components object to the given writer. /// </summary> /// <param name="writer">The writer.</param> public virtual void Write(IOpenApiWriter writer) { if (writer == null) { throw Error.ArgumentNull("writer"); } // { for json, empty for YAML writer.WriteStartObject(); // schemas writer.WriteOptionalDictionary(OpenApiConstants.OpenApiDocSchemas, Schemas); // responses writer.WriteOptionalDictionary(OpenApiConstants.OpenApiDocResponses, Responses); // parameters writer.WriteOptionalDictionary(OpenApiConstants.OpenApiDocParameters, Parameters); // examples writer.WriteOptionalDictionary(OpenApiConstants.OpenApiDocExamples, Examples); // requestBodies writer.WriteOptionalDictionary(OpenApiConstants.OpenApiDocRequestBodies, RequestBodies); // headers writer.WriteOptionalDictionary(OpenApiConstants.OpenApiDocHeaders, Headers); // securitySchemes writer.WriteOptionalDictionary(OpenApiConstants.OpenApiDocSecuritySchemes, SecuritySchemes); // links writer.WriteOptionalDictionary(OpenApiConstants.OpenApiDocLinks, Links); // callbacks writer.WriteOptionalDictionary(OpenApiConstants.OpenApiDocCallbacks, Callbacks); // specification extensions writer.WriteDictionary(Extensions); // } for json, empty for YAML writer.WriteEndObject(); }
private void WriteInternal(IOpenApiWriter writer) { // { for json, empty for YAML writer.WriteStartObject(); // summary writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocSummary, Summary); // description writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocDescription, Description); // value writer.WriteOptionalObject(OpenApiConstants.OpenApiDocValue, Value); // externalValue writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocExternalValue, ExternalValue?.OriginalString); // specification extensions writer.WriteDictionary(Extensions); // } for json, empty for YAML writer.WriteEndObject(); }
private void WriteInternal(IOpenApiWriter writer) { Debug.Assert(writer != null); // { for json, empty for YAML writer.WriteStartObject(); // type writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocType, Type); // title writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocTitle, Title); // multipleOf writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocMultipleOf, MultipleOf); // Pattern writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocPattern, Pattern); // MaxItems writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocMaxItems, MaxItems); // MinItems writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocMinItems, MinItems); // UniqueItems writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocUniqueItems, UniqueItems); // MaxProperties writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocMaxProperties, MaxProperties); // MinProperties writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocMinProperties, MinProperties); // Required writer.WriteOptionalCollection(OpenApiConstants.OpenApiDocRequired, Required); // enum writer.WriteOptionalCollection(OpenApiConstants.OpenApiDocEnum, Enum); // AllOf writer.WriteOptionalCollection(OpenApiConstants.OpenApiDocAllOf, AllOf); // OneOf writer.WriteOptionalCollection(OpenApiConstants.OpenApiDocOneOf, OneOf); // AnyOf writer.WriteOptionalCollection(OpenApiConstants.OpenApiDocAnyOf, AnyOf); // Not writer.WriteOptionalCollection(OpenApiConstants.OpenApiDocNot, Not); // Items writer.WriteOptionalObject(OpenApiConstants.OpenApiDocItems, Items); // Properties writer.WriteOptionalDictionary(OpenApiConstants.OpenApiDocProperties, Properties); // AdditionalProperties writer.WriteOptionalObject(OpenApiConstants.OpenApiDocAdditionalProperties, AdditionalProperties); // Description writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocDescription, Description); // Format writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocFormat, Format); // Maximum writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocMaximum, Maximum); // exclusiveMaximum writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocExclusiveMaximum, ExclusiveMaximum); // Minimum writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocMinimum, Minimum); // exclusiveMinimum writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocExclusiveMinimum, ExclusiveMinimum); // MaxLength writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocMaxLength, MaxLength); // MaxLength writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocMinLength, MinLength); // Default writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocDefault, Default); // nullable writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocNullable, Nullable); // Discriminator writer.WriteOptionalObject(OpenApiConstants.OpenApiDocDiscriminator, Discriminator); // ReadOnly writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocReadOnly, ReadOnly); // WriteOnly writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocWriteOnly, WriteOnly); // XML writer.WriteOptionalObject(OpenApiConstants.OpenApiDocXml, Xml); // ExternalDocs writer.WriteOptionalObject(OpenApiConstants.OpenApiDocExternalDocs, ExternalDocs); // Example writer.WriteOptionalObject(OpenApiConstants.OpenApiDocExample, Example); // Deprecated writer.WriteOptionalProperty(OpenApiConstants.OpenApiDocDeprecated, Deprecated); // specification extensions writer.WriteDictionary(Extensions); // } for json, empty for YAML writer.WriteEndObject(); }