Giter Site home page Giter Site logo

plong-wasin / json-schema-to-php-docstring Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 10 KB

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.

Home Page: https://plong-wasin.github.io/json-schema-to-php-docstring/

License: MIT License

HTML 20.61% JavaScript 79.39%
documentation json-schema php php-docblock docstring php-document php-documentation phpstan

json-schema-to-php-docstring's Introduction

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 (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.

  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:

{
    "$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,
}

License

This project is licensed under the MIT License. Feel free to use, modify, and distribute it according to the terms of the license.

json-schema-to-php-docstring's People

Contributors

plong-wasin avatar

Watchers

 avatar

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.