-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
1,223 additions
and
3,256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,32 @@ | ||
package internal | ||
|
||
import ( | ||
"github.com/hasura/ndc-rest/ndc-rest-schema/configuration" | ||
rest "github.com/hasura/ndc-rest/ndc-rest-schema/schema" | ||
"github.com/hasura/ndc-sdk-go/schema" | ||
) | ||
|
||
// MetadataCollection stores list of REST metadata with helper methods | ||
type MetadataCollection []rest.NDCRestSchema | ||
type MetadataCollection []configuration.NDCRestRuntimeSchema | ||
|
||
// GetFunction gets the NDC function by name | ||
func (rms MetadataCollection) GetFunction(name string) (*rest.OperationInfo, *rest.NDCRestSettings, error) { | ||
func (rms MetadataCollection) GetFunction(name string) (*rest.OperationInfo, configuration.NDCRestRuntimeSchema, error) { | ||
for _, rm := range rms { | ||
fn := rm.GetFunction(name) | ||
if fn != nil { | ||
return fn, rm.Settings, nil | ||
return fn, rm, nil | ||
} | ||
} | ||
return nil, nil, schema.UnprocessableContentError("unsupported query: "+name, nil) | ||
return nil, configuration.NDCRestRuntimeSchema{}, schema.UnprocessableContentError("unsupported query: "+name, nil) | ||
} | ||
|
||
// GetProcedure gets the NDC procedure by name | ||
func (rms MetadataCollection) GetProcedure(name string) (*rest.OperationInfo, *rest.NDCRestSettings, error) { | ||
func (rms MetadataCollection) GetProcedure(name string) (*rest.OperationInfo, configuration.NDCRestRuntimeSchema, error) { | ||
for _, rm := range rms { | ||
fn := rm.GetProcedure(name) | ||
if fn != nil { | ||
return fn, rm.Settings, nil | ||
return fn, rm, nil | ||
} | ||
} | ||
return nil, nil, schema.UnprocessableContentError("unsupported mutation: "+name, nil) | ||
return nil, configuration.NDCRestRuntimeSchema{}, schema.UnprocessableContentError("unsupported mutation: "+name, nil) | ||
} |
Oops, something went wrong.