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: Create tailcall config from a URL #1946

Open
tusharmath opened this issue May 14, 2024 · 0 comments
Open

feat: Create tailcall config from a URL #1946

tusharmath opened this issue May 14, 2024 · 0 comments
Assignees
Labels
type: feature Brand new functionality, features, pages, workflows, endpoints, etc.

Comments

@tusharmath
Copy link
Contributor

tusharmath commented May 14, 2024

Given an HTTP URL for a REST API, generate a valid tailcall configuration that can expose a GraphQL endpoint automatically.

CLI Usage

Option 1

tailcall gen https://jsonplaceholder.typicode.com/users --input URL --output GraphQL

Limitiations: Difficult to configure headers, post requests etc.

Option 2

curl -x https://jsonplaceholder.typicode.com/users | tailcall gen --input CURL --output GraphQL

Limitations: Difficult to enforce usage of -x on the previous curl command and dependency on a curl output parser.

Option 3
Using input type curl to specify all a URL to curl on with arguments to configure the curl command.

tailcall curl https://foo.com/bar\
  -H 'Authorization: Bearer 1234'\
  -d '{"a":"b", "c":"d"}'\
  -X POST\
  --output GraphQL

Generated Configuration

schema @upstream(baseURL: "http://jsonplaceholder.typicode.com") {
  query: Query
}

type Query {
  users: [User] @http(path: "/users")
}

type User {
  id: Int!
  name: String!
  username: String!
  email: String!
  phone: String
  website: String
  address: Address
}


type Address {
  street: String
  suite: String
  city: String
  zipcode: String
  geo: Geo 
}

type Geo {
  lat: String
  lng: String
}

Technical Requirements

  • Add unit test wherever necessary
  • Implement the logic in a separate workspace - tailcall-config-url
@tusharmath tusharmath added the type: feature Brand new functionality, features, pages, workflows, endpoints, etc. label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature Brand new functionality, features, pages, workflows, endpoints, etc.
Projects
None yet
Development

No branches or pull requests

2 participants