Skip to content
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

[Bug]: Lost data format in schema for array of objects #2272

Open
p-golovin opened this issue Apr 18, 2024 · 1 comment
Open

[Bug]: Lost data format in schema for array of objects #2272

p-golovin opened this issue Apr 18, 2024 · 1 comment
Labels

Comments

@p-golovin
Copy link

Version

4.25.2

Description

Lost data format in schema for array of objects.

Old schema:

          "contestants": {
            "title": "List of contestants",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StatContestant2"
            }

...

      "StatContestant2": {
        "required": [
          "members",
          "name",
          "type",
          "side"
        ],
        "properties": {
          "members": {
            "title": "Teams",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StatMember2"
            }
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "type": {
            "title": "Type of contestant",
            "type": "string",
            "enum": [
              "player",
              "team",
              "pair"
            ]
          },
          "side": {
            "title": "Side of contestant",
            "type": "string",
            "enum": [
              "home",
              "away"
            ]
          },
          "outcome": {
            "title": "Outcome result for contestant in game",
            "type": "string",
            "enum": [
              "lose",
              "win",
              "tie"
            ],
            "nullable": true
          },
          "country": {
            "title": "Country",
            "nullable": true,
            "oneOf": [
              {
                "$ref": "#/components/schemas/Country2"
              }
            ]
          }
        },
        "type": "object"
      },

New schema:

          "contestants": {
            "$ref": "#/components/schemas/StatContestant[]2"
          },

...

      "StatContestant[]2": {
        "type": "object"
      },

Documents are:

    /**
     * List of contestants
     *
     * @var Collection<array-key, StatContestant>
     */
    #[Groups(['game:list'])]
    #[Assert\NotBlank]
    #[ODM\EmbedMany(targetDocument: StatContestant::class)]
    private Collection $contestants;

...

    /**
     * Teams
     *
     * @var Collection<array-key, StatMember>
     */
    #[Groups(['game:list'])]
    #[Assert\NotNull]
    #[ODM\EmbedMany(targetDocument: StatMember::class)]
    private Collection $members;

Additional context

No response

@p-golovin p-golovin added the bug label Apr 18, 2024
@DjordyKoert
Copy link
Collaborator

Looks like a bug introduced with the implementation of PHPStan #2249

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants