Giter Club home page Giter Club logo

api-common-protos's Introduction

Common Protos

release level

This repository is a home for the protocol buffer types which are common dependencies throughout the Google API ecosystem, and which are made available for use as dependencies elsewhere.

About protocol buffers

Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data โ€“ think XML, but smaller, faster, and simpler. You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages.

One popular use for protocol buffers, both within Google and elsewhere, is for specifying API design. They serve as a useful representation for API serivices, methods, and fields. You can read more about API design philosophy with protocol buffers by consulting our API Design Guide.

Why a common protos repository?

When writing protocol buffers, it is common to need to reuse common patterns. For example, common types show up in many different APIs, but have a consistent implementation. The same is true elsewhere.

This repository seeks to be a home for such types; protocol buffer authors may check out this repository and import them into their own work to save effort.

The protos in the various subdirectories in this repository have different purposes, and are documented in their respective README files.

Using these protos

NOTE The protos in this repository are not updated automatically and may be outdated. Please look to the protos in googleapis/googleapis instead which are updated regularly.

These protos are made available under an Apache license (see LICENSE) and you are free to depend on them within your applications. They are considered stable and will not change in backwards-incompaible ways.

In order to depend on these protos, use proto import statements that reference the base of this repository, for example:

syntax = "proto3";

import "google/type/color.proto";


// A message representing a paint can.
message PaintCan {
  // The size of the paint can, in gallons.
  float size_gallons = 1;

  // The color of the paint.
  google.type.Color color = 2;
}

If you are using protoc (or other similar tooling) to compile these protos yourself, you will likely require a local copy. Clone this repository to a convenient location and use --proto_path to specify the root of this repository on your machine to the compiler.

Packages

Additionally, if using these common protos, it is not necessary to ship the compiled types yourself in many common languages. Google provides a common protos package in several languages, which can be added as a dependency, and which makes these types available.

Note that if using these packages, you will still need a local copy of these protos when using protoc, but you will not need to ship compiled versions of them. (This is consistent with protoc's default behavior of only providing compiled output for the files specifically requested, and not their imports.)

google.protobuf types (separate from this repo)

There are a small number of types that are so common that they are included in the actual protocol buffers runtime itself. These are anything with an import path beginning with google/protobuf/, and notably includes timestamps and durations.

These are not defined in this directory, and you do not need to follow any of the instructions for including this (as discussed in the root README file) if you want to use those. They are part of protocol buffers, and an import of those will "just work". These are colloquially referred to as "well-known types".

Disclaimer

These protos are made available by Google, but are not considered to be an official Google product.

License

These protos are licensed using the Apache 2.0 software license, a permissive, copyfree license. You are free to use them in your applications provided the license terms are honored.

api-common-protos's People

Contributors

alexander-fenster avatar carl-mastrangelo avatar dazuma avatar eoogbe avatar ethanbao avatar garrettjonesgoogle avatar geigerj avatar google-cloud-policy-bot[bot] avatar googleapis-publisher avatar guptasu avatar hypnoglow avatar iennae avatar ivucica avatar jcanizales avatar jskeet avatar justinbeckwith avatar kolea2 avatar landrito avatar lukesneeringer avatar makdharma avatar michaelbausor avatar noahdietz avatar parthea avatar pongad avatar renovate-bot avatar software-dov avatar viacheslav-rostovtsev avatar wora avatar yihanzhen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

api-common-protos's Issues

api/resource.proto: inconsistency between comments and definition

There are some examples inside the proto itself (resource.proto) which adds some references to a non-existent name_descriptor field.

Furthermore, the AIP establishes the use of a type & pattern properties to define the metadata associated to a specific resource. The comments make a plan to use those in a different way by wrapping it on a custom property (name_descriptor) and make it repeatable.

Is it possible to clarify this? Thanks!

@noahdietz @lukesneeringer as you were the ones involved in the MR.

[Policy Bot] found one or more issues with this repository.

Policy Bot found one or more issues with this repository.

  • Default branch is 'main'
  • Branch protection is enabled
  • Renovate bot is enabled
  • Merge commits disabled
  • There is a CODEOWNERS file
  • There is a valid LICENSE.md
  • There is a CODE_OF_CONDUCT.md
  • There is a CONTRIBUTING.md
  • There is a SECURITY.md

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

bazel
WORKSPACE
  • io_bazel_rules_go 0.18.5
circleci
.circleci/config.yml
  • python 3.10-alpine
  • ubuntu 22.04
dockerfile
Dockerfile
  • alpine 3.15
pip_setup
.circleci/packaging/python/setup.py
  • protobuf >= 3.6.0
  • grpcio >= 1.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

Package metadata field is problematic in Java

The current field name of package for product metadata on the input-contract branch is problematic for Java/Kotlin because protoc does not check for reserved keywords.

Package package = 1048;

Can we change the name before it goes mainstream? I did open a PR for an upstream fix, but changing the name is probably easier (maybe package_metadata?): protocolbuffers/protobuf#5709

cc/ @noahdietz @timburks - I'll update kiosk once this is resolved.

could you provide vcpkg

Hi,

Thanks for the C# Google.Api.CommonProtos NuGet package.
Could you also provide a vcpkg equivalent for C++? There is already a vcpkg for google-cloud-cpp, but this only includes the common protos as "third party" in vcpkg/buildtrees/google-cloud-cpp/src/v0.1.0-533022434b/third_party/googleapis/google/type/date.proto
With a dedicated vcpkg this would make the common protos available seamlessly to Visual Studio 2017 C++ projects from vcpkg/installed/x64-windows/include/google/type/date.proto
This is what the protobuf vcpkg provides (vcpkg/installed/x64-windows/include/google/protobuf/timestamp.proto)

Regards,

Deprecated API is used

Error logging currently generates following warnings:

Google\Cloud\Logging\V2\LogSink_VersionFormat is deprecated and will be removed in the next major release. Use Google\Cloud\Logging\V2\LogSink\VersionFormat instead
 
-> app/vendor/google/cloud-logging/src/V2/LogSink_VersionFormat.php
Google\Rpc\QuotaFailure_Violation is deprecated and will be removed in the next major release. Use Google\Rpc\QuotaFailure\Violation instead

-> app/vendor/google/common-protos/src/Rpc/QuotaFailure_Violation.php 
Google\Rpc\PreconditionFailure_Violation is deprecated and will be removed in the next major release. Use Google\Rpc\PreconditionFailure\Violation instead

-> /app/vendor/google/common-protos/src/Rpc/PreconditionFailure_Violation.php
Google\Rpc\BadRequest_FieldViolation is deprecated and will be removed in the next major release. Use Google\Rpc\BadRequest\FieldViolation instead

-> /app/vendor/google/common-protos/src/Rpc/BadRequest_FieldViolation.php
Google\Rpc\Help_Link is deprecated and will be removed in the next major release. Use Google\Rpc\Help\Link instead

-> /app/vendor/google/common-protos/src/Rpc/Help_Link.php

This is thrown from generated PHP protobufs, but I assume that the root cause is outdated references in source protobuf definitions.
We are observing it while using the latest 0.1.0 version of google/common-protos.

api-common-protos version 1.7.0 with Protobuf 3.9.1 in Unity

After updating my google.Protobuf Library from 3.8.0 to 3.9.1 and GRPC Library from 1.22.0 to 2.25,0.
I am facing this runtime crash : "Could not load signature of Google.Type.CalendarPeriodReflection:get_Descriptor due to: Could not load file or assembly 'Google.Protobuf, Version=3.8.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604' or one of its dependencies. assembly:Google.Protobuf, Version=3.8.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604 type: member:(null) signature:"

Is there any missing class in google.Protobuf 3.9.1 or any compatibility issues.

git issue

Invalid `dev` version identifiers in `setup.py`

There is a bunch of invalid version matchers in setup.py. PEP 440 states:

The canonical public version identifiers MUST comply with the following scheme:
[N!]N(.N)*[{a|b|rc}N][.postN][.devN]

So you are missing a dot and a number in every version identifier that contains the string dev.

It is also considered bad practice to have an upper bound on package versions and installers like pip do not typically consider development versions in any case (unless explicitly told to).

See:

Edit: sorry - one too many.

Warnings from protoc: Import google/api/annotations.proto is unused

Environment details

  • Programming language: C++
  • OS: Ubuntu 22.04
  • Language runtime version: Protobuf 3.12.4
  • Package version: 1.50.0

Steps to reproduce

  1. Run protoc on all the .proto files
  2. The following warnings are reported:
google/api/auth.proto:19:1: warning: Import google/api/annotations.proto is unused.
google/api/billing.proto:19:1: warning: Import google/api/annotations.proto is unused.
google/api/endpoint.proto:19:1: warning: Import google/api/annotations.proto is unused.
google/api/logging.proto:19:1: warning: Import google/api/annotations.proto is unused.
google/api/monitoring.proto:19:1: warning: Import google/api/annotations.proto is unused.
google/api/quota.proto:19:1: warning: Import google/api/annotations.proto is unused.
google/api/service.proto:19:1: warning: Import google/api/annotations.proto is unused.
google/api/usage.proto:19:1: warning: Import google/api/annotations.proto is unused.
google/iam/v1/logging/audit_data.proto:19:1: warning: Import google/api/annotations.proto is unused.
google/iam/v1/policy.proto:19:1: warning: Import google/api/annotations.proto is unused.
google/logging/type/http_request.proto:19:1: warning: Import google/api/annotations.proto is unused.
google/logging/type/log_severity.proto:19:1: warning: Import google/api/annotations.proto is unused.
  1. The generation then completes successfully

Discussion

These warnings don't break anything, but they are a false positive. They waste our and our user's time by bringing attention to a non-existent problem. We could disable printing of all Protobuf warnings in our build setup, but then we could miss some actually important issues.

I suggest to remove the specified unused includes from those files. Or is there a flag I can pass to protoc to silence specifically "unused import" warnings?

Deal with multiple resource_reference types over the same field

I was trying to define one parameter that could reference different types with no luck. The problem can be easily shown using IAM's GetRole method as an example:

// The request to get the definition of an existing role.
message GetRoleRequest {
  // The resource name of the role in one of the following formats:
  // `roles/{ROLE_NAME}`
  // `organizations/{ORGANIZATION_ID}/roles/{ROLE_NAME}`
  // `projects/{PROJECT_ID}/roles/{ROLE_NAME}`
  string name = 1;
}

In this case google.api.resource_reference cannot be used as only one type can be referenced.

I can think of two different ways to solve this:

  • Make resource_reference.type a repeated field
  • Use oneof in name

I think the first one would be the cleanest option but WDYT?

Any help would be much appreciated!

Include mypy types

Is your feature request related to a problem? Please describe.

Modern python can be type-checked using mypy, but the python distribution of this package does not include the type specs, nor is there a companion type package.

Describe the solution you'd like

Types generated using e.g. https://pypi.org/project/mypy-protobuf/ included either directly in the python googleapis-common-protos package or a separate googleapis-common-protos-stubs package. A separate stubs package might help with avoiding accidental breakage.

Describe alternatives you've considered

I could check in the googleapi protos into the repository where I'm using them and add codegen from that.

Additional context
For the grpcio packages, there's stubs maintained by a third-party, https://pypi.org/project/grpc-stubs/. The protoc plugin https://pypi.org/project/mypy-protobuf/ codegens stubs for proto files (messages and grpc clients/handlers).

Should we be tagging releases?

As mentioned by @jbolinger here, it seems useful to have something more than a commit hash to identify releases. A datestamp might be better than a semantic version number, but I don't really have a preference.

[Policy Bot] found one or more issues with this repository.

Policy Bot found one or more issues with this repository.

  • Default branch is 'main'
  • Branch protection is enabled
  • Renovate bot is enabled
  • Merge commits disabled
  • There is a CODEOWNERS file
  • There is a valid LICENSE.md
  • There is a CODE_OF_CONDUCT.md
  • There is a CONTRIBUTING.md
  • There is a SECURITY.md

Enable master branch protection

      This repository does not seem to have master branch
      protection enabled, at least in the way I'm expecting.
      I was hoping for:

      - master branch protection
      - requiring at least one code reviewer
      - requiring at least two status checks
      - enforcing rules for admins

      Please turn it on!

Support for protobuf 5.X

The Python package resulting from this repository and published on PyPI is not compatible with the new released versions of protobuf because it has an upper-limit on <5.0.0.dev0.

Different go_package-s in google/rpc/*.proto

Hi, I cannot understand how to correctly use google/rpc/*.proto definitions in my project. Please explain the best practices here.

I copied google/rpc/*.proto into my repository with protos. Compiled them with buf tool and got all three go modules in one directory:
google/rpc/code.pb.go google/rpc/error_details.pb.go google/rpc/status.pb.go. Each module declares different package name:
package code, package errdetails, package status. This results in a compilaion errror, because Go requires that all modules in one same dir must declare the same one package, not three different ones.

How am I supposed to use those google/rpc/*.proto in my project, please give an advice.

Discrepancies between language package versions

The version numbers used for the compiled packages are not consistent across languages.

For example, the current C# package version is 2.2.0, the current Java package version is 2.0.1, and the current PyPI package version is 1.52.0.

When working in a multi-language environment, these discrepancies make it difficult to ensure compatibility between projects. Additionally, if you are using a local clone of this repo to compile your own proto files to be used in your application(s), then aligning the version of the language packages with the version of the protos found in the local clone is very difficult.

Would it be possible to align these version numbers in some way? Ideally, it would be great if the version number was tied to a release tag on this repo.

Related issue: #17

Enable master branch protection

      This repository does not seem to have master branch
      protection enabled, at least in the way I'm expecting.
      I was hoping for:

      - master branch protection
      - requiring at least one code reviewer
      - requiring at least two status checks
      - enforcing rules for admins

      Please turn it on!

provide compiled common protos in swift

We are currently working using different languages, using protos to generate some of the classes (some of them have dependencies on protos defined in this project). To ship our Swift project we have to generate and compile some protos under google.rpc.*, while on Java we just add them as a dependency.

It would be great if you could provide Swift packages with already compiled protos just like in other languages.

Confusing instruction on using proto js package

According to the note in https://github.com/googleapis/api-common-protos#packages

Note that if using these packages, you will still need a local copy of these protos when using protoc, but you will not need to ship compiled versions of them. (This is consistent with protoc's default behavior of only providing compiled output for the files specifically requested, and not their imports.)

This does not seem right for js package.
I protoc compiled my proto file with those imports from google-proto-files.
Apparently I have to ship compiled version of imported protos too because the google-proto-files does not contain them (unlike the packages for other languages or imports from google/protobuf/).

Python package has 640 permissions instead of 644

If you unpack https://files.pythonhosted.org/packages/61/29/1549f61917eadd11650e42b78b4afcfe9cb467157af4510ab8cb59535f14/googleapis-common-protos-1.5.6.tar.gz, some files in googleapis_common_protos.egg-info directory have 640 permissions instead of 644.

I believe it should be 644.

Real-world impact is e.g. you cannot use it in AWS Lambda, as it's run from a different user, and will throw access denied exception on namespace_packages.txt file.

Similar to unrelated bug https://bugs.archlinux.org/task/30020

Deprecated call breaking most Google Python packages

Environment details

  • Programming language: Python
  • OS: Ubuntu 20.04 LTS
  • Language runtime version: 3.8.10
  • Package version: 1.58.0

Steps to reproduce

  1. Install googleapis-common-protos==1.58.0 into a virtual environment.
  2. Create a file called test.py with the following contents:
import google.rpc
  1. Run python -Wall test.py inside the virtual environment and observe the deprecation warnings:
.../lib/python3.8/site-packages/pkg_resources/__init__.py:2804: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
declare_namespace(pkg)
.../lib/python3.8/site-packages/pkg_resources/__init__.py:2804: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google.logging')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
declare_namespace(pkg)
.../lib/python3.8/site-packages/pkg_resources/__init__.py:2309: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
declare_namespace(parent)
.../lib/python3.8/site-packages/google/rpc/__init__.py:20: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google.rpc')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
pkg_resources.declare_namespace(__name__)
.../lib/python3.8/site-packages/pkg_resources/__init__.py:2309: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
declare_namespace(parent)

The issue seems to be coming primarily from the init files generated here:

__import__('pkg_resources').declare_namespace(__name__)

In our test suites warnings are considered errors, and as google-api-core depends on googleapis-common-protos, this issue breaks every run where we import any Google API SDK package.

Identify the commit for a PyPI version

I'd like to import some of the google.api protos into my own proto, but I need to make sure I'm on the correct commit hash for the released PyPI package (e.g., 1.53.0) because my team depends on the PyPI package.

I searched the git log for 1.53.0 or some of the previous version numbers but found nothing.

Is there a way to identify the commits for released packages?

how can I import these models for Kotlin?

I'm able to import the java artifact containing these protobuf models, but it's lacking the Kotlin generated code which makes the models easier to work with.

How can I import an artifact that contains the protobuf models with a Kotlin language target?

There is an unsuitable proto file for the Go language

I apologize for writing this googleapis issue here, as googleapis has not enabled Issues.

I found a proto file that is not suitable for the Go language.
https://github.com/googleapis/googleapis/blob/master/google/ads/googleads/v10/resources/experiment_arm.proto

This file will be converted experiment_arm.pb.go by protoc-gen-go. However, the Go language compiler interprets the _arm suffix as an architecture type, so it cannot be compiled on non-ARM machines.
Of course, if you rename the file, there is no problem. I guess it's up to the person building the file to be careful, but it's a little uncool. Perhaps, it doesn't work well with automatic build system.

I think it would be better to avoid such file names.
What do you think?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.