public static string GetValueString(this IOpenApiPrimitive primitive) { using var sb = new StringWriter(); var writer = new OpenApiYamlWriter(sb); primitive.Write(writer, OpenApiSpecVersion.OpenApi3_0); return(sb.ToString()); }
private static void WritePrimitive(this IOpenApiWriter writer, IOpenApiPrimitive primitive) { if (writer == null) { throw Error.ArgumentNull(nameof(writer)); } if (primitive == null) { throw Error.ArgumentNull(nameof(primitive)); } // The Spec version is meaning for the Any type, so it's ok to use the latest one. primitive.Write(writer, OpenApiSpecVersion.OpenApi3_0); }