Why is the [#OASchema] attribute not working as in one of examples?

Refreshing the documentation page and getting

User Warning: $ref "#/components/schemas/OrderProduct1N" not found for @OAProperty(property="products") in

ErrorException
Show exception properties
ErrorException {#28457 ▼
  #severity: E_USER_WARNING
}
in vendor/zircote/swagger-php/src/Loggers/DefaultLogger.php (line 31)
in vendor/psr/log/src/LoggerTrait.php -> log (line 61)
in vendor/zircote/swagger-php/src/Annotations/AbstractAnnotation.php -> warning (line 511)
in vendor/zircote/swagger-php/src/Annotations/Schema.php -> validate (line 517)
in vendor/zircote/swagger-php/src/Annotations/AbstractAnnotation.php -> validate (line 592)
in vendor/zircote/swagger-php/src/Annotations/AbstractAnnotation.php :: _validate (line 598)
in vendor/zircote/swagger-php/src/Annotations/AbstractAnnotation.php :: _validate (line 565)
in vendor/zircote/swagger-php/src/Annotations/Schema.php -> validate (line 517)
in vendor/zircote/swagger-php/src/Annotations/AbstractAnnotation.php -> validate (line 592)
in vendor/zircote/swagger-php/src/Annotations/AbstractAnnotation.php :: _validate (line 598)
in vendor/zircote/swagger-php/src/Annotations/AbstractAnnotation.php :: _validate (line 565)
in vendor/zircote/swagger-php/src/Annotations/AbstractAnnotation.php -> validate (line 592)
in vendor/zircote/swagger-php/src/Annotations/AbstractAnnotation.php :: _validate (line 565)
in vendor/zircote/swagger-php/src/Annotations/OpenApi.php -> validate (line 170)
in vendor/zircote/swagger-php/src/Analysis.php -> validate (line 440)
in vendor/nelmio/api-doc-bundle/src/ApiDocGenerator.php -> validate (line 134)
in vendor/nelmio/api-doc-bundle/src/Render/RenderOpenApi.php -> generate (line 85)
in vendor/nelmio/api-doc-bundle/src/Render/RenderOpenApi.php -> render (line 68)
in vendor/nelmio/api-doc-bundle/src/Controller/SwaggerUiController.php -> renderFromRequest (line 36)
in vendor/symfony/http-kernel/HttpKernel.php -> __invoke (line 183)
in vendor/symfony/http-kernel/HttpKernel.php -> handleRaw (line 76)
in vendor/symfony/http-kernel/Kernel.php -> handle (line 182)
in vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php -> handle (line 35)
in vendor/autoload_runtime.php -> run (line 29)
require_once('/var/www/pmp-api/vendor/autoload_runtime.php')
in public/index.php (line 5)
<?phpuse AppKernel;require_once dirname(__DIR__).'/vendor/autoload_runtime.php';return function (array $context) {    return new Kernel($context['APP_ENV'] ?? 'dev', (bool) $context['APP_DEBUG']);};
#[OASchema(
    schema: "OrderProduct1N",
)]

How to understand this attribute? https://zircote.github.io/swagger-php/guide/common-techniques.html#enum-schemas here for example it should work if it is in documentation. So only that my object is in different namespace. But does that have something to do with it?

It is symfony 7, php 8.3.

Controller method:

#[Route(
    path: '/{version}/sellers/{sellerId}/test',
    requirements: ['version' => '%supported_versions%'],
    methods: ['GET']
)]
#[OAResponse(
    response: 200,
    description: 'Successful',
    content: new OAJsonContent(
        ref: new Model(
            type: SellerOrdersList1::class,
        ),

    )
)]
#[OATag(name: 'Orders')]
#[OAGet(summary: 'Get orders belonging to a seller')]
#[Areas(['public'])]
public function test()
{
    return $this->json('ok');
}

Models:

<?php

declare(strict_types=1);

namespace AppModelResponseOrder;

use AppEntityOrder1;
use AppOpenApiSchemasSellerOrderListOrder;
use NelmioApiDocBundleAnnotationModel;
use OpenApiAttributes as OA;

class SellerOrdersList1
{
    #[OAProperty(
        type: 'array',
        items: new OAItems(type: 'object', ref: new Model(type: Order1::class)),
    )]
    protected array $orders;

    /**
     * @return Order[]
     */
    public function getOrders(): array
    {
        return $this->orders;
    }

    /**
     * @param Order[] $orders
     */
    public function setOrders(array $orders): void
    {
        $this->orders = $orders;
    }
}

<?php

namespace AppEntity;

use AppOpenApiSchemasSellerOrderListOrderProduct1N;
use DoctrineCommonCollectionsCollection;
use NelmioApiDocBundleAnnotationModel;
use OpenApiAttributes as OA;


class Order1 implements ClaimEntityInterface
{
    #[OAProperty(
        type: 'array',
        items: new OAItems(ref: new Model(type: OrderProduct1N::class))
    )]
    private Collection $products;
}

<?php

declare(strict_types=1);

namespace AppOpenApiSchemasSellerOrderList;

use OpenApiAttributes as OA;

#[OASchema(
    schema: "OrderProduct1N",
)]
class OrderProduct1N
{
    public string $test;
}

Expecting it to not get error at first.

I see here: NelmioApiDocBundle v4.0.0-BETA1, $ref not found

it is written

In your case, you should use ref=@NelmioApiDocBundleAnnotationModel(type=ProductDTO::class instead of ref=”#/components/schemas/ProductDto.

But I do not understand then why in this https://zircote.github.io/swagger-php/guide/common-techniques.html#enum-schemas example it works assuming it working example.

Update

Making field public gets rid of this error.

#[OAProperty(
    type: 'array',
    items: new OAItems(ref: new Model(type: OrderProduct1N::class))
)]
public Collection $products;

But then it does not matter if schema is existing or not over in this model:

#[OASchema(
    schema: "OrderProduct1N",
)]
class OrderProduct1N
{
    public string $test;
}

so then what this for? I see in another example it is being used without schema key.

#[OASchema(

it just has properties field:

#[OASchema(
properties: [
    new OAProperty(
        property: 'limit',
        type: 'integer',
        example: 40
    )        
]
)]
class PaginationMeta
{
}

In that place it shows documentation for properties like ‘limit’ even when as we can see PaginationMeta has no properties. So if needing this it can be useful – to declare properties for ducumenation which are not on the class. But then what is schema field in schema attribute for? Renaming? Tried using by schema field – getting errors. Like

#[OAProperty(
    type: 'array',
    items: new OAItems(ref: new Model(type: '#/components/schemas/OrderProduct1N'))
)]
public Collection $products;

Schema of type “#/components/schemas/OrderProduct1N” can’t be
generated, no describer supports it. Class
“#/components/schemas/OrderProduct1N” does not exist, did you forget
a use statement, or typed it wrong?

LogicException:
Schema of type "#/components/schemas/OrderProduct1N" can't be generated, no describer supports it. Class "#/components/schemas/OrderProduct1N" does not exist, did you forget a use statement, or typed it wrong?

  at vendor/nelmio/api-doc-bundle/src/Model/ModelRegistry.php:126
  at NelmioApiDocBundleModelModelRegistry->registerSchemas()
     (vendor/nelmio/api-doc-bundle/src/ApiDocGenerator.php:131)
  at NelmioApiDocBundleApiDocGenerator->generate()
     (vendor/nelmio/api-doc-bundle/src/Render/RenderOpenApi.php:85)
  at NelmioApiDocBundleRenderRenderOpenApi->render('html', 'public', array('ui_renderer' => 'swaggerui'))
     (vendor/nelmio/api-doc-bundle/src/Render/RenderOpenApi.php:68)
  at NelmioApiDocBundleRenderRenderOpenApi->renderFromRequest(object(Request), 'html', 'public', array('ui_renderer' => 'swaggerui'))
     (vendor/nelmio/api-doc-bundle/src/Controller/SwaggerUiController.php:36)
  at NelmioApiDocBundleControllerSwaggerUiController->__invoke(object(Request), 'public')
     (vendor/symfony/http-kernel/HttpKernel.php:183)
  at SymfonyComponentHttpKernelHttpKernel->handleRaw(object(Request), 1)
     (vendor/symfony/http-kernel/HttpKernel.php:76)
  at SymfonyComponentHttpKernelHttpKernel->handle(object(Request), 1, true)
     (vendor/symfony/http-kernel/Kernel.php:182)
  at SymfonyComponentHttpKernelKernel->handle(object(Request))
     (vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php:35)
  at SymfonyComponentRuntimeRunnerSymfonyHttpKernelRunner->run()
     (vendor/autoload_runtime.php:29)
  at require_once('/var/www/pmp-api/vendor/autoload_runtime.php')
     (public/index.php:5)                

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật