Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Add the option to load the type model definition from file #97

Open
b1zzu opened this issue Dec 4, 2019 · 8 comments
Open

Add the option to load the type model definition from file #97

b1zzu opened this issue Dec 4, 2019 · 8 comments
Labels
enhancement New feature or request

Comments

@b1zzu
Copy link
Contributor

b1zzu commented Dec 4, 2019

It would be nice if it could be possible to do something like this:

new TestxServer(path.resolve(__dirname, 'schema.graphql'))

but because both the model definition and the file path are strings, in my opinion, something like this is more clear:

new TestxServer({file: path.resolve(__dirname, 'schema.graphql')})

or we could expose a helper method:

testxServerFromFile(path.resolve(__dirname, 'schema.graphql'))
@b1zzu b1zzu added the enhancement New feature or request label Dec 4, 2019
@vinifarias
Copy link
Collaborator

vinifarias commented Dec 5, 2019

@b1zzu I really like this feature, we can try to do something like constructor overload.

@b1zzu
Copy link
Contributor Author

b1zzu commented Dec 5, 2019

Blocked by: #103

@b1zzu b1zzu added the blocked label Dec 5, 2019
@b1zzu
Copy link
Contributor Author

b1zzu commented Dec 5, 2019

@vinifarias I've opened a separate issue to discuss how we could improve the TestxServer constructor/api, we can move the discussion there. Btw what's a constructor overload?

@vinifarias
Copy link
Collaborator

@b1zzu It's when you use multiple constructors for a class, and each of them has different parameters.

@b1zzu
Copy link
Contributor Author

b1zzu commented Dec 5, 2019

@vinifarias that's not possible in typescript/javascript, the alternative in our case would be to add n optional parameters, but it has this drawback

new TestxServer("option one", undefined, undefined, undefined, undefined, "som other options")

@vinifarias
Copy link
Collaborator

@b1zzu Sorry XD, it's not a good idea to keep this type of constructor with many optional parameters.

@b1zzu
Copy link
Contributor Author

b1zzu commented Dec 5, 2019

@vinifarias no need to be sorry 😄, in Java it's a good approach because it's possible to define multiple constructors with the same number of arguments

@b1zzu b1zzu removed the blocked label Dec 9, 2019
@b1zzu b1zzu mentioned this issue Jan 28, 2020
@wtrocki
Copy link
Contributor

wtrocki commented Jan 28, 2020

I plan to use testx with graphback that will use graphql-config.

GraphQL Config always passing compiled schema/string. Files are hard as all depends on the __dirname and process.cwd

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants