Giter Site home page Giter Site logo

mandiwise / graphql-operation-validation-action Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 1.0 1.76 MB

A GitHub Action that validates all operations performed by a client application against a GraphQL schema.

Home Page: https://dev.to/mandiwise/validating-graphql-operations-with-a-github-action-3jkg

License: MIT License

JavaScript 100.00%
github-actions graphql static-analysis

graphql-operation-validation-action's People

Contributors

mandiwise avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

fishbrain

graphql-operation-validation-action's Issues

Error when schema file is not yet used

Assume you have a lot of schema files and specify them using a glob, say schema_location: ${{ github.workspace }}/api/**/*.graphql. If one of the schema files is not used in any operation, then one gets the following error.

 Error: 
      Unable to find any GraphQL type definitions for the following pointers:
        
          - /home/runner/work/..../api/documents/schema.graphql

See https://github.com/JabRef/JabRefOnline/runs/2535901416?check_suite_focus=true for a real-life example.
Specifying the schema in question under excluded_paths doesn't help.

โ™ป๏ธ Breakdown of duties

Hey @mandiwise ๐Ÿ‘‹ Thanks for your work put on this one ๐Ÿ‘

This ability to check for all graphQl mutations/queries to a defined schema is really nice and could be really helpful for a lot of project. However the fact that this process is 'captive' of a GitHub Action doesn't provide a lot of flexibilities.

My idea would be to extract all the logic of it in a package that:

  • export the main function to be used for example validateGraphqlOperations(dir, schemaFilePath)
  • provide a CLI like validate-graphql-operations src schema.graphql

The usage would be really similar to graphql-schema-diff for example.

Finally this action will only import the package and consume it with the @actions/core API.

I can help for the implementation so what do you think of this idea?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.