/// <summary> /// Serialize <see cref="OpenApiOAuthFlow"/> to Open Api v3.0 /// </summary> public void SerializeAsV3(IOpenApiWriter writer) { if (writer == null) { throw Error.ArgumentNull(nameof(writer)); } writer.WriteStartObject(); // authorizationUrl writer.WriteProperty(OpenApiConstants.AuthorizationUrl, AuthorizationUrl?.ToString()); // tokenUrl writer.WriteProperty(OpenApiConstants.TokenUrl, TokenUrl?.ToString()); // refreshUrl writer.WriteProperty(OpenApiConstants.RefreshUrl, RefreshUrl?.ToString()); // scopes writer.WriteRequiredMap(OpenApiConstants.Scopes, Scopes, (w, s) => w.WriteValue(s)); // extensions writer.WriteExtensions(Extensions); writer.WriteEndObject(); }
/// <summary> /// Serialize to OpenAPI V3 document without using reference. /// </summary> public void SerializeAsV3WithoutReference(IOpenApiWriter writer) { writer.WriteStartObject(); // description writer.WriteProperty(OpenApiConstants.Description, Description); // content writer.WriteRequiredMap(OpenApiConstants.Content, Content, (w, c) => c.SerializeAsV3(w)); // required writer.WriteProperty(OpenApiConstants.Required, Required, false); // extensions writer.WriteExtensions(Extensions, OpenApiSpecVersion.OpenApi3_0); writer.WriteEndObject(); }