Closed (works as designed)
Project:
Experience Builder
Version:
0.x-dev
Component:
Project management
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
6 Sep 2024 at 18:12 UTC
Updated:
19 Jun 2025 at 15:50 UTC
Jump to comment: Most recent
Comments
Comment #2
traviscarden commentedComment #3
wim leersIMHO functional tests (
BrowserTestBase+ Cypress E2E tests) is sufficient for now — that's sufficient for testing the common paths.The goal for OpenAPI is to help the front and back ends to stay in sync with more ease, not for that to become a goal unto itself.
IOW:
src/Plugin/Validation/Constraint/*will be for.That being said, if you see a low-effort/maintenance, high-impact/reach way to write kernel or unit tests to verify certain edge cases in request/response bodies are caught automatically by OpenAPI, then I'd definitely welcome that :) But that should not be a multi-week/month endeavor IMHO.
Comment #5
traviscarden commentedtl;dr: I agree with everything you said, and I have an "inexpensive" solution I would like to implement that I would consider to satisfy the requirements of this issue.
I agree.
Yes. We're on the same page here.
I have proposed one in the above MR. I actually hadn't planned on looking at this issue at all yet, but working on #3472584: Add missing request body schemas to `openapi.yml` I was having a hard time testing my assumptions about how the specification itself was being interpreted. And the ability to just whip up a quick PHP array and get instant feedback really clarifies things and saves a lot of "throwing things at the wall" and "testing by coincidence". (Turns out even YAML can be written test-first! 😄)
It just took a day. 😛
Re: the MR
The tests are passing, but I notice PHPUnit reports two tests skipped--which I assume are the two that this MR adds. That is doubtless because the tests depend on
league/openapi-psr7-validator, which I assume isn't installed on CI. Ordinarily that would constitute a problem that needs solving, of course, but I'm actually fine with it in this case, since its whole point is to aid in rapid development and the real "regression tests" are in Cypress. Developers can just run them ad hoc in PhpStorm, for example (as I've been doing), when actually modifyingopenapi.ymland ignore them the rest of the time. They could technically get out of sync, but as far as I'm concerned, we can create a follow-up to worry about that later.So I would like to propose the MR above as a rapid development tool that satisfies our minimal requirements and lays a foundation of future iteration if that ever seems valuable. According to your judgment, we can create a follow-up issue and/or a
@todoor a note in theREADMEI added to capture the above issue of the tests not getting run on CI.Comment #6
wim leersOn the right track 👍 … but it's too PHP-heavy. This test coverage must have a very low bar for non-PHP developers. See MR with suggestions.
Comment #7
traviscarden commentedFYI: I'm setting this issue aside for the time being in favor of higher priorities.
Comment #8
wim leersFollowing up on non-draft MRs that have been open for a long time. That led me here. What's next here? Is this still relevant?
Comment #10
wim leersI think #3499703: Make all XB HTTP API routes consistently prefixed, ensure they all have OpenAPI specs, and tests to keep it so — which I added ~1 month after #8 — is sufficient.
It enforces the presence of OpenAPI specs for every route, in a consistent manner. Testing OpenAPI specs in detail is overhead not worth it to this project, because it's meant to accelerate our "internal velocity": it's not a public HTTP API intended to have an perfect OpenAPI spec; the OpenAPI spec is meant to help us develop faster and catch glaring problems early on.