nelmio / NelmioApiDocBundle

Generates documentation for your REST API from annotations
MIT License
2.21k stars 828 forks source link

[Question]: Why I cant see in swagger properties from model? #2301

Open scion4581 opened 1 week ago

scion4581 commented 1 week ago

Version

4.27.0

Question

Hi! Cant get this to work so much time. I'm feeling the truth is somewhere nearby Simple example, test controller, and test model. But I cant see properties on the response in swagger, its like it doesnt see attributes on the model property. I must to point NelmioApiDocBundle path where are all my classes with attributes in some way?

Controller Model Swagger

Will be grateful for any help, thx

Additional context

No response

DjordyKoert commented 1 week ago

can you share the generated json

scion4581 commented 1 week ago

@DjordyKoert thx for response

following nelmio dump output

{
    "openapi": "3.0.0",
    "info": {
        "title": "Test App",
        "description": "This is test app api",
        "version": "1.0.0"
    },
    "paths": {
        "/api/test": {
            "post": {
                "tags": [
                    "test"
                ],
                "summary": "Test summary",
                "description": "Test description",
                "operationId": "post_app_test",
                "requestBody": {
                    "description": "User login credentials",
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "test": {
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Test success response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TestModel"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "TestModel": {
                "type": "object"
            }
        }
    }
}

See, at the bottom TestModel is empty, no fields descriptions :(

Even when I'm making syntax errors in #[OA\Problablabla(type: 'string', maxLength: 255)]. There are no errors at all, that's why I am thinking NelmioApiDocBundle doenst even see this class.

What could it be?

DjordyKoert commented 1 week ago

Hmm not sure.

scion4581 commented 1 week ago

Nope, nothing changed...:(