Skip to content

feat: More extensive configuration #14

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

kevinmichaelchen
Copy link
Owner

@kevinmichaelchen kevinmichaelchen commented Nov 7, 2023

This PR introduces a new --config / -c flag, which allows for further customization of pruning logic.

The primary use case here is filtering fields out of certain objects or inputs.

Config File Format

[[type]]
name = "PersonInsertInput"
new_name = "SvcPersonInsertInput"
deny_list = ["address"]

[[type]]
name = "Person"
new_name = "SvcPerson"
deny_list = ["address"]

How it works

The first thing the CLI will do is parse the TOML config file.

  • name — The name of a type definition that the config rule will apply for.
  • new_name — What we should call the new type definition.
    • Optional. Useful when we need to preserve the original source definition and don't want the two definitions to have a name collision.
  • deny_list — The fields we should filter out of the type definition.

Caveats

  • Still need to deprecate --desiredDefinitions
  • When we prune an object, that may break some of its interface contracts
    • The current implementation just clears all interfaces entirely. Maybe the config file can be responsible for creation of new interfaces, but it's out of scope for now.

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.

1 participant