Skip to content

feat: add rake task to generate schema without server#260

Open
matthv wants to merge 4 commits intomainfrom
feat/cmd-generate-schema
Open

feat: add rake task to generate schema without server#260
matthv wants to merge 4 commits intomainfrom
feat/cmd-generate-schema

Conversation

@matthv
Copy link
Member

@matthv matthv commented Feb 6, 2026

Definition of Done

  • Add rails forest_admin:schema:generate rake task that generates .forestadmin-schema.json without starting the Rails server or sending the schema to the Forest Admin API

Usage

# Generate schema at the default path (.forestadmin-schema.json)
rails forest_admin:schema:generate

# Show stack trace on error
rails forest_admin:schema:generate debug=true

 ### CI example

```bash
rails forest_admin:schema:generate
git diff --exit-code .forestadmin-schema.json

@matthv matthv force-pushed the feat/cmd-generate-schema branch from f60a9da to 097bd8e Compare February 6, 2026 11:23
task generate: :environment do
require 'forest_admin_agent'

output_path = ENV.fetch('output', nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we leave the default path of the agent setup? why define a new prop for this ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, I initially added this to allow generating the schema elsewhere and comparing it with the existing one, but a simple git diff after generation does the same job. I'll remove it.

matthv and others added 3 commits February 6, 2026 16:48
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.

2 participants