Skip to content

Conversation

@phryneas
Copy link

@phryneas phryneas commented Oct 7, 2020

Like requested in #205

Description

This PR only uses the createJsonSchema part of postgraphile-tag-json-tools, as extractSmartTags and loadSmartTags functionalities do not seem necessary here.

Changes in the database will update @app/server/pg-database-smart-tags.schema.json, but edits in @app/server/pg-smart-tags.schema.json will persist, so additional tags can be added without fear of something being overridden. (I added simpleCollections and resultFieldName, as I didn't have those in my initial schema - if you can think of any more tags, please mention them & I will add them.)

I've marked the place to add new tags with "$comment": "------ Add extra tags here, in properties. ------",.

Performance impact

None in production use, probably neglectable in dev mode.

Security impact

None in production use, nothing I could think of in dev use.

Checklist

  • My code matches the project's code style and yarn lint:fix passes.
  • I've added tests for the new feature, and yarn test passes.
  • I have detailed the new feature in the relevant documentation.
  • I have added this feature to 'Pending' in the RELEASE_NOTES.md file (if one exists).
  • If this is a breaking change I've explained why.

for json schema generation
Copy link
Member

@benjie benjie left a comment

Choose a reason for hiding this comment

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

This is really cool! It could do with a smidge of docs; could you put some in the @app/server/README.md file referencing the two newly created file names and a link to postgraphile-tag-json-tools please?

Comment on lines +189 to +194
...(!isDev
? []
: [
// updates the `pg-database-smart-tags.schema.json` file based on the database
CreateJsonSchemaPlugin,
]),
Copy link
Member

Choose a reason for hiding this comment

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

Avoiding the negative makes this easier to read IMO.

Suggested change
...(!isDev
? []
: [
// updates the `pg-database-smart-tags.schema.json` file based on the database
CreateJsonSchemaPlugin,
]),
...(isDev
? [
// updates the `pg-database-smart-tags.schema.json` file based on the database
CreateJsonSchemaPlugin,
]
: []),

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