mirror of
https://github.com/niusmallnan/steve.git
synced 2025-08-31 12:48:54 +00:00
Fix openapi schema to steve schema generation
This commit is contained in:
@@ -97,8 +97,7 @@ func toField(schema proto.Schema) schemas.Field {
|
||||
case *proto.Map:
|
||||
f.Type = "map[" + toField(v.SubType).Type + "]"
|
||||
case *proto.Kind:
|
||||
parts := v.Path.Get()
|
||||
f.Type = parts[len(parts)-1]
|
||||
f.Type = v.Path.String()
|
||||
case proto.Reference:
|
||||
sub := v.SubSchema()
|
||||
if p, ok := sub.(*proto.Primitive); ok {
|
||||
|
@@ -3,7 +3,7 @@ package converter
|
||||
import (
|
||||
"github.com/rancher/apiserver/pkg/types"
|
||||
"github.com/rancher/wrangler/pkg/schemas"
|
||||
"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
)
|
||||
|
||||
func modelV3ToSchema(name string, k *v1.JSONSchemaProps, schemasMap map[string]*types.APISchema) *types.APISchema {
|
||||
@@ -27,9 +27,10 @@ func modelV3ToSchema(name string, k *v1.JSONSchemaProps, schemasMap map[string]*
|
||||
}
|
||||
}
|
||||
|
||||
if _, ok := schemasMap[s.ID]; !ok {
|
||||
schemasMap[s.ID] = &s
|
||||
if existing, ok := schemasMap[s.ID]; ok && len(existing.Attributes) > 0 {
|
||||
s.Attributes = existing.Attributes
|
||||
}
|
||||
schemasMap[s.ID] = &s
|
||||
|
||||
for k, v := range s.ResourceFields {
|
||||
if types.ReservedFields[k] {
|
||||
|
Reference in New Issue
Block a user