Skip to content

Commit

Permalink
remove comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hgiasac committed Dec 27, 2024
1 parent 7c70ea9 commit 2b100d8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
1 change: 1 addition & 0 deletions connector/internal/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ type DistributedResponse[T any] struct {
Errors []DistributedError `json:"errors" yaml:"errors"`
}

// ToMap serializes the distributed response to a map
func (dr DistributedResponse[T]) ToMap() map[string]any {
results := make([]map[string]any, len(dr.Results))
for i, result := range dr.Results {
Expand Down
12 changes: 6 additions & 6 deletions ndc-http-schema/configuration/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ func buildDistributedResultObjectType(restSchema *rest.NDCHttpSchema, operationN
Type: schema.NewNamedType(rest.HTTPServerIDScalarName).Encode(),
},
},
DistributedObjectResultsDataKey: {
"data": {
ObjectField: schema.ObjectField{
Description: utils.ToPtr("A result of " + operationName),
Type: underlyingType,
Expand All @@ -389,13 +389,13 @@ func buildDistributedResultObjectType(restSchema *rest.NDCHttpSchema, operationN
restSchema.ObjectTypes[distResultType] = rest.ObjectType{
Description: utils.ToPtr("Distributed responses of " + operationName),
Fields: map[string]rest.ObjectField{
DistributedObjectResultsKey: {
"results": {
ObjectField: schema.ObjectField{
Description: utils.ToPtr("Results of " + operationName),
Type: schema.NewArrayType(schema.NewNamedType(distResultDataType)).Encode(),
},
},
DistributedObjectErrorsKey: {
"errors": {
ObjectField: schema.ObjectField{
Description: utils.ToPtr("Error responses of " + operationName),
Type: schema.NewArrayType(schema.NewNamedType(rest.DistributedErrorObjectName)).Encode(),
Expand Down Expand Up @@ -438,9 +438,9 @@ func cloneOperationInfo(operation rest.OperationInfo, req *rest.Request) rest.Op
}

originalResultType := operation.OriginalResultType
// if len(operation.OriginalResultType) == 0 {
// originalResultType = operation.ResultType
// }
if len(operation.OriginalResultType) == 0 {
originalResultType = operation.ResultType
}

return rest.OperationInfo{
Request: req,
Expand Down
6 changes: 0 additions & 6 deletions ndc-http-schema/configuration/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,6 @@ type ConvertCommandArguments struct {
PatchAfter []string `help:"Patch files to be applied into the input file after converting"`
}

const (
DistributedObjectResultsKey = "results"
DistributedObjectErrorsKey = "errors"
DistributedObjectResultsDataKey = "data"
)

// the object type of HTTP execution options for single server
var singleObjectType = rest.ObjectType{
Description: utils.ToPtr("Execution options for HTTP requests to a single server"),
Expand Down

0 comments on commit 2b100d8

Please sign in to comment.