Skip to content

Commit

Permalink
PR Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioRamosEs committed Oct 21, 2024
1 parent bda7776 commit 2a5a47d
Showing 1 changed file with 1 addition and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,7 @@ public void Apply(OpenApiSchema schema, SchemaFilterContext context)
var attribute = context.Type.GetCustomAttribute<AtLeastOneRequiredAttribute>();
if (attribute != null)
{
// Ensure 'Required' is not null
schema.Required ??= new HashSet<string>();

// Remove individually required properties specified in the attribute
foreach (var propName in attribute.PropertyNames)
{
schema.Required.Remove(propName);
}

// Add 'anyOf' with the specified properties
// Add 'anyOf' to the schema with the specified properties
schema.AnyOf = attribute.PropertyNames.Select(propertyName => new OpenApiSchema
{
Required = new HashSet<string> { propertyName },
Expand Down

0 comments on commit 2a5a47d

Please sign in to comment.