Skip to content

Conversation

@mnocon
Copy link
Contributor

@mnocon mnocon commented Dec 16, 2025

JIRA: https://ibexa.atlassian.net/browse/IBX-10396

Current issue: request examples are not part of the REST reference, only the schema is there.

See https://doc.ibexa.co/en/5.0/api/rest_api/rest_api_reference/rest_api_reference.html#tag/Discounts/operation/api_discounts_post for an example - the schema is not that helpful when preparing a request that's more complex.

Disclaimer: I've used Copilot when writing this, especially the tests, but I've reviewed the code manually, and verified locally that it works. The tests are probably too verbose, but I'll leave the decision what to do with them up to you.

Results:

openapi_after.yaml
openapi_before.yaml

In built-in Swagger:
Screenshot 2025-12-16 at 21 12 07

Screenshot 2025-12-16 at 21 03 58 Screenshot 2025-12-16 at 21 04 28 Screenshot 2025-12-16 at 21 04 47 Screenshot 2025-12-16 at 21 05 00

It also works with the buit-in Swagger doc, for both XML and JSON requests.

@mnocon mnocon changed the title IBX-10396: FffAdded support for x-ibexa-example-file in request files IBX-10396: Added support for x-ibexa-example-file in request files Dec 16, 2025
@mnocon mnocon marked this pull request as ready for review December 16, 2025 20:06
@mnocon mnocon requested a review from a team December 17, 2025 08:37
mnocon and others added 2 commits January 20, 2026 14:56
@mnocon
Copy link
Contributor Author

mnocon commented Jan 20, 2026

@konradoboza I've applied your suggestions in 12a1118

In 0de53ef I'm adding improved error handling, because trying to run the OpenAPI generator failed.

The result was:

~/Desktop/Sites/v5 main +3 !200 ?29 ❯ rm -rf var/cache && php bin/console ibexa:openapi --yaml --output=test_new.yaml -v                                                                        14s  24.4.0 15:29:34

In OpenApiFactory.php line 228:

  [RuntimeException]
  Failed to parse JSON example file: /Users/marek/Desktop/Sites/v5/vendor/ibexa/collaboration/src/bundle/Resources/api_platform/examples/collaboration/POST/InvitationCreate.json.example

Hence a new PR was created: https://github.com/ibexa/collaboration/pull/105

The API file generated with the current version of the code is here:
https://gist.github.com/mnocon/7117aaf0b4d6f01047f492b40d41463b

and I need to look at PHPStan, doing it right now - done in 089715b

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
38.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@mnocon mnocon requested a review from konradoboza January 20, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants