Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array of nullable type do not set Nullable=true in generated open api #2628

Closed
worming004 opened this issue Apr 7, 2023 · 3 comments
Closed

Comments

@worming004
Copy link

As this test expose worming004@3506ff1

[Theory]
[InlineData(typeof(int?[]), "integer", "int32", true)]
public void GenerateSchema_GeneratesArraySchema_IfEnumerableType(
    Type type,
    string expectedItemsType,
    string expectedItemsFormat,
    bool expectedItemsNullable)
{
    var schema = Subject().GenerateSchema(type, new SchemaRepository());

    Assert.Equal("array", schema.Type);
    Assert.NotNull(schema.Items);
    Assert.Equal(expectedItemsType, schema.Items.Type);
    Assert.Equal(expectedItemsFormat, schema.Items.Format);
    Assert.Equal(expectedItemsNullable, schema.Items.Nullable); // test fail here
}

The array's item is not set to nullable. Item is expected to be nullable because input type is int?

@304NotModified
Copy link
Contributor

Is this #2059?

@worming004
Copy link
Author

Yes it is

@martincostello
Copy link
Collaborator

Duplicate of #2059.

@martincostello martincostello closed this as not planned Won't fix, can't repro, duplicate, stale Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants