Skip to content
New issue

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

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

Already on GitHub? # to your account

[DRAFT] 2.0 upgrade guide working doc #2298

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open

Conversation

RachitMalik12
Copy link

No description provided.

@RachitMalik12
Copy link
Author

@martincostello Hi Martin! Please refer to this as a work in progress, upgrade guide. We will work on this in the open and keeping adding to it as we have more preview bits added. Please let us know if you have any feedback or questions or if we are missing anything you'd like more info on.
cc: @captainsafia @baywet


public virtual JsonNode Example { get; set; } // No longer IOpenApiAny
public virtual IList<JsonNode> Examples { get; set; }
public virtual IList<JsonNode> Enum { get; set; } = new List<JsonNode>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public virtual IList<JsonNode> Enum { get; set; } = new List<JsonNode>();
public virtual IList<JsonNode> Enum { get; set; }

@martincostello
Copy link
Contributor

@RachitMalik12 Thanks for providing this. I've made various suggested edits to the current content.

My main feedback so far based on my (still ongoing) move in Swashbuckle would be to have a dedicated section showing how the reference handling has changed with the type checks. For example the need to do things like:

public void ProcessSchema(IOpenApiSchema schema)
{
    if (schema is OpenApiSchema concrete)
    {
        // Do something
    }
    else if (scheme is OpenApiSchemaReference reference)
    {
        // Do something else
    }
}

I'll be sure to leave any additional feedback that might be useful once I've gotten Swashbuckle working with the preview7 (as that's what ASP.NET Core 10 preview 2 is compiled against).

@martincostello
Copy link
Contributor

I've also been tripped up by IOpenApiSchema.Type now being a [Flags] enum and had to fix a few things like this:

- if (schema.Type == JsonSchemaTypes.Array)
+ if (schema.Type is { } type && type.HasFlag(JsonSchemaTypes.Array))

People might miss this and introduce subtle bugs if they just one-to-one map the strings to the values like:

- if (schema.Type == "array")
+ if (schema.Type == JsonSchemaTypes.Array)

Co-authored-by: Martin Costello <martin@martincostello.com>
@RachitMalik12 RachitMalik12 requested a review from a team as a code owner April 2, 2025 18:45
RachitMalik12 and others added 6 commits April 2, 2025 11:45
Co-authored-by: Martin Costello <martin@martincostello.com>
Co-authored-by: Martin Costello <martin@martincostello.com>
Co-authored-by: Martin Costello <martin@martincostello.com>
Co-authored-by: Martin Costello <martin@martincostello.com>
Co-authored-by: Martin Costello <martin@martincostello.com>
Co-authored-by: Martin Costello <martin@martincostello.com>

This comment was marked as outdated.

RachitMalik12 and others added 5 commits April 2, 2025 11:53
Co-authored-by: Martin Costello <martin@martincostello.com>
Co-authored-by: Martin Costello <martin@martincostello.com>
Co-authored-by: Martin Costello <martin@martincostello.com>
Co-authored-by: Martin Costello <martin@martincostello.com>
Co-authored-by: Martin Costello <martin@martincostello.com>

This comment was marked as outdated.

1 similar comment
Copy link

sonarqubecloud bot commented Apr 2, 2025

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants