From 01751d048e8950f2adffce80c6a276a41814aaf0 Mon Sep 17 00:00:00 2001 From: Denis Borisov Date: Wed, 25 Jan 2023 11:35:12 +0300 Subject: [PATCH 1/6] add extension --- .../google_api_field_behavior.go | 13 +++++++++++++ .../google_api_field_behavior_test.go | 1 + 2 files changed, 14 insertions(+) create mode 100644 extensions/google_api_field_behavior/google_api_field_behavior.go create mode 100644 extensions/google_api_field_behavior/google_api_field_behavior_test.go diff --git a/extensions/google_api_field_behavior/google_api_field_behavior.go b/extensions/google_api_field_behavior/google_api_field_behavior.go new file mode 100644 index 00000000..5fa4cb4c --- /dev/null +++ b/extensions/google_api_field_behavior/google_api_field_behavior.go @@ -0,0 +1,13 @@ +package extensions + +import ( + "fmt" + "github.com/pseudomuto/protoc-gen-doc/extensions" +) + +func init() { + extensions.SetTransformer("google.api.field_behavior", func(payload interface{}) interface{} { + fmt.Printf("debug field_behavior: %+v\n", payload) + return payload + }) +} diff --git a/extensions/google_api_field_behavior/google_api_field_behavior_test.go b/extensions/google_api_field_behavior/google_api_field_behavior_test.go new file mode 100644 index 00000000..aeec0fa7 --- /dev/null +++ b/extensions/google_api_field_behavior/google_api_field_behavior_test.go @@ -0,0 +1 @@ +package extensions From 383733b63f50a1b55ad6ee1d06e8b7426073fbf7 Mon Sep 17 00:00:00 2001 From: Denis Borisov Date: Wed, 25 Jan 2023 11:39:28 +0300 Subject: [PATCH 2/6] add extension --- .github/workflows/release.yaml | 2 +- .goreleaser.yaml | 8 ++-- CHANGELOG.md | 36 +++++++++--------- CONTRIBUTING.md | 2 +- LICENSE.md | 2 +- Makefile | 4 +- README.md | 34 ++++++++--------- bench_test.go | 3 +- build.gradle | 16 ++++---- cmd/protoc-gen-doc/flags.go | 8 ++-- cmd/protoc-gen-doc/flags_test.go | 1 - cmd/protoc-gen-doc/main.go | 16 ++++---- cmd/protoc-gen-doc/main_test.go | 1 - doc.go | 8 ++-- examples/gradle/build.gradle | 2 +- .../envoyproxy_validate.go | 2 +- .../envoyproxy_validate_test.go | 5 +-- .../google_api_field_behavior.go | 2 +- extensions/google_api_http/google_api_http.go | 2 +- .../google_api_http/google_api_http_test.go | 3 +- extensions/lyft_validate/alias.go | 2 +- extensions/validator_field/validator_field.go | 2 +- .../validator_field/validator_field_test.go | 3 +- filters_test.go | 2 +- fixtures/Booking.proto | 18 ++++----- fixtures/Vehicle.proto | 16 ++++---- fixtures/fileset.pb | Bin 62929 -> 64676 bytes go.mod | 4 +- go.sum | 4 +- plugin.go | 4 +- plugin_test.go | 5 +-- renderer_test.go | 5 +-- template.go | 4 +- template_test.go | 21 +++++----- thirdparty/generate.go | 4 +- .../pseudomuto/protokit/fixtures/extend.proto | 2 +- 36 files changed, 122 insertions(+), 131 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 446a0399..21dac8d1 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -12,7 +12,7 @@ jobs: - name: Login to Docker Hub uses: docker/login-action@v1 with: - username: pseudomuto + username: Raiden1974 password: ${{ secrets.DOCKER_TOKEN }} - name: Checkout uses: actions/checkout@v2 diff --git a/.goreleaser.yaml b/.goreleaser.yaml index a48fb053..4bbceab2 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -18,10 +18,10 @@ builds: dockers: - image_templates: - - pseudomuto/{{.ProjectName}}:latest - - pseudomuto/{{.ProjectName}}:{{.Version}} - - pseudomuto/{{.ProjectName}}:{{.Major}} - - pseudomuto/{{.ProjectName}}:{{.Major}}.{{.Minor}} + - Raiden1974/{{.ProjectName}}:latest + - Raiden1974/{{.ProjectName}}:{{.Version}} + - Raiden1974/{{.ProjectName}}:{{.Major}} + - Raiden1974/{{.ProjectName}}:{{.Major}}.{{.Minor}} build_flag_templates: - "--pull" - "--label=org.opencontainers.image.created={{.Date}}" diff --git a/CHANGELOG.md b/CHANGELOG.md index 36f2fc39..2ee302a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,52 +5,52 @@ All noteworthy changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) (as of Feb 2018) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [Unreleased](https://github.com/pseudomuto/protoc-gen-doc/compare/v1.5.0...master) +## [Unreleased](https://github.com/Raiden1974/protoc-gen-doc/compare/v1.5.0...master) _**CHANGELOG is now available with each release rather than in this file**_ ### Changed -* Escape special characters in markdown anchors [#460](https://github.com/pseudomuto/protoc-gen-doc/pull/460) -* Bump go to 1.17, protoc to 3.18.1, and leverage go:embed [#461](https://github.com/pseudomuto/protoc-gen-doc/pull/461) +* Escape special characters in markdown anchors [#460](https://github.com/Raiden1974/protoc-gen-doc/pull/460) +* Bump go to 1.17, protoc to 3.18.1, and leverage go:embed [#461](https://github.com/Raiden1974/protoc-gen-doc/pull/461) -## [v1.5.0](https://github.com/pseudomuto/protoc-gen-doc/compare/v1.4.1...v1.5.0) +## [v1.5.0](https://github.com/Raiden1974/protoc-gen-doc/compare/v1.4.1...v1.5.0) -* Add `source_relative` flag [#450](https://github.com/pseudomuto/protoc-gen-doc/pull/450) +* Add `source_relative` flag [#450](https://github.com/Raiden1974/protoc-gen-doc/pull/450) -## [v1.4.1](https://github.com/pseudomuto/protoc-gen-doc/compare/v1.3.2...v1.4.1) +## [v1.4.1](https://github.com/Raiden1974/protoc-gen-doc/compare/v1.3.2...v1.4.1) -* Add support for OneOf in templates [#436](https://github.com/pseudomuto/protoc-gen-doc/pull/436) -* Note deprecated fields in HTML, Markdown, and Docbook outputs [#426](https://github.com/pseudomuto/protoc-gen-doc/pull/426) +* Add support for OneOf in templates [#436](https://github.com/Raiden1974/protoc-gen-doc/pull/436) +* Note deprecated fields in HTML, Markdown, and Docbook outputs [#426](https://github.com/Raiden1974/protoc-gen-doc/pull/426) * Tidy up modules -## [v1.3.2](https://github.com/pseudomuto/protoc-gen-doc/compare/v1.3.1...v1.3.2) - May 7, 2020 +## [v1.3.2](https://github.com/Raiden1974/protoc-gen-doc/compare/v1.3.1...v1.3.2) - May 7, 2020 ### Changed -* Stripped unnecessary whitespace from markdown templates [#410](https://github.com/pseudomuto/protoc-gen-doc/pull/410) +* Stripped unnecessary whitespace from markdown templates [#410](https://github.com/Raiden1974/protoc-gen-doc/pull/410) * Renamed `lyft_validate` extension to `envoyproxy_validate` - [#392](https://github.com/pseudomuto/protoc-gen-doc/pull/392) + [#392](https://github.com/Raiden1974/protoc-gen-doc/pull/392) * Fixed `envoyproxy_validate` rules with slice values such as `in` and `not_in` - [#392](https://github.com/pseudomuto/protoc-gen-doc/pull/392) + [#392](https://github.com/Raiden1974/protoc-gen-doc/pull/392) -## [v1.3.1](https://github.com/pseudomuto/protoc-gen-doc/compare/v1.3.0...v1.3.1) - March 3, 2020 +## [v1.3.1](https://github.com/Raiden1974/protoc-gen-doc/compare/v1.3.0...v1.3.1) - March 3, 2020 ### Changed * Switched from dep to go modules -## [v1.3.0](https://github.com/pseudomuto/protoc-gen-doc/compare/v1.2.0...v1.3.0) - April 15, 2019 +## [v1.3.0](https://github.com/Raiden1974/protoc-gen-doc/compare/v1.2.0...v1.3.0) - April 15, 2019 ### Added -* Support for options and extended options in files, services, methods, enums, enum values, messages and fields [#376](https://github.com/pseudomuto/protoc-gen-doc/pull/376) +* Support for options and extended options in files, services, methods, enums, enum values, messages and fields [#376](https://github.com/Raiden1974/protoc-gen-doc/pull/376) ### Changed ### Fixed -## [v1.2.0](https://github.com/pseudomuto/protoc-gen-doc/compare/v1.1.0...v1.2.0) - March 13, 2019 +## [v1.2.0](https://github.com/Raiden1974/protoc-gen-doc/compare/v1.1.0...v1.2.0) - March 13, 2019 ### Added @@ -69,7 +69,7 @@ _**CHANGELOG is now available with each release rather than in this file**_ * Markdown template was incorrectly links response types to request types * Markdown template anchor tags were self-closing (invalid). -## [v1.1.0](https://github.com/pseudomuto/protoc-gen-doc/compare/v1.0.0...v1.1.0) - March 13, 2018 +## [v1.1.0](https://github.com/Raiden1974/protoc-gen-doc/compare/v1.0.0...v1.1.0) - March 13, 2018 ### Added @@ -93,7 +93,7 @@ _**CHANGELOG is now available with each release rather than in this file**_ * The entire `parser` package (in favor of [protokit]) -[protokit]: https://github.com/pseudomuto/protokit +[protokit]: https://github.com/Raiden1974/protokit # v1.0.0 - September 26, 2017 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 775bb5f2..1d8de0f6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,7 +19,7 @@ ensures that you'll only be testing the public interface. Here are some general guidelines for making PRs for this repo. -1. [Fork this repo](https://github.com/pseudomuto/protoc-gen-doc/fork). +1. [Fork this repo](https://github.com/Raiden1974/protoc-gen-doc/fork). 1. Make a branch off of master (`git checkout -b `). 1. Make focused commits with descriptive messages. 1. Add tests that fail without your code, and pass with it. diff --git a/LICENSE.md b/LICENSE.md index 597ec527..6009bead 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 David Muto (pseudomuto) +Copyright (c) 2022 David Muto (Raiden1974) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Makefile b/Makefile index 5b4d6903..7f82f56b 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ DOCKER_CMD=docker run --rm \ -v $(PWD)/thirdparty/github.com/mwitkow:/usr/include/github.com/mwitkow:ro \ -v $(PWD)/thirdparty/github.com/envoyproxy:/usr/include/github.com/envoyproxy:ro \ -v $(PWD)/tmp/googleapis/google/api:/usr/include/google/api:ro \ - pseudomuto/protoc-gen-doc:latest + Raiden1974/protoc-gen-doc:latest BOLD = \033[1m CLEAR = \033[0m @@ -48,7 +48,7 @@ build/examples: bin/protoc build tmp/googleapis examples/proto/*.proto examples/ ##@: Dev dev/docker: bin/protoc tmp/googleapis release/snapshot ## Run bash in the docker container - @docker run --rm -it --entrypoint /bin/bash pseudomuto/protoc-gen-doc:latest + @docker run --rm -it --entrypoint /bin/bash Raiden1974/protoc-gen-doc:latest ##@: Test diff --git a/README.md b/README.md index 2bdc8587..f5bc463b 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,12 @@ It supports proto2 and proto3, and can handle having both in the same context (s ## Installation -There is a Docker image available (`docker pull pseudomuto/protoc-gen-doc`) that has everything you need to generate +There is a Docker image available (`docker pull Raiden1974/protoc-gen-doc`) that has everything you need to generate documentation from your protos. If you'd like to install this locally, you can `go get` it. -`go get -u github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc` +`go get -u github.com/Raiden1974/protoc-gen-doc/cmd/protoc-gen-doc` Alternatively, you can download a pre-built release for your platform from the [releases][] page. @@ -47,7 +47,7 @@ You could generate HTML docs for the examples by running the following: docker run --rm \ -v $(pwd)/examples/doc:/out \ -v $(pwd)/examples/proto:/protos \ - pseudomuto/protoc-gen-doc + Raiden1974/protoc-gen-doc ``` By default HTML documentation is generated in `/out/index.html` for all `.proto` files in the `/protos` volume. This can @@ -59,7 +59,7 @@ For example, to generate Markdown for all the examples: docker run --rm \ -v $(pwd)/examples/doc:/out \ -v $(pwd)/examples/proto:/protos \ - pseudomuto/protoc-gen-doc --doc_opt=markdown,docs.md + Raiden1974/protoc-gen-doc --doc_opt=markdown,docs.md ``` You can also generate documentation for a single file. This can be done by passing the file(s) to the command: @@ -68,7 +68,7 @@ You can also generate documentation for a single file. This can be done by passi docker run --rm \ -v $(pwd)/examples/doc:/out \ -v $(pwd)/examples/proto:/protos \ - pseudomuto/protoc-gen-doc --doc_opt=markdown,docs.md Booking.proto [OPTIONALLY LIST MORE FILES] + Raiden1974/protoc-gen-doc --doc_opt=markdown,docs.md Booking.proto [OPTIONALLY LIST MORE FILES] ``` You can also exclude proto files that match specific path expressions. This is done by passing a second option delimited @@ -78,7 +78,7 @@ by `:`. For example, you can pass any number of comma separated patterns as the docker run --rm \ -v $(pwd)/examples/doc:/out \ -v $(pwd)/examples/proto:/protos \ - pseudomuto/protoc-gen-doc --doc_opt=:google/*,somepath/* + Raiden1974/protoc-gen-doc --doc_opt=:google/*,somepath/* ``` _**Remember**_: Paths should be from within the container, not the host! @@ -191,17 +191,17 @@ Check out the `examples` task in the [Makefile](Makefile) to see how these were https://golang.org/pkg/text/template/ "Template - The Go Programming Language" [custom]: - https://github.com/pseudomuto/protoc-gen-doc/wiki/Custom-Templates + https://github.com/Raiden1974/protoc-gen-doc/wiki/Custom-Templates "Custom templates instructions" [html_preview]: - https://rawgit.com/pseudomuto/protoc-gen-doc/master/examples/doc/example.html + https://rawgit.com/Raiden1974/protoc-gen-doc/master/examples/doc/example.html "HTML Example Output" -[codecov-svg]: https://codecov.io/gh/pseudomuto/protoc-gen-doc/branch/master/graph/badge.svg -[codecov-url]: https://codecov.io/gh/pseudomuto/protoc-gen-doc -[godoc-svg]: https://godoc.org/github.com/pseudomuto/protoc-gen-doc?status.svg -[godoc-url]: https://godoc.org/github.com/pseudomuto/protoc-gen-doc -[goreport-svg]: https://goreportcard.com/badge/github.com/pseudomuto/protoc-gen-doc -[goreport-url]: https://goreportcard.com/report/github.com/pseudomuto/protoc-gen-doc -[ci-svg]: https://github.com/pseudomuto/protoc-gen-doc/actions/workflows/ci.yaml/badge.svg?branch=master -[ci-url]: https://github.com/pseudomuto/protoc-gen-doc/actions/workflows/ci.yaml -[releases]: https://github.com/pseudomuto/protoc-gen-doc/releases +[codecov-svg]: https://codecov.io/gh/Raiden1974/protoc-gen-doc/branch/master/graph/badge.svg +[codecov-url]: https://codecov.io/gh/Raiden1974/protoc-gen-doc +[godoc-svg]: https://godoc.org/github.com/Raiden1974/protoc-gen-doc?status.svg +[godoc-url]: https://godoc.org/github.com/Raiden1974/protoc-gen-doc +[goreport-svg]: https://goreportcard.com/badge/github.com/Raiden1974/protoc-gen-doc +[goreport-url]: https://goreportcard.com/report/github.com/Raiden1974/protoc-gen-doc +[ci-svg]: https://github.com/Raiden1974/protoc-gen-doc/actions/workflows/ci.yaml/badge.svg?branch=master +[ci-url]: https://github.com/Raiden1974/protoc-gen-doc/actions/workflows/ci.yaml +[releases]: https://github.com/Raiden1974/protoc-gen-doc/releases diff --git a/bench_test.go b/bench_test.go index 3bc066e1..ced8988d 100644 --- a/bench_test.go +++ b/bench_test.go @@ -3,8 +3,7 @@ package gendoc_test import ( "testing" - . "github.com/pseudomuto/protoc-gen-doc" - "github.com/pseudomuto/protokit/utils" + "github.com/Raiden1974/protokit/utils" ) func BenchmarkParseCodeRequest(b *testing.B) { diff --git a/build.gradle b/build.gradle index 10b7d2fd..860d6f8b 100644 --- a/build.gradle +++ b/build.gradle @@ -3,12 +3,12 @@ plugins { id 'signing' } -group = 'io.github.pseudomuto' +group = 'io.github.Raiden1974' publishing { publications { maven(MavenPublication) { - groupId = 'io.github.pseudomuto' + groupId = 'io.github.Raiden1974' artifactId = rootProject.name version = System.getenv("GITHUB_REF_NAME") // Strip "v" from version number @@ -19,24 +19,24 @@ publishing { pom { name = groupId + ':' + rootProject.name description = 'This is a documentation generator plugin for the Google Protocol Buffers compiler (protoc). The plugin can generate HTML, JSON, DocBook, and Markdown documentation from comments in your .proto files.' - url = 'https://github.com/pseudomuto/protoc-gen-doc' + url = 'https://github.com/Raiden1974/protoc-gen-doc' licenses { license { name = 'MIT License' - url = 'https://github.com/pseudomuto/protoc-gen-doc/blob/master/LICENSE.md' + url = 'https://github.com/Raiden1974/protoc-gen-doc/blob/master/LICENSE.md' } } developers { developer { - id = 'pseudomuto' + id = 'Raiden1974' name = 'David Muto' email = 'david.muto@gmail.com' } } scm { - connection = 'scm:git:git@github.com:pseudomuto/protoc-gen-doc.git' - developerConnection = 'scm:git:git@github.com:pseudomuto/protoc-gen-doc.git' - url = 'https://github.com/pseudomuto/protoc-gen-doc' + connection = 'scm:git:git@github.com:Raiden1974/protoc-gen-doc.git' + developerConnection = 'scm:git:git@github.com:Raiden1974/protoc-gen-doc.git' + url = 'https://github.com/Raiden1974/protoc-gen-doc' } } diff --git a/cmd/protoc-gen-doc/flags.go b/cmd/protoc-gen-doc/flags.go index 40aa8976..1b8d2ff0 100644 --- a/cmd/protoc-gen-doc/flags.go +++ b/cmd/protoc-gen-doc/flags.go @@ -5,7 +5,7 @@ import ( "fmt" "io" - gendoc "github.com/pseudomuto/protoc-gen-doc" + gendoc "github.com/Raiden1974/protoc-gen-doc" ) const helpMessage = ` @@ -24,7 +24,7 @@ protoc --doc_out=. --doc_opt=custom.tmpl,docs.txt protos/*.proto EXAMPLE: Generate docs relative to source protos protoc --doc_out=. --doc_opt=html,index.html,source_relative protos/*.proto -See https://github.com/pseudomuto/protoc-gen-doc for more details. +See https://github.com/Raiden1974/protoc-gen-doc for more details. ` // Version returns the currently running version of protoc-gen-doc @@ -83,8 +83,8 @@ func (f *Flags) PrintVersion() { // ParseFlags parses the supplied options are returns a `Flags` object to the caller. // // Parameters: -// * `w` - the `io.Writer` to use for printing messages (help, version, etc.) -// * `args` - the set of args the program was invoked with (typically `os.Args`) +// - `w` - the `io.Writer` to use for printing messages (help, version, etc.) +// - `args` - the set of args the program was invoked with (typically `os.Args`) func ParseFlags(w io.Writer, args []string) *Flags { f := Flags{appName: args[0], writer: w} diff --git a/cmd/protoc-gen-doc/flags_test.go b/cmd/protoc-gen-doc/flags_test.go index 40182554..773db1e2 100644 --- a/cmd/protoc-gen-doc/flags_test.go +++ b/cmd/protoc-gen-doc/flags_test.go @@ -5,7 +5,6 @@ import ( "fmt" "testing" - . "github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc" "github.com/stretchr/testify/require" ) diff --git a/cmd/protoc-gen-doc/main.go b/cmd/protoc-gen-doc/main.go index 56e42ce4..7f2b8d52 100644 --- a/cmd/protoc-gen-doc/main.go +++ b/cmd/protoc-gen-doc/main.go @@ -4,25 +4,25 @@ // // Example: generate HTML documentation // -// protoc --doc_out=. --doc_opt=html,index.html protos/*.proto +// protoc --doc_out=. --doc_opt=html,index.html protos/*.proto // // Example: use a custom template // -// protoc --doc_out=. --doc_opt=custom.tmpl,docs.txt protos/*.proto +// protoc --doc_out=. --doc_opt=custom.tmpl,docs.txt protos/*.proto // -// For more details, check out the README at https://github.com/pseudomuto/protoc-gen-doc +// For more details, check out the README at https://github.com/Raiden1974/protoc-gen-doc package main import ( - "github.com/pseudomuto/protokit" + "github.com/Raiden1974/protokit" "log" "os" - gendoc "github.com/pseudomuto/protoc-gen-doc" - _ "github.com/pseudomuto/protoc-gen-doc/extensions/google_api_http" // imported for side effects - _ "github.com/pseudomuto/protoc-gen-doc/extensions/lyft_validate" // imported for side effects - _ "github.com/pseudomuto/protoc-gen-doc/extensions/validator_field" // imported for side effects + gendoc "github.com/Raiden1974/protoc-gen-doc" + _ "github.com/Raiden1974/protoc-gen-doc/extensions/google_api_http" // imported for side effects + _ "github.com/Raiden1974/protoc-gen-doc/extensions/lyft_validate" // imported for side effects + _ "github.com/Raiden1974/protoc-gen-doc/extensions/validator_field" // imported for side effects ) func main() { diff --git a/cmd/protoc-gen-doc/main_test.go b/cmd/protoc-gen-doc/main_test.go index f865db7d..980d17ca 100644 --- a/cmd/protoc-gen-doc/main_test.go +++ b/cmd/protoc-gen-doc/main_test.go @@ -4,7 +4,6 @@ import ( "bytes" "testing" - . "github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc" "github.com/stretchr/testify/require" ) diff --git a/doc.go b/doc.go index e9bee30c..3a88370e 100644 --- a/doc.go +++ b/doc.go @@ -5,15 +5,15 @@ // // Example: generate HTML documentation // -// protoc --doc_out=. --doc_opt=html,index.html protos/*.proto +// protoc --doc_out=. --doc_opt=html,index.html protos/*.proto // // Example: exclude patterns // -// protoc --doc_out=. --doc_opt=html,index.html:google/*,somedir/* protos/*.proto +// protoc --doc_out=. --doc_opt=html,index.html:google/*,somedir/* protos/*.proto // // Example: use a custom template // -// protoc --doc_out=. --doc_opt=custom.tmpl,docs.txt protos/*.proto +// protoc --doc_out=. --doc_opt=custom.tmpl,docs.txt protos/*.proto // -// For more details, check out the README at https://github.com/pseudomuto/protoc-gen-doc +// For more details, check out the README at https://github.com/Raiden1974/protoc-gen-doc package gendoc diff --git a/examples/gradle/build.gradle b/examples/gradle/build.gradle index 0f0a3abe..72b6b09a 100644 --- a/examples/gradle/build.gradle +++ b/examples/gradle/build.gradle @@ -9,7 +9,7 @@ protobuf { } plugins { doc { - artifact = "io.github.pseudomuto:protoc-gen-doc:1.5.1" + artifact = "io.github.Raiden1974:protoc-gen-doc:1.5.1" } } diff --git a/extensions/envoyproxy_validate/envoyproxy_validate.go b/extensions/envoyproxy_validate/envoyproxy_validate.go index 70941f65..0b6777fa 100644 --- a/extensions/envoyproxy_validate/envoyproxy_validate.go +++ b/extensions/envoyproxy_validate/envoyproxy_validate.go @@ -5,8 +5,8 @@ import ( "reflect" "strings" + "github.com/Raiden1974/protoc-gen-doc/extensions" "github.com/envoyproxy/protoc-gen-validate/validate" - "github.com/pseudomuto/protoc-gen-doc/extensions" ) // ValidateRule represents a single validator rule from the (validate.rules) method option extension. diff --git a/extensions/envoyproxy_validate/envoyproxy_validate_test.go b/extensions/envoyproxy_validate/envoyproxy_validate_test.go index 7c6cae87..ad63c407 100644 --- a/extensions/envoyproxy_validate/envoyproxy_validate_test.go +++ b/extensions/envoyproxy_validate/envoyproxy_validate_test.go @@ -3,10 +3,9 @@ package extensions_test import ( "testing" + "github.com/Raiden1974/protoc-gen-doc/extensions" + . "github.com/Raiden1974/protoc-gen-doc/extensions/lyft_validate" "github.com/envoyproxy/protoc-gen-validate/validate" - "github.com/golang/protobuf/proto" - "github.com/pseudomuto/protoc-gen-doc/extensions" - . "github.com/pseudomuto/protoc-gen-doc/extensions/lyft_validate" "github.com/stretchr/testify/require" ) diff --git a/extensions/google_api_field_behavior/google_api_field_behavior.go b/extensions/google_api_field_behavior/google_api_field_behavior.go index 5fa4cb4c..0a021efd 100644 --- a/extensions/google_api_field_behavior/google_api_field_behavior.go +++ b/extensions/google_api_field_behavior/google_api_field_behavior.go @@ -2,7 +2,7 @@ package extensions import ( "fmt" - "github.com/pseudomuto/protoc-gen-doc/extensions" + "github.com/Raiden1974/protoc-gen-doc/extensions" ) func init() { diff --git a/extensions/google_api_http/google_api_http.go b/extensions/google_api_http/google_api_http.go index cbc5ad14..7764e654 100644 --- a/extensions/google_api_http/google_api_http.go +++ b/extensions/google_api_http/google_api_http.go @@ -3,7 +3,7 @@ package extensions import ( "net/http" - "github.com/pseudomuto/protoc-gen-doc/extensions" + "github.com/Raiden1974/protoc-gen-doc/extensions" "google.golang.org/genproto/googleapis/api/annotations" ) diff --git a/extensions/google_api_http/google_api_http_test.go b/extensions/google_api_http/google_api_http_test.go index 18e3bf6e..932e297f 100644 --- a/extensions/google_api_http/google_api_http_test.go +++ b/extensions/google_api_http/google_api_http_test.go @@ -4,8 +4,7 @@ import ( "net/http" "testing" - "github.com/pseudomuto/protoc-gen-doc/extensions" - . "github.com/pseudomuto/protoc-gen-doc/extensions/google_api_http" + "github.com/Raiden1974/protoc-gen-doc/extensions" "github.com/stretchr/testify/require" "google.golang.org/genproto/googleapis/api/annotations" ) diff --git a/extensions/lyft_validate/alias.go b/extensions/lyft_validate/alias.go index 985a0cf9..5c467133 100644 --- a/extensions/lyft_validate/alias.go +++ b/extensions/lyft_validate/alias.go @@ -1,6 +1,6 @@ package extensions -import evp "github.com/pseudomuto/protoc-gen-doc/extensions/envoyproxy_validate" +import evp "github.com/Raiden1974/protoc-gen-doc/extensions/envoyproxy_validate" // ValidateRule represents a single validator rule from the (validate.rules) method option extension. type ValidateRule = evp.ValidateRule diff --git a/extensions/validator_field/validator_field.go b/extensions/validator_field/validator_field.go index 224e414d..edd61572 100644 --- a/extensions/validator_field/validator_field.go +++ b/extensions/validator_field/validator_field.go @@ -5,10 +5,10 @@ import ( "reflect" "strings" + "github.com/Raiden1974/protoc-gen-doc/extensions" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/protoc-gen-go/descriptor" validator "github.com/mwitkow/go-proto-validators" - "github.com/pseudomuto/protoc-gen-doc/extensions" ) func init() { diff --git a/extensions/validator_field/validator_field_test.go b/extensions/validator_field/validator_field_test.go index ae0eeee0..dc9a47fd 100644 --- a/extensions/validator_field/validator_field_test.go +++ b/extensions/validator_field/validator_field_test.go @@ -3,10 +3,9 @@ package extensions_test import ( "testing" + "github.com/Raiden1974/protoc-gen-doc/extensions" "github.com/golang/protobuf/proto" validator "github.com/mwitkow/go-proto-validators" - "github.com/pseudomuto/protoc-gen-doc/extensions" - . "github.com/pseudomuto/protoc-gen-doc/extensions/validator_field" "github.com/stretchr/testify/require" ) diff --git a/filters_test.go b/filters_test.go index 353583c4..dfc82e46 100644 --- a/filters_test.go +++ b/filters_test.go @@ -4,7 +4,7 @@ import ( html "html/template" "testing" - . "github.com/pseudomuto/protoc-gen-doc" + . "github.com/Raiden1974/protoc-gen-doc" "github.com/stretchr/testify/require" ) diff --git a/fixtures/Booking.proto b/fixtures/Booking.proto index 516bf8ef..7fb4c1a5 100644 --- a/fixtures/Booking.proto +++ b/fixtures/Booking.proto @@ -6,21 +6,21 @@ */ syntax = "proto2"; -import "github.com/pseudomuto/protokit/fixtures/extend.proto"; +import "github.com/Raiden1974/protokit/fixtures/extend.proto"; package com.example; -option (com.pseudomuto.protokit.v1.extend_file) = true; +option (com.Raiden1974.protokit.v1.extend_file) = true; /** * Service for handling vehicle bookings. */ service BookingService { - option (com.pseudomuto.protokit.v1.extend_service) = true; + option (com.Raiden1974.protokit.v1.extend_service) = true; /// Used to book a vehicle. Pass in a Booking and a BookingStatus will be returned. rpc BookVehicle (Booking) returns (BookingStatus) { - option (com.pseudomuto.protokit.v1.extend_method) = true; + option (com.Raiden1974.protokit.v1.extend_method) = true; }; } @@ -36,7 +36,7 @@ message BookingStatus { BAD_REQUEST = 400; // BAD result. } - required int32 id = 1 [(com.pseudomuto.protokit.v1.extend_field) = true]; /// Unique booking status ID. + required int32 id = 1 [(com.Raiden1974.protokit.v1.extend_field) = true]; /// Unique booking status ID. required string description = 2; /// Booking status description. E.g. "Active". optional StatusCode status_code = 3; /// The status of this status? @@ -52,10 +52,10 @@ extend BookingStatus { * The type of booking. */ enum BookingType { - option (com.pseudomuto.protokit.v1.extend_enum) = true; + option (com.Raiden1974.protokit.v1.extend_enum) = true; IMMEDIATE = 100; // Immediate booking. - FUTURE = 101 [(com.pseudomuto.protokit.v1.extend_enum_value) = true]; // Future booking. + FUTURE = 101 [(com.Raiden1974.protokit.v1.extend_enum_value) = true]; // Future booking. } /** @@ -64,7 +64,7 @@ enum BookingType { * Vehicles are some cool shit. But drive carefully! */ message Booking { - option (com.pseudomuto.protokit.v1.extend_message) = true; + option (com.Raiden1974.protokit.v1.extend_message) = true; required int32 vehicle_id = 1; /// ID of booked vehicle. required int32 customer_id = 2; /// Customer that booked the vehicle. @@ -74,7 +74,7 @@ message Booking { required bool confirmation_sent = 4; /** Has payment been received? */ - optional bool payment_received = 5 [default = false, (com.pseudomuto.protokit.v1.extend_field) = true]; + optional bool payment_received = 5 [default = false, (com.Raiden1974.protokit.v1.extend_field) = true]; optional string color_preference = 6 [deprecated=true]; // Color preference of the customer. diff --git a/fixtures/Vehicle.proto b/fixtures/Vehicle.proto index 303e3748..f98cf12d 100644 --- a/fixtures/Vehicle.proto +++ b/fixtures/Vehicle.proto @@ -3,11 +3,11 @@ */ syntax = "proto3"; -import "github.com/pseudomuto/protokit/fixtures/extend.proto"; +import "github.com/Raiden1974/protokit/fixtures/extend.proto"; package com.example; -option (com.pseudomuto.protokit.v1.extend_file) = true; +option (com.Raiden1974.protokit.v1.extend_file) = true; /** * The vehicle service. @@ -15,7 +15,7 @@ option (com.pseudomuto.protokit.v1.extend_file) = true; * Manages vehicles and such... */ service VehicleService { - option (com.pseudomuto.protokit.v1.extend_service) = true; + option (com.Raiden1974.protokit.v1.extend_service) = true; // Returns the set of models. rpc GetModels(EmptyMessage) returns (stream Model); @@ -26,7 +26,7 @@ service VehicleService { * Looks up a vehicle by id. */ rpc GetVehicle(FindVehicleById) returns (Vehicle) { - option (com.pseudomuto.protokit.v1.extend_method) = true; + option (com.Raiden1974.protokit.v1.extend_method) = true; }; } @@ -69,10 +69,10 @@ message ExcludedMessage { // The type of model. enum Type { - option (com.pseudomuto.protokit.v1.extend_enum) = true; + option (com.Raiden1974.protokit.v1.extend_enum) = true; COUPE = 0; // The type is coupe. - SEDAN = 1 [(com.pseudomuto.protokit.v1.extend_enum_value) = true]; // The type is sedan. + SEDAN = 1 [(com.Raiden1974.protokit.v1.extend_enum_value) = true]; // The type is sedan. } /** @@ -99,7 +99,7 @@ message Manufacturer { * Represents a vehicle that can be hired. */ message Vehicle { - option (com.pseudomuto.protokit.v1.extend_message) = true; + option (com.Raiden1974.protokit.v1.extend_message) = true; /** * Represents a vehicle category. E.g. "Sedan" or "Truck". @@ -128,7 +128,7 @@ message Vehicle { int32 id = 1; /** Unique vehicle ID. */ Model model = 2; /** Vehicle model. */ - string reg_number = 3 [(com.pseudomuto.protokit.v1.extend_field) = true]; /** Vehicle registration number. */ + string reg_number = 3 [(com.Raiden1974.protokit.v1.extend_field) = true]; /** Vehicle registration number. */ sint32 mileage = 4; /** Current vehicle mileage, if known. */ Category category = 5; /** Vehicle category. */ Engine engine = 9; /** Vehicle engine. */ diff --git a/fixtures/fileset.pb b/fixtures/fileset.pb index c766927deba70651220d4cb72f1d1dd70cbe6b22..2a9228f95b9a20d67bbfa79aec5455d4306ad509 100644 GIT binary patch delta 15730 zcmZ`=32GeiMS6OYZCQ);BuiE-?^}$w1jk!syd-vDqs8BtG6H8zW3msT1&kxiUd5cWAujY z+g7itwc4imZ25W1vx(ZbPoBLsexxuM-xWRnhgiFza>z>KMV;}7@c)HEU;OjRYlPV?2*VPAlfFdW$uAsEAHf$w||E&HSnE;_J zJab^FR>tshEwbIy&$llUda)(2bN0r~QF+&aLwon_-?L?RZ59*&=)kr6NB8cmc?v-n zS8m^5Gb82F4E*uuXRmP7=gjC8mB*LOIpK!Hq{8ui2J^uah@`3o`^2PY;C(D1cLra zyKl$GudMh1x}RNXhp$?7Ojx{s)tBV=;nkgio%HSx@7NuMfp2C7b!mWd6fP)SnNJv) z?S#J7gnflCTOZvR`GFrQ7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<7sh9Vy=zew^e!J9g Ub`P7K+4e)2u@5u5fBe+?AGxr(1^@s6 diff --git a/go.mod b/go.mod index dc25f7ac..d0ec1808 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/pseudomuto/protoc-gen-doc +module github.com/Raiden1974/protoc-gen-doc go 1.17 @@ -12,7 +12,7 @@ require ( github.com/huandu/xstrings v1.0.0 // indirect github.com/imdario/mergo v0.3.4 // indirect github.com/mwitkow/go-proto-validators v0.3.2 - github.com/pseudomuto/protokit v0.2.0 + github.com/Raiden1974/protokit v0.2.0 github.com/stretchr/testify v1.6.1 google.golang.org/api v0.58.0 google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4 diff --git a/go.sum b/go.sum index 93e369a0..bd1e0c76 100644 --- a/go.sum +++ b/go.sum @@ -182,8 +182,8 @@ github.com/mwitkow/go-proto-validators v0.3.2/go.mod h1:ej0Qp0qMgHN/KtDyUt+Q1/tA github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/pseudomuto/protokit v0.2.0 h1:hlnBDcy3YEDXH7kc9gV+NLaN0cDzhDvD1s7Y6FZ8RpM= -github.com/pseudomuto/protokit v0.2.0/go.mod h1:2PdH30hxVHsup8KpBTOXTBeMVhJZVio3Q8ViKSAXT0Q= +github.com/Raiden1974/protokit v0.2.0 h1:hlnBDcy3YEDXH7kc9gV+NLaN0cDzhDvD1s7Y6FZ8RpM= +github.com/Raiden1974/protokit v0.2.0/go.mod h1:2PdH30hxVHsup8KpBTOXTBeMVhJZVio3Q8ViKSAXT0Q= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= diff --git a/plugin.go b/plugin.go index bc769016..39f2c86b 100644 --- a/plugin.go +++ b/plugin.go @@ -8,9 +8,9 @@ import ( "regexp" "strings" + "github.com/Raiden1974/protokit" "github.com/golang/protobuf/proto" plugin_go "github.com/golang/protobuf/protoc-gen-go/plugin" - "github.com/pseudomuto/protokit" ) // PluginOptions encapsulates options for the plugin. The type of renderer, template file, and the name of the output @@ -26,7 +26,7 @@ type PluginOptions struct { // SupportedFeatures describes a flag setting for supported features. var SupportedFeatures = uint64(plugin_go.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) -// Plugin describes a protoc code generate plugin. It's an implementation of Plugin from github.com/pseudomuto/protokit +// Plugin describes a protoc code generate plugin. It's an implementation of Plugin from github.com/Raiden1974/protokit type Plugin struct{} // Generate compiles the documentation and generates the CodeGeneratorResponse to send back to protoc. It does this diff --git a/plugin_test.go b/plugin_test.go index ebb18b7d..01740e3b 100644 --- a/plugin_test.go +++ b/plugin_test.go @@ -4,10 +4,9 @@ import ( "regexp" "testing" - "github.com/golang/protobuf/proto" + . "github.com/Raiden1974/protoc-gen-doc" + "github.com/Raiden1974/protokit/utils" plugin_go "github.com/golang/protobuf/protoc-gen-go/plugin" - . "github.com/pseudomuto/protoc-gen-doc" - "github.com/pseudomuto/protokit/utils" "github.com/stretchr/testify/require" ) diff --git a/renderer_test.go b/renderer_test.go index d1c1abb4..ef8b7c5a 100644 --- a/renderer_test.go +++ b/renderer_test.go @@ -4,9 +4,8 @@ import ( "os" "testing" - . "github.com/pseudomuto/protoc-gen-doc" - "github.com/pseudomuto/protokit" - "github.com/pseudomuto/protokit/utils" + "github.com/Raiden1974/protokit" + "github.com/Raiden1974/protokit/utils" "github.com/stretchr/testify/require" ) diff --git a/template.go b/template.go index 9edaac72..9ab2bade 100644 --- a/template.go +++ b/template.go @@ -6,9 +6,9 @@ import ( "sort" "strings" + "github.com/Raiden1974/protoc-gen-doc/extensions" + "github.com/Raiden1974/protokit" "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/pseudomuto/protoc-gen-doc/extensions" - "github.com/pseudomuto/protokit" ) // Template is a type for encapsulating all the parsed files, messages, fields, enums, services, extensions, etc. into diff --git a/template_test.go b/template_test.go index 717919b2..e2f57bda 100644 --- a/template_test.go +++ b/template_test.go @@ -4,12 +4,11 @@ import ( "os" "testing" + "github.com/Raiden1974/protoc-gen-doc/extensions" + "github.com/Raiden1974/protokit" + "github.com/Raiden1974/protokit/utils" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/protoc-gen-go/descriptor" - . "github.com/pseudomuto/protoc-gen-doc" - "github.com/pseudomuto/protoc-gen-doc/extensions" - "github.com/pseudomuto/protokit" - "github.com/pseudomuto/protokit/utils" "github.com/stretchr/testify/require" ) @@ -48,7 +47,7 @@ var E_ExtendFile = &proto.ExtensionDesc{ ExtendedType: (*descriptor.FileOptions)(nil), ExtensionType: (*bool)(nil), Field: 20000, - Name: "com.pseudomuto.protokit.v1.extend_file", + Name: "com.Raiden1974.protokit.v1.extend_file", Tag: "varint,20000,opt,name=extend_file,json=extendFile", Filename: "extend.proto", } @@ -57,7 +56,7 @@ var E_ExtendService = &proto.ExtensionDesc{ ExtendedType: (*descriptor.ServiceOptions)(nil), ExtensionType: (*bool)(nil), Field: 20000, - Name: "com.pseudomuto.protokit.v1.extend_service", + Name: "com.Raiden1974.protokit.v1.extend_service", Tag: "varint,20000,opt,name=extend_service,json=extendService", Filename: "extend.proto", } @@ -66,7 +65,7 @@ var E_ExtendMethod = &proto.ExtensionDesc{ ExtendedType: (*descriptor.MethodOptions)(nil), ExtensionType: (*bool)(nil), Field: 20000, - Name: "com.pseudomuto.protokit.v1.extend_method", + Name: "com.Raiden1974.protokit.v1.extend_method", Tag: "varint,20000,opt,name=extend_method,json=extendMethod", Filename: "extend.proto", } @@ -75,7 +74,7 @@ var E_ExtendEnum = &proto.ExtensionDesc{ ExtendedType: (*descriptor.EnumOptions)(nil), ExtensionType: (*bool)(nil), Field: 20000, - Name: "com.pseudomuto.protokit.v1.extend_enum", + Name: "com.Raiden1974.protokit.v1.extend_enum", Tag: "varint,20000,opt,name=extend_enum,json=extendEnum", Filename: "extend.proto", } @@ -84,7 +83,7 @@ var E_ExtendEnumValue = &proto.ExtensionDesc{ ExtendedType: (*descriptor.EnumValueOptions)(nil), ExtensionType: (*bool)(nil), Field: 20000, - Name: "com.pseudomuto.protokit.v1.extend_enum_value", + Name: "com.Raiden1974.protokit.v1.extend_enum_value", Tag: "varint,20000,opt,name=extend_enum_value,json=extendEnumValue", Filename: "extend.proto", } @@ -93,7 +92,7 @@ var E_ExtendMessage = &proto.ExtensionDesc{ ExtendedType: (*descriptor.MessageOptions)(nil), ExtensionType: (*bool)(nil), Field: 20000, - Name: "com.pseudomuto.protokit.v1.extend_message", + Name: "com.Raiden1974.protokit.v1.extend_message", Tag: "varint,20000,opt,name=extend_message,json=extendMessage", Filename: "extend.proto", } @@ -102,7 +101,7 @@ var E_ExtendField = &proto.ExtensionDesc{ ExtendedType: (*descriptor.FieldOptions)(nil), ExtensionType: (*bool)(nil), Field: 20000, - Name: "com.pseudomuto.protokit.v1.extend_field", + Name: "com.Raiden1974.protokit.v1.extend_field", Tag: "varint,20000,opt,name=extend_field,json=extendField", Filename: "extend.proto", } diff --git a/thirdparty/generate.go b/thirdparty/generate.go index 0e758dd7..9321d512 100644 --- a/thirdparty/generate.go +++ b/thirdparty/generate.go @@ -6,5 +6,5 @@ package thirdparty //go:generate mkdir -p github.com/mwitkow/go-proto-validators //go:generate curl -fsSL https://github.com/mwitkow/go-proto-validators/raw/master/validator.proto -o github.com/mwitkow/go-proto-validators/validator.proto -//go:generate mkdir -p github.com/pseudomuto/protokit/fixtures -//go:generate curl -fsSL https://github.com/pseudomuto/protokit/raw/master/fixtures/extend.proto -o github.com/pseudomuto/protokit/fixtures/extend.proto +//go:generate mkdir -p github.com/Raiden1974/protokit/fixtures +//go:generate curl -fsSL https://github.com/Raiden1974/protokit/raw/master/fixtures/extend.proto -o github.com/Raiden1974/protokit/fixtures/extend.proto diff --git a/thirdparty/github.com/pseudomuto/protokit/fixtures/extend.proto b/thirdparty/github.com/pseudomuto/protokit/fixtures/extend.proto index c0260241..96be0754 100644 --- a/thirdparty/github.com/pseudomuto/protokit/fixtures/extend.proto +++ b/thirdparty/github.com/pseudomuto/protokit/fixtures/extend.proto @@ -2,7 +2,7 @@ syntax = "proto2"; import "google/protobuf/descriptor.proto"; -package com.pseudomuto.protokit.v1; +package com.Raiden1974.protokit.v1; /** * Extension of protobuf file options. From ce72aa27bb53710735dcb868bf079121737ff563 Mon Sep 17 00:00:00 2001 From: Denis Borisov Date: Wed, 25 Jan 2023 11:48:29 +0300 Subject: [PATCH 3/6] add extension --- CHANGELOG.md | 2 +- bench_test.go | 2 +- cmd/protoc-gen-doc/main.go | 2 +- fixtures/Booking.proto | 2 +- fixtures/Vehicle.proto | 2 +- fixtures/fileset.pb | Bin 64676 -> 64676 bytes go.mod | 2 +- go.sum | 4 ++-- plugin.go | 4 ++-- plugin_test.go | 2 +- renderer_test.go | 4 ++-- template.go | 2 +- template_test.go | 4 ++-- thirdparty/generate.go | 4 ++-- 14 files changed, 18 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ee302a6..2b4d77cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -93,7 +93,7 @@ _**CHANGELOG is now available with each release rather than in this file**_ * The entire `parser` package (in favor of [protokit]) -[protokit]: https://github.com/Raiden1974/protokit +[protokit]: https://github.com/pseudomuto/protokit # v1.0.0 - September 26, 2017 diff --git a/bench_test.go b/bench_test.go index ced8988d..e6578576 100644 --- a/bench_test.go +++ b/bench_test.go @@ -3,7 +3,7 @@ package gendoc_test import ( "testing" - "github.com/Raiden1974/protokit/utils" + "github.com/pseudomuto/protokit/utils" ) func BenchmarkParseCodeRequest(b *testing.B) { diff --git a/cmd/protoc-gen-doc/main.go b/cmd/protoc-gen-doc/main.go index 7f2b8d52..cffbaa36 100644 --- a/cmd/protoc-gen-doc/main.go +++ b/cmd/protoc-gen-doc/main.go @@ -14,7 +14,7 @@ package main import ( - "github.com/Raiden1974/protokit" + "github.com/pseudomuto/protokit" "log" "os" diff --git a/fixtures/Booking.proto b/fixtures/Booking.proto index 7fb4c1a5..087064a8 100644 --- a/fixtures/Booking.proto +++ b/fixtures/Booking.proto @@ -6,7 +6,7 @@ */ syntax = "proto2"; -import "github.com/Raiden1974/protokit/fixtures/extend.proto"; +import "github.com/pseudomuto/protokit/fixtures/extend.proto"; package com.example; diff --git a/fixtures/Vehicle.proto b/fixtures/Vehicle.proto index f98cf12d..8ddc451f 100644 --- a/fixtures/Vehicle.proto +++ b/fixtures/Vehicle.proto @@ -3,7 +3,7 @@ */ syntax = "proto3"; -import "github.com/Raiden1974/protokit/fixtures/extend.proto"; +import "github.com/pseudomuto/protokit/fixtures/extend.proto"; package com.example; diff --git a/fixtures/fileset.pb b/fixtures/fileset.pb index 2a9228f95b9a20d67bbfa79aec5455d4306ad509..68b8404e87ee80fab1d3fc853566fbb51580bd36 100644 GIT binary patch delta 65 zcmZ4TlX=Nc<_#~8a}^Y)mZs$AmX_pCo^V@!v(O14HdHZ%&3@-Bc#*_5Pq;0j2mt6~ B9R&aY delta 65 zcmZ4TlX=Nc<_#~8a|I=4rljT>TAG_oo^V@!v(O14HdHZ%&3@-Bc#*_5Pq;0j2mpe; B8GZl& diff --git a/go.mod b/go.mod index d0ec1808..dde18546 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/huandu/xstrings v1.0.0 // indirect github.com/imdario/mergo v0.3.4 // indirect github.com/mwitkow/go-proto-validators v0.3.2 - github.com/Raiden1974/protokit v0.2.0 + github.com/pseudomuto/protokit v0.2.0 github.com/stretchr/testify v1.6.1 google.golang.org/api v0.58.0 google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4 diff --git a/go.sum b/go.sum index bd1e0c76..93e369a0 100644 --- a/go.sum +++ b/go.sum @@ -182,8 +182,8 @@ github.com/mwitkow/go-proto-validators v0.3.2/go.mod h1:ej0Qp0qMgHN/KtDyUt+Q1/tA github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/Raiden1974/protokit v0.2.0 h1:hlnBDcy3YEDXH7kc9gV+NLaN0cDzhDvD1s7Y6FZ8RpM= -github.com/Raiden1974/protokit v0.2.0/go.mod h1:2PdH30hxVHsup8KpBTOXTBeMVhJZVio3Q8ViKSAXT0Q= +github.com/pseudomuto/protokit v0.2.0 h1:hlnBDcy3YEDXH7kc9gV+NLaN0cDzhDvD1s7Y6FZ8RpM= +github.com/pseudomuto/protokit v0.2.0/go.mod h1:2PdH30hxVHsup8KpBTOXTBeMVhJZVio3Q8ViKSAXT0Q= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= diff --git a/plugin.go b/plugin.go index 39f2c86b..bc769016 100644 --- a/plugin.go +++ b/plugin.go @@ -8,9 +8,9 @@ import ( "regexp" "strings" - "github.com/Raiden1974/protokit" "github.com/golang/protobuf/proto" plugin_go "github.com/golang/protobuf/protoc-gen-go/plugin" + "github.com/pseudomuto/protokit" ) // PluginOptions encapsulates options for the plugin. The type of renderer, template file, and the name of the output @@ -26,7 +26,7 @@ type PluginOptions struct { // SupportedFeatures describes a flag setting for supported features. var SupportedFeatures = uint64(plugin_go.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) -// Plugin describes a protoc code generate plugin. It's an implementation of Plugin from github.com/Raiden1974/protokit +// Plugin describes a protoc code generate plugin. It's an implementation of Plugin from github.com/pseudomuto/protokit type Plugin struct{} // Generate compiles the documentation and generates the CodeGeneratorResponse to send back to protoc. It does this diff --git a/plugin_test.go b/plugin_test.go index 01740e3b..269f69bb 100644 --- a/plugin_test.go +++ b/plugin_test.go @@ -5,8 +5,8 @@ import ( "testing" . "github.com/Raiden1974/protoc-gen-doc" - "github.com/Raiden1974/protokit/utils" plugin_go "github.com/golang/protobuf/protoc-gen-go/plugin" + "github.com/pseudomuto/protokit/utils" "github.com/stretchr/testify/require" ) diff --git a/renderer_test.go b/renderer_test.go index ef8b7c5a..42eb2e0a 100644 --- a/renderer_test.go +++ b/renderer_test.go @@ -4,8 +4,8 @@ import ( "os" "testing" - "github.com/Raiden1974/protokit" - "github.com/Raiden1974/protokit/utils" + "github.com/pseudomuto/protokit" + "github.com/pseudomuto/protokit/utils" "github.com/stretchr/testify/require" ) diff --git a/template.go b/template.go index 9ab2bade..01de0492 100644 --- a/template.go +++ b/template.go @@ -7,8 +7,8 @@ import ( "strings" "github.com/Raiden1974/protoc-gen-doc/extensions" - "github.com/Raiden1974/protokit" "github.com/golang/protobuf/protoc-gen-go/descriptor" + "github.com/pseudomuto/protokit" ) // Template is a type for encapsulating all the parsed files, messages, fields, enums, services, extensions, etc. into diff --git a/template_test.go b/template_test.go index e2f57bda..16330177 100644 --- a/template_test.go +++ b/template_test.go @@ -5,10 +5,10 @@ import ( "testing" "github.com/Raiden1974/protoc-gen-doc/extensions" - "github.com/Raiden1974/protokit" - "github.com/Raiden1974/protokit/utils" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/protoc-gen-go/descriptor" + "github.com/pseudomuto/protokit" + "github.com/pseudomuto/protokit/utils" "github.com/stretchr/testify/require" ) diff --git a/thirdparty/generate.go b/thirdparty/generate.go index 9321d512..0e758dd7 100644 --- a/thirdparty/generate.go +++ b/thirdparty/generate.go @@ -6,5 +6,5 @@ package thirdparty //go:generate mkdir -p github.com/mwitkow/go-proto-validators //go:generate curl -fsSL https://github.com/mwitkow/go-proto-validators/raw/master/validator.proto -o github.com/mwitkow/go-proto-validators/validator.proto -//go:generate mkdir -p github.com/Raiden1974/protokit/fixtures -//go:generate curl -fsSL https://github.com/Raiden1974/protokit/raw/master/fixtures/extend.proto -o github.com/Raiden1974/protokit/fixtures/extend.proto +//go:generate mkdir -p github.com/pseudomuto/protokit/fixtures +//go:generate curl -fsSL https://github.com/pseudomuto/protokit/raw/master/fixtures/extend.proto -o github.com/pseudomuto/protokit/fixtures/extend.proto From 5a7abd78d620aa01f0f8e63d2e977088ea817dcf Mon Sep 17 00:00:00 2001 From: Denis Borisov Date: Thu, 26 Jan 2023 10:40:09 +0300 Subject: [PATCH 4/6] add extension for field behavior --- .github/workflows/release.yaml | 2 +- .goreleaser.yaml | 8 ++--- CHANGELOG.md | 34 +++++++++--------- CONTRIBUTING.md | 2 +- LICENSE.md | 2 +- Makefile | 4 +-- README.md | 34 +++++++++--------- build.gradle | 16 ++++----- cmd/protoc-gen-doc/flags.go | 4 +-- cmd/protoc-gen-doc/main.go | 11 +++--- doc.go | 2 +- examples/gradle/build.gradle | 2 +- .../envoyproxy_validate.go | 2 +- .../envoyproxy_validate_test.go | 3 +- .../google_api_field_behavior.go | 25 ++++++++++--- .../google_api_field_behavior_test.go | 20 ++++++++++- extensions/google_api_http/google_api_http.go | 2 +- .../google_api_http/google_api_http_test.go | 2 +- extensions/lyft_validate/alias.go | 2 +- extensions/validator_field/validator_field.go | 2 +- .../validator_field/validator_field_test.go | 2 +- filters_test.go | 2 +- fixtures/Booking.proto | 16 ++++----- fixtures/Vehicle.proto | 14 ++++---- fixtures/fileset.pb | Bin 64676 -> 64676 bytes go.mod | 2 +- plugin_test.go | 1 - renderer_test.go | 33 +++++++++-------- template.go | 8 ++++- template_test.go | 30 +++++++++++----- .../pseudomuto/protokit/fixtures/extend.proto | 2 +- 31 files changed, 173 insertions(+), 116 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 21dac8d1..446a0399 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -12,7 +12,7 @@ jobs: - name: Login to Docker Hub uses: docker/login-action@v1 with: - username: Raiden1974 + username: pseudomuto password: ${{ secrets.DOCKER_TOKEN }} - name: Checkout uses: actions/checkout@v2 diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 4bbceab2..a48fb053 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -18,10 +18,10 @@ builds: dockers: - image_templates: - - Raiden1974/{{.ProjectName}}:latest - - Raiden1974/{{.ProjectName}}:{{.Version}} - - Raiden1974/{{.ProjectName}}:{{.Major}} - - Raiden1974/{{.ProjectName}}:{{.Major}}.{{.Minor}} + - pseudomuto/{{.ProjectName}}:latest + - pseudomuto/{{.ProjectName}}:{{.Version}} + - pseudomuto/{{.ProjectName}}:{{.Major}} + - pseudomuto/{{.ProjectName}}:{{.Major}}.{{.Minor}} build_flag_templates: - "--pull" - "--label=org.opencontainers.image.created={{.Date}}" diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b4d77cb..36f2fc39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,52 +5,52 @@ All noteworthy changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) (as of Feb 2018) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [Unreleased](https://github.com/Raiden1974/protoc-gen-doc/compare/v1.5.0...master) +## [Unreleased](https://github.com/pseudomuto/protoc-gen-doc/compare/v1.5.0...master) _**CHANGELOG is now available with each release rather than in this file**_ ### Changed -* Escape special characters in markdown anchors [#460](https://github.com/Raiden1974/protoc-gen-doc/pull/460) -* Bump go to 1.17, protoc to 3.18.1, and leverage go:embed [#461](https://github.com/Raiden1974/protoc-gen-doc/pull/461) +* Escape special characters in markdown anchors [#460](https://github.com/pseudomuto/protoc-gen-doc/pull/460) +* Bump go to 1.17, protoc to 3.18.1, and leverage go:embed [#461](https://github.com/pseudomuto/protoc-gen-doc/pull/461) -## [v1.5.0](https://github.com/Raiden1974/protoc-gen-doc/compare/v1.4.1...v1.5.0) +## [v1.5.0](https://github.com/pseudomuto/protoc-gen-doc/compare/v1.4.1...v1.5.0) -* Add `source_relative` flag [#450](https://github.com/Raiden1974/protoc-gen-doc/pull/450) +* Add `source_relative` flag [#450](https://github.com/pseudomuto/protoc-gen-doc/pull/450) -## [v1.4.1](https://github.com/Raiden1974/protoc-gen-doc/compare/v1.3.2...v1.4.1) +## [v1.4.1](https://github.com/pseudomuto/protoc-gen-doc/compare/v1.3.2...v1.4.1) -* Add support for OneOf in templates [#436](https://github.com/Raiden1974/protoc-gen-doc/pull/436) -* Note deprecated fields in HTML, Markdown, and Docbook outputs [#426](https://github.com/Raiden1974/protoc-gen-doc/pull/426) +* Add support for OneOf in templates [#436](https://github.com/pseudomuto/protoc-gen-doc/pull/436) +* Note deprecated fields in HTML, Markdown, and Docbook outputs [#426](https://github.com/pseudomuto/protoc-gen-doc/pull/426) * Tidy up modules -## [v1.3.2](https://github.com/Raiden1974/protoc-gen-doc/compare/v1.3.1...v1.3.2) - May 7, 2020 +## [v1.3.2](https://github.com/pseudomuto/protoc-gen-doc/compare/v1.3.1...v1.3.2) - May 7, 2020 ### Changed -* Stripped unnecessary whitespace from markdown templates [#410](https://github.com/Raiden1974/protoc-gen-doc/pull/410) +* Stripped unnecessary whitespace from markdown templates [#410](https://github.com/pseudomuto/protoc-gen-doc/pull/410) * Renamed `lyft_validate` extension to `envoyproxy_validate` - [#392](https://github.com/Raiden1974/protoc-gen-doc/pull/392) + [#392](https://github.com/pseudomuto/protoc-gen-doc/pull/392) * Fixed `envoyproxy_validate` rules with slice values such as `in` and `not_in` - [#392](https://github.com/Raiden1974/protoc-gen-doc/pull/392) + [#392](https://github.com/pseudomuto/protoc-gen-doc/pull/392) -## [v1.3.1](https://github.com/Raiden1974/protoc-gen-doc/compare/v1.3.0...v1.3.1) - March 3, 2020 +## [v1.3.1](https://github.com/pseudomuto/protoc-gen-doc/compare/v1.3.0...v1.3.1) - March 3, 2020 ### Changed * Switched from dep to go modules -## [v1.3.0](https://github.com/Raiden1974/protoc-gen-doc/compare/v1.2.0...v1.3.0) - April 15, 2019 +## [v1.3.0](https://github.com/pseudomuto/protoc-gen-doc/compare/v1.2.0...v1.3.0) - April 15, 2019 ### Added -* Support for options and extended options in files, services, methods, enums, enum values, messages and fields [#376](https://github.com/Raiden1974/protoc-gen-doc/pull/376) +* Support for options and extended options in files, services, methods, enums, enum values, messages and fields [#376](https://github.com/pseudomuto/protoc-gen-doc/pull/376) ### Changed ### Fixed -## [v1.2.0](https://github.com/Raiden1974/protoc-gen-doc/compare/v1.1.0...v1.2.0) - March 13, 2019 +## [v1.2.0](https://github.com/pseudomuto/protoc-gen-doc/compare/v1.1.0...v1.2.0) - March 13, 2019 ### Added @@ -69,7 +69,7 @@ _**CHANGELOG is now available with each release rather than in this file**_ * Markdown template was incorrectly links response types to request types * Markdown template anchor tags were self-closing (invalid). -## [v1.1.0](https://github.com/Raiden1974/protoc-gen-doc/compare/v1.0.0...v1.1.0) - March 13, 2018 +## [v1.1.0](https://github.com/pseudomuto/protoc-gen-doc/compare/v1.0.0...v1.1.0) - March 13, 2018 ### Added diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1d8de0f6..775bb5f2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,7 +19,7 @@ ensures that you'll only be testing the public interface. Here are some general guidelines for making PRs for this repo. -1. [Fork this repo](https://github.com/Raiden1974/protoc-gen-doc/fork). +1. [Fork this repo](https://github.com/pseudomuto/protoc-gen-doc/fork). 1. Make a branch off of master (`git checkout -b `). 1. Make focused commits with descriptive messages. 1. Add tests that fail without your code, and pass with it. diff --git a/LICENSE.md b/LICENSE.md index 6009bead..597ec527 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 David Muto (Raiden1974) +Copyright (c) 2022 David Muto (pseudomuto) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Makefile b/Makefile index 7f82f56b..5b4d6903 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ DOCKER_CMD=docker run --rm \ -v $(PWD)/thirdparty/github.com/mwitkow:/usr/include/github.com/mwitkow:ro \ -v $(PWD)/thirdparty/github.com/envoyproxy:/usr/include/github.com/envoyproxy:ro \ -v $(PWD)/tmp/googleapis/google/api:/usr/include/google/api:ro \ - Raiden1974/protoc-gen-doc:latest + pseudomuto/protoc-gen-doc:latest BOLD = \033[1m CLEAR = \033[0m @@ -48,7 +48,7 @@ build/examples: bin/protoc build tmp/googleapis examples/proto/*.proto examples/ ##@: Dev dev/docker: bin/protoc tmp/googleapis release/snapshot ## Run bash in the docker container - @docker run --rm -it --entrypoint /bin/bash Raiden1974/protoc-gen-doc:latest + @docker run --rm -it --entrypoint /bin/bash pseudomuto/protoc-gen-doc:latest ##@: Test diff --git a/README.md b/README.md index f5bc463b..2bdc8587 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,12 @@ It supports proto2 and proto3, and can handle having both in the same context (s ## Installation -There is a Docker image available (`docker pull Raiden1974/protoc-gen-doc`) that has everything you need to generate +There is a Docker image available (`docker pull pseudomuto/protoc-gen-doc`) that has everything you need to generate documentation from your protos. If you'd like to install this locally, you can `go get` it. -`go get -u github.com/Raiden1974/protoc-gen-doc/cmd/protoc-gen-doc` +`go get -u github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc` Alternatively, you can download a pre-built release for your platform from the [releases][] page. @@ -47,7 +47,7 @@ You could generate HTML docs for the examples by running the following: docker run --rm \ -v $(pwd)/examples/doc:/out \ -v $(pwd)/examples/proto:/protos \ - Raiden1974/protoc-gen-doc + pseudomuto/protoc-gen-doc ``` By default HTML documentation is generated in `/out/index.html` for all `.proto` files in the `/protos` volume. This can @@ -59,7 +59,7 @@ For example, to generate Markdown for all the examples: docker run --rm \ -v $(pwd)/examples/doc:/out \ -v $(pwd)/examples/proto:/protos \ - Raiden1974/protoc-gen-doc --doc_opt=markdown,docs.md + pseudomuto/protoc-gen-doc --doc_opt=markdown,docs.md ``` You can also generate documentation for a single file. This can be done by passing the file(s) to the command: @@ -68,7 +68,7 @@ You can also generate documentation for a single file. This can be done by passi docker run --rm \ -v $(pwd)/examples/doc:/out \ -v $(pwd)/examples/proto:/protos \ - Raiden1974/protoc-gen-doc --doc_opt=markdown,docs.md Booking.proto [OPTIONALLY LIST MORE FILES] + pseudomuto/protoc-gen-doc --doc_opt=markdown,docs.md Booking.proto [OPTIONALLY LIST MORE FILES] ``` You can also exclude proto files that match specific path expressions. This is done by passing a second option delimited @@ -78,7 +78,7 @@ by `:`. For example, you can pass any number of comma separated patterns as the docker run --rm \ -v $(pwd)/examples/doc:/out \ -v $(pwd)/examples/proto:/protos \ - Raiden1974/protoc-gen-doc --doc_opt=:google/*,somepath/* + pseudomuto/protoc-gen-doc --doc_opt=:google/*,somepath/* ``` _**Remember**_: Paths should be from within the container, not the host! @@ -191,17 +191,17 @@ Check out the `examples` task in the [Makefile](Makefile) to see how these were https://golang.org/pkg/text/template/ "Template - The Go Programming Language" [custom]: - https://github.com/Raiden1974/protoc-gen-doc/wiki/Custom-Templates + https://github.com/pseudomuto/protoc-gen-doc/wiki/Custom-Templates "Custom templates instructions" [html_preview]: - https://rawgit.com/Raiden1974/protoc-gen-doc/master/examples/doc/example.html + https://rawgit.com/pseudomuto/protoc-gen-doc/master/examples/doc/example.html "HTML Example Output" -[codecov-svg]: https://codecov.io/gh/Raiden1974/protoc-gen-doc/branch/master/graph/badge.svg -[codecov-url]: https://codecov.io/gh/Raiden1974/protoc-gen-doc -[godoc-svg]: https://godoc.org/github.com/Raiden1974/protoc-gen-doc?status.svg -[godoc-url]: https://godoc.org/github.com/Raiden1974/protoc-gen-doc -[goreport-svg]: https://goreportcard.com/badge/github.com/Raiden1974/protoc-gen-doc -[goreport-url]: https://goreportcard.com/report/github.com/Raiden1974/protoc-gen-doc -[ci-svg]: https://github.com/Raiden1974/protoc-gen-doc/actions/workflows/ci.yaml/badge.svg?branch=master -[ci-url]: https://github.com/Raiden1974/protoc-gen-doc/actions/workflows/ci.yaml -[releases]: https://github.com/Raiden1974/protoc-gen-doc/releases +[codecov-svg]: https://codecov.io/gh/pseudomuto/protoc-gen-doc/branch/master/graph/badge.svg +[codecov-url]: https://codecov.io/gh/pseudomuto/protoc-gen-doc +[godoc-svg]: https://godoc.org/github.com/pseudomuto/protoc-gen-doc?status.svg +[godoc-url]: https://godoc.org/github.com/pseudomuto/protoc-gen-doc +[goreport-svg]: https://goreportcard.com/badge/github.com/pseudomuto/protoc-gen-doc +[goreport-url]: https://goreportcard.com/report/github.com/pseudomuto/protoc-gen-doc +[ci-svg]: https://github.com/pseudomuto/protoc-gen-doc/actions/workflows/ci.yaml/badge.svg?branch=master +[ci-url]: https://github.com/pseudomuto/protoc-gen-doc/actions/workflows/ci.yaml +[releases]: https://github.com/pseudomuto/protoc-gen-doc/releases diff --git a/build.gradle b/build.gradle index 860d6f8b..10b7d2fd 100644 --- a/build.gradle +++ b/build.gradle @@ -3,12 +3,12 @@ plugins { id 'signing' } -group = 'io.github.Raiden1974' +group = 'io.github.pseudomuto' publishing { publications { maven(MavenPublication) { - groupId = 'io.github.Raiden1974' + groupId = 'io.github.pseudomuto' artifactId = rootProject.name version = System.getenv("GITHUB_REF_NAME") // Strip "v" from version number @@ -19,24 +19,24 @@ publishing { pom { name = groupId + ':' + rootProject.name description = 'This is a documentation generator plugin for the Google Protocol Buffers compiler (protoc). The plugin can generate HTML, JSON, DocBook, and Markdown documentation from comments in your .proto files.' - url = 'https://github.com/Raiden1974/protoc-gen-doc' + url = 'https://github.com/pseudomuto/protoc-gen-doc' licenses { license { name = 'MIT License' - url = 'https://github.com/Raiden1974/protoc-gen-doc/blob/master/LICENSE.md' + url = 'https://github.com/pseudomuto/protoc-gen-doc/blob/master/LICENSE.md' } } developers { developer { - id = 'Raiden1974' + id = 'pseudomuto' name = 'David Muto' email = 'david.muto@gmail.com' } } scm { - connection = 'scm:git:git@github.com:Raiden1974/protoc-gen-doc.git' - developerConnection = 'scm:git:git@github.com:Raiden1974/protoc-gen-doc.git' - url = 'https://github.com/Raiden1974/protoc-gen-doc' + connection = 'scm:git:git@github.com:pseudomuto/protoc-gen-doc.git' + developerConnection = 'scm:git:git@github.com:pseudomuto/protoc-gen-doc.git' + url = 'https://github.com/pseudomuto/protoc-gen-doc' } } diff --git a/cmd/protoc-gen-doc/flags.go b/cmd/protoc-gen-doc/flags.go index 1b8d2ff0..90d54c94 100644 --- a/cmd/protoc-gen-doc/flags.go +++ b/cmd/protoc-gen-doc/flags.go @@ -5,7 +5,7 @@ import ( "fmt" "io" - gendoc "github.com/Raiden1974/protoc-gen-doc" + gendoc "github.com/pseudomuto/protoc-gen-doc" ) const helpMessage = ` @@ -24,7 +24,7 @@ protoc --doc_out=. --doc_opt=custom.tmpl,docs.txt protos/*.proto EXAMPLE: Generate docs relative to source protos protoc --doc_out=. --doc_opt=html,index.html,source_relative protos/*.proto -See https://github.com/Raiden1974/protoc-gen-doc for more details. +See https://github.com/pseudomuto/protoc-gen-doc for more details. ` // Version returns the currently running version of protoc-gen-doc diff --git a/cmd/protoc-gen-doc/main.go b/cmd/protoc-gen-doc/main.go index cffbaa36..fabfeebc 100644 --- a/cmd/protoc-gen-doc/main.go +++ b/cmd/protoc-gen-doc/main.go @@ -10,7 +10,7 @@ // // protoc --doc_out=. --doc_opt=custom.tmpl,docs.txt protos/*.proto // -// For more details, check out the README at https://github.com/Raiden1974/protoc-gen-doc +// For more details, check out the README at https://github.com/pseudomuto/protoc-gen-doc package main import ( @@ -19,10 +19,11 @@ import ( "log" "os" - gendoc "github.com/Raiden1974/protoc-gen-doc" - _ "github.com/Raiden1974/protoc-gen-doc/extensions/google_api_http" // imported for side effects - _ "github.com/Raiden1974/protoc-gen-doc/extensions/lyft_validate" // imported for side effects - _ "github.com/Raiden1974/protoc-gen-doc/extensions/validator_field" // imported for side effects + gendoc "github.com/pseudomuto/protoc-gen-doc" + _ "github.com/pseudomuto/protoc-gen-doc/extensions/google_api_field_behavior" // imported for side effects + _ "github.com/pseudomuto/protoc-gen-doc/extensions/google_api_http" // imported for side effects + _ "github.com/pseudomuto/protoc-gen-doc/extensions/lyft_validate" // imported for side effects + _ "github.com/pseudomuto/protoc-gen-doc/extensions/validator_field" // imported for side effects ) func main() { diff --git a/doc.go b/doc.go index 3a88370e..df9f6622 100644 --- a/doc.go +++ b/doc.go @@ -15,5 +15,5 @@ // // protoc --doc_out=. --doc_opt=custom.tmpl,docs.txt protos/*.proto // -// For more details, check out the README at https://github.com/Raiden1974/protoc-gen-doc +// For more details, check out the README at https://github.com/pseudomuto/protoc-gen-doc package gendoc diff --git a/examples/gradle/build.gradle b/examples/gradle/build.gradle index 72b6b09a..0f0a3abe 100644 --- a/examples/gradle/build.gradle +++ b/examples/gradle/build.gradle @@ -9,7 +9,7 @@ protobuf { } plugins { doc { - artifact = "io.github.Raiden1974:protoc-gen-doc:1.5.1" + artifact = "io.github.pseudomuto:protoc-gen-doc:1.5.1" } } diff --git a/extensions/envoyproxy_validate/envoyproxy_validate.go b/extensions/envoyproxy_validate/envoyproxy_validate.go index 0b6777fa..70941f65 100644 --- a/extensions/envoyproxy_validate/envoyproxy_validate.go +++ b/extensions/envoyproxy_validate/envoyproxy_validate.go @@ -5,8 +5,8 @@ import ( "reflect" "strings" - "github.com/Raiden1974/protoc-gen-doc/extensions" "github.com/envoyproxy/protoc-gen-validate/validate" + "github.com/pseudomuto/protoc-gen-doc/extensions" ) // ValidateRule represents a single validator rule from the (validate.rules) method option extension. diff --git a/extensions/envoyproxy_validate/envoyproxy_validate_test.go b/extensions/envoyproxy_validate/envoyproxy_validate_test.go index ad63c407..e4a0091d 100644 --- a/extensions/envoyproxy_validate/envoyproxy_validate_test.go +++ b/extensions/envoyproxy_validate/envoyproxy_validate_test.go @@ -3,9 +3,8 @@ package extensions_test import ( "testing" - "github.com/Raiden1974/protoc-gen-doc/extensions" - . "github.com/Raiden1974/protoc-gen-doc/extensions/lyft_validate" "github.com/envoyproxy/protoc-gen-validate/validate" + "github.com/pseudomuto/protoc-gen-doc/extensions" "github.com/stretchr/testify/require" ) diff --git a/extensions/google_api_field_behavior/google_api_field_behavior.go b/extensions/google_api_field_behavior/google_api_field_behavior.go index 0a021efd..fa3423c3 100644 --- a/extensions/google_api_field_behavior/google_api_field_behavior.go +++ b/extensions/google_api_field_behavior/google_api_field_behavior.go @@ -1,13 +1,30 @@ package extensions import ( - "fmt" - "github.com/Raiden1974/protoc-gen-doc/extensions" + "github.com/pseudomuto/protoc-gen-doc/extensions" + "google.golang.org/genproto/googleapis/api/annotations" ) +type FieldBehaviorExtension struct { + Options []string `json:"options"` +} + func init() { extensions.SetTransformer("google.api.field_behavior", func(payload interface{}) interface{} { - fmt.Printf("debug field_behavior: %+v\n", payload) - return payload + fb, ok := payload.([]annotations.FieldBehavior) + if !ok { + return nil + } + + if len(fb) == 0 { + return nil + } + + fbs := make([]string, len(fb)) + for i, behavior := range fb { + fbs[i] = behavior.String() + } + + return FieldBehaviorExtension{Options: fbs} }) } diff --git a/extensions/google_api_field_behavior/google_api_field_behavior_test.go b/extensions/google_api_field_behavior/google_api_field_behavior_test.go index aeec0fa7..af346ec5 100644 --- a/extensions/google_api_field_behavior/google_api_field_behavior_test.go +++ b/extensions/google_api_field_behavior/google_api_field_behavior_test.go @@ -1 +1,19 @@ -package extensions +package extensions_test + +import ( + "testing" + + "github.com/pseudomuto/protoc-gen-doc/extensions" + "github.com/stretchr/testify/require" + "google.golang.org/genproto/googleapis/api/annotations" +) + +func TestTransform(t *testing.T) { + behavior := []annotations.FieldBehavior{annotations.FieldBehavior_REQUIRED} + + transformed := extensions.Transform(map[string]interface{}{"google.api.field_behavior": behavior}) + require.NotEmpty(t, transformed) + + options := transformed["google.api.field_behavior"].(FieldBehaviorExtension).Options() + require.Equal(t, options, []string{annotations.FieldBehavior_REQUIRED.String()}) +} diff --git a/extensions/google_api_http/google_api_http.go b/extensions/google_api_http/google_api_http.go index 7764e654..cbc5ad14 100644 --- a/extensions/google_api_http/google_api_http.go +++ b/extensions/google_api_http/google_api_http.go @@ -3,7 +3,7 @@ package extensions import ( "net/http" - "github.com/Raiden1974/protoc-gen-doc/extensions" + "github.com/pseudomuto/protoc-gen-doc/extensions" "google.golang.org/genproto/googleapis/api/annotations" ) diff --git a/extensions/google_api_http/google_api_http_test.go b/extensions/google_api_http/google_api_http_test.go index 932e297f..c1c70f59 100644 --- a/extensions/google_api_http/google_api_http_test.go +++ b/extensions/google_api_http/google_api_http_test.go @@ -4,7 +4,7 @@ import ( "net/http" "testing" - "github.com/Raiden1974/protoc-gen-doc/extensions" + "github.com/pseudomuto/protoc-gen-doc/extensions" "github.com/stretchr/testify/require" "google.golang.org/genproto/googleapis/api/annotations" ) diff --git a/extensions/lyft_validate/alias.go b/extensions/lyft_validate/alias.go index 5c467133..985a0cf9 100644 --- a/extensions/lyft_validate/alias.go +++ b/extensions/lyft_validate/alias.go @@ -1,6 +1,6 @@ package extensions -import evp "github.com/Raiden1974/protoc-gen-doc/extensions/envoyproxy_validate" +import evp "github.com/pseudomuto/protoc-gen-doc/extensions/envoyproxy_validate" // ValidateRule represents a single validator rule from the (validate.rules) method option extension. type ValidateRule = evp.ValidateRule diff --git a/extensions/validator_field/validator_field.go b/extensions/validator_field/validator_field.go index edd61572..224e414d 100644 --- a/extensions/validator_field/validator_field.go +++ b/extensions/validator_field/validator_field.go @@ -5,10 +5,10 @@ import ( "reflect" "strings" - "github.com/Raiden1974/protoc-gen-doc/extensions" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/protoc-gen-go/descriptor" validator "github.com/mwitkow/go-proto-validators" + "github.com/pseudomuto/protoc-gen-doc/extensions" ) func init() { diff --git a/extensions/validator_field/validator_field_test.go b/extensions/validator_field/validator_field_test.go index dc9a47fd..3e89a2c8 100644 --- a/extensions/validator_field/validator_field_test.go +++ b/extensions/validator_field/validator_field_test.go @@ -3,9 +3,9 @@ package extensions_test import ( "testing" - "github.com/Raiden1974/protoc-gen-doc/extensions" "github.com/golang/protobuf/proto" validator "github.com/mwitkow/go-proto-validators" + "github.com/pseudomuto/protoc-gen-doc/extensions" "github.com/stretchr/testify/require" ) diff --git a/filters_test.go b/filters_test.go index dfc82e46..353583c4 100644 --- a/filters_test.go +++ b/filters_test.go @@ -4,7 +4,7 @@ import ( html "html/template" "testing" - . "github.com/Raiden1974/protoc-gen-doc" + . "github.com/pseudomuto/protoc-gen-doc" "github.com/stretchr/testify/require" ) diff --git a/fixtures/Booking.proto b/fixtures/Booking.proto index 087064a8..516bf8ef 100644 --- a/fixtures/Booking.proto +++ b/fixtures/Booking.proto @@ -10,17 +10,17 @@ import "github.com/pseudomuto/protokit/fixtures/extend.proto"; package com.example; -option (com.Raiden1974.protokit.v1.extend_file) = true; +option (com.pseudomuto.protokit.v1.extend_file) = true; /** * Service for handling vehicle bookings. */ service BookingService { - option (com.Raiden1974.protokit.v1.extend_service) = true; + option (com.pseudomuto.protokit.v1.extend_service) = true; /// Used to book a vehicle. Pass in a Booking and a BookingStatus will be returned. rpc BookVehicle (Booking) returns (BookingStatus) { - option (com.Raiden1974.protokit.v1.extend_method) = true; + option (com.pseudomuto.protokit.v1.extend_method) = true; }; } @@ -36,7 +36,7 @@ message BookingStatus { BAD_REQUEST = 400; // BAD result. } - required int32 id = 1 [(com.Raiden1974.protokit.v1.extend_field) = true]; /// Unique booking status ID. + required int32 id = 1 [(com.pseudomuto.protokit.v1.extend_field) = true]; /// Unique booking status ID. required string description = 2; /// Booking status description. E.g. "Active". optional StatusCode status_code = 3; /// The status of this status? @@ -52,10 +52,10 @@ extend BookingStatus { * The type of booking. */ enum BookingType { - option (com.Raiden1974.protokit.v1.extend_enum) = true; + option (com.pseudomuto.protokit.v1.extend_enum) = true; IMMEDIATE = 100; // Immediate booking. - FUTURE = 101 [(com.Raiden1974.protokit.v1.extend_enum_value) = true]; // Future booking. + FUTURE = 101 [(com.pseudomuto.protokit.v1.extend_enum_value) = true]; // Future booking. } /** @@ -64,7 +64,7 @@ enum BookingType { * Vehicles are some cool shit. But drive carefully! */ message Booking { - option (com.Raiden1974.protokit.v1.extend_message) = true; + option (com.pseudomuto.protokit.v1.extend_message) = true; required int32 vehicle_id = 1; /// ID of booked vehicle. required int32 customer_id = 2; /// Customer that booked the vehicle. @@ -74,7 +74,7 @@ message Booking { required bool confirmation_sent = 4; /** Has payment been received? */ - optional bool payment_received = 5 [default = false, (com.Raiden1974.protokit.v1.extend_field) = true]; + optional bool payment_received = 5 [default = false, (com.pseudomuto.protokit.v1.extend_field) = true]; optional string color_preference = 6 [deprecated=true]; // Color preference of the customer. diff --git a/fixtures/Vehicle.proto b/fixtures/Vehicle.proto index 8ddc451f..303e3748 100644 --- a/fixtures/Vehicle.proto +++ b/fixtures/Vehicle.proto @@ -7,7 +7,7 @@ import "github.com/pseudomuto/protokit/fixtures/extend.proto"; package com.example; -option (com.Raiden1974.protokit.v1.extend_file) = true; +option (com.pseudomuto.protokit.v1.extend_file) = true; /** * The vehicle service. @@ -15,7 +15,7 @@ option (com.Raiden1974.protokit.v1.extend_file) = true; * Manages vehicles and such... */ service VehicleService { - option (com.Raiden1974.protokit.v1.extend_service) = true; + option (com.pseudomuto.protokit.v1.extend_service) = true; // Returns the set of models. rpc GetModels(EmptyMessage) returns (stream Model); @@ -26,7 +26,7 @@ service VehicleService { * Looks up a vehicle by id. */ rpc GetVehicle(FindVehicleById) returns (Vehicle) { - option (com.Raiden1974.protokit.v1.extend_method) = true; + option (com.pseudomuto.protokit.v1.extend_method) = true; }; } @@ -69,10 +69,10 @@ message ExcludedMessage { // The type of model. enum Type { - option (com.Raiden1974.protokit.v1.extend_enum) = true; + option (com.pseudomuto.protokit.v1.extend_enum) = true; COUPE = 0; // The type is coupe. - SEDAN = 1 [(com.Raiden1974.protokit.v1.extend_enum_value) = true]; // The type is sedan. + SEDAN = 1 [(com.pseudomuto.protokit.v1.extend_enum_value) = true]; // The type is sedan. } /** @@ -99,7 +99,7 @@ message Manufacturer { * Represents a vehicle that can be hired. */ message Vehicle { - option (com.Raiden1974.protokit.v1.extend_message) = true; + option (com.pseudomuto.protokit.v1.extend_message) = true; /** * Represents a vehicle category. E.g. "Sedan" or "Truck". @@ -128,7 +128,7 @@ message Vehicle { int32 id = 1; /** Unique vehicle ID. */ Model model = 2; /** Vehicle model. */ - string reg_number = 3 [(com.Raiden1974.protokit.v1.extend_field) = true]; /** Vehicle registration number. */ + string reg_number = 3 [(com.pseudomuto.protokit.v1.extend_field) = true]; /** Vehicle registration number. */ sint32 mileage = 4; /** Current vehicle mileage, if known. */ Category category = 5; /** Vehicle category. */ Engine engine = 9; /** Vehicle engine. */ diff --git a/fixtures/fileset.pb b/fixtures/fileset.pb index 68b8404e87ee80fab1d3fc853566fbb51580bd36..9ce9af9ba77a611301443d31110e53fb9781ff92 100644 GIT binary patch delta 25 hcmZ4TlX=Nc<_!`jxC)9>OH=Z5OH1-ME1hUE0RWs93xfav delta 25 hcmZ4TlX=Nc<_!`jxPlThQ&RH`EzM0fE1hUE0RWM>3RVCB diff --git a/go.mod b/go.mod index dde18546..dc25f7ac 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/Raiden1974/protoc-gen-doc +module github.com/pseudomuto/protoc-gen-doc go 1.17 diff --git a/plugin_test.go b/plugin_test.go index 269f69bb..7b906c37 100644 --- a/plugin_test.go +++ b/plugin_test.go @@ -4,7 +4,6 @@ import ( "regexp" "testing" - . "github.com/Raiden1974/protoc-gen-doc" plugin_go "github.com/golang/protobuf/protoc-gen-go/plugin" "github.com/pseudomuto/protokit/utils" "github.com/stretchr/testify/require" diff --git a/renderer_test.go b/renderer_test.go index 42eb2e0a..75d17923 100644 --- a/renderer_test.go +++ b/renderer_test.go @@ -7,48 +7,51 @@ import ( "github.com/pseudomuto/protokit" "github.com/pseudomuto/protokit/utils" "github.com/stretchr/testify/require" + + gendoc "github.com/pseudomuto/protoc-gen-doc" ) func TestRenderers(t *testing.T) { set, err := utils.LoadDescriptorSet("fixtures", "fileset.pb") require.NoError(t, err) - os.Mkdir("./tmp", os.ModePerm) + err = os.Mkdir("./tmp", os.ModePerm) + require.NoError(t, err) req := utils.CreateGenRequest(set, "Booking.proto", "Vehicle.proto") result := protokit.ParseCodeGenRequest(req) - template := NewTemplate(result) + template := gendoc.NewTemplate(result) - for _, r := range []RenderType{ - RenderTypeDocBook, - RenderTypeHTML, - RenderTypeJSON, - RenderTypeMarkdown, + for _, r := range []gendoc.RenderType{ + gendoc.RenderTypeDocBook, + gendoc.RenderTypeHTML, + gendoc.RenderTypeJSON, + gendoc.RenderTypeMarkdown, } { - _, err := RenderTemplate(r, template, "") + _, err := gendoc.RenderTemplate(r, template, "") require.NoError(t, err) } } func TestNewRenderType(t *testing.T) { - expected := []RenderType{ - RenderTypeDocBook, - RenderTypeHTML, - RenderTypeJSON, - RenderTypeMarkdown, + expected := []gendoc.RenderType{ + gendoc.RenderTypeDocBook, + gendoc.RenderTypeHTML, + gendoc.RenderTypeJSON, + gendoc.RenderTypeMarkdown, } supplied := []string{"docbook", "html", "json", "markdown"} for idx, input := range supplied { - rt, err := NewRenderType(input) + rt, err := gendoc.NewRenderType(input) require.Nil(t, err) require.Equal(t, expected[idx], rt) } } func TestNewRenderTypeUnknown(t *testing.T) { - rt, err := NewRenderType("/some/template.tmpl") + rt, err := gendoc.NewRenderType("/some/template.tmpl") require.Zero(t, rt) require.Error(t, err) } diff --git a/template.go b/template.go index 01de0492..6d647401 100644 --- a/template.go +++ b/template.go @@ -6,8 +6,8 @@ import ( "sort" "strings" - "github.com/Raiden1974/protoc-gen-doc/extensions" "github.com/golang/protobuf/protoc-gen-go/descriptor" + "github.com/pseudomuto/protoc-gen-doc/extensions" "github.com/pseudomuto/protokit" ) @@ -38,6 +38,7 @@ func NewTemplate(descs []*protokit.FileDescriptor) *Template { Messages: make(orderedMessages, 0, len(f.Messages)), Services: make(orderedServices, 0, len(f.Services)), Options: mergeOptions(extractOptions(f.GetOptions()), extensions.Transform(f.OptionExtensions)), + Syntax: f.GetSyntax(), } for _, e := range f.Enums { @@ -141,6 +142,8 @@ type File struct { Services orderedServices `json:"services"` Options map[string]interface{} `json:"options,omitempty"` + + Syntax string `json:"syntax,omitempty"` } // Option returns the named option. @@ -236,6 +239,8 @@ type MessageField struct { DefaultValue string `json:"defaultValue"` Options map[string]interface{} `json:"options,omitempty"` + + Number int `json:"number,omitempty"` } // Option returns the named option. @@ -482,6 +487,7 @@ func parseMessageField(pf *protokit.FieldDescriptor, oneofDecls []*descriptor.On DefaultValue: pf.GetDefaultValue(), Options: mergeOptions(extractOptions(pf.GetOptions()), extensions.Transform(pf.OptionExtensions)), IsOneof: pf.OneofIndex != nil, + Number: int(pf.GetNumber()), } if m.IsOneof { diff --git a/template_test.go b/template_test.go index 16330177..7cdb117b 100644 --- a/template_test.go +++ b/template_test.go @@ -4,9 +4,9 @@ import ( "os" "testing" - "github.com/Raiden1974/protoc-gen-doc/extensions" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/protoc-gen-go/descriptor" + "github.com/pseudomuto/protoc-gen-doc/extensions" "github.com/pseudomuto/protokit" "github.com/pseudomuto/protokit/utils" "github.com/stretchr/testify/require" @@ -47,7 +47,7 @@ var E_ExtendFile = &proto.ExtensionDesc{ ExtendedType: (*descriptor.FileOptions)(nil), ExtensionType: (*bool)(nil), Field: 20000, - Name: "com.Raiden1974.protokit.v1.extend_file", + Name: "com.pseudomuto.protokit.v1.extend_file", Tag: "varint,20000,opt,name=extend_file,json=extendFile", Filename: "extend.proto", } @@ -56,7 +56,7 @@ var E_ExtendService = &proto.ExtensionDesc{ ExtendedType: (*descriptor.ServiceOptions)(nil), ExtensionType: (*bool)(nil), Field: 20000, - Name: "com.Raiden1974.protokit.v1.extend_service", + Name: "com.pseudomuto.protokit.v1.extend_service", Tag: "varint,20000,opt,name=extend_service,json=extendService", Filename: "extend.proto", } @@ -65,7 +65,7 @@ var E_ExtendMethod = &proto.ExtensionDesc{ ExtendedType: (*descriptor.MethodOptions)(nil), ExtensionType: (*bool)(nil), Field: 20000, - Name: "com.Raiden1974.protokit.v1.extend_method", + Name: "com.pseudomuto.protokit.v1.extend_method", Tag: "varint,20000,opt,name=extend_method,json=extendMethod", Filename: "extend.proto", } @@ -74,7 +74,7 @@ var E_ExtendEnum = &proto.ExtensionDesc{ ExtendedType: (*descriptor.EnumOptions)(nil), ExtensionType: (*bool)(nil), Field: 20000, - Name: "com.Raiden1974.protokit.v1.extend_enum", + Name: "com.pseudomuto.protokit.v1.extend_enum", Tag: "varint,20000,opt,name=extend_enum,json=extendEnum", Filename: "extend.proto", } @@ -83,7 +83,7 @@ var E_ExtendEnumValue = &proto.ExtensionDesc{ ExtendedType: (*descriptor.EnumValueOptions)(nil), ExtensionType: (*bool)(nil), Field: 20000, - Name: "com.Raiden1974.protokit.v1.extend_enum_value", + Name: "com.pseudomuto.protokit.v1.extend_enum_value", Tag: "varint,20000,opt,name=extend_enum_value,json=extendEnumValue", Filename: "extend.proto", } @@ -92,7 +92,7 @@ var E_ExtendMessage = &proto.ExtensionDesc{ ExtendedType: (*descriptor.MessageOptions)(nil), ExtensionType: (*bool)(nil), Field: 20000, - Name: "com.Raiden1974.protokit.v1.extend_message", + Name: "com.pseudomuto.protokit.v1.extend_message", Tag: "varint,20000,opt,name=extend_message,json=extendMessage", Filename: "extend.proto", } @@ -101,7 +101,7 @@ var E_ExtendField = &proto.ExtensionDesc{ ExtendedType: (*descriptor.FieldOptions)(nil), ExtensionType: (*bool)(nil), Field: 20000, - Name: "com.Raiden1974.protokit.v1.extend_field", + Name: "com.pseudomuto.protokit.v1.extend_field", Tag: "varint,20000,opt,name=extend_field,json=extendField", Filename: "extend.proto", } @@ -137,6 +137,7 @@ func TestFileProperties(t *testing.T) { require.True(t, bookingFile.HasServices) require.NotEmpty(t, bookingFile.Options) require.True(t, *bookingFile.Option(E_ExtendFile.Name).(*bool)) + require.Equal(t, "", bookingFile.Syntax) } func TestFileEnumProperties(t *testing.T) { @@ -253,6 +254,7 @@ func TestFieldProperties(t *testing.T) { require.False(t, field.IsOneof) require.NotEmpty(t, field.Options) require.True(t, *field.Option(E_ExtendField.Name).(*bool)) + require.Equal(t, 1, field.Number) field = findField("status_code", msg) require.Equal(t, "status_code", field.Name) @@ -263,6 +265,7 @@ func TestFieldProperties(t *testing.T) { require.Equal(t, "com.example.BookingStatus.StatusCode", field.FullType) require.Empty(t, field.DefaultValue) require.False(t, field.IsOneof) + require.Equal(t, 3, field.Number) field = findField("category", findMessage("Vehicle", vehicleFile)) require.Equal(t, "category", field.Name) @@ -273,6 +276,7 @@ func TestFieldProperties(t *testing.T) { require.Equal(t, "com.example.Vehicle.Category", field.FullType) require.Empty(t, field.DefaultValue) require.False(t, field.IsOneof) + require.Equal(t, 5, field.Number) field = findField("properties", findMessage("Vehicle", vehicleFile)) require.Equal(t, "properties", field.Name) @@ -283,6 +287,7 @@ func TestFieldProperties(t *testing.T) { require.Empty(t, field.DefaultValue) require.True(t, field.IsMap) require.False(t, field.IsOneof) + require.Equal(t, 7, field.Number) field = findField("rates", findMessage("Vehicle", vehicleFile)) require.Equal(t, "rates", field.Name) @@ -292,6 +297,7 @@ func TestFieldProperties(t *testing.T) { require.Equal(t, "sint32", field.FullType) require.False(t, field.IsMap) require.False(t, field.IsOneof) + require.Equal(t, 6, field.Number) field = findField("kilometers", findMessage("Vehicle", vehicleFile)) require.Equal(t, "kilometers", field.Name) @@ -302,6 +308,7 @@ func TestFieldProperties(t *testing.T) { require.False(t, field.IsMap) require.True(t, field.IsOneof) require.Equal(t, "travel", field.OneofDecl) + require.Equal(t, 8, field.Number) field = findField("human_name", findMessage("Vehicle", vehicleFile)) require.Equal(t, "human_name", field.Name) @@ -312,6 +319,7 @@ func TestFieldProperties(t *testing.T) { require.False(t, field.IsMap) require.True(t, field.IsOneof) require.Equal(t, "drivers", field.OneofDecl) + require.Equal(t, 11, field.Number) } func TestFieldPropertiesProto3(t *testing.T) { @@ -326,6 +334,7 @@ func TestFieldPropertiesProto3(t *testing.T) { require.Equal(t, "string", field.FullType) require.Empty(t, field.DefaultValue) require.Empty(t, field.Options) + require.Equal(t, 1, field.Number) field = findField("model_code", msg) require.Equal(t, "model_code", field.Name) @@ -336,6 +345,7 @@ func TestFieldPropertiesProto3(t *testing.T) { require.Equal(t, "string", field.FullType) require.Empty(t, field.DefaultValue) require.Empty(t, field.Options) + require.Equal(t, 2, field.Number) field = findField("daily_hire_rate_dollars", msg) require.Equal(t, "daily_hire_rate_dollars", field.Name) @@ -346,6 +356,7 @@ func TestFieldPropertiesProto3(t *testing.T) { require.Equal(t, "sint32", field.FullType) require.Empty(t, field.DefaultValue) require.Empty(t, field.Options) + require.Equal(t, 4, field.Number) } func TestFieldPropertiesProto3Optional(t *testing.T) { @@ -360,6 +371,7 @@ func TestFieldPropertiesProto3Optional(t *testing.T) { require.Equal(t, "string", field.FullType) require.Empty(t, field.DefaultValue) require.Empty(t, field.Options) + require.Equal(t, 1, field.Number) field = findField("name", msg) require.Equal(t, "name", field.Name) @@ -370,6 +382,7 @@ func TestFieldPropertiesProto3Optional(t *testing.T) { require.Equal(t, "string", field.FullType) require.Empty(t, field.DefaultValue) require.Empty(t, field.Options) + require.Equal(t, 2, field.Number) field = findField("ingredients", msg) require.Equal(t, "ingredients", field.Name) @@ -380,6 +393,7 @@ func TestFieldPropertiesProto3Optional(t *testing.T) { require.Equal(t, "string", field.FullType) require.Empty(t, field.DefaultValue) require.Empty(t, field.Options) + require.Equal(t, 3, field.Number) } func TestServiceProperties(t *testing.T) { diff --git a/thirdparty/github.com/pseudomuto/protokit/fixtures/extend.proto b/thirdparty/github.com/pseudomuto/protokit/fixtures/extend.proto index 96be0754..c0260241 100644 --- a/thirdparty/github.com/pseudomuto/protokit/fixtures/extend.proto +++ b/thirdparty/github.com/pseudomuto/protokit/fixtures/extend.proto @@ -2,7 +2,7 @@ syntax = "proto2"; import "google/protobuf/descriptor.proto"; -package com.Raiden1974.protokit.v1; +package com.pseudomuto.protokit.v1; /** * Extension of protobuf file options. From 2e4a2962f4306f8996836d46566ea76ca84e6eb6 Mon Sep 17 00:00:00 2001 From: Denis Borisov Date: Fri, 27 Jan 2023 09:30:52 +0300 Subject: [PATCH 5/6] revert template --- template.go | 6 ------ template_test.go | 15 +-------------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/template.go b/template.go index 6d647401..9edaac72 100644 --- a/template.go +++ b/template.go @@ -38,7 +38,6 @@ func NewTemplate(descs []*protokit.FileDescriptor) *Template { Messages: make(orderedMessages, 0, len(f.Messages)), Services: make(orderedServices, 0, len(f.Services)), Options: mergeOptions(extractOptions(f.GetOptions()), extensions.Transform(f.OptionExtensions)), - Syntax: f.GetSyntax(), } for _, e := range f.Enums { @@ -142,8 +141,6 @@ type File struct { Services orderedServices `json:"services"` Options map[string]interface{} `json:"options,omitempty"` - - Syntax string `json:"syntax,omitempty"` } // Option returns the named option. @@ -239,8 +236,6 @@ type MessageField struct { DefaultValue string `json:"defaultValue"` Options map[string]interface{} `json:"options,omitempty"` - - Number int `json:"number,omitempty"` } // Option returns the named option. @@ -487,7 +482,6 @@ func parseMessageField(pf *protokit.FieldDescriptor, oneofDecls []*descriptor.On DefaultValue: pf.GetDefaultValue(), Options: mergeOptions(extractOptions(pf.GetOptions()), extensions.Transform(pf.OptionExtensions)), IsOneof: pf.OneofIndex != nil, - Number: int(pf.GetNumber()), } if m.IsOneof { diff --git a/template_test.go b/template_test.go index 7cdb117b..717919b2 100644 --- a/template_test.go +++ b/template_test.go @@ -6,6 +6,7 @@ import ( "github.com/golang/protobuf/proto" "github.com/golang/protobuf/protoc-gen-go/descriptor" + . "github.com/pseudomuto/protoc-gen-doc" "github.com/pseudomuto/protoc-gen-doc/extensions" "github.com/pseudomuto/protokit" "github.com/pseudomuto/protokit/utils" @@ -137,7 +138,6 @@ func TestFileProperties(t *testing.T) { require.True(t, bookingFile.HasServices) require.NotEmpty(t, bookingFile.Options) require.True(t, *bookingFile.Option(E_ExtendFile.Name).(*bool)) - require.Equal(t, "", bookingFile.Syntax) } func TestFileEnumProperties(t *testing.T) { @@ -254,7 +254,6 @@ func TestFieldProperties(t *testing.T) { require.False(t, field.IsOneof) require.NotEmpty(t, field.Options) require.True(t, *field.Option(E_ExtendField.Name).(*bool)) - require.Equal(t, 1, field.Number) field = findField("status_code", msg) require.Equal(t, "status_code", field.Name) @@ -265,7 +264,6 @@ func TestFieldProperties(t *testing.T) { require.Equal(t, "com.example.BookingStatus.StatusCode", field.FullType) require.Empty(t, field.DefaultValue) require.False(t, field.IsOneof) - require.Equal(t, 3, field.Number) field = findField("category", findMessage("Vehicle", vehicleFile)) require.Equal(t, "category", field.Name) @@ -276,7 +274,6 @@ func TestFieldProperties(t *testing.T) { require.Equal(t, "com.example.Vehicle.Category", field.FullType) require.Empty(t, field.DefaultValue) require.False(t, field.IsOneof) - require.Equal(t, 5, field.Number) field = findField("properties", findMessage("Vehicle", vehicleFile)) require.Equal(t, "properties", field.Name) @@ -287,7 +284,6 @@ func TestFieldProperties(t *testing.T) { require.Empty(t, field.DefaultValue) require.True(t, field.IsMap) require.False(t, field.IsOneof) - require.Equal(t, 7, field.Number) field = findField("rates", findMessage("Vehicle", vehicleFile)) require.Equal(t, "rates", field.Name) @@ -297,7 +293,6 @@ func TestFieldProperties(t *testing.T) { require.Equal(t, "sint32", field.FullType) require.False(t, field.IsMap) require.False(t, field.IsOneof) - require.Equal(t, 6, field.Number) field = findField("kilometers", findMessage("Vehicle", vehicleFile)) require.Equal(t, "kilometers", field.Name) @@ -308,7 +303,6 @@ func TestFieldProperties(t *testing.T) { require.False(t, field.IsMap) require.True(t, field.IsOneof) require.Equal(t, "travel", field.OneofDecl) - require.Equal(t, 8, field.Number) field = findField("human_name", findMessage("Vehicle", vehicleFile)) require.Equal(t, "human_name", field.Name) @@ -319,7 +313,6 @@ func TestFieldProperties(t *testing.T) { require.False(t, field.IsMap) require.True(t, field.IsOneof) require.Equal(t, "drivers", field.OneofDecl) - require.Equal(t, 11, field.Number) } func TestFieldPropertiesProto3(t *testing.T) { @@ -334,7 +327,6 @@ func TestFieldPropertiesProto3(t *testing.T) { require.Equal(t, "string", field.FullType) require.Empty(t, field.DefaultValue) require.Empty(t, field.Options) - require.Equal(t, 1, field.Number) field = findField("model_code", msg) require.Equal(t, "model_code", field.Name) @@ -345,7 +337,6 @@ func TestFieldPropertiesProto3(t *testing.T) { require.Equal(t, "string", field.FullType) require.Empty(t, field.DefaultValue) require.Empty(t, field.Options) - require.Equal(t, 2, field.Number) field = findField("daily_hire_rate_dollars", msg) require.Equal(t, "daily_hire_rate_dollars", field.Name) @@ -356,7 +347,6 @@ func TestFieldPropertiesProto3(t *testing.T) { require.Equal(t, "sint32", field.FullType) require.Empty(t, field.DefaultValue) require.Empty(t, field.Options) - require.Equal(t, 4, field.Number) } func TestFieldPropertiesProto3Optional(t *testing.T) { @@ -371,7 +361,6 @@ func TestFieldPropertiesProto3Optional(t *testing.T) { require.Equal(t, "string", field.FullType) require.Empty(t, field.DefaultValue) require.Empty(t, field.Options) - require.Equal(t, 1, field.Number) field = findField("name", msg) require.Equal(t, "name", field.Name) @@ -382,7 +371,6 @@ func TestFieldPropertiesProto3Optional(t *testing.T) { require.Equal(t, "string", field.FullType) require.Empty(t, field.DefaultValue) require.Empty(t, field.Options) - require.Equal(t, 2, field.Number) field = findField("ingredients", msg) require.Equal(t, "ingredients", field.Name) @@ -393,7 +381,6 @@ func TestFieldPropertiesProto3Optional(t *testing.T) { require.Equal(t, "string", field.FullType) require.Empty(t, field.DefaultValue) require.Empty(t, field.Options) - require.Equal(t, 3, field.Number) } func TestServiceProperties(t *testing.T) { From 7c3a349f3401f948eadaf06aa96ec80e5186ef50 Mon Sep 17 00:00:00 2001 From: Denis Borisov Date: Fri, 27 Jan 2023 09:45:06 +0300 Subject: [PATCH 6/6] revert auto format --- bench_test.go | 1 + cmd/protoc-gen-doc/flags_test.go | 1 + cmd/protoc-gen-doc/main_test.go | 1 + .../envoyproxy_validate_test.go | 2 ++ .../google_api_http/google_api_http_test.go | 1 + .../validator_field/validator_field_test.go | 1 + fixtures/fileset.pb | Bin 64676 -> 62929 bytes plugin_test.go | 2 ++ renderer_test.go | 34 +++++++++--------- 9 files changed, 25 insertions(+), 18 deletions(-) diff --git a/bench_test.go b/bench_test.go index e6578576..3bc066e1 100644 --- a/bench_test.go +++ b/bench_test.go @@ -3,6 +3,7 @@ package gendoc_test import ( "testing" + . "github.com/pseudomuto/protoc-gen-doc" "github.com/pseudomuto/protokit/utils" ) diff --git a/cmd/protoc-gen-doc/flags_test.go b/cmd/protoc-gen-doc/flags_test.go index 773db1e2..40182554 100644 --- a/cmd/protoc-gen-doc/flags_test.go +++ b/cmd/protoc-gen-doc/flags_test.go @@ -5,6 +5,7 @@ import ( "fmt" "testing" + . "github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc" "github.com/stretchr/testify/require" ) diff --git a/cmd/protoc-gen-doc/main_test.go b/cmd/protoc-gen-doc/main_test.go index 980d17ca..f865db7d 100644 --- a/cmd/protoc-gen-doc/main_test.go +++ b/cmd/protoc-gen-doc/main_test.go @@ -4,6 +4,7 @@ import ( "bytes" "testing" + . "github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc" "github.com/stretchr/testify/require" ) diff --git a/extensions/envoyproxy_validate/envoyproxy_validate_test.go b/extensions/envoyproxy_validate/envoyproxy_validate_test.go index e4a0091d..7c6cae87 100644 --- a/extensions/envoyproxy_validate/envoyproxy_validate_test.go +++ b/extensions/envoyproxy_validate/envoyproxy_validate_test.go @@ -4,7 +4,9 @@ import ( "testing" "github.com/envoyproxy/protoc-gen-validate/validate" + "github.com/golang/protobuf/proto" "github.com/pseudomuto/protoc-gen-doc/extensions" + . "github.com/pseudomuto/protoc-gen-doc/extensions/lyft_validate" "github.com/stretchr/testify/require" ) diff --git a/extensions/google_api_http/google_api_http_test.go b/extensions/google_api_http/google_api_http_test.go index c1c70f59..18e3bf6e 100644 --- a/extensions/google_api_http/google_api_http_test.go +++ b/extensions/google_api_http/google_api_http_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/pseudomuto/protoc-gen-doc/extensions" + . "github.com/pseudomuto/protoc-gen-doc/extensions/google_api_http" "github.com/stretchr/testify/require" "google.golang.org/genproto/googleapis/api/annotations" ) diff --git a/extensions/validator_field/validator_field_test.go b/extensions/validator_field/validator_field_test.go index 3e89a2c8..ae0eeee0 100644 --- a/extensions/validator_field/validator_field_test.go +++ b/extensions/validator_field/validator_field_test.go @@ -6,6 +6,7 @@ import ( "github.com/golang/protobuf/proto" validator "github.com/mwitkow/go-proto-validators" "github.com/pseudomuto/protoc-gen-doc/extensions" + . "github.com/pseudomuto/protoc-gen-doc/extensions/validator_field" "github.com/stretchr/testify/require" ) diff --git a/fixtures/fileset.pb b/fixtures/fileset.pb index 9ce9af9ba77a611301443d31110e53fb9781ff92..c766927deba70651220d4cb72f1d1dd70cbe6b22 100644 GIT binary patch delta 14012 zcmZu&d3==Bxz0J?GBe-IB$F?Jz_1Nr4=4!kXj>GdU_oW6*4m$C88H?Kg&^ANHDQSe zDi9A_kgcM!iHHMkT6RzDztgt1Yy|sycL4PfSm^FFkt5h;d`m zemgHNe($VcadFNW!@miMlU9j%$nEMK4kfDbA1{3~^Sa9!8oU*Hi@hXfgdf7coyZ?M z#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ws37&Hw&N1i8uCRaQSupZpm>cK_v zU=%qImXjI}nnhWQ2TwKaQ;GP~|MK=$vq_t*14~iXfu)Et(08OL>%dx+I`BTqpjgFV zu={eA;S*ojxz}oolgRd?{}$;wQpA3p{i1y-QW=VPoMpc)utmx)UVGv8>vNFw#vDg-`<)7r!%&KGsGA9@XdlV$`|$FTU>tRuWe3+pZM<{ z**;(Y^qStqrTx+PZD+8RUK2;gH{b+2zUa|QT_#z6t$wLJ0`}DAKiu0=~G{PuW!5KyfUtQ`D**8hd&R0xyOOt`Q>{qv8DA| zRJmfywnO{3Uwv@kRnbadv|W%0mcUv<5I{@9;)p(TFG-pCptoH+5OiOFNv z+Qx7}XhC;rUi*Uc_qum}T=leKXb;4F&#g%T|cOL_TT?aHXHYU>jrk5 z{_VFuFLl$Od-iRfL%Zxd>+Hu~_(@e!_UuPf@!j8fa%5)J71USRv-%japIymaPkijT zBM$V*=Z>~&X8KkCu_5u&9%U=AhA3P-k8hhbNtD4ZM=AjqvG5}oh;tu@#<`;L&#$iS+DhHwO*-7cw{o64~ z<8QoZKj-@Wi&OE`k9OL)EmSVY5EZf)5pnO105sHYl(NuiKFAk9VB-to>@jrE{q;9Tc0Nba+yFfq#S!` z$VThXC5N722d-&eS@I3kYqanHpzSp*dR@C@T}K1^Y|;*14i&t4qxeM3%FcdJ$)BJM@RTjl$t@GO8~goBHI;$!CXs=`#={4W!jqB4$}k|ccywdf~PyjPMo^k zsfKql_#{tJm{fY2NrjSBiq!zy6j)s9N<4mN@evg29>bFiiFyr*FVyzc0 zx>1k6{^OOZ)S_c6%Wmi%%Xqr%f~JAE?1rToAMT-uOiOxa8}g#TD@h&=k{YA$@OjLX z*Ctyc)RPC+AG;95|dxP;Lk{j{W^@)tk*uK)j0L)(o2 diff --git a/plugin_test.go b/plugin_test.go index 7b906c37..ebb18b7d 100644 --- a/plugin_test.go +++ b/plugin_test.go @@ -4,7 +4,9 @@ import ( "regexp" "testing" + "github.com/golang/protobuf/proto" plugin_go "github.com/golang/protobuf/protoc-gen-go/plugin" + . "github.com/pseudomuto/protoc-gen-doc" "github.com/pseudomuto/protokit/utils" "github.com/stretchr/testify/require" ) diff --git a/renderer_test.go b/renderer_test.go index 75d17923..d1c1abb4 100644 --- a/renderer_test.go +++ b/renderer_test.go @@ -4,54 +4,52 @@ import ( "os" "testing" + . "github.com/pseudomuto/protoc-gen-doc" "github.com/pseudomuto/protokit" "github.com/pseudomuto/protokit/utils" "github.com/stretchr/testify/require" - - gendoc "github.com/pseudomuto/protoc-gen-doc" ) func TestRenderers(t *testing.T) { set, err := utils.LoadDescriptorSet("fixtures", "fileset.pb") require.NoError(t, err) - err = os.Mkdir("./tmp", os.ModePerm) - require.NoError(t, err) + os.Mkdir("./tmp", os.ModePerm) req := utils.CreateGenRequest(set, "Booking.proto", "Vehicle.proto") result := protokit.ParseCodeGenRequest(req) - template := gendoc.NewTemplate(result) + template := NewTemplate(result) - for _, r := range []gendoc.RenderType{ - gendoc.RenderTypeDocBook, - gendoc.RenderTypeHTML, - gendoc.RenderTypeJSON, - gendoc.RenderTypeMarkdown, + for _, r := range []RenderType{ + RenderTypeDocBook, + RenderTypeHTML, + RenderTypeJSON, + RenderTypeMarkdown, } { - _, err := gendoc.RenderTemplate(r, template, "") + _, err := RenderTemplate(r, template, "") require.NoError(t, err) } } func TestNewRenderType(t *testing.T) { - expected := []gendoc.RenderType{ - gendoc.RenderTypeDocBook, - gendoc.RenderTypeHTML, - gendoc.RenderTypeJSON, - gendoc.RenderTypeMarkdown, + expected := []RenderType{ + RenderTypeDocBook, + RenderTypeHTML, + RenderTypeJSON, + RenderTypeMarkdown, } supplied := []string{"docbook", "html", "json", "markdown"} for idx, input := range supplied { - rt, err := gendoc.NewRenderType(input) + rt, err := NewRenderType(input) require.Nil(t, err) require.Equal(t, expected[idx], rt) } } func TestNewRenderTypeUnknown(t *testing.T) { - rt, err := gendoc.NewRenderType("/some/template.tmpl") + rt, err := NewRenderType("/some/template.tmpl") require.Zero(t, rt) require.Error(t, err) }