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

Commit

Permalink
fix: marshaling resource definition output panic
Browse files Browse the repository at this point in the history
  • Loading branch information
gitlawr authored and aiwantaozi committed Nov 10, 2023
1 parent 2e61212 commit a3e5c03
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/apis/resourcedefinition/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (h Handler) Create(req CreateRequest) (CreateResponse, error) {
return nil, err
}

return dao.ExposeResourceDefinition(entity), nil
return model.ExposeResourceDefinition(entity), nil
}

func (h Handler) Get(req GetRequest) (GetResponse, error) {
Expand Down
8 changes: 7 additions & 1 deletion pkg/templates/openapi/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ func IntersectSchema(s1, s2 *openapi3.Schema) *openapi3.Schema {
return s1
}

if s1.Type != s2.Type {
return nil
}

r1 := sets.New[string](s1.Required...)
p1 := sets.KeySet[string](s1.Properties)

Expand All @@ -25,7 +29,9 @@ func IntersectSchema(s1, s2 *openapi3.Schema) *openapi3.Schema {
required := r1.Intersection(r2)
propertyKeys := p1.Intersection(p2)

s := &openapi3.Schema{}
s := &openapi3.Schema{
Type: s1.Type,
}
s.Required = required.UnsortedList()
s.Properties = make(openapi3.Schemas)

Expand Down

0 comments on commit a3e5c03

Please sign in to comment.