-
Notifications
You must be signed in to change notification settings - Fork 33
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
Theme Test blueprint #13
Conversation
That's the problem explored in #6. I'd love to solve it sooner than later.
One option is to merge this PR as it is since it references the "official" community assets that may fluctuate over time. To include the images in this PR, we'll need a new tool like "WXR to zip" that would accept a WXR export, pull all the images assets etc, and package them into something we could ship in a PR.
What do you mean? |
…ma (#23) Solves the Blueprint parsing problem as follows: * JSON Schema is the source of truth for the Blueprint data structure * Model classes are generated from JSON Schema * Input Validation is done against the JSON Schema * Mapping validated input into model instances is indirectly done based on the JSON Schema ## Summary of the approach We use [Janephp](https://github.com/janephp/janephp/) to infer the PHP model class structure from the JSON schema We then use Jane's output to generate PHP code using [Nette PHP generator](https://github.com/nette/php-generator): * Model classes * Interfaces for groups of related classes: `StepDefinitionInterface`, `ResourceDefinitionInterface`. * Interface resolution map for the [JsonMapper library](https://jsonmapper.net/). * PHP docstrings with more accurate types than Jane to guide the mapping process From there, the data pipeline looks as follows: 1. Parse raw JSON 2. Validate it with Opis 3. Map it into PHP models using JsonMapper Or, if you're consuming the PHP API directly: 1. Create Model instances 2. Validate them with Opis ## Remaining work - [ ] Solve merge conflicts ## Rationale Parsing and mapping JSON [in TypeScript is a simple problem, but in PHP it's surprisingly involved](WordPress/blueprints#13 (comment)). This PR combines three previously explored approaches into a single pipeline: * WordPress/blueprints#17 * WordPress/blueprints#19 * WordPress/blueprints#21
…ma (#23) Solves the Blueprint parsing problem as follows: * JSON Schema is the source of truth for the Blueprint data structure * Model classes are generated from JSON Schema * Input Validation is done against the JSON Schema * Mapping validated input into model instances is indirectly done based on the JSON Schema ## Summary of the approach We use [Janephp](https://github.com/janephp/janephp/) to infer the PHP model class structure from the JSON schema We then use Jane's output to generate PHP code using [Nette PHP generator](https://github.com/nette/php-generator): * Model classes * Interfaces for groups of related classes: `StepDefinitionInterface`, `ResourceDefinitionInterface`. * Interface resolution map for the [JsonMapper library](https://jsonmapper.net/). * PHP docstrings with more accurate types than Jane to guide the mapping process From there, the data pipeline looks as follows: 1. Parse raw JSON 2. Validate it with Opis 3. Map it into PHP models using JsonMapper Or, if you're consuming the PHP API directly: 1. Create Model instances 2. Validate them with Opis ## Remaining work - [ ] Solve merge conflicts ## Rationale Parsing and mapping JSON [in TypeScript is a simple problem, but in PHP it's surprisingly involved](WordPress/blueprints#13 (comment)). This PR combines three previously explored approaches into a single pipeline: * WordPress/blueprints#17 * WordPress/blueprints#19 * WordPress/blueprints#21
It uses the a11y test content as well as the content from the theme team.
Would still need to figure out what to do with the images in the content.
And what are the correct steps are now.
The schema, the documentation, and the source code are not yet in synch