Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: merge resource spec into component spec #86

Merged
merged 2 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/base/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ func (c *Connector) LoadConnectorDefinition(definitionJSONBytes []byte, tasksJSO
if err != nil {
return err
}

// deprecated, will be removed soon
def.Spec.ResourceSpecification, err = c.refineResourceSpec(def.Spec.ResourceSpecification)
if err != nil {
return err
Expand All @@ -88,6 +90,9 @@ func (c *Connector) LoadConnectorDefinition(definitionJSONBytes []byte, tasksJSO
if err != nil {
return err
}
connectionPropStruct := &structpb.Struct{Fields: map[string]*structpb.Value{}}
connectionPropStruct.Fields["connection"] = structpb.NewStructValue(def.Spec.ResourceSpecification)
def.Spec.ComponentSpecification.Fields["properties"] = structpb.NewStructValue(connectionPropStruct)

def.Spec.DataSpecifications, err = c.generateDataSpecs(def.Title, availableTasks)
if err != nil {
Expand Down
22 changes: 22 additions & 0 deletions pkg/base/testdata/wantConnectorDefinition.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,28 @@
"type": "object"
}
],
"properties": {
"connection": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": true,
"instillShortDescription": "",
"properties": {
"api_key": {
"description": "Fill your OpenAI API key. To find your keys, visit your OpenAI's API Keys page.",
"instillCredentialField": true,
"instillShortDescription": "Fill your OpenAI API key. To find your keys, visit your OpenAI's API Keys page.",
"instillUIOrder": 0,
"title": "API Key",
"type": "string"
}
},
"required": [
"api_key"
],
"title": "OpenAI Connector Resource",
"type": "object"
}
},
"title": "OpenAI Component",
"type": "object"
},
Expand Down
Loading