AlexanderAllen / panettone

A lightweight PHP type generator for Open API (formerly Swagger)
GNU General Public License v3.0
1 stars 0 forks source link

Support for additional Open API features (deferred) #21

Open AlexanderAllen opened 3 months ago

AlexanderAllen commented 3 months ago

This issue is an epic. If I decide to ship anything mentioned here, I will cut such feature into it's own separate ticket.

The features listed here are supported by the Open API spec, but are currently not implemented, nor I necessarily deem them urgent for my personal use cases.

Therefore I'm capturing these features in this ticket for future reference.

Not supporting

AlexanderAllen commented 3 months ago

Moving some inline comments from the test to here for future reference, and to clamp down on the test file size.

    // ADV_ALLOF_EDGECASE
    // TooManyRequests:
    // allOf:
    //   - $ref: '#/components/schemas/Error'
    //   - $ref: '#/components/schemas/Error'
    //   - type: object
    //     properties:
    //       spam_warning_urn:
    //         type: string
    //       some_other_ref:
    //         $ref: '#/components/schemas/Error'

    /**
     * Test for schema with a Type of "allOf".
     *
     * # This ...
     * TooManyRequests:
     *   allOf:
     *     - $ref: '#/components/schemas/Error'
     *     - type: object
     *       properties:
     *         spam_warning_urn:
     *           type: string
     *
     * # Should translate to this ...
     *   Class TooManyRequests
     *     public readonly ?Error $error = null
     *     public ?string $spam_warning_urn = null
     *
     * Notes:
     *   - cebe interprets the first $ref as an object, complete with inline properties ready for use
     *     when using `RESOLVE_MODE_ALL`. Adding these props straight away would result in inlined props
     *     and therefore duplicate props between types!
     *   - Both the first $ref Schema item and the second 'anonymous' Schema item have a cebe
     *     Schema type of `object`. Keep an eye on the conditions on the prop generator
     *     to prevent these getting mixed up.
     *
     * @TODO Test more complex edge cases w/ multiple and nested references. See ADV_ALLOF_EDGECASE above.
     *
     * @see https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/
     */