OpenApiTag Serialization
Hi, just a check, what is the expected behaviour of the Serialisation both for V2 and V3 for OpenApiTag, i see this code:
/// <summary>
/// Serialize <see cref="OpenApiTag"/> to Open Api v3.0
/// </summary>
public void SerializeAsV3(IOpenApiWriter writer)
{
if (writer == null)
{
throw Error.ArgumentNull(nameof(writer));
}
if (Reference != null)
{
Reference.SerializeAsV3(writer);
return;
}
writer.WriteValue(Name);
}
i would have something like this expected, please see last line:
/// <summary>
/// Serialize <see cref="OpenApiTag"/> to Open Api v3.0
/// </summary>
public void SerializeAsV3(IOpenApiWriter writer)
{
if (writer == null)
{
throw Error.ArgumentNull(nameof(writer));
}
if (Reference != null)
{
Reference.SerializeAsV3(writer);
return;
}
SerializeAsV3WithoutReference(writer);
}
if this first version is correct (which i assume) because there are also tests which cover this, then has OpenApiTag still to be IOpenApiReferenceable ? Is the SerializeAsV3WithoutReference(writer); used anywhere?
Tag is a bit of a funny bird because it is effectively referenceable, but doesn't use $ref to do the referencing. It's similar to SecurityScheme. I'll need to dig into this a bit more to see whether the change you suggested is needed. The SerializeAsV3Withoutreference is used within components because when serializing components we want to render the entire object, not just the $ref. This code does seem suspect because how would the description ever get rendered.