schema-generator icon indicating copy to clipboard operation
schema-generator copied to clipboard

Enum Class Generation for schema.org/OrderStatus not working

Open stiivo opened this issue 2 years ago • 2 comments

API Platform version(s) affected: 3.0.8 Generator: 5.2.0

Description

Enum generation not working for schema.org/OrderStatus Instead OrderStatus becomes a normal Entity

How to reproduce

types:
  Thing:
    properties:
      gender: { range: "https://schema.org/GenderType" }
      orderStatus: { range: "https://schema.org/OrderStatus" }
  GenderType:
    properties:
      gender: [ ]
  OrderStatus:
    properties:
      orderStatus: [ ]

$ php vendor/bin/schema generate config/schema.yaml

stiivo avatar Jan 02 '23 14:01 stiivo

Probably because OrderStatus is not a direct subclass of Enumeration. The corresponding code is here, do you want to try to fix it? https://github.com/api-platform/schema-generator/blob/8b66b379ff1166c98824ff72237cbebd6c2c0256/src/Schema/Model/Class_.php#L69-L74

alanpoulain avatar Jan 02 '23 14:01 alanpoulain

Hi alan,

thanks for the very fast reply.

I m going to check if there are any other enumeration classes besides Enumeration and StatusEnumeration and submit a pull request when done.

thanks

stiivo avatar Jan 02 '23 15:01 stiivo