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

Add nil checks for schema when evaluating XRD schema field #161

Merged
merged 1 commit into from
Mar 28, 2022

Conversation

tnthornton
Copy link
Member

Description of your changes

XRDs do not have a hard requirement that a version has a schema. Given that, the previous implementation assumed that there would be a schema object on every version; which results in a panic when a schema does not exist.

This can also be seen if an end user is typing an XRD from scratch and has not yet defined the schema.

Fixes #160

I have:

  • Read and followed Upbound's contribution process.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR, as appropriate.

How has this code been tested

  1. Verified that a panic is no longer seen in xpls when using the https://github.com/danielinclouds/play_crossplane_plugin repo.
  2. Verified that typing up the schema and partially supplying its definition does not result in a panic. Effectively mocking the authoring flow of typing everything individually.

Signed-off-by: Taylor Thornton <thornton.tn@gmail.com>
Copy link
Contributor

@hasheddan hasheddan left a comment

Choose a reason for hiding this comment

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

Thanks @tnthornton!

@tnthornton tnthornton merged commit c3e5760 into upbound:main Mar 28, 2022
@tnthornton tnthornton deleted the xrd-openapischema-panic branch March 28, 2022 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

panic seen when using xpls on when XRD in repo does not have an openApiSchema object
2 participants