Skip to content

feat: add workflow to validate OpenAPI schemas in reference/rest-api.json#64

Open
treyhyde wants to merge 10 commits into
v2from
debt/readme-action
Open

feat: add workflow to validate OpenAPI schemas in reference/rest-api.json#64
treyhyde wants to merge 10 commits into
v2from
debt/readme-action

Conversation

@treyhyde

@treyhyde treyhyde commented May 8, 2026

Copy link
Copy Markdown
Member

No description provided.

@treyhyde treyhyde changed the base branch from main to v2 May 8, 2026 17:49
@treyhyde treyhyde requested review from a team as code owners May 8, 2026 17:49
Copilot AI review requested due to automatic review settings May 8, 2026 19:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.json on PRs and pushes to v2.
  • 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.

Comment thread .github/skills/sync-form-schema/SKILL.md Outdated
Comment thread .github/skills/sync-form-schema/SKILL.md Outdated
pedrodotavila
pedrodotavila previously approved these changes May 8, 2026

@pedrodotavila pedrodotavila left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.) |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is fulcrum-core really the source of truth? We have to keep that in sync with the actual API.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly have no idea what fulcrum-core does.

@pedrodotavila pedrodotavila dismissed their stale review May 8, 2026 20:42

Dismissing automated approval per user request.

Copilot AI review requested due to automatic review settings June 5, 2026 23:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

Comment thread .github/workflows/validate-openapi.yml
Comment thread .github/workflows/validate-openapi.yml
Comment thread .github/skills/sync-form-schema/SKILL.md Outdated
Comment thread .github/skills/sync-form-schema/SKILL.md Outdated
Comment thread .github/skills/sync-form-schema/SKILL.md
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 16, 2026 15:17
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
treyhyde and others added 4 commits June 16, 2026 08:18
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

Comment on lines +29 to +46
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.
Comment on lines +48 to +70
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants