Skip to content

Commit

Permalink
Add missing Google.Rpc types (#26)
Browse files Browse the repository at this point in the history
* use v2 of buf config template. generate google.rpc types that were missing.

* regenerating types made essentially whitespace changes. I am not attached to these, just committing them since they were automatic.

* update the buf CI action to support buf v2 configs

* only run buf-action setup, not all its default stuff. also check google rpc generated code.

* Ignore google rpc generated folder

* bump version to 1.0.1
  • Loading branch information
mattpolzin authored Aug 20, 2024
1 parent 069127f commit db8ebc6
Show file tree
Hide file tree
Showing 20 changed files with 475 additions and 120 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,16 @@ jobs:
run: |
mix escript.install hex protobuf --force
echo "/home/runner/.mix/escripts" >> $GITHUB_PATH
- uses: "bufbuild/[email protected]"
- uses: "bufbuild/buf-action@v1"
with:
setup_only: true
- name: "Generate & Diff Protos"
run: |
echo "/home/runner/.mix/escripts" >> $GITHUB_PATH
./buf.gen.yaml
mix format authzed/**/*.ex
mix format google/rpc/**/*.ex
bash -c '[[ $(diff -qr authzed/api lib/api | grep "Only in authzed") -eq 0 ]]'
bash -c '[[ $(diff -qr google/rpc lib/google/rpc | grep "Only in google") -eq 0 ]]'
mix format
rm -rf authzed
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ authzed_ex-*.tar

# Ignore buf generated schema
authzed/*
google/*
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ generate:
@echo "Generation successful"
@echo "Copying files to authzed/api folder..."
cp -r authzed/api/* lib/api/
@echo "Copying files to google/rpc folder..."
@mkdir -p lib/google
cp -r google/rpc lib/google/
@echo "Files moved successfully"
@echo "Removing generated files.."
rm -rf authzed
Expand Down
10 changes: 7 additions & 3 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#!/usr/bin/env -S buf generate buf.build/authzed/api:v1.33.0 --template
#!/usr/bin/env -S buf generate --template
---
version: "v1"
version: "v2"
plugins:
- name: "elixir"
- local: "protoc-gen-elixir"
out: "."
opt:
- plugins=grpc
inputs:
- module: "buf.build/authzed/api:v1.33.0 "
- module: "buf.build/googleapis/googleapis"

8 changes: 4 additions & 4 deletions lib/api/v0/core.pb.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Authzed.Api.V0.RelationTuple do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:object_and_relation, 1,
type: Authzed.Api.V0.ObjectAndRelation,
Expand All @@ -15,7 +15,7 @@ end
defmodule Authzed.Api.V0.ObjectAndRelation do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:namespace, 1, type: :string, deprecated: false)
field(:object_id, 2, type: :string, json_name: "objectId", deprecated: false)
Expand All @@ -25,7 +25,7 @@ end
defmodule Authzed.Api.V0.RelationReference do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:namespace, 1, type: :string, deprecated: false)
field(:relation, 3, type: :string, deprecated: false)
Expand All @@ -34,7 +34,7 @@ end
defmodule Authzed.Api.V0.User do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

oneof(:user_oneof, 0)

Expand Down
36 changes: 18 additions & 18 deletions lib/api/v0/developer.pb.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Authzed.Api.V0.LookupShareResponse.LookupStatus do
@moduledoc false

use Protobuf, enum: true, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, enum: true, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:UNKNOWN_REFERENCE, 0)
field(:FAILED_TO_LOOKUP, 1)
Expand All @@ -12,7 +12,7 @@ end
defmodule Authzed.Api.V0.DeveloperError.Source do
@moduledoc false

use Protobuf, enum: true, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, enum: true, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:UNKNOWN_SOURCE, 0)
field(:SCHEMA, 1)
Expand All @@ -25,7 +25,7 @@ end
defmodule Authzed.Api.V0.DeveloperError.ErrorKind do
@moduledoc false

use Protobuf, enum: true, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, enum: true, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:UNKNOWN_KIND, 0)
field(:PARSE_ERROR, 1)
Expand All @@ -42,15 +42,15 @@ end
defmodule Authzed.Api.V0.FormatSchemaRequest do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:schema, 1, type: :string)
end

defmodule Authzed.Api.V0.FormatSchemaResponse do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:error, 1, type: Authzed.Api.V0.DeveloperError)
field(:formatted_schema, 2, type: :string, json_name: "formattedSchema")
Expand All @@ -59,15 +59,15 @@ end
defmodule Authzed.Api.V0.UpgradeSchemaRequest do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:namespace_configs, 1, repeated: true, type: :string, json_name: "namespaceConfigs")
end

defmodule Authzed.Api.V0.UpgradeSchemaResponse do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:error, 1, type: Authzed.Api.V0.DeveloperError)
field(:upgraded_schema, 2, type: :string, json_name: "upgradedSchema")
Expand All @@ -76,7 +76,7 @@ end
defmodule Authzed.Api.V0.ShareRequest do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:schema, 1, type: :string)
field(:relationships_yaml, 2, type: :string, json_name: "relationshipsYaml")
Expand All @@ -87,23 +87,23 @@ end
defmodule Authzed.Api.V0.ShareResponse do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:share_reference, 1, type: :string, json_name: "shareReference")
end

defmodule Authzed.Api.V0.LookupShareRequest do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:share_reference, 1, type: :string, json_name: "shareReference")
end

defmodule Authzed.Api.V0.LookupShareResponse do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:status, 1, type: Authzed.Api.V0.LookupShareResponse.LookupStatus, enum: true)
field(:schema, 2, type: :string)
Expand All @@ -115,7 +115,7 @@ end
defmodule Authzed.Api.V0.RequestContext do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:schema, 1, type: :string)
field(:relationships, 2, repeated: true, type: Authzed.Api.V0.RelationTuple)
Expand All @@ -124,7 +124,7 @@ end
defmodule Authzed.Api.V0.EditCheckRequest do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:context, 1, type: Authzed.Api.V0.RequestContext)

Expand All @@ -138,7 +138,7 @@ end
defmodule Authzed.Api.V0.EditCheckResult do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:relationship, 1, type: Authzed.Api.V0.RelationTuple)
field(:is_member, 2, type: :bool, json_name: "isMember")
Expand All @@ -148,7 +148,7 @@ end
defmodule Authzed.Api.V0.EditCheckResponse do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:request_errors, 1,
repeated: true,
Expand All @@ -166,7 +166,7 @@ end
defmodule Authzed.Api.V0.ValidateRequest do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:context, 1, type: Authzed.Api.V0.RequestContext)
field(:validation_yaml, 3, type: :string, json_name: "validationYaml")
Expand All @@ -177,7 +177,7 @@ end
defmodule Authzed.Api.V0.ValidateResponse do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:request_errors, 1,
repeated: true,
Expand All @@ -197,7 +197,7 @@ end
defmodule Authzed.Api.V0.DeveloperError do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:message, 1, type: :string)
field(:line, 2, type: :uint32)
Expand Down
26 changes: 13 additions & 13 deletions lib/api/v1/core.pb.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Authzed.Api.V1.RelationshipUpdate.Operation do
@moduledoc false

use Protobuf, enum: true, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, enum: true, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:OPERATION_UNSPECIFIED, 0)
field(:OPERATION_CREATE, 1)
Expand All @@ -12,7 +12,7 @@ end
defmodule Authzed.Api.V1.AlgebraicSubjectSet.Operation do
@moduledoc false

use Protobuf, enum: true, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, enum: true, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:OPERATION_UNSPECIFIED, 0)
field(:OPERATION_UNION, 1)
Expand All @@ -23,7 +23,7 @@ end
defmodule Authzed.Api.V1.Relationship do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:resource, 1, type: Authzed.Api.V1.ObjectReference, deprecated: false)
field(:relation, 2, type: :string, deprecated: false)
Expand All @@ -39,7 +39,7 @@ end
defmodule Authzed.Api.V1.ContextualizedCaveat do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:caveat_name, 1, type: :string, json_name: "caveatName", deprecated: false)
field(:context, 2, type: Google.Protobuf.Struct, deprecated: false)
Expand All @@ -48,7 +48,7 @@ end
defmodule Authzed.Api.V1.SubjectReference do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:object, 1, type: Authzed.Api.V1.ObjectReference, deprecated: false)
field(:optional_relation, 2, type: :string, json_name: "optionalRelation", deprecated: false)
Expand All @@ -57,7 +57,7 @@ end
defmodule Authzed.Api.V1.ObjectReference do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:object_type, 1, type: :string, json_name: "objectType", deprecated: false)
field(:object_id, 2, type: :string, json_name: "objectId", deprecated: false)
Expand All @@ -66,23 +66,23 @@ end
defmodule Authzed.Api.V1.ZedToken do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:token, 1, type: :string, deprecated: false)
end

defmodule Authzed.Api.V1.Cursor do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:token, 1, type: :string, deprecated: false)
end

defmodule Authzed.Api.V1.RelationshipUpdate do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:operation, 1,
type: Authzed.Api.V1.RelationshipUpdate.Operation,
Expand All @@ -96,7 +96,7 @@ end
defmodule Authzed.Api.V1.PermissionRelationshipTree do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

oneof(:tree_type, 0)

Expand All @@ -109,7 +109,7 @@ end
defmodule Authzed.Api.V1.AlgebraicSubjectSet do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:operation, 1,
type: Authzed.Api.V1.AlgebraicSubjectSet.Operation,
Expand All @@ -127,15 +127,15 @@ end
defmodule Authzed.Api.V1.DirectSubjectSet do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:subjects, 1, repeated: true, type: Authzed.Api.V1.SubjectReference)
end

defmodule Authzed.Api.V1.PartialCaveatInfo do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3

field(:missing_required_context, 1,
repeated: true,
Expand Down
Loading

0 comments on commit db8ebc6

Please sign in to comment.