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

Do something about the smart tags JSON schema #561

Open
benjie opened this issue Nov 8, 2019 · 2 comments
Open

Do something about the smart tags JSON schema #561

benjie opened this issue Nov 8, 2019 · 2 comments

Comments

@benjie
Copy link
Member

benjie commented Nov 8, 2019

@singingwolfboy has prepared a draft: https://gist.github.com/singingwolfboy/a7144db4e24b5d31ba81f28b878a4b51

Would be great to integrate this with VSCode.

Relates to the smart tags plugin's JSON format:

/**
* JSON (or JSON5) description of the tags to add to various entities, e.g.
*
* ```js
* {
* version: 1,
* tags: {
* class: {
* my_table: {
* tags: {omit: "create,update,delete"},
* description: "You can overwrite the description too",
* columns: {
* my_private_field: {tags: {omit: true}}
* }
* },
* "my_schema.myOtherTable": {
* description: "If necessary, add your schema to the table name to prevent multiple being matched"
* }
* },
* procedure: {
* "my_schema.my_function_name": {
* tags: {sortable: true, filterable: true}
* }
* }
* }
* }
* ```
*/
export type JSONPgSmartTags = {
version: 1;
config: {
[kind in PgSmartTagSupportedKinds]: {
[identifier: string]: {
tags?: PgSmartTagTags;
description?: string;
columns?: {
[columnName: string]: {
tags?: PgSmartTagTags;
description?: string;
};
};
};
};
};
};

Used by PostGraphile in postgraphile.tags.json5: graphile/crystal#1177

@keithlayne
Copy link
Contributor

So this is kinda rough but it's automatable. There's probably a way to tweak the output too using quicktype. I know it's not the only tool available but I've used it before, seems pretty good.

Also, shouldn't

[kind in PgSmartTagSupportedKinds]: { 
  ...
}

be optional?

@benjie
Copy link
Member Author

benjie commented Jan 16, 2020

Yeah; you don't have to specify all, so I guess it should 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants