Skip to content
This repository was archived by the owner on Jun 2, 2026. It is now read-only.

Allow excepting keys from sanitization#454

Open
DanailPenev wants to merge 1 commit into
IBM:masterfrom
DanailPenev:allow-unsanitized-dynamic-objects
Open

Allow excepting keys from sanitization#454
DanailPenev wants to merge 1 commit into
IBM:masterfrom
DanailPenev:allow-unsanitized-dynamic-objects

Conversation

@DanailPenev

Copy link
Copy Markdown

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

Alan-Cha commented May 3, 2022

Copy link
Copy Markdown
Collaborator

@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

Alan-Cha commented May 3, 2022

Copy link
Copy Markdown
Collaborator

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants