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

Validator - validate batch table JSON against schema #32

Closed
lilleyse opened this issue Nov 18, 2016 · 0 comments
Closed

Validator - validate batch table JSON against schema #32

lilleyse opened this issue Nov 18, 2016 · 0 comments

Comments

@lilleyse
Copy link
Contributor

@JudyWeng

From the roadmap:

Validate Batch Table is valid JSON and follows the schema (have a generic validation function for this).

For this you will need to extract the batch table JSON from the buffer, using the batchTableJSONByteOffset field of the header, and then use Node's Buffer class to convert to a string, and then JSON.parse. This whole step of getting the JSON from a buffer and byte offset can be made into its own helper file since it will be used by every tile format.

You should also extract the batch table binary. This doesn't need its own helper function because it should be a one-liner in Node.

Now add a new file called validateBatchTable which takes the batch table JSON and batch table binary. In here the first step will be to validate the JSON against the schema. I think the best idea for getting the schema is getting it directly from the github url where it is hosted. For this you can use Cesium's loadJson function. Once you have the schema, use a node library to validate the batch table JSON against the schema JSON. I believe a good library for this is https://www.npmjs.com/package/ajv.

The batch table schema is located here: https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/schema/batchTable.schema.json

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

No branches or pull requests

1 participant