Skip to content

Commit

Permalink
Fix api-linter errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
SanjayVas committed May 24, 2023
1 parent ac298e4 commit f8a0093
Show file tree
Hide file tree
Showing 28 changed files with 392 additions and 153 deletions.
20 changes: 20 additions & 0 deletions src/main/proto/api-linter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2022 The Cross-Media Measurement Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

- included_paths:
- 'wfa/measurement/api/v2alpha/**/*.proto'
disabled_rules:
- 'core::0191::java-package'
- 'core::0127::http-annotation'
- 'core::0133::http-uri-parent'
23 changes: 19 additions & 4 deletions src/main/proto/wfa/measurement/api/v2alpha/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ proto_library(
srcs = ["certificate.proto"],
strip_import_prefix = IMPORT_PREFIX,
deps = [
"@com_google_googleapis//google/api:field_behavior_proto",
"@com_google_googleapis//google/api:resource_proto",
],
)
Expand All @@ -33,6 +34,7 @@ proto_library(
strip_import_prefix = IMPORT_PREFIX,
deps = [
":crypto_proto",
"@com_google_googleapis//google/api:field_behavior_proto",
"@com_google_googleapis//google/api:resource_proto",
],
)
Expand All @@ -43,6 +45,7 @@ proto_library(
strip_import_prefix = IMPORT_PREFIX,
deps = [
"//src/main/proto/wfa/measurement/api/v2alpha:time_interval_proto",
"@com_google_googleapis//google/api:field_behavior_proto",
"@com_google_googleapis//google/api:resource_proto",
],
)
Expand All @@ -55,6 +58,7 @@ proto_library(
":crypto_proto",
":measurement_proto",
":protocol_config_proto",
"@com_google_googleapis//google/api:field_behavior_proto",
"@com_google_googleapis//google/api:resource_proto",
],
)
Expand Down Expand Up @@ -83,6 +87,7 @@ proto_library(
strip_import_prefix = IMPORT_PREFIX,
deps = [
":crypto_proto",
"@com_google_googleapis//google/api:field_behavior_proto",
"@com_google_googleapis//google/api:resource_proto",
],
)
Expand All @@ -94,6 +99,7 @@ proto_library(
deps = [
":crypto_proto",
":measurement_consumer_proto",
"@com_google_googleapis//google/api:field_behavior_proto",
"@com_google_googleapis//google/api:resource_proto",
],
)
Expand Down Expand Up @@ -150,7 +156,6 @@ proto_library(
strip_import_prefix = IMPORT_PREFIX,
deps = [
":differential_privacy_proto",
"@com_google_googleapis//google/api:resource_proto",
],
)

Expand All @@ -161,6 +166,7 @@ proto_library(
deps = [
":crypto_proto",
":protocol_config_proto",
"@com_google_googleapis//google/api:field_behavior_proto",
"@com_google_googleapis//google/api:resource_proto",
"@com_google_protobuf//:duration_proto",
],
Expand All @@ -171,6 +177,7 @@ proto_library(
srcs = ["duchy.proto"],
strip_import_prefix = IMPORT_PREFIX,
deps = [
"@com_google_googleapis//google/api:field_behavior_proto",
"@com_google_googleapis//google/api:resource_proto",
],
)
Expand Down Expand Up @@ -212,6 +219,7 @@ proto_library(
strip_import_prefix = IMPORT_PREFIX,
deps = [
":model_suite_proto",
"@com_google_googleapis//google/api:client_proto",
"@com_google_googleapis//google/api:field_behavior_proto",
"@com_google_googleapis//google/api:resource_proto",
],
Expand Down Expand Up @@ -259,6 +267,7 @@ proto_library(
deps = [
":model_rollout_proto",
"//src/main/proto/wfa/measurement/api/v2alpha:time_interval_proto",
"@com_google_googleapis//google/api:client_proto",
"@com_google_googleapis//google/api:field_behavior_proto",
"@com_google_googleapis//google/api:resource_proto",
"@com_google_protobuf//:empty_proto",
Expand All @@ -283,6 +292,7 @@ proto_library(
strip_import_prefix = IMPORT_PREFIX,
deps = [
":model_release_proto",
"@com_google_googleapis//google/api:client_proto",
"@com_google_googleapis//google/api:field_behavior_proto",
"@com_google_googleapis//google/api:resource_proto",
],
Expand All @@ -293,10 +303,8 @@ proto_library(
srcs = ["model_shard.proto"],
strip_import_prefix = IMPORT_PREFIX,
deps = [
"//src/main/proto/wfa/measurement/api/v2alpha:time_interval_proto",
"@com_google_googleapis//google/api:field_behavior_proto",
"@com_google_googleapis//google/api:resource_proto",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:timestamp_proto",
],
)
Expand All @@ -307,7 +315,6 @@ proto_library(
strip_import_prefix = IMPORT_PREFIX,
deps = [
":model_shard_proto",
"//src/main/proto/wfa/measurement/api/v2alpha:time_interval_proto",
"@com_google_googleapis//google/api:field_behavior_proto",
"@com_google_googleapis//google/api:resource_proto",
"@com_google_protobuf//:empty_proto",
Expand Down Expand Up @@ -354,6 +361,7 @@ proto_library(
srcs = ["exchange.proto"],
strip_import_prefix = IMPORT_PREFIX,
deps = [
"@com_google_googleapis//google/api:field_behavior_proto",
"@com_google_googleapis//google/api:resource_proto",
"@com_google_googleapis//google/type:date_proto",
],
Expand All @@ -364,6 +372,7 @@ proto_library(
srcs = ["exchange_step.proto"],
strip_import_prefix = IMPORT_PREFIX,
deps = [
"@com_google_googleapis//google/api:field_behavior_proto",
"@com_google_googleapis//google/api:resource_proto",
"@com_google_googleapis//google/type:date_proto",
],
Expand All @@ -374,6 +383,7 @@ proto_library(
srcs = ["exchange_step_attempt.proto"],
strip_import_prefix = IMPORT_PREFIX,
deps = [
"@com_google_googleapis//google/api:field_behavior_proto",
"@com_google_googleapis//google/api:resource_proto",
"@com_google_protobuf//:timestamp_proto",
],
Expand Down Expand Up @@ -410,6 +420,8 @@ proto_library(
srcs = ["api_keys_service.proto"],
deps = [
":api_key_proto",
"@com_google_googleapis//google/api:client_proto",
"@com_google_googleapis//google/api:field_behavior_proto",
"@com_google_googleapis//google/api:resource_proto",
],
)
Expand All @@ -431,6 +443,7 @@ proto_library(
strip_import_prefix = IMPORT_PREFIX,
deps = [
":requisition_proto",
"@com_google_googleapis//google/api:field_behavior_proto",
"@com_google_googleapis//google/api:resource_proto",
],
)
Expand Down Expand Up @@ -501,6 +514,8 @@ proto_library(
srcs = ["recurring_exchanges_service.proto"],
deps = [
":recurring_exchange_proto",
"@com_google_googleapis//google/api:client_proto",
"@com_google_googleapis//google/api:field_behavior_proto",
"@com_google_googleapis//google/api:resource_proto",
],
)
Expand Down
1 change: 1 addition & 0 deletions src/main/proto/wfa/measurement/api/v2alpha/account.proto
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ message Account {
option (google.api.resource) = {
type: "halo.wfanet.org/Account"
pattern: "accounts/{account}"
plural: "accounts"
};

enum View {
Expand Down
1 change: 1 addition & 0 deletions src/main/proto/wfa/measurement/api/v2alpha/api_key.proto
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ message ApiKey {
option (google.api.resource) = {
type: "halo.wfanet.org/ApiKey"
pattern: "measurementConsumers/{measurement_consumer}/apiKeys/{api_key}"
plural: "apiKeys"
};

string name = 1;
Expand Down
31 changes: 21 additions & 10 deletions src/main/proto/wfa/measurement/api/v2alpha/api_keys_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ syntax = "proto3";

package wfa.measurement.api.v2alpha;

import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "wfa/measurement/api/v2alpha/api_key.proto";

Expand All @@ -29,29 +31,38 @@ service ApiKeys {
//
// Results in PERMISSION_DENIED if the authenticated caller does not own the
// `MeasurementConsumer` the `ApiKey` is being created for.
rpc CreateApiKey(CreateApiKeyRequest) returns (ApiKey) {}
rpc CreateApiKey(CreateApiKeyRequest) returns (ApiKey) {
option (google.api.method_signature) = "parent,api_key";
}

// Deletes an `ApiKey`.
//
// Results in PERMISSION_DENIED if the authenticated caller does not own the
// `MeasurementConsumer` the `ApiKey` is being used for.
rpc DeleteApiKey(DeleteApiKeyRequest) returns (ApiKey) {}
rpc DeleteApiKey(DeleteApiKeyRequest) returns (ApiKey) {
option (google.api.method_signature) = "name";
}
}

// Request message for `CreateApiKey` method.
message CreateApiKeyRequest {
// Name of the parent `MeasurementConsumer`. Required.
string parent = 1
[(google.api.resource_reference).child_type = "halo.wfanet.org/ApiKey"];
// Name of the parent `MeasurementConsumer`.
string parent = 1 [
(google.api.resource_reference).child_type = "halo.wfanet.org/ApiKey",
(google.api.field_behavior) = REQUIRED
];

// The `ApiKey` to create. Required.
// The `ApiKey` to create.
//
// The `name` field will be ignored, and the system will assign an ID.
ApiKey apiKey = 2;
ApiKey api_key = 2 [(google.api.field_behavior) = REQUIRED];
}

// Request message for `DeleteApiKey` method.
message DeleteApiKeyRequest {
// Resource name of the `ApiKey` to delete. Required.
string name = 1
[(google.api.resource_reference).type = "halo.wfanet.org/ApiKey"];
// Resource name of the `ApiKey` to delete.
string name = 1 [
(google.api.resource_reference).type = "halo.wfanet.org/ApiKey",
(google.api.field_behavior) = REQUIRED
];
}
14 changes: 11 additions & 3 deletions src/main/proto/wfa/measurement/api/v2alpha/certificate.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ syntax = "proto3";

package wfa.measurement.api.v2alpha;

import "google/api/field_behavior.proto";
import "google/api/resource.proto";

option java_package = "org.wfanet.measurement.api.v2alpha";
Expand All @@ -30,6 +31,8 @@ message Certificate {
pattern: "duchies/{duchy}/certificates/{certificate}"
pattern: "measurementConsumers/{measurement_consumer}/certificates/{certificate}"
pattern: "modelProviders/{model_provider}/certificates/{certificate}"
singular: "certificate"
plural: "certificates"
};

// Resource name.
Expand All @@ -39,12 +42,16 @@ message Certificate {
string name = 1;

// X.509 certificate in DER format. Required. Immutable.
bytes x509_der = 2;
bytes x509_der = 2 [
(google.api.field_behavior) = REQUIRED,
(google.api.field_behavior) = IMMUTABLE
];

// RFC 5280 revocation state.
//
// This is *not* a resource state as defined by https://google.aip.dev/216.
enum RevocationState {
// Default value used if the revocation state is omitted.
REVOCATION_STATE_UNSPECIFIED = 0;

// Certificate is on hold and therefore invalid, possibly temporarily.
Expand All @@ -53,11 +60,12 @@ message Certificate {
// Certificate has been revoked. Terminal state.
REVOKED = 2;
}
// Revocation state of the certificate reported by an API caller. Output-only.
// Revocation state of the certificate reported by an API caller.
//
// If specified, it means that the certificate is not currently valid.
//
// Note that this is not guaranteed to reflect the actual revocation state
// determined by the issuing certificate authority.
RevocationState revocation_state = 3;
RevocationState revocation_state = 3
[(google.api.field_behavior) = OUTPUT_ONLY];
}
11 changes: 4 additions & 7 deletions src/main/proto/wfa/measurement/api/v2alpha/data_provider.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ syntax = "proto3";

package wfa.measurement.api.v2alpha;

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "wfa/measurement/api/v2alpha/crypto.proto";

Expand All @@ -29,6 +30,7 @@ message DataProvider {
option (google.api.resource) = {
type: "halo.wfanet.org/DataProvider"
pattern: "dataProviders/{data_provider}"
plural: "dataProviders"
};

// Resource name.
Expand All @@ -54,11 +56,6 @@ message DataProvider {

// The list of duchies that must be included in all computations involving
// this `DataProvider`
repeated string required_external_duchy_ids = 6;
}

// Wrapper for a list of `DataProvider` resource names.
message DataProviderList {
repeated string data_provider = 1
[(google.api.resource_reference).type = "halo.wfanet.org/DataProvider"];
repeated string required_external_duchy_ids = 6
[(google.api.field_behavior) = UNORDERED_LIST];
}
13 changes: 8 additions & 5 deletions src/main/proto/wfa/measurement/api/v2alpha/duchy.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ syntax = "proto3";

package wfa.measurement.api.v2alpha;

import "google/api/field_behavior.proto";
import "google/api/resource.proto";

option java_package = "org.wfanet.measurement.api.v2alpha";
Expand All @@ -27,19 +28,21 @@ message Duchy {
option (google.api.resource) = {
type: "halo.wfanet.org/Duchy"
pattern: "duchies/{duchy}"
singular: "duchy"
plural: "duchies"
};

// Resource name.
string name = 1;

// The *preferred* X.509 certificate belonging to this `Duchy` in DER format.
// Required.
bytes preferred_certificate_der = 2;
bytes preferred_certificate_der = 2 [(google.api.field_behavior) = REQUIRED];

// Resource name of the *preferred* `Certificate` belonging to this `Duchy`.
// Output-only.
//
// The `x509_der` field of this resource matches `preferred_certificate_der`.
string preferred_certificate = 3
[(google.api.resource_reference).type = "halo.wfanet.org/Certificate"];
string preferred_certificate = 3 [
(google.api.resource_reference).type = "halo.wfanet.org/Certificate",
(google.api.field_behavior) = OUTPUT_ONLY
];
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// (--
// api-linter: core::0123::resource-annotation=disabled
// api-linter: core::0203::required=disabled
// api-linter: core::0203::immutable=disabled
// aip.dev/not-precedent: These are protobuf annotations, not API messages.
// --)

syntax = "proto3";

package wfa.measurement.api.v2alpha;
Expand All @@ -20,6 +27,7 @@ import "google/protobuf/descriptor.proto";

option java_package = "org.wfanet.measurement.api.v2alpha";
option java_multiple_files = true;
option java_outer_classname = "EventAnnotationsProto";

// Descriptor for a field inside of an event template message.
message EventFieldDescriptor {
Expand Down
Loading

0 comments on commit f8a0093

Please sign in to comment.