Skip to content

Conversation

@makeev-pavel
Copy link
Collaborator

No description provided.

@makeev-pavel makeev-pavel marked this pull request as draft September 25, 2025 06:41
@github-actions github-actions bot added the enhancement New feature or request label Sep 25, 2025
@github-actions github-actions bot added the bug Something isn't working label Sep 26, 2025
@makeev-pavel makeev-pavel marked this pull request as ready for review September 29, 2025 11:55
@b41ex b41ex changed the title feat: OAS 3.0 to OAS 3.1 comparison feat: nullable in OAS 3.0 is equivalent to union with null type in 31. Sep 30, 2025
@b41ex b41ex changed the title feat: nullable in OAS 3.0 is equivalent to union with null type in 31. feat: nullable in OAS 3.0 is equivalent to union with null type in 3.1 Sep 30, 2025
})

describe('Comparison nullable and null type', () => {
test('could compare nullable to anyOf', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

'nullable is equivalent to anyOf with null type'

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

Copy link
Collaborator

@JayLim2 JayLim2 left a comment

Choose a reason for hiding this comment

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

Comments about types are just recommendations

)

const inputOrigins = valueWithoutNullable[originsFlag] as Record<PropertyKey, unknown> | undefined
const nullTypeOrigins = nullTypeObject[originsFlag] as Record<PropertyKey, unknown> | undefined ?? {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

it's better to check type explicitly with isObject

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

Copy link
Collaborator

Choose a reason for hiding this comment

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

it's not necessary to cast type if you checked it explicitly. If it doesn't work, maybe you have to extract it to fixed const before checking.

It increases code size, but it is more type safe

Copy link
Collaborator

@JayLim2 JayLim2 left a comment

Choose a reason for hiding this comment

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

The only 1 recommendation is left about removing casting after type check. It is already type safe, but a little bit ugly

@b41ex b41ex merged commit 20679bd into develop Oct 2, 2025
15 checks passed
@b41ex b41ex deleted the feature/oas-30-to-31-comparison branch October 2, 2025 12:56
@github-actions github-actions bot locked and limited conversation to collaborators Oct 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support comparing nullable in OAS 3.0 to null type in OAS 3.1

4 participants