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: Herbarium - Use it to create mutations, queries and types #54

Merged
merged 14 commits into from
Jun 29, 2022

Conversation

PedroMarquesFr
Copy link
Contributor

@PedroMarquesFr PedroMarquesFr commented Jun 14, 2022

Created herbarium support to herbs2gql

Fixes #38

Proposed Changes

  1. Created a new import called herbarium2gql file
  2. Added herbarium library
  3. New test
  4. New documentation

Readiness Checklist

Author/Contributor

  • If documentation is needed for this change, has that been included in this pull request
  • Remember to check if code coverage decrease, if so, please implement the necessary tests

Reviewing Maintainer

  • Label as breaking if this is a large fundamental change
  • Label as either automation, bug, documentation, enhancement, infrastructure, or performance

request: {
arrayField: [CoolEntity],
},

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this blank line, please

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

request: {
id: Number,
},

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@italojs
Copy link
Member

italojs commented Jun 15, 2022

awesome PR @PedroMarquesFr , thank you very much!
could you add a session in our documentation please?

@codecov
Copy link

codecov bot commented Jun 17, 2022

Codecov Report

Merging #54 (9cf5cc5) into master (4f6e74e) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master       #54   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           13        14    +1     
  Lines          173       192   +19     
=========================================
+ Hits           173       192   +19     
Impacted Files Coverage Δ
src/herbs2gql.js 100.00% <ø> (ø)
src/herbarium2gql.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 83b167b...9cf5cc5. Read the comment docs.

README.md Outdated
@@ -149,6 +149,16 @@ const [gql, resolver] = usecase2mutation(usecase, resolverFunc)
```
Or you can use `herbs2gql` [`defaultResolver`](https://github.com/herbsjs/herbs2gql/blob/master/src/defaultResolver.js) implementation as a reference.

### Herbarium integration
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Herbarium integration

Since this kind of integration will be the primary way of converting Herbs to GraphQL, this should be the first method to show, not the last

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sense, fixed

src/herbs2gql.js Outdated
@@ -7,4 +7,5 @@ module.exports = {
defaultResolver: require('./defaultResolver'),
defaultErrorHandler: require('./defaultErrorHandler').defaultErrorHandler,
args2request: require('./args2request'),
herbarium2gql:require('./herbarium2gql')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

herbarium2gql -> herbs2gql

The idea is that Herbarium is not the important part here, it is just part of Herbs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@dalssoft
Copy link
Member

@PedroMarquesFr thank you for this PR. It is on the right path!

package.json Outdated
@@ -34,6 +34,7 @@
"license": "MIT",
"homepage": "https://github.com/herbsjs/herbs2gql#readme",
"dependencies": {
"@herbsjs/herbarium": "^1.4.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't be put on "peerDependencies"?

Copy link
Contributor Author

@PedroMarquesFr PedroMarquesFr Jun 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true I didn't noticed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@dalssoft
Copy link
Member

when I look at the To Do List project, there it is possible to find custom mutations and queries - here

in this format with herbarium, how would this scenario of custom mutations and queries look like?

@PedroMarquesFr
Copy link
Contributor Author

PedroMarquesFr commented Jun 25, 2022

when I look at the To Do List project, there it is possible to find custom mutations and queries - here

in this format with herbarium, how would this scenario of custom mutations and queries look like?

As mutations, queries and types array struture didnt change it would work the same way, using push method, but all in the index file and not on each individual file. Example using quoted To Do List project:
image

@PedroMarquesFr
Copy link
Contributor Author

I think now the CI is working, can you run it again please @jhomarolo ?

@dalssoft
Copy link
Member

@PedroMarquesFr the PR is read to merge but it seems the test coverage has dropped. Can you check it?

@jhomarolo-vortx
Copy link
Contributor

It seems that have some "it.only" inside the test suite. @PedroMarquesFr could you please remove them?

@dalssoft dalssoft merged commit 92d38ce into herbsjs:master Jun 29, 2022
@herbsjs-robot
Copy link

🎉 This PR is included in version 2.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Already in production
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Herbarium - Use it to create mutations, queries and types
5 participants