42 public void Write(IOpenApiWriter writer, OpenApiSpecVersion specVersion)
44 ArgumentNullException.ThrowIfNull(writer);
46 if (specVersion != OpenApiSpecVersion.OpenApi3_0)
47 throw new InvalidOperationException(
"This extension only applies to OpenAPI 3.0!");
49 writer.WriteStartArray();
50 foreach (var enumValue
in Enum.GetValues(
enumType))
52 var enumName = enumValue.ToString()!;
53 var field =
enumType.GetField(enumName)!;
54 if (field.IsDefined(typeof(ObsoleteAttribute),
false))
55 enumName = $
"DEPRECATED_{enumName}";
57 writer.WriteValue(enumName);
60 writer.WriteEndArray();