Skip to content

Validator ergonomics for consumer repos: validate CLI exits 0 on stub, validate.py takes one file, default schema path assumes repo layout #266

Open

Description

@cskwork

Summary

Three small friction points that show up when you consume the spec from your own repository — vendoring core-spec/osi-schema.json and validation/validate.py into a repo that holds domain models — rather than working inside apache/ossie itself.

All three are on main as of today.

1. ossie validate exits 0 while printing not yet implemented

cli/cmd/validate.go:

var validateCmd = &cobra.Command{
	Use:   "validate [flags] <path> [<path>...]",
	Short: "Validate one or more OSSIE YAML or JSON files",
	Args:  cobra.MinimumNArgs(1),
	RunE:  runValidate,
}

func runValidate(cmd *cobra.Command, args []string) error {
	fmt.Fprintln(cmd.OutOrStdout(), "not yet implemented")
	return nil
}

ossie validate broken-model.yaml prints one line and exits 0. Dropped into a CI step, that is indistinguishable from a pass — the one failure mode worth avoiding in a validation command. The help text also advertises [<path>...], --strict and --output, none of which do anything yet.

Suggestion: return a non-zero error (or mark the command hidden / Deprecated) until it is wired up.

2. validation/validate.py accepts exactly one file

if len(args) > 1:
    if len(args) == 3 and args[1] == "--schema":
        schema_path = Path(args[2])
    else:
        print("Usage: python validation/validate.py <yaml_file> [--schema <schema_file>]")
        sys.exit(1)

So validate.py models/**/*.yaml fails with a usage error rather than validating the set. Any repo with more than one model ends up wrapping it in a shell loop, which loses the aggregate summary and makes "did everything pass?" a matter of collecting exit codes by hand.

Suggestion: accept N paths, validate each, print a per-file PASS/FAIL, and exit non-zero if any file failed.

3. The default schema path assumes the upstream repo layout

schema_path = Path(__file__).parent.parent / "core-spec" / "osi-schema.json"

Vendored as scripts/validate.py in a consumer repo, that resolves to <repo>/core-spec/osi-schema.json — a directory the user never created. --schema solves it, but the first-run error (Error: Schema not found: …/core-spec/osi-schema.json) points at a path nobody chose, which is a confusing place to start.

Suggestion: keep the current default, then fall back to ./schema/osi-schema.json and/or an OSSIE_SCHEMA environment variable before erroring — and mention --schema in the error message.

Context

I hit these while putting together a scaffold for consumer repositories. The workaround is a Makefile that loops per file and always passes --schema, which works fine but is the sort of thing every consumer will end up reinventing.

Happy to send a PR for any or all of these if the direction sounds right — please say which of the three you'd take, and whether the Go CLI is expected to absorb the Python validator's job eventually (that would change what's worth fixing in validate.py).

Activity

  1. kayemkim commented on Sep 14, 2026

    @kayemkim
    Contributor

    I opened #390 for the first item: the four unimplemented commands (validate, convert, plugin install, plugin remove) now return an error and exit 1 instead of printing not yet implemented and exiting 0. It is the same thing #345 lists in its closing note.

    The two validate.py points (several files per run, schema path fallback) are separate. cskwork, you offered a PR for these in July and that still seems the natural path; if it is no longer on your plate I can follow up, though #271 and #373 both touch main() there right now so it may be worth waiting for those.

  2. ihadoop commented on Oct 10, 2026

    @ihadoop
    Contributor

    All three items appear landed on current main (642cb89) — re-checked each, so noting it for triage:

    1. ossie validate exiting 0 on a stub — closed by #390. cli/cmd/validate.go is now return fmt.Errorf("%s is not yet implemented", cmd.CommandPath()), so the command exits non-zero instead of printing a line and passing. convert and the two plugin mutators took the same treatment.

    2. one file per run — closed by #545. Verified:

    $ python validation/validate.py model_a.yaml model_b.yaml
    == from_gooddata.yaml
    Validation PASSED: from_gooddata.yaml
    
    2 of 2 file(s) passed
    

    The aggregate summary the issue asked for is there, so a consumer repo no longer needs the Makefile loop that collects exit codes by hand.

    3. default schema path assuming the upstream layout — closed by #545. resolve_schema_path() prefers OSSIE_SCHEMA when set, and the not-found diagnostic now ends with Pass --schema <schema_file> or set OSSIE_SCHEMA to point at ossie-schema.json. — which is the --schema hint the issue suggested, instead of pointing at a path nobody chose. The module docstring documents the vendored case too.

    One thing I cannot answer from the code, because it is the design question the issue raises at the end: whether the Go CLI is expected to absorb this validator's job eventually. If it is, item 2 and 3 may be worth less than they look; if not, this issue can probably be closed. cc @kayemkim @cskwork since the September thread here was about who would take it.

    Not my call to close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions