Skip to content
Snippets Groups Projects

Combine step and definition structures

Merged Joe Burnett requested to merge jburnett/combine-step-and-definition-3 into main
All threads resolved!

This change combines the Step and StepDefinition structures.

In order to combine these structures, we also needed to generate the Go types from the JSON Schema (instead of the other way around). The schema generation library we were using couldn't hand recursion. And the schema is a better single source-of-truth anyway, so we want to write that by hand.

The first commit creates the new schema from scratch in the schema/v0 folder. The second commit replaces schema/v1 with v0 so you can see how they relate to each other. You can review it commit-wise for all together, whatever is the most clear for you.

Note this replaces the schema without breaking changes. So all existing tests pass. However it also allows us to expand easily into a few additional valid usecases. See the issue for details.

Fixes #103 (closed)

Edited by Joe Burnett

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Cameron Swords
  • Cameron Swords
  • Cameron Swords
  • Cameron Swords
  • The file schema/v1/constants.go is as follows:

    package schema
    
    const (
    	yamlStringTag = "!!str"
    	yamlMapTag    = "!!map"
    	delegate      = "delegate"
    	scriptStep    = "https://gitlab.com/components/script@main"
    	actionStep    = "https://gitlab.com/components/action-runner@main"
    )

    yamlStringTag, yamlMapTag, and delegate are no longer used. scriptStep and actionStep are only used in one place, I'd recommend inlining them and removing constants.go.

  • Cameron Swords
    • Resolved by Cameron Swords

      @josephburnett, there's so much change here that I can't be sure if this is a breaking change or not. I'm not too worried though, Steps is barely experimental. It would have been easier for me to review this MR if it were split into multiple MRs, one to change how the JSON files are created, another to make the changes you want to the schema. All good, and maybe that's what you intended with the different commits anyway.

      Breaking changes aside, I think the changes to the JSON spec are too permissive. That is, it allows too many invalid definitions. Could you please clarify exactly what use-cases you're trying to support? :pray:

  • Cameron Swords requested changes

    requested changes

  • Joe Burnett added 14 commits

    added 14 commits

    Compare with previous version

  • Cameron Swords requested changes

    requested changes

  • Joe Burnett added 2 commits

    added 2 commits

    • 0928afaf - Remove schema generation
    • 1b1c75cb - Test reference serialization at the step level

    Compare with previous version

  • Joe Burnett requested review from @cam_swords

    requested review from @cam_swords

  • Joe Burnett enabled an automatic merge when all merge checks for 1b1c75cb pass

    enabled an automatic merge when all merge checks for 1b1c75cb pass

  • Looks good, thanks @josephburnett :man_dancing:

  • Cameron Swords approved this merge request

    approved this merge request

  • Joe Burnett resolved all threads

    resolved all threads

  • merged

  • Joe Burnett mentioned in commit 87bc52df

    mentioned in commit 87bc52df

  • Joe Burnett mentioned in merge request !119 (merged)

    mentioned in merge request !119 (merged)

  • Please register or sign in to reply
    Loading