Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Fix openapi schema generation for event fields #1961

Merged
merged 1 commit into from
Jul 21, 2023

Conversation

njhale
Copy link
Member

@njhale njhale commented Jul 21, 2023

Set formatting and extensions for the observed and details fields
respectively. This prevents field manager from complaining when events
are created.

Addresses #1672

Set formatting and extensions for the observed and details fields
respectively. This prevents field manager from complaining when events
are created.

Signed-off-by: Nick Hale <[email protected]>
@@ -10,7 +10,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
result := generated.GetOpenAPIDefinitions(ref)
for _, v := range result {
for name := range v.Schema.SchemaProps.Properties {
if name == "deployArgs" || name == "buildArgs" || name == "params" {
if name == "deployArgs" || name == "buildArgs" || name == "params" || name == "details" {
Copy link
Member

Choose a reason for hiding this comment

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

Oh, I forgot about this hack. This explains a lot of errors I see because this list is not comprehensive for all the places we use GenericMap. There's got to be a better more proper approach for this.

Copy link
Member Author

@njhale njhale Jul 21, 2023

Choose a reason for hiding this comment

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

I burned a lot of time trying to sniff out a better way to do this. I eventually stumbled onto https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators#custom-openapi-type-definitions

... unfortunately, func (_ GenericMap) OpenAPIDefinition() openapi.OpenAPIDefinition {//... wasn't doing the trick (curiously enough, implementing the other two methods for MicroTime did though).

@njhale njhale merged commit 300660d into acorn-io:main Jul 21, 2023
@njhale njhale deleted the fix/events-mfe branch July 21, 2023 22:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants