Git Product home page Git Product logo

pf2ools-schema's Introduction

The Pf2ools Schema

A project in the Pf2ools ecosystem to define a schema for Pathfinder 2nd Edition game content. We use Zod to development the schema in TypeScript, from which we generate a mostly identical JSON Schema for general use.

How to validate your Pf2ools data

Beyond providing TypeScript types for developers, the Pf2ools Schema validates JSON data for the Pf2ools ecosystem. You can validate files using this simple syntax:

npx pf2ools-schema [--options ...] <paths ...>

where <paths ...> is one or more paths to files or directories you'd like to validate.

You can learn about the available options using npx pf2ools-schema --help.

Example

$ npx pf2ools-schema -ar ./myFile.json ./myDirectory
	[Passed]  myFile.json
	[Passed]  myDirectory/file1.json
	[Failed]  myDirectory/file2.json
	[Passed]  myDirectory/nestedDirectory/moreFile.json
1 file (25%) failed validation.

Important

Pf2ools Schema requires you install NodeJS and its package manager, npm, first.

Using with Pf2ools Data

If you've made a local clone of the Pf2ools Data repository, you can make use of the Pf2ools Schema automatically.

First run npm i within your cloned directory to install the latest dependencies. You can then either run npx pf2ools-schema as above to validate something in the repo, or you can use npm run test:data to test everything. Note that the latter might take a while, so it's not worth the effort if you're just working on a small piece!

Remember to re-run npm i whenever the schema changes!

In-editor validation

If your code editor supports automatic schema validation, you can point it to this file.

Alternatively, if your editor supports implicit schema validation, you can add this property to the top level of your JSON file.

"$schema": "https://raw.githubusercontent.com/Pf2ools/pf2ools-schema/master/_dist/schema/data.json"

Contributing

Please see CONTRIBUTING.md or join our Discord server for more information.

Legal

The schema and all scripts are licensed under the MIT license.

pf2ools-schema's People

Contributors

dependabot[bot] avatar mrvauxs avatar spappz avatar

Stargazers

 avatar

pf2ools-schema's Issues

More specific Backgrounds Skills

Currently backgrounds data only provide the total sum of what they can provide. It would be great if we can distinguish "Pick anything / from a list" from hardcoded "You are trained in X."

The basic implementation would be creating an array of objects representing available choices. The array should by default be "and", with each object being a single choice. "Trained in Occultism and any other of your choice" would become [{occultism}, {any}] in pseudo-code.

We don't need to lose our minds over "sets" of choices (yet), so no need for recursive patterns like "You are trained in either Occultism and Nature or Arcana and Religion." Let's stick it to one layer for now.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.