Convert JSON Schema to PHP Array Shapes Docstring simplifies the process of generating PHP documentation from JSON Schema, streamlining development workflows and enhancing code maintainability.
MIT License
This project provides a simple tool to convert JSON Schema into PHP array shapes docstring. It helps developers easily generate PHP documentation for their JSON Schema.
Input JSON Data: Paste your JSON data into Quicktype (a tool for generating data types and converters from JSON to various programming languages).
Set Language to JSON Schema: In Quicktype, ensure that you select "JSON Schema" as the output language.
Adjust Settings: In the "Other" tab of Quicktype, ensure that all options are checked. This ensures the most comprehensive conversion. If you encounter a "RangeError: Maximum call stack size exceeded" error after clicking "Convert" on converter website, go back to Quicktype and uncheck "Merge similar classes" in the "Other" tab.
Copy JSON Schema: Copy the generated JSON Schema from Quicktype.
Access the Converter: Visit website.
Paste JSON Schema: Paste the copied JSON Schema into the designated area on the website.
Convert: Click on the "Convert" button to initiate the conversion process.
Result: The converted PHP array shapes docstring will be displayed on the website. You can copy this docstring and use it in your PHP documentation.
Here's a simple example to illustrate the process:
{
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "array",
"items": {
"$ref": "#/definitions/RootElement"
},
"definitions": {
"RootElement": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"age": {
"type": "integer"
}
},
"required": [
"name"
],
"title": "RootElement"
}
}
}
This JSON Schema will be converted into the following PHP array shapes docstring:
array{
name: string,
age?: int,
}
This project is licensed under the MIT License. Feel free to use, modify, and distribute it according to the terms of the license.