Skip to content

Commit

Permalink
fix: fix pipeline can not generate correct output schema (#342)
Browse files Browse the repository at this point in the history
Because

- pipeline can not generate correct output schema when it contains
`semi-structured/object`

This commit

- fix pipeline can not generate correct output schema
  • Loading branch information
donch1989 authored Dec 22, 2023
1 parent 59d9808 commit 502f1c4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/iancoleman/strcase v0.2.0
github.com/influxdata/influxdb-client-go/v2 v2.12.3
github.com/instill-ai/component v0.8.0-beta
github.com/instill-ai/connector v0.8.0-beta.0.20231219105932-d0dea69b3d0c
github.com/instill-ai/connector v0.8.1-beta
github.com/instill-ai/operator v0.6.0-beta
github.com/instill-ai/protogen-go v0.3.3-alpha.0.20231214110613-21be2ae5d3e9
github.com/instill-ai/usage-client v0.2.4-alpha.0.20231206162018-6ccbff13136b
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1187,8 +1187,8 @@ github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 h1:W9WBk7
github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo=
github.com/instill-ai/component v0.8.0-beta h1:xXePzuaKhh9RjSnmo6mZE4QD8OkaAuWVxxero6b4Kyo=
github.com/instill-ai/component v0.8.0-beta/go.mod h1:fWyVPJVJ4WyFSQMgWCc7KvcS7m9QpdS3VXCL2CZE8OY=
github.com/instill-ai/connector v0.8.0-beta.0.20231219105932-d0dea69b3d0c h1:dXT4lToRM9h18y2+/8fzzj2QwZk5hvG2QAyhjl+X9sE=
github.com/instill-ai/connector v0.8.0-beta.0.20231219105932-d0dea69b3d0c/go.mod h1:y7QDqft1AARunXwHi7+D0veMbwWWDO7WJ/1YeV8uUN8=
github.com/instill-ai/connector v0.8.1-beta h1:KQOnOrkeXl3a9xFTDz9Kd/vxrTyAP6AajiQ0gsxF9z0=
github.com/instill-ai/connector v0.8.1-beta/go.mod h1:QgaSVMIVkqZS4y5TGMrfk01h6dDVTGAZxVCRncA2grs=
github.com/instill-ai/operator v0.6.0-beta h1:G3imamqb9tDmOKYwzKqbvnKRaseX+PcNXpUJKu03lv8=
github.com/instill-ai/operator v0.6.0-beta/go.mod h1:exFYtKdZFyzAczduFxQlD4X7+/B4OLYJ3ihA7j8Kcsg=
github.com/instill-ai/protogen-go v0.3.3-alpha.0.20231214110613-21be2ae5d3e9 h1:Yv0wikxsdNbvyQSk1gsiUXTRlWDmh7+Qqb3mGy2qw80=
Expand Down
8 changes: 4 additions & 4 deletions pkg/service/openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,21 +352,21 @@ func (s *service) GenerateOpenApiSpec(startCompOrigin *pipelinePB.Component, end
target := strings.Split(curr, "[")[0]
if _, ok := walk.GetStructValue().Fields["properties"]; ok {
if _, ok := walk.GetStructValue().Fields["properties"].GetStructValue().Fields[target]; !ok {
return nil, fmt.Errorf("openapi error")
break
}
} else {
return nil, fmt.Errorf("openapi error")
break
}
walk = walk.GetStructValue().Fields["properties"].GetStructValue().Fields[target].GetStructValue().Fields["items"]
} else {
target := curr

if _, ok := walk.GetStructValue().Fields["properties"]; ok {
if _, ok := walk.GetStructValue().Fields["properties"].GetStructValue().Fields[target]; !ok {
return nil, fmt.Errorf("openapi error")
break
}
} else {
return nil, fmt.Errorf("openapi error")
break
}

walk = walk.GetStructValue().Fields["properties"].GetStructValue().Fields[target]
Expand Down

0 comments on commit 502f1c4

Please sign in to comment.