feat: add workflow to validate OpenAPI schemas in reference/rest-api.json#64
feat: add workflow to validate OpenAPI schemas in reference/rest-api.json#64treyhyde wants to merge 10 commits into
Conversation
…OpenAPI validation
There was a problem hiding this comment.
Pull request overview
Adds automation and guidance to keep the OpenAPI spec (reference/rest-api.json) valid and consistent during changes.
Changes:
- Introduces a GitHub Actions workflow that validates
reference/rest-api.jsonon PRs and pushes tov2. - Adds a Copilot skill document describing a process for syncing form-related schemas from upstream repos.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| .github/workflows/validate-openapi.yml | Adds CI validation for JSON syntax, RAW_BODY checks, external $ref checks, and rdme openapi validate on relevant changes. |
| .github/skills/sync-form-schema/SKILL.md | Adds a documented “skill” workflow for syncing form-related OpenAPI schemas from upstream sources. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
pedrodotavila
left a comment
There was a problem hiding this comment.
Automated review: Good DevOps addition. The validation workflow will catch common OpenAPI spec issues (JSON syntax, RAW_BODY anti-patterns, external $ref paths). All CI checks passed.
| All schemas live inline in `reference/rest-api.json` under `components.schemas`. The ones that | ||
| map to the form model are: | ||
|
|
||
| | OpenAPI Schema | Maps From | |
There was a problem hiding this comment.
This part concerns me. We state that the source of truth is in fulcrum-schema. But then we show this mapping. I am assuming that they are currently in sync. But now we have two different lists to maintain. I can see the LLM ignore a field type that has been deleted or ignoring fulcrum-schema because we already have a mapping here.
I would try just telling the LLM to check fulcrum-schema and describe what it should be looking for.
There was a problem hiding this comment.
this is what we've done here.
| | `fulcrumapp/fulcrum-schema` | `src/data-elements.js` | Complete list of element `type` enum values | | ||
| | `fulcrumapp/fulcrum-schema` | `src/schema.js` | SQL column definitions per element — reveals what fields each type stores | | ||
| | `fulcrumapp/fulcrum-schema` | `test/fixtures/form-v5.json` | Real form fixture — definitive JSON shape for all element types | | ||
| | `fulcrumapp/fulcrum-core` | `src/form.js` | Form-level attributes (geometry_types, script, projects_enabled, etc.) | |
There was a problem hiding this comment.
Is fulcrum-core really the source of truth? We have to keep that in sync with the actual API.
There was a problem hiding this comment.
I honestly have no idea what fulcrum-core does.
Dismissing automated approval per user request.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| All schemas live inline in `reference/rest-api.json` under `components.schemas`. The current | ||
| form model in that file is **not** split into per-element OpenAPI schemas such as | ||
| `FormBaseElement`, `FormTextFieldElement`, or `FormChoiceFieldElement`, and `FormElement` is not | ||
| currently documented there as a `oneOf` discriminated union. Do not update this skill as if that | ||
| refactor has already happened. | ||
|
|
||
| Use the schema names that actually exist in `reference/rest-api.json` today: | ||
|
|
||
| | OpenAPI Schema | Maps From | | ||
| |----------------|-----------| | ||
| | `FormElement` | Primary form element schema. Keep its properties, enums, and required fields aligned with the upstream Fulcrum element model and fixture JSON. | | ||
| | `StatusField` | Status field definition used by the current spec. Keep it aligned with the upstream status field shape. | | ||
| | `StatusFieldChoice` | Status choice objects nested under status fields. Keep choice properties and enums aligned with upstream data. | | ||
|
|
||
| If you find new upstream element-specific attributes in `fulcrum-schema` or `fulcrum-core`, first | ||
| check whether they belong on the existing `FormElement` schema in `reference/rest-api.json`. | ||
| Only document or edit per-element schemas after `reference/rest-api.json` has been explicitly | ||
| refactored to introduce them. |
| When syncing, treat the upstream fixture and element definitions as the source of truth for field | ||
| names, required properties, enum values, and nested object shapes; then map those changes onto the | ||
| actual current OpenAPI schemas listed above. | ||
| | `FormHyperlinkFieldElement` | `HyperlinkField` | | ||
| | `FormCalculatedFieldElement` | `CalculatedField` — expression, display, default_values | | ||
| | `FormRecordLinkFieldElement` | `RecordLinkField` — allow_existing_records, linked_form_id, etc. | | ||
| | `FormAttachmentFieldElement` | `AttachmentField` | | ||
| | `FormCheckboxFieldElement` | `CheckboxField` | | ||
| | `FormDynamicFieldElement` | `DynamicField` | | ||
| | `FormLocationFieldElement` | `LocationField` | | ||
| | `FormButtonFieldElement` | `ButtonField` | | ||
| | `FormSketchFieldElement` | `SketchField` — min_length, max_length | | ||
| | `FormLabelElement` | `Label` | | ||
| | `FormSectionElement` | `Section` — display, nested elements | | ||
| | `FormRepeatableElement` | `Repeatable` — nested elements, title_field_keys, geometry_types | | ||
| | `FormStatusField` | Status field — choices (with color), default_value, enabled, read_only | | ||
| | `FormBody` | `fulcrum-core/src/form.js` — top-level form attributes | | ||
| | `FormRequest` | Wrapper `{ "form": FormBody }` | | ||
| | `FormElementCondition` | Visibility/required condition rule | | ||
| | `FormElementChoice` | Choice option (label, value, color) | | ||
| | `FormClassificationItem` | Hierarchical classification item (recursive) | | ||
| | `FormYesNoOption` | Yes/No option shape | | ||
| | `FormCalculatedDisplay` | Calculated field display style | |
| GET https://raw.githubusercontent.com/fulcrumapp/fulcrum-core/main/src/form.js | ||
| ``` | ||
|
|
||
| Use `fetch_webpage` or `mcp_github_github_get_file_contents` to retrieve these. |
No description provided.