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 status endpoint to base class #114

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mika-hjalmarsson
Copy link

This will introduce the possibility to modify the status endpoint on the models.

@mika-hjalmarsson mika-hjalmarsson requested a review from a team as a code owner June 13, 2023 09:06
Copy link
Member

@oyvindio oyvindio left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

I think this looks reasonable. I've left some minor comments in line. In addition, it would be ideal to add some tests which verify the basic behavior of the save_status method added here. There are some tests for some of the other model methods here which might be useful as a starting point

Apologies for the delayed review

Comment on lines 147 to +151
openAPIV3Schema = Field(JSONSchemaProps)


class CustomResourceValidationStatusEnabled(Model):
openAPIV3Schema = Field(JSONSchemaPropsStatusEnabled)
Copy link
Member

Choose a reason for hiding this comment

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

Since the difference in allowed fields when the status subresource is enabled is only in JSONSchemaProps, maybe CustomResourceValidationStatusEnabled can be made unnecessary by letting CustomResourceValidation.openAPIV3Schema be either JSONSchemaProps type

Suggested change
openAPIV3Schema = Field(JSONSchemaProps)
class CustomResourceValidationStatusEnabled(Model):
openAPIV3Schema = Field(JSONSchemaPropsStatusEnabled)
openAPIV3Schema = Field(JSONSchemaProps, alt_type=JSONSchemaPropsStatusEnabled)

@@ -77,6 +77,31 @@ class JSONSchemaProps(Model):
x_kubernetes_preserve_unknown_fields = Field(bool, name="x-kubernetes-preserve-unknown-fields")


class JSONSchemaPropsStatusEnabled(Model):
Copy link
Member

Choose a reason for hiding this comment

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

Fields with type six.text_type should be changed to str, after dropping Python 2.x support and removing dependency on six in #116

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

Successfully merging this pull request may close these issues.

2 participants