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

Allow excepting keys from sanitization #454

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DanailPenev
Copy link

Summary

  • Add an optional parameter nonSanitizableObjectKeys that prevents OpenAPI-to-GraphQL from sanitizing objects that fall under these keys
  • This does not conform to the GraphQL rules but allows power users who have a non-standard schema to persevere their original data in exceptional cases
  • I understand this might be controversial so happy to explore alternative options that are not much larger in scope

Testing

  • Add a test case for the sanitization function
  • Add an E2E test case for the server and schema creation with appropriate params
  • All other tests pass

- Add an optional parameter nonSanitizableObjectKeys that prevents OpenAPI-to-GraphQL from sanitizing them
- This does not conform to the GraphQL rules but allows power users who have a non-standard schema to handle their exceptional cases

Signed-off-by: Dani Penev <danailnpenev@gmail.com>
@Alan-Cha
Copy link
Collaborator

Alan-Cha commented May 3, 2022

@DanailPenev Thanks for providing this suggestion and including tests! It is also so helpful to include tests.

However, I wonder if there is a better way to do this. Are you aware of the custom type/field/enum extension? The intention of this extension is to allow users to have greater control over type and field names and enum values. However, I think we still ensure basic santization aka remove GraphQL unsafe characters.

Perhaps there should be an option that prevents OtG from sanitizing these extension names/values giving users definitive control over names and values. Perhaps something like disableCustomNameValueSanitzation? It's a long name so I am open to alternatives.

In general, what do you think?

@Alan-Cha
Copy link
Collaborator

Alan-Cha commented May 3, 2022

And I am sorry for the late reply. I have really been struggling to maintain OtG by myself.

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.

None yet

2 participants