Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/plong-wasin/json-schema-to-php-docstring
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.
https://github.com/plong-wasin/json-schema-to-php-docstring
docstring documentation json-schema php php-docblock php-document php-documentation phpstan
Last synced: 3 months ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/plong-wasin/json-schema-to-php-docstring
- Owner: Plong-Wasin
- License: mit
- Created: 2024-03-14T10:58:36.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-09-19T09:47:01.000Z (3 months ago)
- Last Synced: 2024-10-09T11:21:27.463Z (3 months ago)
- Topics: docstring, documentation, json-schema, php, php-docblock, php-document, php-documentation, phpstan
- Language: JavaScript
- Homepage: https://plong-wasin.github.io/json-schema-to-php-docstring/
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JSON Schema to PHP Array Shapes Docstring Converter
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.
## How to Use
1. **Input JSON Data**: Paste your JSON data into [Quicktype](https://app.quicktype.io?l=schema) (a tool for generating data types and converters from JSON to various programming languages).
2. **Set Language to JSON Schema**: In Quicktype, ensure that you select "JSON Schema" as the output language.
3. **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.
4. **Copy JSON Schema**: Copy the generated JSON Schema from Quicktype.
5. **Access the Converter**: Visit [website](https://plong-wasin.github.io/json-schema-to-php-docstring/).
6. **Paste JSON Schema**: Paste the copied JSON Schema into the designated area on the website.
7. **Convert**: Click on the "Convert" button to initiate the conversion process.
8. **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.
## Example
Here's a simple example to illustrate the process:
```json
{
"$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:
```text
array{
name: string,
age?: int,
}
```## License
This project is licensed under the [MIT License](LICENSE). Feel free to use, modify, and distribute it according to the terms of the license.