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

add the schema link in toml files #2104

Merged
merged 12 commits into from
Mar 13, 2024
Merged

add the schema link in toml files #2104

merged 12 commits into from
Mar 13, 2024

Conversation

OniriCorpe
Copy link
Member

@OniriCorpe OniriCorpe commented Mar 7, 2024

notes:

  • graveyard.toml does not have a schema -> fixed
  • antifeatures.toml does not have a schema -> fixed
  • Additional properties are not allowed ('draft' was unexpected) errors for wishlist.toml -> fixed

PR status: ready

@OniriCorpe OniriCorpe force-pushed the add-schema-link-toml branch from 8f26262 to d80c901 Compare March 7, 2024 22:27
@OniriCorpe OniriCorpe force-pushed the add-schema-link-toml branch from c12d0ec to 674b302 Compare March 7, 2024 22:39
create & add a schema to graveyard.tom

tag kavita with "paid-content"

aaaaa the autoformater

tag kavita with "paid-content"

aaaaa the autoformater

add the schema link in toml files

create & add a schema to antifeatures.toml

add 'draft' property to the wishlist schema
@Psycojoker
Copy link
Member

Are those schemas used by linter tools? Do we have a CI job that used them before merging or do we need one?

@OniriCorpe
Copy link
Member Author

OniriCorpe commented Mar 8, 2024

Are those schemas used by linter tools? Do we have a CI job that used them before merging or do we need one?

yes it's used by an automatic linter, but only for apps.toml

def validate_schema() -> Generator[str, None, None]:
with open(REPO_APPS_ROOT / "schemas" / "apps.toml.schema.json", encoding="utf-8") as file:
apps_catalog_schema = json.load(file)
validator = jsonschema.Draft202012Validator(apps_catalog_schema)
for error in validator.iter_errors(get_catalog()):
yield f"at .{'.'.join(error.path)}: {error.message}"

it's also used by my linter in my IDE, so i can easilly spot errors like:

Additional properties are not allowed ('draft' was unexpected) errors for wishlist.toml

and fix them by hand

even if they're not used by an automatic CI, it's a good enhancement i think:

  • it brings standardization (all our .toml files have their associated schema)
  • it's good practice for toml
  • we can quickly see manually what is broken, it's not perfect but better than nothing
  • the new schemas could be used in an automatic linter one day in the future

@Psycojoker
Copy link
Member

even if they're not used by an automatic CI, it's a good enhancement i think

I think too, I'm interested about how to automatized it and adding it where it's useful like in some CI jobs or equivalent

@Salamandar Salamandar merged commit 67351da into master Mar 13, 2024
2 checks passed
@Salamandar Salamandar deleted the add-schema-link-toml branch March 13, 2024 10:06
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.

3 participants