Skip to content

Conversation

@cyscott
Copy link
Contributor

@cyscott cyscott commented Apr 2, 2025

Fix: Properly handle schema option in parseArgs function

Problem

The --schema command line option isn't working properly because the parseArgs function doesn't include the schema path in the returned configuration object. This causes the application to always use introspection even when a local schema file is specified.

Solution

Updated the parseArgs function to properly include all command line arguments in the configuration object, specifically:

  • Added name from argv.name
  • Added allowMutations from argv["enable-mutations"]
  • Added schema from argv.schema

The code now correctly respects the --schema option as documented in the README.

Testing

Tested locally by running the application with a local schema file:
node ./dist/index.js --endpoint http://localhost:3000/graphql --schema ./schema.graphql
Verified that the application now uses the local schema file rather than performing introspection.

Additional Notes

This is a small but important fix that ensures the application behaves as documented in the README. No additional tests or documentation changes were needed as this functionality was already documented.

@blurrah
Copy link
Owner

blurrah commented Apr 2, 2025

Thanks! My bad on this one haha

@blurrah blurrah merged commit 2406adb into blurrah:main Apr 2, 2025
@cyscott
Copy link
Contributor Author

cyscott commented Apr 2, 2025

Appreciate the library! Super helpful.

@blurrah
Copy link
Owner

blurrah commented Apr 3, 2025

Thanks for that :) Will try to work on better integration tests so I can catch these. The fix has been release with v0.3.3

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.

2 participants