Skip to content

Commit

Permalink
Merge pull request #1320 from Permify/feature/add-run-with-shape
Browse files Browse the repository at this point in the history
feat: feature/add run with shape
  • Loading branch information
tolgaOzen authored Jun 28, 2024
2 parents 2f1c8e5 + 82e7884 commit 277c225
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/api-reference/apidocs.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"info": {
"title": "Permify API",
"description": "Permify is an open source authorization service for creating fine-grained and scalable authorization systems.",
"version": "v0.9.4",
"version": "v0.9.5",
"contact": {
"name": "API Support",
"url": "https://github.com/Permify/permify/issues",
Expand Down
2 changes: 1 addition & 1 deletion internal/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var Identifier = ""
*/
const (
// Version is the last release of the Permify (e.g. v0.1.0)
Version = "v0.9.4"
Version = "v0.9.5"
)

// Function to create a single line of the ASCII art with centered content and color
Expand Down
14 changes: 9 additions & 5 deletions pkg/development/development.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,12 @@ func (c *Development) Run(ctx context.Context, shape map[string]interface{}) (er
return
}

return c.RunWithShape(ctx, s)
}

func (c *Development) RunWithShape(ctx context.Context, shape *file.Shape) (errors []Error) {
// Parse the schema using the parser library
sch, err := parser.NewParser(s.Schema).Parse()
sch, err := parser.NewParser(shape.Schema).Parse()
if err != nil {
errors = append(errors, Error{
Type: "schema",
Expand Down Expand Up @@ -185,7 +189,7 @@ func (c *Development) Run(ctx context.Context, shape map[string]interface{}) (er
}

// Each item in the Relationships slice is processed individually
for _, t := range s.Relationships {
for _, t := range shape.Relationships {
tup, err := tuple.Tuple(t)
if err != nil {
errors = append(errors, Error{
Expand Down Expand Up @@ -232,7 +236,7 @@ func (c *Development) Run(ctx context.Context, shape map[string]interface{}) (er
}

// Each item in the Attributes slice is processed individually
for _, a := range s.Attributes {
for _, a := range shape.Attributes {
attr, err := attribute.Attribute(a)
if err != nil {
errors = append(errors, Error{
Expand Down Expand Up @@ -279,7 +283,7 @@ func (c *Development) Run(ctx context.Context, shape map[string]interface{}) (er
}

// Each item in the Scenarios slice is processed individually
for i, scenario := range s.Scenarios {
for i, scenario := range shape.Scenarios {

// Each Check in the current scenario is processed
for _, check := range scenario.Checks {
Expand Down Expand Up @@ -341,7 +345,7 @@ func (c *Development) Run(ctx context.Context, shape map[string]interface{}) (er
})
if err != nil {
errors = append(errors, Error{
Type: "checks",
Type: "scenarios",
Key: i,
Message: err.Error(),
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/pb/base/v1/openapi.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion proto/base/v1/openapi.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
info: {
title: "Permify API";
description: "Permify is an open source authorization service for creating fine-grained and scalable authorization systems.";
version: "v0.9.4";
version: "v0.9.5";
contact: {
name: "API Support";
url: "https://github.com/Permify/permify/issues";
Expand Down

0 comments on commit 277c225

Please sign in to comment.