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

codegen: support predicate arguments #178

Merged
merged 4 commits into from
Jan 16, 2025
Merged

Conversation

hgiasac
Copy link
Collaborator

@hgiasac hgiasac commented Jan 10, 2025

Add the ndc struct tag to support predicate arguments. If there is a schema.Expression field with ndc:"predicate=<object-name>" tag in the argument struct it will be generated as a Predicate type.

type CreateAuthorArguments struct {
	Where schema.Expression `json:"where" ndc:"predicate=Author"`
}
{
  "arguments": {
    "where": {
      "type": {
        "type": "nullable",
        "underlying_type": {
          "object_type_name": "Author",
          "type": "predicate"
        }
      }
    }
  },
  "name": "createAuthor",
  "result_type": {
    "type": "nullable",
    "underlying_type": {
      "name": "CreateAuthorResult",
      "type": "named"
    }
  }
}

Copy link

github-actions bot commented Jan 10, 2025

Code Coverage

Package Line Rate Health
github.com/hasura/ndc-sdk-go/cmd/hasura-ndc-go/command/internal 83%
github.com/hasura/ndc-sdk-go/cmd/hasura-ndc-go/command 34%
github.com/hasura/ndc-sdk-go/cmd/hasura-ndc-go/version 43%
github.com/hasura/ndc-sdk-go/connector 54%
github.com/hasura/ndc-sdk-go/example/reference 57%
github.com/hasura/ndc-sdk-go/ndctest 51%
github.com/hasura/ndc-sdk-go/scalar 97%
github.com/hasura/ndc-sdk-go/schema 48%
github.com/hasura/ndc-sdk-go/utils 35%
Summary 52% (6738 / 12842)

Minimum allowed line rate is 40%

@hgiasac hgiasac merged commit e81c119 into main Jan 16, 2025
2 checks passed
@hgiasac hgiasac deleted the cmd/support-predicate-argument branch January 16, 2025 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant