Skip to content

Expose public Go APIs for model test functionality #719

Description

@ErlingWis

description

The CLI currently implements functionality that is useful outside a command-line process, but the reusable pieces live under internal and are not consumable by external Go applications.

We would like to programmatically use the equivalent of fga model test, given an in-memory struct matching the documented .fga.yaml test file format, execute the tests and return structured results/summary.

example

func main() {

	result, err := modeltest.Run(ctx, modeltest.StoreData{
		Model: "...",
		Tuples: []client.ClientContextualTupleKey{...},
		Tests: []modeltest.ModelTest{...},
	}, modeltest.WithMaxTypesPerAuthorizationModel(100))

  	if result.Summary.Passing {
		// ...
  	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Intake

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions