Scenario:
You have a new type, say Foo. Defined as such:
type Foo struct {
... // objectMeta, typeMeta
EventTime *metav1.MicroTime `json:"eventTime"`
}
Now, you run this type through Wrangler's provided ToOpenAPIFromStruct as seen in
|
func ToOpenAPIFromStruct(obj interface{}) (*v1.JSONSchemaProps, error) { |
Wrangler incorrectly spits out an OpenAPI schema in which the MicroTime is stored as an object. It should be stored as a string, similar to how metav1.Time is stored.
The problem is in reflection.go,
|
case reflect.Struct: |
|
if t.Name() == "Time" { |
|
return "date", nil |
|
} |
Time is correctly compensated for, but not MicroTime.