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

nix: fix postgrest-dump-schema with optional yaml output #3304

Merged
merged 2 commits into from
Mar 7, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions nix/tools/tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,19 @@ let
checkedShellScript
{
name = "postgrest-dump-schema";
docs = "Dump the loaded schema's SchemaCache as a yaml file.";
docs = "Dump the loaded schema's SchemaCache in JSON or Yaml format.";
args = [
"ARG_OPTIONAL_BOOLEAN([yaml], [y], [Dump the schema cache in Yaml format])"
];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just remove the YAML option entirely. The reason for its introduction was because we intended to use it to commit a dump of the schema cache to the repo and then have the diff for that as a kind of test. This was discussed in #1699, but has since been superseded by the new snapshot IO test.

It's fine to output JSON only, which is easier to work with for local development / debugging.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, got it! Done.

workingDir = "/";
withEnv = postgrest.env;
withPath = [ jq ];
}
''
${withTools.withPg} -f test/spec/fixtures.sql \
${withTools.withPg} -f test/spec/fixtures/load.sql \
${cabal-install}/bin/cabal v2-run ${devCabalOptions} --verbose=0 -- \
postgrest --dump-schema \
| ${yq}/bin/yq -y .
| if [ "$_arg_yaml" = on ]; then ${yq}/bin/yq -y .; else cat; fi
'';

coverage =
Expand Down
Loading