diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 000000000..7ec33334a
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,22 @@
+{
+ "workbench.colorCustomizations": {
+ "activityBar.activeBackground": "#6f36a2",
+ "activityBar.background": "#6f36a2",
+ "activityBar.foreground": "#e7e7e7",
+ "activityBar.inactiveForeground": "#e7e7e799",
+ "activityBarBadge.background": "#302110",
+ "activityBarBadge.foreground": "#e7e7e7",
+ "commandCenter.border": "#e7e7e799",
+ "sash.hoverBorder": "#6f36a2",
+ "statusBar.background": "#55297c",
+ "statusBar.foreground": "#e7e7e7",
+ "statusBarItem.hoverBackground": "#6f36a2",
+ "statusBarItem.remoteBackground": "#55297c",
+ "statusBarItem.remoteForeground": "#e7e7e7",
+ "titleBar.activeBackground": "#55297c",
+ "titleBar.activeForeground": "#e7e7e7",
+ "titleBar.inactiveBackground": "#55297c99",
+ "titleBar.inactiveForeground": "#e7e7e799"
+ },
+ "peacock.color": "#55297c"
+}
\ No newline at end of file
diff --git a/vendor/github.com/fxamacker/cbor/v2/.gitignore b/vendor/github.com/fxamacker/cbor/v2/.gitignore
new file mode 100644
index 000000000..f1c181ec9
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/.gitignore
@@ -0,0 +1,12 @@
+# Binaries for programs and plugins
+*.exe
+*.exe~
+*.dll
+*.so
+*.dylib
+
+# Test binary, build with `go test -c`
+*.test
+
+# Output of the go coverage tool, specifically when used with LiteIDE
+*.out
diff --git a/vendor/github.com/fxamacker/cbor/v2/.golangci.yml b/vendor/github.com/fxamacker/cbor/v2/.golangci.yml
new file mode 100644
index 000000000..38cb9ae10
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/.golangci.yml
@@ -0,0 +1,104 @@
+# Do not delete linter settings. Linters like gocritic can be enabled on the command line.
+
+linters-settings:
+ depguard:
+ rules:
+ prevent_unmaintained_packages:
+ list-mode: strict
+ files:
+ - $all
+ - "!$test"
+ allow:
+ - $gostd
+ - github.com/x448/float16
+ deny:
+ - pkg: io/ioutil
+ desc: "replaced by io and os packages since Go 1.16: https://tip.golang.org/doc/go1.16#ioutil"
+ dupl:
+ threshold: 100
+ funlen:
+ lines: 100
+ statements: 50
+ goconst:
+ ignore-tests: true
+ min-len: 2
+ min-occurrences: 3
+ gocritic:
+ enabled-tags:
+ - diagnostic
+ - experimental
+ - opinionated
+ - performance
+ - style
+ disabled-checks:
+ - commentedOutCode
+ - dupImport # https://github.com/go-critic/go-critic/issues/845
+ - ifElseChain
+ - octalLiteral
+ - paramTypeCombine
+ - whyNoLint
+ gofmt:
+ simplify: false
+ goimports:
+ local-prefixes: github.com/fxamacker/cbor
+ golint:
+ min-confidence: 0
+ govet:
+ check-shadowing: true
+ lll:
+ line-length: 140
+ maligned:
+ suggest-new: true
+ misspell:
+ locale: US
+ staticcheck:
+ checks: ["all"]
+
+linters:
+ disable-all: true
+ enable:
+ - asciicheck
+ - bidichk
+ - depguard
+ - errcheck
+ - exportloopref
+ - goconst
+ - gocritic
+ - gocyclo
+ - gofmt
+ - goimports
+ - goprintffuncname
+ - gosec
+ - gosimple
+ - govet
+ - ineffassign
+ - misspell
+ - nilerr
+ - revive
+ - staticcheck
+ - stylecheck
+ - typecheck
+ - unconvert
+ - unused
+
+issues:
+ # max-issues-per-linter default is 50. Set to 0 to disable limit.
+ max-issues-per-linter: 0
+ # max-same-issues default is 3. Set to 0 to disable limit.
+ max-same-issues: 0
+
+ exclude-rules:
+ - path: decode.go
+ text: "string ` overflows ` has (\\d+) occurrences, make it a constant"
+ - path: decode.go
+ text: "string ` \\(range is \\[` has (\\d+) occurrences, make it a constant"
+ - path: decode.go
+ text: "string `, ` has (\\d+) occurrences, make it a constant"
+ - path: decode.go
+ text: "string ` overflows Go's int64` has (\\d+) occurrences, make it a constant"
+ - path: decode.go
+ text: "string `\\]\\)` has (\\d+) occurrences, make it a constant"
+ - path: valid.go
+ text: "string ` for type ` has (\\d+) occurrences, make it a constant"
+ - path: valid.go
+ text: "string `cbor: ` has (\\d+) occurrences, make it a constant"
diff --git a/vendor/github.com/fxamacker/cbor/v2/CODE_OF_CONDUCT.md b/vendor/github.com/fxamacker/cbor/v2/CODE_OF_CONDUCT.md
new file mode 100644
index 000000000..c794b2b0c
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/CODE_OF_CONDUCT.md
@@ -0,0 +1,133 @@
+
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+We as members, contributors, and leaders pledge to make participation in our
+community a harassment-free experience for everyone, regardless of age, body
+size, visible or invisible disability, ethnicity, sex characteristics, gender
+identity and expression, level of experience, education, socio-economic status,
+nationality, personal appearance, race, caste, color, religion, or sexual
+identity and orientation.
+
+We pledge to act and interact in ways that contribute to an open, welcoming,
+diverse, inclusive, and healthy community.
+
+## Our Standards
+
+Examples of behavior that contributes to a positive environment for our
+community include:
+
+* Demonstrating empathy and kindness toward other people
+* Being respectful of differing opinions, viewpoints, and experiences
+* Giving and gracefully accepting constructive feedback
+* Accepting responsibility and apologizing to those affected by our mistakes,
+ and learning from the experience
+* Focusing on what is best not just for us as individuals, but for the overall
+ community
+
+Examples of unacceptable behavior include:
+
+* The use of sexualized language or imagery, and sexual attention or advances of
+ any kind
+* Trolling, insulting or derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or email address,
+ without their explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Enforcement Responsibilities
+
+Community leaders are responsible for clarifying and enforcing our standards of
+acceptable behavior and will take appropriate and fair corrective action in
+response to any behavior that they deem inappropriate, threatening, offensive,
+or harmful.
+
+Community leaders have the right and responsibility to remove, edit, or reject
+comments, commits, code, wiki edits, issues, and other contributions that are
+not aligned to this Code of Conduct, and will communicate reasons for moderation
+decisions when appropriate.
+
+## Scope
+
+This Code of Conduct applies within all community spaces, and also applies when
+an individual is officially representing the community in public spaces.
+Examples of representing our community include using an official e-mail address,
+posting via an official social media account, or acting as an appointed
+representative at an online or offline event.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported to the community leaders responsible for enforcement at
+faye.github@gmail.com.
+All complaints will be reviewed and investigated promptly and fairly.
+
+All community leaders are obligated to respect the privacy and security of the
+reporter of any incident.
+
+## Enforcement Guidelines
+
+Community leaders will follow these Community Impact Guidelines in determining
+the consequences for any action they deem in violation of this Code of Conduct:
+
+### 1. Correction
+
+**Community Impact**: Use of inappropriate language or other behavior deemed
+unprofessional or unwelcome in the community.
+
+**Consequence**: A private, written warning from community leaders, providing
+clarity around the nature of the violation and an explanation of why the
+behavior was inappropriate. A public apology may be requested.
+
+### 2. Warning
+
+**Community Impact**: A violation through a single incident or series of
+actions.
+
+**Consequence**: A warning with consequences for continued behavior. No
+interaction with the people involved, including unsolicited interaction with
+those enforcing the Code of Conduct, for a specified period of time. This
+includes avoiding interactions in community spaces as well as external channels
+like social media. Violating these terms may lead to a temporary or permanent
+ban.
+
+### 3. Temporary Ban
+
+**Community Impact**: A serious violation of community standards, including
+sustained inappropriate behavior.
+
+**Consequence**: A temporary ban from any sort of interaction or public
+communication with the community for a specified period of time. No public or
+private interaction with the people involved, including unsolicited interaction
+with those enforcing the Code of Conduct, is allowed during this period.
+Violating these terms may lead to a permanent ban.
+
+### 4. Permanent Ban
+
+**Community Impact**: Demonstrating a pattern of violation of community
+standards, including sustained inappropriate behavior, harassment of an
+individual, or aggression toward or disparagement of classes of individuals.
+
+**Consequence**: A permanent ban from any sort of public interaction within the
+community.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage],
+version 2.1, available at
+[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
+
+Community Impact Guidelines were inspired by
+[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
+
+For answers to common questions about this code of conduct, see the FAQ at
+[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
+[https://www.contributor-covenant.org/translations][translations].
+
+[homepage]: https://www.contributor-covenant.org
+[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
+[Mozilla CoC]: https://github.com/mozilla/diversity
+[FAQ]: https://www.contributor-covenant.org/faq
+[translations]: https://www.contributor-covenant.org/translations
diff --git a/vendor/github.com/fxamacker/cbor/v2/CONTRIBUTING.md b/vendor/github.com/fxamacker/cbor/v2/CONTRIBUTING.md
new file mode 100644
index 000000000..de0965e12
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/CONTRIBUTING.md
@@ -0,0 +1,41 @@
+# How to contribute
+
+You can contribute by using the library, opening issues, or opening pull requests.
+
+## Bug reports and security vulnerabilities
+
+Most issues are tracked publicly on [GitHub](https://github.com/fxamacker/cbor/issues).
+
+To report security vulnerabilities, please email faye.github@gmail.com and allow time for the problem to be resolved before disclosing it to the public. For more info, see [Security Policy](https://github.com/fxamacker/cbor#security-policy).
+
+Please do not send data that might contain personally identifiable information, even if you think you have permission. That type of support requires payment and a signed contract where I'm indemnified, held harmless, and defended by you for any data you send to me.
+
+## Pull requests
+
+Please [create an issue](https://github.com/fxamacker/cbor/issues/new/choose) before you begin work on a PR. The improvement may have already been considered, etc.
+
+Pull requests have signing requirements and must not be anonymous. Exceptions are usually made for docs and CI scripts.
+
+See the [Pull Request Template](https://github.com/fxamacker/cbor/blob/master/.github/pull_request_template.md) for details.
+
+Pull requests have a greater chance of being approved if:
+- it does not reduce speed, increase memory use, reduce security, etc. for people not using the new option or feature.
+- it has > 97% code coverage.
+
+## Describe your issue
+
+Clearly describe the issue:
+* If it's a bug, please provide: **version of this library** and **Go** (`go version`), **unmodified error message**, and describe **how to reproduce it**. Also state **what you expected to happen** instead of the error.
+* If you propose a change or addition, try to give an example how the improved code could look like or how to use it.
+* If you found a compilation error, please confirm you're using a supported version of Go. If you are, then provide the output of `go version` first, followed by the complete error message.
+
+## Please don't
+
+Please don't send data containing personally identifiable information, even if you think you have permission. That type of support requires payment and a contract where I'm indemnified, held harmless, and defended for any data you send to me.
+
+Please don't send CBOR data larger than 1024 bytes by email. If you want to send crash-producing CBOR data > 1024 bytes by email, please get my permission before sending it to me.
+
+## Credits
+
+- This guide used nlohmann/json contribution guidelines for inspiration as suggested in issue #22.
+- Special thanks to @lukseven for pointing out the contribution guidelines didn't mention signing requirements.
diff --git a/vendor/github.com/fxamacker/cbor/v2/LICENSE b/vendor/github.com/fxamacker/cbor/v2/LICENSE
new file mode 100644
index 000000000..eaa850492
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2019-present Faye Amacker
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
diff --git a/vendor/github.com/fxamacker/cbor/v2/README.md b/vendor/github.com/fxamacker/cbor/v2/README.md
new file mode 100644
index 000000000..af0a79507
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/README.md
@@ -0,0 +1,691 @@
+# CBOR Codec in Go
+
+
+
+[fxamacker/cbor](https://github.com/fxamacker/cbor) is a library for encoding and decoding [CBOR](https://www.rfc-editor.org/info/std94) and [CBOR Sequences](https://www.rfc-editor.org/rfc/rfc8742.html).
+
+CBOR is a [trusted alternative](https://www.rfc-editor.org/rfc/rfc8949.html#name-comparison-of-other-binary-) to JSON, MessagePack, Protocol Buffers, etc. CBOR is an Internet Standard defined by [IETF STD 94 (RFC 8949)](https://www.rfc-editor.org/info/std94) and is designed to be relevant for decades.
+
+`fxamacker/cbor` is used in projects by Arm Ltd., Cisco, EdgeX Foundry, Flow Foundation, Fraunhofer‑AISEC, Kubernetes, Let's Encrypt (ISRG), Linux Foundation, Microsoft, Mozilla, Oasis Protocol, Tailscale, Teleport, [etc](https://github.com/fxamacker/cbor#who-uses-fxamackercbor).
+
+See [Quick Start](#quick-start) and [Releases](https://github.com/fxamacker/cbor/releases/). 🆕 `UnmarshalFirst` and `DiagnoseFirst` can decode CBOR Sequences. `cbor.MarshalToBuffer()` and `UserBufferEncMode` accepts user-specified buffer.
+
+## fxamacker/cbor
+
+[![](https://github.com/fxamacker/cbor/workflows/ci/badge.svg)](https://github.com/fxamacker/cbor/actions?query=workflow%3Aci)
+[![](https://github.com/fxamacker/cbor/workflows/cover%20%E2%89%A596%25/badge.svg)](https://github.com/fxamacker/cbor/actions?query=workflow%3A%22cover+%E2%89%A596%25%22)
+[![CodeQL](https://github.com/fxamacker/cbor/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/fxamacker/cbor/actions/workflows/codeql-analysis.yml)
+[![](https://img.shields.io/badge/fuzzing-passing-44c010)](#fuzzing-and-code-coverage)
+[![Go Report Card](https://goreportcard.com/badge/github.com/fxamacker/cbor)](https://goreportcard.com/report/github.com/fxamacker/cbor)
+
+`fxamacker/cbor` is a CBOR codec in full conformance with [IETF STD 94 (RFC 8949)](https://www.rfc-editor.org/info/std94). It also supports CBOR Sequences ([RFC 8742](https://www.rfc-editor.org/rfc/rfc8742.html)) and Extended Diagnostic Notation ([Appendix G of RFC 8610](https://www.rfc-editor.org/rfc/rfc8610.html#appendix-G)).
+
+Features include full support for CBOR tags, [Core Deterministic Encoding](https://www.rfc-editor.org/rfc/rfc8949.html#name-core-deterministic-encoding), duplicate map key detection, etc.
+
+Design balances trade-offs between security, speed, concurrency, encoded data size, usability, etc.
+
+Highlights
+
+__🚀 Speed__
+
+Encoding and decoding is fast without using Go's `unsafe` package. Slower settings are opt-in. Default limits allow very fast and memory efficient rejection of malformed CBOR data.
+
+__🔒 Security__
+
+Decoder has configurable limits that defend against malicious inputs. Duplicate map key detection is supported. By contrast, `encoding/gob` is [not designed to be hardened against adversarial inputs](https://pkg.go.dev/encoding/gob#hdr-Security).
+
+Codec passed multiple confidential security assessments in 2022. No vulnerabilities found in subset of codec in a [nonconfidential security assessment](https://github.com/veraison/go-cose/blob/v1.0.0-rc.1/reports/NCC_Microsoft-go-cose-Report_2022-05-26_v1.0.pdf) prepared by NCC Group for Microsoft Corporation.
+
+__🗜️ Data Size__
+
+Struct tags (`toarray`, `keyasint`, `omitempty`) automatically reduce size of encoded structs. Encoding optionally shrinks float64→32→16 when values fit.
+
+__:jigsaw: Usability__
+
+API is mostly same as `encoding/json` plus interfaces that simplify concurrency for CBOR options. Encoding and decoding modes can be created at startup and reused by any goroutines.
+
+Presets include Core Deterministic Encoding, Preferred Serialization, CTAP2 Canonical CBOR, etc.
+
+__📆 Extensibility__
+
+Features include CBOR [extension points](https://www.rfc-editor.org/rfc/rfc8949.html#section-7.1) (e.g. CBOR tags) and extensive settings. API has interfaces that allow users to create custom encoding and decoding without modifying this library.
+
+
+
+
+
+### Secure Decoding with Configurable Settings
+
+`fxamacker/cbor` has configurable limits, etc. that defend against malicious CBOR data.
+
+By contrast, `encoding/gob` is [not designed to be hardened against adversarial inputs](https://pkg.go.dev/encoding/gob#hdr-Security).
+
+Example decoding with encoding/gob 💥 fatal error (out of memory)
+
+```Go
+// Example of encoding/gob having "fatal error: runtime: out of memory"
+// while decoding 181 bytes.
+package main
+import (
+ "bytes"
+ "encoding/gob"
+ "encoding/hex"
+ "fmt"
+)
+
+// Example data is from https://github.com/golang/go/issues/24446
+// (shortened to 181 bytes).
+const data = "4dffb503010102303001ff30000109010130010800010130010800010130" +
+ "01ffb80001014a01ffb60001014b01ff860001013001ff860001013001ff" +
+ "860001013001ff860001013001ffb80000001eff850401010e3030303030" +
+ "30303030303030303001ff3000010c0104000016ffb70201010830303030" +
+ "3030303001ff3000010c000030ffb6040405fcff00303030303030303030" +
+ "303030303030303030303030303030303030303030303030303030303030" +
+ "30"
+
+type X struct {
+ J *X
+ K map[string]int
+}
+
+func main() {
+ raw, _ := hex.DecodeString(data)
+ decoder := gob.NewDecoder(bytes.NewReader(raw))
+
+ var x X
+ decoder.Decode(&x) // fatal error: runtime: out of memory
+ fmt.Println("Decoding finished.")
+}
+```
+
+
+
+
+
+`fxamacker/cbor` is fast at rejecting malformed CBOR data. E.g. attempts to
+decode 10 bytes of malicious CBOR data to `[]byte` (with default settings):
+
+| Codec | Speed (ns/op) | Memory | Allocs |
+| :---- | ------------: | -----: | -----: |
+| fxamacker/cbor 2.5.0 | 44 ± 5% | 32 B/op | 2 allocs/op |
+| ugorji/go 1.2.11 | 5353261 ± 4% | 67111321 B/op | 13 allocs/op |
+
+Benchmark details
+
+Latest comparison used:
+- Input: `[]byte{0x9B, 0x00, 0x00, 0x42, 0xFA, 0x42, 0xFA, 0x42, 0xFA, 0x42}`
+- go1.19.10, linux/amd64, i5-13600K (disabled all e-cores, DDR4 @2933)
+- go test -bench=. -benchmem -count=20
+
+#### Prior comparisons
+
+| Codec | Speed (ns/op) | Memory | Allocs |
+| :---- | ------------: | -----: | -----: |
+| fxamacker/cbor 2.5.0-beta2 | 44.33 ± 2% | 32 B/op | 2 allocs/op |
+| fxamacker/cbor 0.1.0 - 2.4.0 | ~44.68 ± 6% | 32 B/op | 2 allocs/op |
+| ugorji/go 1.2.10 | 5524792.50 ± 3% | 67110491 B/op | 12 allocs/op |
+| ugorji/go 1.1.0 - 1.2.6 | 💥 runtime: | out of memory: | cannot allocate |
+
+- Input: `[]byte{0x9B, 0x00, 0x00, 0x42, 0xFA, 0x42, 0xFA, 0x42, 0xFA, 0x42}`
+- go1.19.6, linux/amd64, i5-13600K (DDR4)
+- go test -bench=. -benchmem -count=20
+
+
+
+
+
+### Smaller Encodings with Struct Tags
+
+Struct tags (`toarray`, `keyasint`, `omitempty`) reduce encoded size of structs.
+
+Example encoding 3-level nested Go struct to 1 byte CBOR
+
+https://go.dev/play/p/YxwvfPdFQG2
+
+```Go
+// Example encoding nested struct (with omitempty tag)
+// - encoding/json: 18 byte JSON
+// - fxamacker/cbor: 1 byte CBOR
+package main
+
+import (
+ "encoding/hex"
+ "encoding/json"
+ "fmt"
+
+ "github.com/fxamacker/cbor/v2"
+)
+
+type GrandChild struct {
+ Quux int `json:",omitempty"`
+}
+
+type Child struct {
+ Baz int `json:",omitempty"`
+ Qux GrandChild `json:",omitempty"`
+}
+
+type Parent struct {
+ Foo Child `json:",omitempty"`
+ Bar int `json:",omitempty"`
+}
+
+func cb() {
+ results, _ := cbor.Marshal(Parent{})
+ fmt.Println("hex(CBOR): " + hex.EncodeToString(results))
+
+ text, _ := cbor.Diagnose(results) // Diagnostic Notation
+ fmt.Println("DN: " + text)
+}
+
+func js() {
+ results, _ := json.Marshal(Parent{})
+ fmt.Println("hex(JSON): " + hex.EncodeToString(results))
+
+ text := string(results) // JSON
+ fmt.Println("JSON: " + text)
+}
+
+func main() {
+ cb()
+ fmt.Println("-------------")
+ js()
+}
+```
+
+Output (DN is Diagnostic Notation):
+```
+hex(CBOR): a0
+DN: {}
+-------------
+hex(JSON): 7b22466f6f223a7b22517578223a7b7d7d7d
+JSON: {"Foo":{"Qux":{}}}
+```
+
+
+
+
+
+Example using different struct tags together:
+
+![alt text](https://github.com/fxamacker/images/raw/master/cbor/v2.3.0/cbor_struct_tags_api.svg?sanitize=1 "CBOR API and Go Struct Tags")
+
+API is mostly same as `encoding/json`, plus interfaces that simplify concurrency for CBOR options.
+
+## Quick Start
+
+__Install__: `go get github.com/fxamacker/cbor/v2` and `import "github.com/fxamacker/cbor/v2"`.
+
+### Key Points
+
+This library can encode and decode CBOR (RFC 8949) and CBOR Sequences (RFC 8742).
+
+- __CBOR data item__ is a single piece of CBOR data and its structure may contain 0 or more nested data items.
+- __CBOR sequence__ is a concatenation of 0 or more encoded CBOR data items.
+
+Configurable limits and options can be used to balance trade-offs.
+
+- Encoding and decoding modes are created from options (settings).
+- Modes can be created at startup and reused.
+- Modes are safe for concurrent use.
+
+### Default Mode
+
+Package level functions only use this library's default settings.
+They provide the "default mode" of encoding and decoding.
+
+```go
+// API matches encoding/json for Marshal, Unmarshal, Encode, Decode, etc.
+b, err = cbor.Marshal(v) // encode v to []byte b
+err = cbor.Unmarshal(b, &v) // decode []byte b to v
+decoder = cbor.NewDecoder(r) // create decoder with io.Reader r
+err = decoder.Decode(&v) // decode a CBOR data item to v
+
+// v2.7.0 added MarshalToBuffer() and UserBufferEncMode interface.
+err = cbor.MarshalToBuffer(v, b) // encode v to b instead of using built-in buf pool.
+
+// v2.5.0 added new functions that return remaining bytes.
+
+// UnmarshalFirst decodes first CBOR data item and returns remaining bytes.
+rest, err = cbor.UnmarshalFirst(b, &v) // decode []byte b to v
+
+// DiagnoseFirst translates first CBOR data item to text and returns remaining bytes.
+text, rest, err = cbor.DiagnoseFirst(b) // decode []byte b to Diagnostic Notation text
+
+// NOTE: Unmarshal returns ExtraneousDataError if there are remaining bytes,
+// but new funcs UnmarshalFirst and DiagnoseFirst do not.
+```
+
+__IMPORTANT__: 👉 CBOR settings allow trade-offs between speed, security, encoding size, etc.
+
+- Different CBOR libraries may use different default settings.
+- CBOR-based formats or protocols usually require specific settings.
+
+For example, WebAuthn uses "CTAP2 Canonical CBOR" which is available as a preset.
+
+### Presets
+
+Presets can be used as-is or as a starting point for custom settings.
+
+```go
+// EncOptions is a struct of encoder settings.
+func CoreDetEncOptions() EncOptions // RFC 8949 Core Deterministic Encoding
+func PreferredUnsortedEncOptions() EncOptions // RFC 8949 Preferred Serialization
+func CanonicalEncOptions() EncOptions // RFC 7049 Canonical CBOR
+func CTAP2EncOptions() EncOptions // FIDO2 CTAP2 Canonical CBOR
+```
+
+Presets are used to create custom modes.
+
+### Custom Modes
+
+Modes are created from settings. Once created, modes have immutable settings.
+
+💡 Create the mode at startup and reuse it. It is safe for concurrent use.
+
+```Go
+// Create encoding mode.
+opts := cbor.CoreDetEncOptions() // use preset options as a starting point
+opts.Time = cbor.TimeUnix // change any settings if needed
+em, err := opts.EncMode() // create an immutable encoding mode
+
+// Reuse the encoding mode. It is safe for concurrent use.
+
+// API matches encoding/json.
+b, err := em.Marshal(v) // encode v to []byte b
+encoder := em.NewEncoder(w) // create encoder with io.Writer w
+err := encoder.Encode(v) // encode v to io.Writer w
+```
+
+Default mode and custom modes automatically apply struct tags.
+
+### User Specified Buffer for Encoding (v2.7.0)
+
+`UserBufferEncMode` interface extends `EncMode` interface to add `MarshalToBuffer()`. It accepts a user-specified buffer instead of using built-in buffer pool.
+
+```Go
+em, err := myEncOptions.UserBufferEncMode() // create UserBufferEncMode mode
+
+var buf bytes.Buffer
+err = em.MarshalToBuffer(v, &buf) // encode v to provided buf
+```
+
+### Struct Tags
+
+Struct tags (`toarray`, `keyasint`, `omitempty`) reduce encoded size of structs.
+
+Example encoding 3-level nested Go struct to 1 byte CBOR
+
+https://go.dev/play/p/YxwvfPdFQG2
+
+```Go
+// Example encoding nested struct (with omitempty tag)
+// - encoding/json: 18 byte JSON
+// - fxamacker/cbor: 1 byte CBOR
+package main
+
+import (
+ "encoding/hex"
+ "encoding/json"
+ "fmt"
+
+ "github.com/fxamacker/cbor/v2"
+)
+
+type GrandChild struct {
+ Quux int `json:",omitempty"`
+}
+
+type Child struct {
+ Baz int `json:",omitempty"`
+ Qux GrandChild `json:",omitempty"`
+}
+
+type Parent struct {
+ Foo Child `json:",omitempty"`
+ Bar int `json:",omitempty"`
+}
+
+func cb() {
+ results, _ := cbor.Marshal(Parent{})
+ fmt.Println("hex(CBOR): " + hex.EncodeToString(results))
+
+ text, _ := cbor.Diagnose(results) // Diagnostic Notation
+ fmt.Println("DN: " + text)
+}
+
+func js() {
+ results, _ := json.Marshal(Parent{})
+ fmt.Println("hex(JSON): " + hex.EncodeToString(results))
+
+ text := string(results) // JSON
+ fmt.Println("JSON: " + text)
+}
+
+func main() {
+ cb()
+ fmt.Println("-------------")
+ js()
+}
+```
+
+Output (DN is Diagnostic Notation):
+```
+hex(CBOR): a0
+DN: {}
+-------------
+hex(JSON): 7b22466f6f223a7b22517578223a7b7d7d7d
+JSON: {"Foo":{"Qux":{}}}
+```
+
+
+
+
+
+Example using several struct tags
+
+![alt text](https://github.com/fxamacker/images/raw/master/cbor/v2.3.0/cbor_struct_tags_api.svg?sanitize=1 "CBOR API and Go Struct Tags")
+
+
+
+Struct tags simplify use of CBOR-based protocols that require CBOR arrays or maps with integer keys.
+
+### CBOR Tags
+
+CBOR tags are specified in a `TagSet`.
+
+Custom modes can be created with a `TagSet` to handle CBOR tags.
+
+```go
+em, err := opts.EncMode() // no CBOR tags
+em, err := opts.EncModeWithTags(ts) // immutable CBOR tags
+em, err := opts.EncModeWithSharedTags(ts) // mutable shared CBOR tags
+```
+
+`TagSet` and modes using it are safe for concurrent use. Equivalent API is available for `DecMode`.
+
+Example using TagSet and TagOptions
+
+```go
+// Use signedCWT struct defined in "Decoding CWT" example.
+
+// Create TagSet (safe for concurrency).
+tags := cbor.NewTagSet()
+// Register tag COSE_Sign1 18 with signedCWT type.
+tags.Add(
+ cbor.TagOptions{EncTag: cbor.EncTagRequired, DecTag: cbor.DecTagRequired},
+ reflect.TypeOf(signedCWT{}),
+ 18)
+
+// Create DecMode with immutable tags.
+dm, _ := cbor.DecOptions{}.DecModeWithTags(tags)
+
+// Unmarshal to signedCWT with tag support.
+var v signedCWT
+if err := dm.Unmarshal(data, &v); err != nil {
+ return err
+}
+
+// Create EncMode with immutable tags.
+em, _ := cbor.EncOptions{}.EncModeWithTags(tags)
+
+// Marshal signedCWT with tag number.
+if data, err := cbor.Marshal(v); err != nil {
+ return err
+}
+```
+
+
+
+### Functions and Interfaces
+
+Functions and interfaces at a glance
+
+Common functions with same API as `encoding/json`:
+- `Marshal`, `Unmarshal`
+- `NewEncoder`, `(*Encoder).Encode`
+- `NewDecoder`, `(*Decoder).Decode`
+
+NOTE: `Unmarshal` will return `ExtraneousDataError` if there are remaining bytes
+because RFC 8949 treats CBOR data item with remaining bytes as malformed.
+- 💡 Use `UnmarshalFirst` to decode first CBOR data item and return any remaining bytes.
+
+Other useful functions:
+- `Diagnose`, `DiagnoseFirst` produce human-readable [Extended Diagnostic Notation](https://www.rfc-editor.org/rfc/rfc8610.html#appendix-G) from CBOR data.
+- `UnmarshalFirst` decodes first CBOR data item and return any remaining bytes.
+- `Wellformed` returns true if the the CBOR data item is well-formed.
+
+Interfaces identical or comparable to Go `encoding` packages include:
+`Marshaler`, `Unmarshaler`, `BinaryMarshaler`, and `BinaryUnmarshaler`.
+
+The `RawMessage` type can be used to delay CBOR decoding or precompute CBOR encoding.
+
+
+
+### Security Tips
+
+🔒 Use Go's `io.LimitReader` to limit size when decoding very large or indefinite size data.
+
+Default limits may need to be increased for systems handling very large data (e.g. blockchains).
+
+`DecOptions` can be used to modify default limits for `MaxArrayElements`, `MaxMapPairs`, and `MaxNestedLevels`.
+
+## Status
+
+v2.7.0 (June 23, 2024) adds features and improvements that help large projects (e.g. Kubernetes) use CBOR as an alternative to JSON and Protocol Buffers. Other improvements include speedups, improved memory use, bug fixes, new serialization options, etc. It passed fuzz tests (5+ billion executions) and is production quality.
+
+For more details, see [release notes](https://github.com/fxamacker/cbor/releases).
+
+### Prior Release
+
+[v2.6.0](https://github.com/fxamacker/cbor/releases/tag/v2.6.0) (February 2024) adds important new features, optimizations, and bug fixes. It is especially useful to systems that need to convert data between CBOR and JSON. New options and optimizations improve handling of bignum, integers, maps, and strings.
+
+v2.5.0 was released on Sunday, August 13, 2023 with new features and important bug fixes. It is fuzz tested and production quality after extended beta [v2.5.0-beta](https://github.com/fxamacker/cbor/releases/tag/v2.5.0-beta) (Dec 2022) -> [v2.5.0](https://github.com/fxamacker/cbor/releases/tag/v2.5.0) (Aug 2023).
+
+__IMPORTANT__: 👉 Before upgrading from v2.4 or older release, please read the notable changes highlighted in the release notes. v2.5.0 is a large release with bug fixes to error handling for extraneous data in `Unmarshal`, etc. that should be reviewed before upgrading.
+
+See [v2.5.0 release notes](https://github.com/fxamacker/cbor/releases/tag/v2.5.0) for list of new features, improvements, and bug fixes.
+
+See ["Version and API Changes"](https://github.com/fxamacker/cbor#versions-and-api-changes) section for more info about version numbering, etc.
+
+
+
+## Who uses fxamacker/cbor
+
+`fxamacker/cbor` is used in projects by Arm Ltd., Berlin Institute of Health at Charité, Chainlink, Cisco, Confidential Computing Consortium, ConsenSys, Dapper Labs, EdgeX Foundry, F5, FIDO Alliance, Fraunhofer‑AISEC, Kubernetes, Let's Encrypt (ISRG), Linux Foundation, Matrix.org, Microsoft, Mozilla, National Cybersecurity Agency of France (govt), Netherlands (govt), Oasis Protocol, Smallstep, Tailscale, Taurus SA, Teleport, TIBCO, and others.
+
+`fxamacker/cbor` passed multiple confidential security assessments. A [nonconfidential security assessment](https://github.com/veraison/go-cose/blob/v1.0.0-rc.1/reports/NCC_Microsoft-go-cose-Report_2022-05-26_v1.0.pdf) (prepared by NCC Group for Microsoft Corporation) includes a subset of fxamacker/cbor v2.4.0 in its scope.
+
+## Standards
+
+`fxamacker/cbor` is a CBOR codec in full conformance with [IETF STD 94 (RFC 8949)](https://www.rfc-editor.org/info/std94). It also supports CBOR Sequences ([RFC 8742](https://www.rfc-editor.org/rfc/rfc8742.html)) and Extended Diagnostic Notation ([Appendix G of RFC 8610](https://www.rfc-editor.org/rfc/rfc8610.html#appendix-G)).
+
+Notable CBOR features include:
+
+| CBOR Feature | Description |
+| :--- | :--- |
+| CBOR tags | API supports built-in and user-defined tags. |
+| Preferred serialization | Integers encode to fewest bytes. Optional float64 → float32 → float16. |
+| Map key sorting | Unsorted, length-first (Canonical CBOR), and bytewise-lexicographic (CTAP2). |
+| Duplicate map keys | Always forbid for encoding and option to allow/forbid for decoding. |
+| Indefinite length data | Option to allow/forbid for encoding and decoding. |
+| Well-formedness | Always checked and enforced. |
+| Basic validity checks | Optionally check UTF-8 validity and duplicate map keys. |
+| Security considerations | Prevent integer overflow and resource exhaustion (RFC 8949 Section 10). |
+
+Known limitations are noted in the [Limitations section](#limitations).
+
+Go nil values for slices, maps, pointers, etc. are encoded as CBOR null. Empty slices, maps, etc. are encoded as empty CBOR arrays and maps.
+
+Decoder checks for all required well-formedness errors, including all "subkinds" of syntax errors and too little data.
+
+After well-formedness is verified, basic validity errors are handled as follows:
+
+* Invalid UTF-8 string: Decoder has option to check and return invalid UTF-8 string error. This check is enabled by default.
+* Duplicate keys in a map: Decoder has options to ignore or enforce rejection of duplicate map keys.
+
+When decoding well-formed CBOR arrays and maps, decoder saves the first error it encounters and continues with the next item. Options to handle this differently may be added in the future.
+
+By default, decoder treats time values of floating-point NaN and Infinity as if they are CBOR Null or CBOR Undefined.
+
+__Click to expand topic:__
+
+
+ Duplicate Map Keys
+
+This library provides options for fast detection and rejection of duplicate map keys based on applying a Go-specific data model to CBOR's extended generic data model in order to determine duplicate vs distinct map keys. Detection relies on whether the CBOR map key would be a duplicate "key" when decoded and applied to the user-provided Go map or struct.
+
+`DupMapKeyQuiet` turns off detection of duplicate map keys. It tries to use a "keep fastest" method by choosing either "keep first" or "keep last" depending on the Go data type.
+
+`DupMapKeyEnforcedAPF` enforces detection and rejection of duplidate map keys. Decoding stops immediately and returns `DupMapKeyError` when the first duplicate key is detected. The error includes the duplicate map key and the index number.
+
+APF suffix means "Allow Partial Fill" so the destination map or struct can contain some decoded values at the time of error. It is the caller's responsibility to respond to the `DupMapKeyError` by discarding the partially filled result if that's required by their protocol.
+
+
+
+
+ Tag Validity
+
+This library checks tag validity for built-in tags (currently tag numbers 0, 1, 2, 3, and 55799):
+
+* Inadmissible type for tag content
+* Inadmissible value for tag content
+
+Unknown tag data items (not tag number 0, 1, 2, 3, or 55799) are handled in two ways:
+
+* When decoding into an empty interface, unknown tag data item will be decoded into `cbor.Tag` data type, which contains tag number and tag content. The tag content will be decoded into the default Go data type for the CBOR data type.
+* When decoding into other Go types, unknown tag data item is decoded into the specified Go type. If Go type is registered with a tag number, the tag number can optionally be verified.
+
+Decoder also has an option to forbid tag data items (treat any tag data item as error) which is specified by protocols such as CTAP2 Canonical CBOR.
+
+For more information, see [decoding options](#decoding-options-1) and [tag options](#tag-options).
+
+
+
+## Limitations
+
+If any of these limitations prevent you from using this library, please open an issue along with a link to your project.
+
+* CBOR `Undefined` (0xf7) value decodes to Go's `nil` value. CBOR `Null` (0xf6) more closely matches Go's `nil`.
+* CBOR map keys with data types not supported by Go for map keys are ignored and an error is returned after continuing to decode remaining items.
+* When decoding registered CBOR tag data to interface type, decoder creates a pointer to registered Go type matching CBOR tag number. Requiring a pointer for this is a Go limitation.
+
+## Fuzzing and Code Coverage
+
+__Code coverage__ is always 95% or higher (with `go test -cover`) when tagging a release.
+
+__Coverage-guided fuzzing__ must pass billions of execs using before tagging a release. Fuzzing is done using nonpublic code which may eventually get merged into this project. Until then, reports like OpenSSF Scorecard can't detect fuzz tests being used by this project.
+
+
+
+## Versions and API Changes
+This project uses [Semantic Versioning](https://semver.org), so the API is always backwards compatible unless the major version number changes.
+
+These functions have signatures identical to encoding/json and their API will continue to match `encoding/json` even after major new releases:
+`Marshal`, `Unmarshal`, `NewEncoder`, `NewDecoder`, `(*Encoder).Encode`, and `(*Decoder).Decode`.
+
+Exclusions from SemVer:
+- Newly added API documented as "subject to change".
+- Newly added API in the master branch that has never been tagged in non-beta release.
+- If function parameters are unchanged, bug fixes that change behavior (e.g. return error for edge case was missed in prior version). We try to highlight these in the release notes and add extended beta period. E.g. [v2.5.0-beta](https://github.com/fxamacker/cbor/releases/tag/v2.5.0-beta) (Dec 2022) -> [v2.5.0](https://github.com/fxamacker/cbor/releases/tag/v2.5.0) (Aug 2023).
+
+This project avoids breaking changes to behavior of encoding and decoding functions unless required to improve conformance with supported RFCs (e.g. RFC 8949, RFC 8742, etc.) Visible changes that don't improve conformance to standards are typically made available as new opt-in settings or new functions.
+
+## Code of Conduct
+
+This project has adopted the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md). Contact [faye.github@gmail.com](mailto:faye.github@gmail.com) with any questions or comments.
+
+## Contributing
+
+Please open an issue before beginning work on a PR. The improvement may have already been considered, etc.
+
+For more info, see [How to Contribute](CONTRIBUTING.md).
+
+## Security Policy
+
+Security fixes are provided for the latest released version of fxamacker/cbor.
+
+For the full text of the Security Policy, see [SECURITY.md](SECURITY.md).
+
+## Acknowledgements
+
+Many thanks to all the contributors on this project!
+
+I'm especially grateful to Bastian Müller and Dieter Shirley for suggesting and collaborating on CBOR stream mode, and much more.
+
+I'm very grateful to Stefan Tatschner, Yawning Angel, Jernej Kos, x448, ZenGround0, and Jakob Borg for their contributions or support in the very early days.
+
+Big thanks to Ben Luddy for his contributions in v2.6.0 and v2.7.0.
+
+This library clearly wouldn't be possible without Carsten Bormann authoring CBOR RFCs.
+
+Special thanks to Laurence Lundblade and Jeffrey Yasskin for their help on IETF mailing list or at [7049bis](https://github.com/cbor-wg/CBORbis).
+
+Huge thanks to The Go Authors for creating a fun and practical programming language with batteries included!
+
+This library uses `x448/float16` which used to be included. As a standalone package, `x448/float16` is useful to other projects as well.
+
+## License
+
+Copyright © 2019-2024 [Faye Amacker](https://github.com/fxamacker).
+
+fxamacker/cbor is licensed under the MIT License. See [LICENSE](LICENSE) for the full license text.
+
+
diff --git a/vendor/github.com/fxamacker/cbor/v2/SECURITY.md b/vendor/github.com/fxamacker/cbor/v2/SECURITY.md
new file mode 100644
index 000000000..9c05146d1
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/SECURITY.md
@@ -0,0 +1,7 @@
+# Security Policy
+
+Security fixes are provided for the latest released version of fxamacker/cbor.
+
+If the security vulnerability is already known to the public, then you can open an issue as a bug report.
+
+To report security vulnerabilities not yet known to the public, please email faye.github@gmail.com and allow time for the problem to be resolved before reporting it to the public.
diff --git a/vendor/github.com/fxamacker/cbor/v2/bytestring.go b/vendor/github.com/fxamacker/cbor/v2/bytestring.go
new file mode 100644
index 000000000..823bff12c
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/bytestring.go
@@ -0,0 +1,63 @@
+// Copyright (c) Faye Amacker. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+package cbor
+
+import (
+ "errors"
+)
+
+// ByteString represents CBOR byte string (major type 2). ByteString can be used
+// when using a Go []byte is not possible or convenient. For example, Go doesn't
+// allow []byte as map key, so ByteString can be used to support data formats
+// having CBOR map with byte string keys. ByteString can also be used to
+// encode invalid UTF-8 string as CBOR byte string.
+// See DecOption.MapKeyByteStringMode for more details.
+type ByteString string
+
+// Bytes returns bytes representing ByteString.
+func (bs ByteString) Bytes() []byte {
+ return []byte(bs)
+}
+
+// MarshalCBOR encodes ByteString as CBOR byte string (major type 2).
+func (bs ByteString) MarshalCBOR() ([]byte, error) {
+ e := getEncodeBuffer()
+ defer putEncodeBuffer(e)
+
+ // Encode length
+ encodeHead(e, byte(cborTypeByteString), uint64(len(bs)))
+
+ // Encode data
+ buf := make([]byte, e.Len()+len(bs))
+ n := copy(buf, e.Bytes())
+ copy(buf[n:], bs)
+
+ return buf, nil
+}
+
+// UnmarshalCBOR decodes CBOR byte string (major type 2) to ByteString.
+// Decoding CBOR null and CBOR undefined sets ByteString to be empty.
+func (bs *ByteString) UnmarshalCBOR(data []byte) error {
+ if bs == nil {
+ return errors.New("cbor.ByteString: UnmarshalCBOR on nil pointer")
+ }
+
+ // Decoding CBOR null and CBOR undefined to ByteString resets data.
+ // This behavior is similar to decoding CBOR null and CBOR undefined to []byte.
+ if len(data) == 1 && (data[0] == 0xf6 || data[0] == 0xf7) {
+ *bs = ""
+ return nil
+ }
+
+ d := decoder{data: data, dm: defaultDecMode}
+
+ // Check if CBOR data type is byte string
+ if typ := d.nextCBORType(); typ != cborTypeByteString {
+ return &UnmarshalTypeError{CBORType: typ.String(), GoType: typeByteString.String()}
+ }
+
+ b, _ := d.parseByteString()
+ *bs = ByteString(b)
+ return nil
+}
diff --git a/vendor/github.com/fxamacker/cbor/v2/cache.go b/vendor/github.com/fxamacker/cbor/v2/cache.go
new file mode 100644
index 000000000..ea0f39e24
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/cache.go
@@ -0,0 +1,363 @@
+// Copyright (c) Faye Amacker. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+package cbor
+
+import (
+ "bytes"
+ "errors"
+ "fmt"
+ "reflect"
+ "sort"
+ "strconv"
+ "strings"
+ "sync"
+)
+
+type encodeFuncs struct {
+ ef encodeFunc
+ ief isEmptyFunc
+}
+
+var (
+ decodingStructTypeCache sync.Map // map[reflect.Type]*decodingStructType
+ encodingStructTypeCache sync.Map // map[reflect.Type]*encodingStructType
+ encodeFuncCache sync.Map // map[reflect.Type]encodeFuncs
+ typeInfoCache sync.Map // map[reflect.Type]*typeInfo
+)
+
+type specialType int
+
+const (
+ specialTypeNone specialType = iota
+ specialTypeUnmarshalerIface
+ specialTypeEmptyIface
+ specialTypeIface
+ specialTypeTag
+ specialTypeTime
+)
+
+type typeInfo struct {
+ elemTypeInfo *typeInfo
+ keyTypeInfo *typeInfo
+ typ reflect.Type
+ kind reflect.Kind
+ nonPtrType reflect.Type
+ nonPtrKind reflect.Kind
+ spclType specialType
+}
+
+func newTypeInfo(t reflect.Type) *typeInfo {
+ tInfo := typeInfo{typ: t, kind: t.Kind()}
+
+ for t.Kind() == reflect.Ptr {
+ t = t.Elem()
+ }
+
+ k := t.Kind()
+
+ tInfo.nonPtrType = t
+ tInfo.nonPtrKind = k
+
+ if k == reflect.Interface {
+ if t.NumMethod() == 0 {
+ tInfo.spclType = specialTypeEmptyIface
+ } else {
+ tInfo.spclType = specialTypeIface
+ }
+ } else if t == typeTag {
+ tInfo.spclType = specialTypeTag
+ } else if t == typeTime {
+ tInfo.spclType = specialTypeTime
+ } else if reflect.PtrTo(t).Implements(typeUnmarshaler) {
+ tInfo.spclType = specialTypeUnmarshalerIface
+ }
+
+ switch k {
+ case reflect.Array, reflect.Slice:
+ tInfo.elemTypeInfo = getTypeInfo(t.Elem())
+ case reflect.Map:
+ tInfo.keyTypeInfo = getTypeInfo(t.Key())
+ tInfo.elemTypeInfo = getTypeInfo(t.Elem())
+ }
+
+ return &tInfo
+}
+
+type decodingStructType struct {
+ fields fields
+ fieldIndicesByName map[string]int
+ err error
+ toArray bool
+}
+
+// The stdlib errors.Join was introduced in Go 1.20, and we still support Go 1.17, so instead,
+// here's a very basic implementation of an aggregated error.
+type multierror []error
+
+func (m multierror) Error() string {
+ var sb strings.Builder
+ for i, err := range m {
+ sb.WriteString(err.Error())
+ if i < len(m)-1 {
+ sb.WriteString(", ")
+ }
+ }
+ return sb.String()
+}
+
+func getDecodingStructType(t reflect.Type) *decodingStructType {
+ if v, _ := decodingStructTypeCache.Load(t); v != nil {
+ return v.(*decodingStructType)
+ }
+
+ flds, structOptions := getFields(t)
+
+ toArray := hasToArrayOption(structOptions)
+
+ var errs []error
+ for i := 0; i < len(flds); i++ {
+ if flds[i].keyAsInt {
+ nameAsInt, numErr := strconv.Atoi(flds[i].name)
+ if numErr != nil {
+ errs = append(errs, errors.New("cbor: failed to parse field name \""+flds[i].name+"\" to int ("+numErr.Error()+")"))
+ break
+ }
+ flds[i].nameAsInt = int64(nameAsInt)
+ }
+
+ flds[i].typInfo = getTypeInfo(flds[i].typ)
+ }
+
+ fieldIndicesByName := make(map[string]int, len(flds))
+ for i, fld := range flds {
+ if _, ok := fieldIndicesByName[fld.name]; ok {
+ errs = append(errs, fmt.Errorf("cbor: two or more fields of %v have the same name %q", t, fld.name))
+ continue
+ }
+ fieldIndicesByName[fld.name] = i
+ }
+
+ var err error
+ {
+ var multi multierror
+ for _, each := range errs {
+ if each != nil {
+ multi = append(multi, each)
+ }
+ }
+ if len(multi) == 1 {
+ err = multi[0]
+ } else if len(multi) > 1 {
+ err = multi
+ }
+ }
+
+ structType := &decodingStructType{
+ fields: flds,
+ fieldIndicesByName: fieldIndicesByName,
+ err: err,
+ toArray: toArray,
+ }
+ decodingStructTypeCache.Store(t, structType)
+ return structType
+}
+
+type encodingStructType struct {
+ fields fields
+ bytewiseFields fields
+ lengthFirstFields fields
+ omitEmptyFieldsIdx []int
+ err error
+ toArray bool
+}
+
+func (st *encodingStructType) getFields(em *encMode) fields {
+ switch em.sort {
+ case SortNone, SortFastShuffle:
+ return st.fields
+ case SortLengthFirst:
+ return st.lengthFirstFields
+ default:
+ return st.bytewiseFields
+ }
+}
+
+type bytewiseFieldSorter struct {
+ fields fields
+}
+
+func (x *bytewiseFieldSorter) Len() int {
+ return len(x.fields)
+}
+
+func (x *bytewiseFieldSorter) Swap(i, j int) {
+ x.fields[i], x.fields[j] = x.fields[j], x.fields[i]
+}
+
+func (x *bytewiseFieldSorter) Less(i, j int) bool {
+ return bytes.Compare(x.fields[i].cborName, x.fields[j].cborName) <= 0
+}
+
+type lengthFirstFieldSorter struct {
+ fields fields
+}
+
+func (x *lengthFirstFieldSorter) Len() int {
+ return len(x.fields)
+}
+
+func (x *lengthFirstFieldSorter) Swap(i, j int) {
+ x.fields[i], x.fields[j] = x.fields[j], x.fields[i]
+}
+
+func (x *lengthFirstFieldSorter) Less(i, j int) bool {
+ if len(x.fields[i].cborName) != len(x.fields[j].cborName) {
+ return len(x.fields[i].cborName) < len(x.fields[j].cborName)
+ }
+ return bytes.Compare(x.fields[i].cborName, x.fields[j].cborName) <= 0
+}
+
+func getEncodingStructType(t reflect.Type) (*encodingStructType, error) {
+ if v, _ := encodingStructTypeCache.Load(t); v != nil {
+ structType := v.(*encodingStructType)
+ return structType, structType.err
+ }
+
+ flds, structOptions := getFields(t)
+
+ if hasToArrayOption(structOptions) {
+ return getEncodingStructToArrayType(t, flds)
+ }
+
+ var err error
+ var hasKeyAsInt bool
+ var hasKeyAsStr bool
+ var omitEmptyIdx []int
+ e := getEncodeBuffer()
+ for i := 0; i < len(flds); i++ {
+ // Get field's encodeFunc
+ flds[i].ef, flds[i].ief = getEncodeFunc(flds[i].typ)
+ if flds[i].ef == nil {
+ err = &UnsupportedTypeError{t}
+ break
+ }
+
+ // Encode field name
+ if flds[i].keyAsInt {
+ nameAsInt, numErr := strconv.Atoi(flds[i].name)
+ if numErr != nil {
+ err = errors.New("cbor: failed to parse field name \"" + flds[i].name + "\" to int (" + numErr.Error() + ")")
+ break
+ }
+ flds[i].nameAsInt = int64(nameAsInt)
+ if nameAsInt >= 0 {
+ encodeHead(e, byte(cborTypePositiveInt), uint64(nameAsInt))
+ } else {
+ n := nameAsInt*(-1) - 1
+ encodeHead(e, byte(cborTypeNegativeInt), uint64(n))
+ }
+ flds[i].cborName = make([]byte, e.Len())
+ copy(flds[i].cborName, e.Bytes())
+ e.Reset()
+
+ hasKeyAsInt = true
+ } else {
+ encodeHead(e, byte(cborTypeTextString), uint64(len(flds[i].name)))
+ flds[i].cborName = make([]byte, e.Len()+len(flds[i].name))
+ n := copy(flds[i].cborName, e.Bytes())
+ copy(flds[i].cborName[n:], flds[i].name)
+ e.Reset()
+
+ // If cborName contains a text string, then cborNameByteString contains a
+ // string that has the byte string major type but is otherwise identical to
+ // cborName.
+ flds[i].cborNameByteString = make([]byte, len(flds[i].cborName))
+ copy(flds[i].cborNameByteString, flds[i].cborName)
+ // Reset encoded CBOR type to byte string, preserving the "additional
+ // information" bits:
+ flds[i].cborNameByteString[0] = byte(cborTypeByteString) |
+ getAdditionalInformation(flds[i].cborNameByteString[0])
+
+ hasKeyAsStr = true
+ }
+
+ // Check if field can be omitted when empty
+ if flds[i].omitEmpty {
+ omitEmptyIdx = append(omitEmptyIdx, i)
+ }
+ }
+ putEncodeBuffer(e)
+
+ if err != nil {
+ structType := &encodingStructType{err: err}
+ encodingStructTypeCache.Store(t, structType)
+ return structType, structType.err
+ }
+
+ // Sort fields by canonical order
+ bytewiseFields := make(fields, len(flds))
+ copy(bytewiseFields, flds)
+ sort.Sort(&bytewiseFieldSorter{bytewiseFields})
+
+ lengthFirstFields := bytewiseFields
+ if hasKeyAsInt && hasKeyAsStr {
+ lengthFirstFields = make(fields, len(flds))
+ copy(lengthFirstFields, flds)
+ sort.Sort(&lengthFirstFieldSorter{lengthFirstFields})
+ }
+
+ structType := &encodingStructType{
+ fields: flds,
+ bytewiseFields: bytewiseFields,
+ lengthFirstFields: lengthFirstFields,
+ omitEmptyFieldsIdx: omitEmptyIdx,
+ }
+
+ encodingStructTypeCache.Store(t, structType)
+ return structType, structType.err
+}
+
+func getEncodingStructToArrayType(t reflect.Type, flds fields) (*encodingStructType, error) {
+ for i := 0; i < len(flds); i++ {
+ // Get field's encodeFunc
+ flds[i].ef, flds[i].ief = getEncodeFunc(flds[i].typ)
+ if flds[i].ef == nil {
+ structType := &encodingStructType{err: &UnsupportedTypeError{t}}
+ encodingStructTypeCache.Store(t, structType)
+ return structType, structType.err
+ }
+ }
+
+ structType := &encodingStructType{
+ fields: flds,
+ toArray: true,
+ }
+ encodingStructTypeCache.Store(t, structType)
+ return structType, structType.err
+}
+
+func getEncodeFunc(t reflect.Type) (encodeFunc, isEmptyFunc) {
+ if v, _ := encodeFuncCache.Load(t); v != nil {
+ fs := v.(encodeFuncs)
+ return fs.ef, fs.ief
+ }
+ ef, ief := getEncodeFuncInternal(t)
+ encodeFuncCache.Store(t, encodeFuncs{ef, ief})
+ return ef, ief
+}
+
+func getTypeInfo(t reflect.Type) *typeInfo {
+ if v, _ := typeInfoCache.Load(t); v != nil {
+ return v.(*typeInfo)
+ }
+ tInfo := newTypeInfo(t)
+ typeInfoCache.Store(t, tInfo)
+ return tInfo
+}
+
+func hasToArrayOption(tag string) bool {
+ s := ",toarray"
+ idx := strings.Index(tag, s)
+ return idx >= 0 && (len(tag) == idx+len(s) || tag[idx+len(s)] == ',')
+}
diff --git a/vendor/github.com/fxamacker/cbor/v2/common.go b/vendor/github.com/fxamacker/cbor/v2/common.go
new file mode 100644
index 000000000..ec038a49e
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/common.go
@@ -0,0 +1,182 @@
+// Copyright (c) Faye Amacker. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+package cbor
+
+import (
+ "fmt"
+ "strconv"
+)
+
+type cborType uint8
+
+const (
+ cborTypePositiveInt cborType = 0x00
+ cborTypeNegativeInt cborType = 0x20
+ cborTypeByteString cborType = 0x40
+ cborTypeTextString cborType = 0x60
+ cborTypeArray cborType = 0x80
+ cborTypeMap cborType = 0xa0
+ cborTypeTag cborType = 0xc0
+ cborTypePrimitives cborType = 0xe0
+)
+
+func (t cborType) String() string {
+ switch t {
+ case cborTypePositiveInt:
+ return "positive integer"
+ case cborTypeNegativeInt:
+ return "negative integer"
+ case cborTypeByteString:
+ return "byte string"
+ case cborTypeTextString:
+ return "UTF-8 text string"
+ case cborTypeArray:
+ return "array"
+ case cborTypeMap:
+ return "map"
+ case cborTypeTag:
+ return "tag"
+ case cborTypePrimitives:
+ return "primitives"
+ default:
+ return "Invalid type " + strconv.Itoa(int(t))
+ }
+}
+
+type additionalInformation uint8
+
+const (
+ maxAdditionalInformationWithoutArgument = 23
+ additionalInformationWith1ByteArgument = 24
+ additionalInformationWith2ByteArgument = 25
+ additionalInformationWith4ByteArgument = 26
+ additionalInformationWith8ByteArgument = 27
+
+ // For major type 7.
+ additionalInformationAsFalse = 20
+ additionalInformationAsTrue = 21
+ additionalInformationAsNull = 22
+ additionalInformationAsUndefined = 23
+ additionalInformationAsFloat16 = 25
+ additionalInformationAsFloat32 = 26
+ additionalInformationAsFloat64 = 27
+
+ // For major type 2, 3, 4, 5.
+ additionalInformationAsIndefiniteLengthFlag = 31
+)
+
+const (
+ maxSimpleValueInAdditionalInformation = 23
+ minSimpleValueIn1ByteArgument = 32
+)
+
+func (ai additionalInformation) isIndefiniteLength() bool {
+ return ai == additionalInformationAsIndefiniteLengthFlag
+}
+
+const (
+ // From RFC 8949 Section 3:
+ // "The initial byte of each encoded data item contains both information about the major type
+ // (the high-order 3 bits, described in Section 3.1) and additional information
+ // (the low-order 5 bits)."
+
+ // typeMask is used to extract major type in initial byte of encoded data item.
+ typeMask = 0xe0
+
+ // additionalInformationMask is used to extract additional information in initial byte of encoded data item.
+ additionalInformationMask = 0x1f
+)
+
+func getType(raw byte) cborType {
+ return cborType(raw & typeMask)
+}
+
+func getAdditionalInformation(raw byte) byte {
+ return raw & additionalInformationMask
+}
+
+func isBreakFlag(raw byte) bool {
+ return raw == cborBreakFlag
+}
+
+func parseInitialByte(b byte) (t cborType, ai byte) {
+ return getType(b), getAdditionalInformation(b)
+}
+
+const (
+ tagNumRFC3339Time = 0
+ tagNumEpochTime = 1
+ tagNumUnsignedBignum = 2
+ tagNumNegativeBignum = 3
+ tagNumExpectedLaterEncodingBase64URL = 21
+ tagNumExpectedLaterEncodingBase64 = 22
+ tagNumExpectedLaterEncodingBase16 = 23
+ tagNumSelfDescribedCBOR = 55799
+)
+
+const (
+ cborBreakFlag = byte(0xff)
+ cborByteStringWithIndefiniteLengthHead = byte(0x5f)
+ cborTextStringWithIndefiniteLengthHead = byte(0x7f)
+ cborArrayWithIndefiniteLengthHead = byte(0x9f)
+ cborMapWithIndefiniteLengthHead = byte(0xbf)
+)
+
+var (
+ cborFalse = []byte{0xf4}
+ cborTrue = []byte{0xf5}
+ cborNil = []byte{0xf6}
+ cborNaN = []byte{0xf9, 0x7e, 0x00}
+ cborPositiveInfinity = []byte{0xf9, 0x7c, 0x00}
+ cborNegativeInfinity = []byte{0xf9, 0xfc, 0x00}
+)
+
+// validBuiltinTag checks that supported built-in tag numbers are followed by expected content types.
+func validBuiltinTag(tagNum uint64, contentHead byte) error {
+ t := getType(contentHead)
+ switch tagNum {
+ case tagNumRFC3339Time:
+ // Tag content (date/time text string in RFC 3339 format) must be string type.
+ if t != cborTypeTextString {
+ return newInadmissibleTagContentTypeError(
+ tagNumRFC3339Time,
+ "text string",
+ t.String())
+ }
+ return nil
+
+ case tagNumEpochTime:
+ // Tag content (epoch date/time) must be uint, int, or float type.
+ if t != cborTypePositiveInt && t != cborTypeNegativeInt && (contentHead < 0xf9 || contentHead > 0xfb) {
+ return newInadmissibleTagContentTypeError(
+ tagNumEpochTime,
+ "integer or floating-point number",
+ t.String())
+ }
+ return nil
+
+ case tagNumUnsignedBignum, tagNumNegativeBignum:
+ // Tag content (bignum) must be byte type.
+ if t != cborTypeByteString {
+ return newInadmissibleTagContentTypeErrorf(
+ fmt.Sprintf(
+ "tag number %d or %d must be followed by byte string, got %s",
+ tagNumUnsignedBignum,
+ tagNumNegativeBignum,
+ t.String(),
+ ))
+ }
+ return nil
+
+ case tagNumExpectedLaterEncodingBase64URL, tagNumExpectedLaterEncodingBase64, tagNumExpectedLaterEncodingBase16:
+ // From RFC 8949 3.4.5.2:
+ // The data item tagged can be a byte string or any other data item. In the latter
+ // case, the tag applies to all of the byte string data items contained in the data
+ // item, except for those contained in a nested data item tagged with an expected
+ // conversion.
+ return nil
+ }
+
+ return nil
+}
diff --git a/vendor/github.com/fxamacker/cbor/v2/decode.go b/vendor/github.com/fxamacker/cbor/v2/decode.go
new file mode 100644
index 000000000..85842ac73
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/decode.go
@@ -0,0 +1,3187 @@
+// Copyright (c) Faye Amacker. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+package cbor
+
+import (
+ "encoding"
+ "encoding/base64"
+ "encoding/binary"
+ "encoding/hex"
+ "errors"
+ "fmt"
+ "io"
+ "math"
+ "math/big"
+ "reflect"
+ "strconv"
+ "strings"
+ "time"
+ "unicode/utf8"
+
+ "github.com/x448/float16"
+)
+
+// Unmarshal parses the CBOR-encoded data into the value pointed to by v
+// using default decoding options. If v is nil, not a pointer, or
+// a nil pointer, Unmarshal returns an error.
+//
+// To unmarshal CBOR into a value implementing the Unmarshaler interface,
+// Unmarshal calls that value's UnmarshalCBOR method with a valid
+// CBOR value.
+//
+// To unmarshal CBOR byte string into a value implementing the
+// encoding.BinaryUnmarshaler interface, Unmarshal calls that value's
+// UnmarshalBinary method with decoded CBOR byte string.
+//
+// To unmarshal CBOR into a pointer, Unmarshal sets the pointer to nil
+// if CBOR data is null (0xf6) or undefined (0xf7). Otherwise, Unmarshal
+// unmarshals CBOR into the value pointed to by the pointer. If the
+// pointer is nil, Unmarshal creates a new value for it to point to.
+//
+// To unmarshal CBOR into an empty interface value, Unmarshal uses the
+// following rules:
+//
+// CBOR booleans decode to bool.
+// CBOR positive integers decode to uint64.
+// CBOR negative integers decode to int64 (big.Int if value overflows).
+// CBOR floating points decode to float64.
+// CBOR byte strings decode to []byte.
+// CBOR text strings decode to string.
+// CBOR arrays decode to []interface{}.
+// CBOR maps decode to map[interface{}]interface{}.
+// CBOR null and undefined values decode to nil.
+// CBOR times (tag 0 and 1) decode to time.Time.
+// CBOR bignums (tag 2 and 3) decode to big.Int.
+// CBOR tags with an unrecognized number decode to cbor.Tag
+//
+// To unmarshal a CBOR array into a slice, Unmarshal allocates a new slice
+// if the CBOR array is empty or slice capacity is less than CBOR array length.
+// Otherwise Unmarshal overwrites existing elements, and sets slice length
+// to CBOR array length.
+//
+// To unmarshal a CBOR array into a Go array, Unmarshal decodes CBOR array
+// elements into Go array elements. If the Go array is smaller than the
+// CBOR array, the extra CBOR array elements are discarded. If the CBOR
+// array is smaller than the Go array, the extra Go array elements are
+// set to zero values.
+//
+// To unmarshal a CBOR array into a struct, struct must have a special field "_"
+// with struct tag `cbor:",toarray"`. Go array elements are decoded into struct
+// fields. Any "omitempty" struct field tag option is ignored in this case.
+//
+// To unmarshal a CBOR map into a map, Unmarshal allocates a new map only if the
+// map is nil. Otherwise Unmarshal reuses the existing map and keeps existing
+// entries. Unmarshal stores key-value pairs from the CBOR map into Go map.
+// See DecOptions.DupMapKey to enable duplicate map key detection.
+//
+// To unmarshal a CBOR map into a struct, Unmarshal matches CBOR map keys to the
+// keys in the following priority:
+//
+// 1. "cbor" key in struct field tag,
+// 2. "json" key in struct field tag,
+// 3. struct field name.
+//
+// Unmarshal tries an exact match for field name, then a case-insensitive match.
+// Map key-value pairs without corresponding struct fields are ignored. See
+// DecOptions.ExtraReturnErrors to return error at unknown field.
+//
+// To unmarshal a CBOR text string into a time.Time value, Unmarshal parses text
+// string formatted in RFC3339. To unmarshal a CBOR integer/float into a
+// time.Time value, Unmarshal creates an unix time with integer/float as seconds
+// and fractional seconds since January 1, 1970 UTC. As a special case, Infinite
+// and NaN float values decode to time.Time's zero value.
+//
+// To unmarshal CBOR null (0xf6) and undefined (0xf7) values into a
+// slice/map/pointer, Unmarshal sets Go value to nil. Because null is often
+// used to mean "not present", unmarshalling CBOR null and undefined value
+// into any other Go type has no effect and returns no error.
+//
+// Unmarshal supports CBOR tag 55799 (self-describe CBOR), tag 0 and 1 (time),
+// and tag 2 and 3 (bignum).
+//
+// Unmarshal returns ExtraneousDataError error (without decoding into v)
+// if there are any remaining bytes following the first valid CBOR data item.
+// See UnmarshalFirst, if you want to unmarshal only the first
+// CBOR data item without ExtraneousDataError caused by remaining bytes.
+func Unmarshal(data []byte, v interface{}) error {
+ return defaultDecMode.Unmarshal(data, v)
+}
+
+// UnmarshalFirst parses the first CBOR data item into the value pointed to by v
+// using default decoding options. Any remaining bytes are returned in rest.
+//
+// If v is nil, not a pointer, or a nil pointer, UnmarshalFirst returns an error.
+//
+// See the documentation for Unmarshal for details.
+func UnmarshalFirst(data []byte, v interface{}) (rest []byte, err error) {
+ return defaultDecMode.UnmarshalFirst(data, v)
+}
+
+// Valid checks whether data is a well-formed encoded CBOR data item and
+// that it complies with default restrictions such as MaxNestedLevels,
+// MaxArrayElements, MaxMapPairs, etc.
+//
+// If there are any remaining bytes after the CBOR data item,
+// an ExtraneousDataError is returned.
+//
+// WARNING: Valid doesn't check if encoded CBOR data item is valid (i.e. validity)
+// and RFC 8949 distinctly defines what is "Valid" and what is "Well-formed".
+//
+// Deprecated: Valid is kept for compatibility and should not be used.
+// Use Wellformed instead because it has a more appropriate name.
+func Valid(data []byte) error {
+ return defaultDecMode.Valid(data)
+}
+
+// Wellformed checks whether data is a well-formed encoded CBOR data item and
+// that it complies with default restrictions such as MaxNestedLevels,
+// MaxArrayElements, MaxMapPairs, etc.
+//
+// If there are any remaining bytes after the CBOR data item,
+// an ExtraneousDataError is returned.
+func Wellformed(data []byte) error {
+ return defaultDecMode.Wellformed(data)
+}
+
+// Unmarshaler is the interface implemented by types that wish to unmarshal
+// CBOR data themselves. The input is a valid CBOR value. UnmarshalCBOR
+// must copy the CBOR data if it needs to use it after returning.
+type Unmarshaler interface {
+ UnmarshalCBOR([]byte) error
+}
+
+// InvalidUnmarshalError describes an invalid argument passed to Unmarshal.
+type InvalidUnmarshalError struct {
+ s string
+}
+
+func (e *InvalidUnmarshalError) Error() string {
+ return e.s
+}
+
+// UnmarshalTypeError describes a CBOR value that can't be decoded to a Go type.
+type UnmarshalTypeError struct {
+ CBORType string // type of CBOR value
+ GoType string // type of Go value it could not be decoded into
+ StructFieldName string // name of the struct field holding the Go value (optional)
+ errorMsg string // additional error message (optional)
+}
+
+func (e *UnmarshalTypeError) Error() string {
+ var s string
+ if e.StructFieldName != "" {
+ s = "cbor: cannot unmarshal " + e.CBORType + " into Go struct field " + e.StructFieldName + " of type " + e.GoType
+ } else {
+ s = "cbor: cannot unmarshal " + e.CBORType + " into Go value of type " + e.GoType
+ }
+ if e.errorMsg != "" {
+ s += " (" + e.errorMsg + ")"
+ }
+ return s
+}
+
+// InvalidMapKeyTypeError describes invalid Go map key type when decoding CBOR map.
+// For example, Go doesn't allow slice as map key.
+type InvalidMapKeyTypeError struct {
+ GoType string
+}
+
+func (e *InvalidMapKeyTypeError) Error() string {
+ return "cbor: invalid map key type: " + e.GoType
+}
+
+// DupMapKeyError describes detected duplicate map key in CBOR map.
+type DupMapKeyError struct {
+ Key interface{}
+ Index int
+}
+
+func (e *DupMapKeyError) Error() string {
+ return fmt.Sprintf("cbor: found duplicate map key \"%v\" at map element index %d", e.Key, e.Index)
+}
+
+// UnknownFieldError describes detected unknown field in CBOR map when decoding to Go struct.
+type UnknownFieldError struct {
+ Index int
+}
+
+func (e *UnknownFieldError) Error() string {
+ return fmt.Sprintf("cbor: found unknown field at map element index %d", e.Index)
+}
+
+// UnacceptableDataItemError is returned when unmarshaling a CBOR input that contains a data item
+// that is not acceptable to a specific CBOR-based application protocol ("invalid or unexpected" as
+// described in RFC 8949 Section 5 Paragraph 3).
+type UnacceptableDataItemError struct {
+ CBORType string
+ Message string
+}
+
+func (e UnacceptableDataItemError) Error() string {
+ return fmt.Sprintf("cbor: data item of cbor type %s is not accepted by protocol: %s", e.CBORType, e.Message)
+}
+
+// ByteStringExpectedFormatError is returned when unmarshaling CBOR byte string fails when
+// using non-default ByteStringExpectedFormat decoding option that makes decoder expect
+// a specified format such as base64, hex, etc.
+type ByteStringExpectedFormatError struct {
+ expectedFormatOption ByteStringExpectedFormatMode
+ err error
+}
+
+func newByteStringExpectedFormatError(expectedFormatOption ByteStringExpectedFormatMode, err error) *ByteStringExpectedFormatError {
+ return &ByteStringExpectedFormatError{expectedFormatOption, err}
+}
+
+func (e *ByteStringExpectedFormatError) Error() string {
+ switch e.expectedFormatOption {
+ case ByteStringExpectedBase64URL:
+ return fmt.Sprintf("cbor: failed to decode base64url from byte string: %s", e.err)
+
+ case ByteStringExpectedBase64:
+ return fmt.Sprintf("cbor: failed to decode base64 from byte string: %s", e.err)
+
+ case ByteStringExpectedBase16:
+ return fmt.Sprintf("cbor: failed to decode hex from byte string: %s", e.err)
+
+ default:
+ return fmt.Sprintf("cbor: failed to decode byte string in expected format %d: %s", e.expectedFormatOption, e.err)
+ }
+}
+
+func (e *ByteStringExpectedFormatError) Unwrap() error {
+ return e.err
+}
+
+// InadmissibleTagContentTypeError is returned when unmarshaling built-in CBOR tags
+// fails because of inadmissible type for tag content. Currently, the built-in
+// CBOR tags in this codec are tags 0-3 and 21-23.
+// See "Tag validity" in RFC 8949 Section 5.3.2.
+type InadmissibleTagContentTypeError struct {
+ s string
+ tagNum int
+ expectedTagContentType string
+ gotTagContentType string
+}
+
+func newInadmissibleTagContentTypeError(
+ tagNum int,
+ expectedTagContentType string,
+ gotTagContentType string,
+) *InadmissibleTagContentTypeError {
+ return &InadmissibleTagContentTypeError{
+ tagNum: tagNum,
+ expectedTagContentType: expectedTagContentType,
+ gotTagContentType: gotTagContentType,
+ }
+}
+
+func newInadmissibleTagContentTypeErrorf(s string) *InadmissibleTagContentTypeError {
+ return &InadmissibleTagContentTypeError{s: "cbor: " + s} //nolint:goconst // ignore "cbor"
+}
+
+func (e *InadmissibleTagContentTypeError) Error() string {
+ if e.s == "" {
+ return fmt.Sprintf(
+ "cbor: tag number %d must be followed by %s, got %s",
+ e.tagNum,
+ e.expectedTagContentType,
+ e.gotTagContentType,
+ )
+ }
+ return e.s
+}
+
+// DupMapKeyMode specifies how to enforce duplicate map key. Two map keys are considered duplicates if:
+// 1. When decoding into a struct, both keys match the same struct field. The keys are also
+// considered duplicates if neither matches any field and decoding to interface{} would produce
+// equal (==) values for both keys.
+// 2. When decoding into a map, both keys are equal (==) when decoded into values of the
+// destination map's key type.
+type DupMapKeyMode int
+
+const (
+ // DupMapKeyQuiet doesn't enforce duplicate map key. Decoder quietly (no error)
+ // uses faster of "keep first" or "keep last" depending on Go data type and other factors.
+ DupMapKeyQuiet DupMapKeyMode = iota
+
+ // DupMapKeyEnforcedAPF enforces detection and rejection of duplicate map keys.
+ // APF means "Allow Partial Fill" and the destination map or struct can be partially filled.
+ // If a duplicate map key is detected, DupMapKeyError is returned without further decoding
+ // of the map. It's the caller's responsibility to respond to DupMapKeyError by
+ // discarding the partially filled result if their protocol requires it.
+ // WARNING: using DupMapKeyEnforcedAPF will decrease performance and increase memory use.
+ DupMapKeyEnforcedAPF
+
+ maxDupMapKeyMode
+)
+
+func (dmkm DupMapKeyMode) valid() bool {
+ return dmkm >= 0 && dmkm < maxDupMapKeyMode
+}
+
+// IndefLengthMode specifies whether to allow indefinite length items.
+type IndefLengthMode int
+
+const (
+ // IndefLengthAllowed allows indefinite length items.
+ IndefLengthAllowed IndefLengthMode = iota
+
+ // IndefLengthForbidden disallows indefinite length items.
+ IndefLengthForbidden
+
+ maxIndefLengthMode
+)
+
+func (m IndefLengthMode) valid() bool {
+ return m >= 0 && m < maxIndefLengthMode
+}
+
+// TagsMode specifies whether to allow CBOR tags.
+type TagsMode int
+
+const (
+ // TagsAllowed allows CBOR tags.
+ TagsAllowed TagsMode = iota
+
+ // TagsForbidden disallows CBOR tags.
+ TagsForbidden
+
+ maxTagsMode
+)
+
+func (tm TagsMode) valid() bool {
+ return tm >= 0 && tm < maxTagsMode
+}
+
+// IntDecMode specifies which Go type (int64, uint64, or big.Int) should
+// be used when decoding CBOR integers (major type 0 and 1) to Go interface{}.
+type IntDecMode int
+
+const (
+ // IntDecConvertNone affects how CBOR integers (major type 0 and 1) decode to Go interface{}.
+ // It decodes CBOR unsigned integer (major type 0) to:
+ // - uint64
+ // It decodes CBOR negative integer (major type 1) to:
+ // - int64 if value fits
+ // - big.Int or *big.Int (see BigIntDecMode) if value doesn't fit into int64
+ IntDecConvertNone IntDecMode = iota
+
+ // IntDecConvertSigned affects how CBOR integers (major type 0 and 1) decode to Go interface{}.
+ // It decodes CBOR integers (major type 0 and 1) to:
+ // - int64 if value fits
+ // - big.Int or *big.Int (see BigIntDecMode) if value < math.MinInt64
+ // - return UnmarshalTypeError if value > math.MaxInt64
+ // Deprecated: IntDecConvertSigned should not be used.
+ // Please use other options, such as IntDecConvertSignedOrError, IntDecConvertSignedOrBigInt, IntDecConvertNone.
+ IntDecConvertSigned
+
+ // IntDecConvertSignedOrFail affects how CBOR integers (major type 0 and 1) decode to Go interface{}.
+ // It decodes CBOR integers (major type 0 and 1) to:
+ // - int64 if value fits
+ // - return UnmarshalTypeError if value doesn't fit into int64
+ IntDecConvertSignedOrFail
+
+ // IntDecConvertSigned affects how CBOR integers (major type 0 and 1) decode to Go interface{}.
+ // It makes CBOR integers (major type 0 and 1) decode to:
+ // - int64 if value fits
+ // - big.Int or *big.Int (see BigIntDecMode) if value doesn't fit into int64
+ IntDecConvertSignedOrBigInt
+
+ maxIntDec
+)
+
+func (idm IntDecMode) valid() bool {
+ return idm >= 0 && idm < maxIntDec
+}
+
+// MapKeyByteStringMode specifies how to decode CBOR byte string (major type 2)
+// as Go map key when decoding CBOR map key into an empty Go interface value.
+// Specifically, this option applies when decoding CBOR map into
+// - Go empty interface, or
+// - Go map with empty interface as key type.
+// The CBOR map key types handled by this option are
+// - byte string
+// - tagged byte string
+// - nested tagged byte string
+type MapKeyByteStringMode int
+
+const (
+ // MapKeyByteStringAllowed allows CBOR byte string to be decoded as Go map key.
+ // Since Go doesn't allow []byte as map key, CBOR byte string is decoded to
+ // ByteString which has underlying string type.
+ // This is the default setting.
+ MapKeyByteStringAllowed MapKeyByteStringMode = iota
+
+ // MapKeyByteStringForbidden forbids CBOR byte string being decoded as Go map key.
+ // Attempting to decode CBOR byte string as map key into empty interface value
+ // returns a decoding error.
+ MapKeyByteStringForbidden
+
+ maxMapKeyByteStringMode
+)
+
+func (mkbsm MapKeyByteStringMode) valid() bool {
+ return mkbsm >= 0 && mkbsm < maxMapKeyByteStringMode
+}
+
+// ExtraDecErrorCond specifies extra conditions that should be treated as errors.
+type ExtraDecErrorCond uint
+
+// ExtraDecErrorNone indicates no extra error condition.
+const ExtraDecErrorNone ExtraDecErrorCond = 0
+
+const (
+ // ExtraDecErrorUnknownField indicates error condition when destination
+ // Go struct doesn't have a field matching a CBOR map key.
+ ExtraDecErrorUnknownField ExtraDecErrorCond = 1 << iota
+
+ maxExtraDecError
+)
+
+func (ec ExtraDecErrorCond) valid() bool {
+ return ec < maxExtraDecError
+}
+
+// UTF8Mode option specifies if decoder should
+// decode CBOR Text containing invalid UTF-8 string.
+type UTF8Mode int
+
+const (
+ // UTF8RejectInvalid rejects CBOR Text containing
+ // invalid UTF-8 string.
+ UTF8RejectInvalid UTF8Mode = iota
+
+ // UTF8DecodeInvalid allows decoding CBOR Text containing
+ // invalid UTF-8 string.
+ UTF8DecodeInvalid
+
+ maxUTF8Mode
+)
+
+func (um UTF8Mode) valid() bool {
+ return um >= 0 && um < maxUTF8Mode
+}
+
+// FieldNameMatchingMode specifies how string keys in CBOR maps are matched to Go struct field names.
+type FieldNameMatchingMode int
+
+const (
+ // FieldNameMatchingPreferCaseSensitive prefers to decode map items into struct fields whose names (or tag
+ // names) exactly match the item's key. If there is no such field, a map item will be decoded into a field whose
+ // name is a case-insensitive match for the item's key.
+ FieldNameMatchingPreferCaseSensitive FieldNameMatchingMode = iota
+
+ // FieldNameMatchingCaseSensitive decodes map items only into a struct field whose name (or tag name) is an
+ // exact match for the item's key.
+ FieldNameMatchingCaseSensitive
+
+ maxFieldNameMatchingMode
+)
+
+func (fnmm FieldNameMatchingMode) valid() bool {
+ return fnmm >= 0 && fnmm < maxFieldNameMatchingMode
+}
+
+// BigIntDecMode specifies how to decode CBOR bignum to Go interface{}.
+type BigIntDecMode int
+
+const (
+ // BigIntDecodeValue makes CBOR bignum decode to big.Int (instead of *big.Int)
+ // when unmarshalling into a Go interface{}.
+ BigIntDecodeValue BigIntDecMode = iota
+
+ // BigIntDecodePointer makes CBOR bignum decode to *big.Int when
+ // unmarshalling into a Go interface{}.
+ BigIntDecodePointer
+
+ maxBigIntDecMode
+)
+
+func (bidm BigIntDecMode) valid() bool {
+ return bidm >= 0 && bidm < maxBigIntDecMode
+}
+
+// ByteStringToStringMode specifies the behavior when decoding a CBOR byte string into a Go string.
+type ByteStringToStringMode int
+
+const (
+ // ByteStringToStringForbidden generates an error on an attempt to decode a CBOR byte string into a Go string.
+ ByteStringToStringForbidden ByteStringToStringMode = iota
+
+ // ByteStringToStringAllowed permits decoding a CBOR byte string into a Go string.
+ ByteStringToStringAllowed
+
+ // ByteStringToStringAllowedWithExpectedLaterEncoding permits decoding a CBOR byte string
+ // into a Go string. Also, if the byte string is enclosed (directly or indirectly) by one of
+ // the "expected later encoding" tags (numbers 21 through 23), the destination string will
+ // be populated by applying the designated text encoding to the contents of the input byte
+ // string.
+ ByteStringToStringAllowedWithExpectedLaterEncoding
+
+ maxByteStringToStringMode
+)
+
+func (bstsm ByteStringToStringMode) valid() bool {
+ return bstsm >= 0 && bstsm < maxByteStringToStringMode
+}
+
+// FieldNameByteStringMode specifies the behavior when decoding a CBOR byte string map key as a Go struct field name.
+type FieldNameByteStringMode int
+
+const (
+ // FieldNameByteStringForbidden generates an error on an attempt to decode a CBOR byte string map key as a Go struct field name.
+ FieldNameByteStringForbidden FieldNameByteStringMode = iota
+
+ // FieldNameByteStringAllowed permits CBOR byte string map keys to be recognized as Go struct field names.
+ FieldNameByteStringAllowed
+
+ maxFieldNameByteStringMode
+)
+
+func (fnbsm FieldNameByteStringMode) valid() bool {
+ return fnbsm >= 0 && fnbsm < maxFieldNameByteStringMode
+}
+
+// UnrecognizedTagToAnyMode specifies how to decode unrecognized CBOR tag into an empty interface (any).
+// Currently, recognized CBOR tag numbers are 0, 1, 2, 3, or registered by TagSet.
+type UnrecognizedTagToAnyMode int
+
+const (
+ // UnrecognizedTagNumAndContentToAny decodes CBOR tag number and tag content to cbor.Tag
+ // when decoding unrecognized CBOR tag into an empty interface.
+ UnrecognizedTagNumAndContentToAny UnrecognizedTagToAnyMode = iota
+
+ // UnrecognizedTagContentToAny decodes only CBOR tag content (into its default type)
+ // when decoding unrecognized CBOR tag into an empty interface.
+ UnrecognizedTagContentToAny
+
+ maxUnrecognizedTagToAny
+)
+
+func (uttam UnrecognizedTagToAnyMode) valid() bool {
+ return uttam >= 0 && uttam < maxUnrecognizedTagToAny
+}
+
+// TimeTagToAnyMode specifies how to decode CBOR tag 0 and 1 into an empty interface (any).
+// Based on the specified mode, Unmarshal can return a time.Time value or a time string in a specific format.
+type TimeTagToAnyMode int
+
+const (
+ // TimeTagToTime decodes CBOR tag 0 and 1 into a time.Time value
+ // when decoding tag 0 or 1 into an empty interface.
+ TimeTagToTime TimeTagToAnyMode = iota
+
+ // TimeTagToRFC3339 decodes CBOR tag 0 and 1 into a time string in RFC3339 format
+ // when decoding tag 0 or 1 into an empty interface.
+ TimeTagToRFC3339
+
+ // TimeTagToRFC3339Nano decodes CBOR tag 0 and 1 into a time string in RFC3339Nano format
+ // when decoding tag 0 or 1 into an empty interface.
+ TimeTagToRFC3339Nano
+
+ maxTimeTagToAnyMode
+)
+
+func (tttam TimeTagToAnyMode) valid() bool {
+ return tttam >= 0 && tttam < maxTimeTagToAnyMode
+}
+
+// SimpleValueRegistry is a registry of unmarshaling behaviors for each possible CBOR simple value
+// number (0...23 and 32...255).
+type SimpleValueRegistry struct {
+ rejected [256]bool
+}
+
+// WithRejectedSimpleValue registers the given simple value as rejected. If the simple value is
+// encountered in a CBOR input during unmarshaling, an UnacceptableDataItemError is returned.
+func WithRejectedSimpleValue(sv SimpleValue) func(*SimpleValueRegistry) error {
+ return func(r *SimpleValueRegistry) error {
+ if sv >= 24 && sv <= 31 {
+ return fmt.Errorf("cbor: cannot set analog for reserved simple value %d", sv)
+ }
+ r.rejected[sv] = true
+ return nil
+ }
+}
+
+// Creates a new SimpleValueRegistry. The registry state is initialized by executing the provided
+// functions in order against a registry that is pre-populated with the defaults for all well-formed
+// simple value numbers.
+func NewSimpleValueRegistryFromDefaults(fns ...func(*SimpleValueRegistry) error) (*SimpleValueRegistry, error) {
+ var r SimpleValueRegistry
+ for _, fn := range fns {
+ if err := fn(&r); err != nil {
+ return nil, err
+ }
+ }
+ return &r, nil
+}
+
+// NaNMode specifies how to decode floating-point values (major type 7, additional information 25
+// through 27) representing NaN (not-a-number).
+type NaNMode int
+
+const (
+ // NaNDecodeAllowed will decode NaN values to Go float32 or float64.
+ NaNDecodeAllowed NaNMode = iota
+
+ // NaNDecodeForbidden will return an UnacceptableDataItemError on an attempt to decode a NaN value.
+ NaNDecodeForbidden
+
+ maxNaNDecode
+)
+
+func (ndm NaNMode) valid() bool {
+ return ndm >= 0 && ndm < maxNaNDecode
+}
+
+// InfMode specifies how to decode floating-point values (major type 7, additional information 25
+// through 27) representing positive or negative infinity.
+type InfMode int
+
+const (
+ // InfDecodeAllowed will decode infinite values to Go float32 or float64.
+ InfDecodeAllowed InfMode = iota
+
+ // InfDecodeForbidden will return an UnacceptableDataItemError on an attempt to decode an
+ // infinite value.
+ InfDecodeForbidden
+
+ maxInfDecode
+)
+
+func (idm InfMode) valid() bool {
+ return idm >= 0 && idm < maxInfDecode
+}
+
+// ByteStringToTimeMode specifies the behavior when decoding a CBOR byte string into a Go time.Time.
+type ByteStringToTimeMode int
+
+const (
+ // ByteStringToTimeForbidden generates an error on an attempt to decode a CBOR byte string into a Go time.Time.
+ ByteStringToTimeForbidden ByteStringToTimeMode = iota
+
+ // ByteStringToTimeAllowed permits decoding a CBOR byte string into a Go time.Time.
+ ByteStringToTimeAllowed
+
+ maxByteStringToTimeMode
+)
+
+func (bttm ByteStringToTimeMode) valid() bool {
+ return bttm >= 0 && bttm < maxByteStringToTimeMode
+}
+
+// ByteStringExpectedFormatMode specifies how to decode CBOR byte string into Go byte slice
+// when the byte string is NOT enclosed in CBOR tag 21, 22, or 23. An error is returned if
+// the CBOR byte string does not contain the expected format (e.g. base64) specified.
+// For tags 21-23, see "Expected Later Encoding for CBOR-to-JSON Converters"
+// in RFC 8949 Section 3.4.5.2.
+type ByteStringExpectedFormatMode int
+
+const (
+ // ByteStringExpectedFormatNone copies the unmodified CBOR byte string into Go byte slice
+ // if the byte string is not tagged by CBOR tag 21-23.
+ ByteStringExpectedFormatNone ByteStringExpectedFormatMode = iota
+
+ // ByteStringExpectedBase64URL expects CBOR byte strings to contain base64url-encoded bytes
+ // if the byte string is not tagged by CBOR tag 21-23. The decoder will attempt to decode
+ // the base64url-encoded bytes into Go slice.
+ ByteStringExpectedBase64URL
+
+ // ByteStringExpectedBase64 expects CBOR byte strings to contain base64-encoded bytes
+ // if the byte string is not tagged by CBOR tag 21-23. The decoder will attempt to decode
+ // the base64-encoded bytes into Go slice.
+ ByteStringExpectedBase64
+
+ // ByteStringExpectedBase16 expects CBOR byte strings to contain base16-encoded bytes
+ // if the byte string is not tagged by CBOR tag 21-23. The decoder will attempt to decode
+ // the base16-encoded bytes into Go slice.
+ ByteStringExpectedBase16
+
+ maxByteStringExpectedFormatMode
+)
+
+func (bsefm ByteStringExpectedFormatMode) valid() bool {
+ return bsefm >= 0 && bsefm < maxByteStringExpectedFormatMode
+}
+
+// BignumTagMode specifies whether or not the "bignum" tags 2 and 3 (RFC 8949 Section 3.4.3) can be
+// decoded.
+type BignumTagMode int
+
+const (
+ // BignumTagAllowed allows bignum tags to be decoded.
+ BignumTagAllowed BignumTagMode = iota
+
+ // BignumTagForbidden produces an UnacceptableDataItemError during Unmarshal if a bignum tag
+ // is encountered in the input.
+ BignumTagForbidden
+
+ maxBignumTag
+)
+
+func (btm BignumTagMode) valid() bool {
+ return btm >= 0 && btm < maxBignumTag
+}
+
+// BinaryUnmarshalerMode specifies how to decode into types that implement
+// encoding.BinaryUnmarshaler.
+type BinaryUnmarshalerMode int
+
+const (
+ // BinaryUnmarshalerByteString will invoke UnmarshalBinary on the contents of a CBOR byte
+ // string when decoding into a value that implements BinaryUnmarshaler.
+ BinaryUnmarshalerByteString BinaryUnmarshalerMode = iota
+
+ // BinaryUnmarshalerNone does not recognize BinaryUnmarshaler implementations during decode.
+ BinaryUnmarshalerNone
+
+ maxBinaryUnmarshalerMode
+)
+
+func (bum BinaryUnmarshalerMode) valid() bool {
+ return bum >= 0 && bum < maxBinaryUnmarshalerMode
+}
+
+// DecOptions specifies decoding options.
+type DecOptions struct {
+ // DupMapKey specifies whether to enforce duplicate map key.
+ DupMapKey DupMapKeyMode
+
+ // TimeTag specifies whether or not untagged data items, or tags other
+ // than tag 0 and tag 1, can be decoded to time.Time. If tag 0 or tag 1
+ // appears in an input, the type of its content is always validated as
+ // specified in RFC 8949. That behavior is not controlled by this
+ // option. The behavior of the supported modes are:
+ //
+ // DecTagIgnored (default): Untagged text strings and text strings
+ // enclosed in tags other than 0 and 1 are decoded as though enclosed
+ // in tag 0. Untagged unsigned integers, negative integers, and
+ // floating-point numbers (or those enclosed in tags other than 0 and
+ // 1) are decoded as though enclosed in tag 1. Decoding a tag other
+ // than 0 or 1 enclosing simple values null or undefined into a
+ // time.Time does not modify the destination value.
+ //
+ // DecTagOptional: Untagged text strings are decoded as though
+ // enclosed in tag 0. Untagged unsigned integers, negative integers,
+ // and floating-point numbers are decoded as though enclosed in tag
+ // 1. Tags other than 0 and 1 will produce an error on attempts to
+ // decode them into a time.Time.
+ //
+ // DecTagRequired: Only tags 0 and 1 can be decoded to time.Time. Any
+ // other input will produce an error.
+ TimeTag DecTagMode
+
+ // MaxNestedLevels specifies the max nested levels allowed for any combination of CBOR array, maps, and tags.
+ // Default is 32 levels and it can be set to [4, 65535]. Note that higher maximum levels of nesting can
+ // require larger amounts of stack to deserialize. Don't increase this higher than you require.
+ MaxNestedLevels int
+
+ // MaxArrayElements specifies the max number of elements for CBOR arrays.
+ // Default is 128*1024=131072 and it can be set to [16, 2147483647]
+ MaxArrayElements int
+
+ // MaxMapPairs specifies the max number of key-value pairs for CBOR maps.
+ // Default is 128*1024=131072 and it can be set to [16, 2147483647]
+ MaxMapPairs int
+
+ // IndefLength specifies whether to allow indefinite length CBOR items.
+ IndefLength IndefLengthMode
+
+ // TagsMd specifies whether to allow CBOR tags (major type 6).
+ TagsMd TagsMode
+
+ // IntDec specifies which Go integer type (int64 or uint64) to use
+ // when decoding CBOR int (major type 0 and 1) to Go interface{}.
+ IntDec IntDecMode
+
+ // MapKeyByteString specifies how to decode CBOR byte string as map key
+ // when decoding CBOR map with byte string key into an empty interface value.
+ // By default, an error is returned when attempting to decode CBOR byte string
+ // as map key because Go doesn't allow []byte as map key.
+ MapKeyByteString MapKeyByteStringMode
+
+ // ExtraReturnErrors specifies extra conditions that should be treated as errors.
+ ExtraReturnErrors ExtraDecErrorCond
+
+ // DefaultMapType specifies Go map type to create and decode to
+ // when unmarshalling CBOR into an empty interface value.
+ // By default, unmarshal uses map[interface{}]interface{}.
+ DefaultMapType reflect.Type
+
+ // UTF8 specifies if decoder should decode CBOR Text containing invalid UTF-8.
+ // By default, unmarshal rejects CBOR text containing invalid UTF-8.
+ UTF8 UTF8Mode
+
+ // FieldNameMatching specifies how string keys in CBOR maps are matched to Go struct field names.
+ FieldNameMatching FieldNameMatchingMode
+
+ // BigIntDec specifies how to decode CBOR bignum to Go interface{}.
+ BigIntDec BigIntDecMode
+
+ // DefaultByteStringType is the Go type that should be produced when decoding a CBOR byte
+ // string into an empty interface value. Types to which a []byte is convertible are valid
+ // for this option, except for array and pointer-to-array types. If nil, the default is
+ // []byte.
+ DefaultByteStringType reflect.Type
+
+ // ByteStringToString specifies the behavior when decoding a CBOR byte string into a Go string.
+ ByteStringToString ByteStringToStringMode
+
+ // FieldNameByteString specifies the behavior when decoding a CBOR byte string map key as a
+ // Go struct field name.
+ FieldNameByteString FieldNameByteStringMode
+
+ // UnrecognizedTagToAny specifies how to decode unrecognized CBOR tag into an empty interface.
+ // Currently, recognized CBOR tag numbers are 0, 1, 2, 3, or registered by TagSet.
+ UnrecognizedTagToAny UnrecognizedTagToAnyMode
+
+ // TimeTagToAny specifies how to decode CBOR tag 0 and 1 into an empty interface (any).
+ // Based on the specified mode, Unmarshal can return a time.Time value or a time string in a specific format.
+ TimeTagToAny TimeTagToAnyMode
+
+ // SimpleValues is an immutable mapping from each CBOR simple value to a corresponding
+ // unmarshal behavior. If nil, the simple values false, true, null, and undefined are mapped
+ // to the Go analog values false, true, nil, and nil, respectively, and all other simple
+ // values N (except the reserved simple values 24 through 31) are mapped to
+ // cbor.SimpleValue(N). In other words, all well-formed simple values can be decoded.
+ //
+ // Users may provide a custom SimpleValueRegistry constructed via
+ // NewSimpleValueRegistryFromDefaults.
+ SimpleValues *SimpleValueRegistry
+
+ // NaN specifies how to decode floating-point values (major type 7, additional information
+ // 25 through 27) representing NaN (not-a-number).
+ NaN NaNMode
+
+ // Inf specifies how to decode floating-point values (major type 7, additional information
+ // 25 through 27) representing positive or negative infinity.
+ Inf InfMode
+
+ // ByteStringToTime specifies how to decode CBOR byte string into Go time.Time.
+ ByteStringToTime ByteStringToTimeMode
+
+ // ByteStringExpectedFormat specifies how to decode CBOR byte string into Go byte slice
+ // when the byte string is NOT enclosed in CBOR tag 21, 22, or 23. An error is returned if
+ // the CBOR byte string does not contain the expected format (e.g. base64) specified.
+ // For tags 21-23, see "Expected Later Encoding for CBOR-to-JSON Converters"
+ // in RFC 8949 Section 3.4.5.2.
+ ByteStringExpectedFormat ByteStringExpectedFormatMode
+
+ // BignumTag specifies whether or not the "bignum" tags 2 and 3 (RFC 8949 Section 3.4.3) can
+ // be decoded. Unlike BigIntDec, this option applies to all bignum tags encountered in a
+ // CBOR input, independent of the type of the destination value of a particular Unmarshal
+ // operation.
+ BignumTag BignumTagMode
+
+ // BinaryUnmarshaler specifies how to decode into types that implement
+ // encoding.BinaryUnmarshaler.
+ BinaryUnmarshaler BinaryUnmarshalerMode
+}
+
+// DecMode returns DecMode with immutable options and no tags (safe for concurrency).
+func (opts DecOptions) DecMode() (DecMode, error) { //nolint:gocritic // ignore hugeParam
+ return opts.decMode()
+}
+
+// validForTags checks that the provided tag set is compatible with these options and returns a
+// non-nil error if and only if the provided tag set is incompatible.
+func (opts DecOptions) validForTags(tags TagSet) error { //nolint:gocritic // ignore hugeParam
+ if opts.TagsMd == TagsForbidden {
+ return errors.New("cbor: cannot create DecMode with TagSet when TagsMd is TagsForbidden")
+ }
+ if tags == nil {
+ return errors.New("cbor: cannot create DecMode with nil value as TagSet")
+ }
+ if opts.ByteStringToString == ByteStringToStringAllowedWithExpectedLaterEncoding ||
+ opts.ByteStringExpectedFormat != ByteStringExpectedFormatNone {
+ for _, tagNum := range []uint64{
+ tagNumExpectedLaterEncodingBase64URL,
+ tagNumExpectedLaterEncodingBase64,
+ tagNumExpectedLaterEncodingBase16,
+ } {
+ if rt := tags.getTypeFromTagNum([]uint64{tagNum}); rt != nil {
+ return fmt.Errorf("cbor: DecMode with non-default StringExpectedEncoding or ByteSliceExpectedEncoding treats tag %d as built-in and conflicts with the provided TagSet's registration of %v", tagNum, rt)
+ }
+ }
+
+ }
+ return nil
+}
+
+// DecModeWithTags returns DecMode with options and tags that are both immutable (safe for concurrency).
+func (opts DecOptions) DecModeWithTags(tags TagSet) (DecMode, error) { //nolint:gocritic // ignore hugeParam
+ if err := opts.validForTags(tags); err != nil {
+ return nil, err
+ }
+ dm, err := opts.decMode()
+ if err != nil {
+ return nil, err
+ }
+
+ // Copy tags
+ ts := tagSet(make(map[reflect.Type]*tagItem))
+ syncTags := tags.(*syncTagSet)
+ syncTags.RLock()
+ for contentType, tag := range syncTags.t {
+ if tag.opts.DecTag != DecTagIgnored {
+ ts[contentType] = tag
+ }
+ }
+ syncTags.RUnlock()
+
+ if len(ts) > 0 {
+ dm.tags = ts
+ }
+
+ return dm, nil
+}
+
+// DecModeWithSharedTags returns DecMode with immutable options and mutable shared tags (safe for concurrency).
+func (opts DecOptions) DecModeWithSharedTags(tags TagSet) (DecMode, error) { //nolint:gocritic // ignore hugeParam
+ if err := opts.validForTags(tags); err != nil {
+ return nil, err
+ }
+ dm, err := opts.decMode()
+ if err != nil {
+ return nil, err
+ }
+ dm.tags = tags
+ return dm, nil
+}
+
+const (
+ defaultMaxArrayElements = 131072
+ minMaxArrayElements = 16
+ maxMaxArrayElements = 2147483647
+
+ defaultMaxMapPairs = 131072
+ minMaxMapPairs = 16
+ maxMaxMapPairs = 2147483647
+
+ defaultMaxNestedLevels = 32
+ minMaxNestedLevels = 4
+ maxMaxNestedLevels = 65535
+)
+
+var defaultSimpleValues = func() *SimpleValueRegistry {
+ registry, err := NewSimpleValueRegistryFromDefaults()
+ if err != nil {
+ panic(err)
+ }
+ return registry
+}()
+
+//nolint:gocyclo // Each option comes with some manageable boilerplate
+func (opts DecOptions) decMode() (*decMode, error) { //nolint:gocritic // ignore hugeParam
+ if !opts.DupMapKey.valid() {
+ return nil, errors.New("cbor: invalid DupMapKey " + strconv.Itoa(int(opts.DupMapKey)))
+ }
+
+ if !opts.TimeTag.valid() {
+ return nil, errors.New("cbor: invalid TimeTag " + strconv.Itoa(int(opts.TimeTag)))
+ }
+
+ if !opts.IndefLength.valid() {
+ return nil, errors.New("cbor: invalid IndefLength " + strconv.Itoa(int(opts.IndefLength)))
+ }
+
+ if !opts.TagsMd.valid() {
+ return nil, errors.New("cbor: invalid TagsMd " + strconv.Itoa(int(opts.TagsMd)))
+ }
+
+ if !opts.IntDec.valid() {
+ return nil, errors.New("cbor: invalid IntDec " + strconv.Itoa(int(opts.IntDec)))
+ }
+
+ if !opts.MapKeyByteString.valid() {
+ return nil, errors.New("cbor: invalid MapKeyByteString " + strconv.Itoa(int(opts.MapKeyByteString)))
+ }
+
+ if opts.MaxNestedLevels == 0 {
+ opts.MaxNestedLevels = defaultMaxNestedLevels
+ } else if opts.MaxNestedLevels < minMaxNestedLevels || opts.MaxNestedLevels > maxMaxNestedLevels {
+ return nil, errors.New("cbor: invalid MaxNestedLevels " + strconv.Itoa(opts.MaxNestedLevels) +
+ " (range is [" + strconv.Itoa(minMaxNestedLevels) + ", " + strconv.Itoa(maxMaxNestedLevels) + "])")
+ }
+
+ if opts.MaxArrayElements == 0 {
+ opts.MaxArrayElements = defaultMaxArrayElements
+ } else if opts.MaxArrayElements < minMaxArrayElements || opts.MaxArrayElements > maxMaxArrayElements {
+ return nil, errors.New("cbor: invalid MaxArrayElements " + strconv.Itoa(opts.MaxArrayElements) +
+ " (range is [" + strconv.Itoa(minMaxArrayElements) + ", " + strconv.Itoa(maxMaxArrayElements) + "])")
+ }
+
+ if opts.MaxMapPairs == 0 {
+ opts.MaxMapPairs = defaultMaxMapPairs
+ } else if opts.MaxMapPairs < minMaxMapPairs || opts.MaxMapPairs > maxMaxMapPairs {
+ return nil, errors.New("cbor: invalid MaxMapPairs " + strconv.Itoa(opts.MaxMapPairs) +
+ " (range is [" + strconv.Itoa(minMaxMapPairs) + ", " + strconv.Itoa(maxMaxMapPairs) + "])")
+ }
+
+ if !opts.ExtraReturnErrors.valid() {
+ return nil, errors.New("cbor: invalid ExtraReturnErrors " + strconv.Itoa(int(opts.ExtraReturnErrors)))
+ }
+
+ if opts.DefaultMapType != nil && opts.DefaultMapType.Kind() != reflect.Map {
+ return nil, fmt.Errorf("cbor: invalid DefaultMapType %s", opts.DefaultMapType)
+ }
+
+ if !opts.UTF8.valid() {
+ return nil, errors.New("cbor: invalid UTF8 " + strconv.Itoa(int(opts.UTF8)))
+ }
+
+ if !opts.FieldNameMatching.valid() {
+ return nil, errors.New("cbor: invalid FieldNameMatching " + strconv.Itoa(int(opts.FieldNameMatching)))
+ }
+
+ if !opts.BigIntDec.valid() {
+ return nil, errors.New("cbor: invalid BigIntDec " + strconv.Itoa(int(opts.BigIntDec)))
+ }
+
+ if opts.DefaultByteStringType != nil &&
+ opts.DefaultByteStringType.Kind() != reflect.String &&
+ (opts.DefaultByteStringType.Kind() != reflect.Slice || opts.DefaultByteStringType.Elem().Kind() != reflect.Uint8) {
+ return nil, fmt.Errorf("cbor: invalid DefaultByteStringType: %s is not of kind string or []uint8", opts.DefaultByteStringType)
+ }
+
+ if !opts.ByteStringToString.valid() {
+ return nil, errors.New("cbor: invalid ByteStringToString " + strconv.Itoa(int(opts.ByteStringToString)))
+ }
+
+ if !opts.FieldNameByteString.valid() {
+ return nil, errors.New("cbor: invalid FieldNameByteString " + strconv.Itoa(int(opts.FieldNameByteString)))
+ }
+
+ if !opts.UnrecognizedTagToAny.valid() {
+ return nil, errors.New("cbor: invalid UnrecognizedTagToAnyMode " + strconv.Itoa(int(opts.UnrecognizedTagToAny)))
+ }
+ simpleValues := opts.SimpleValues
+ if simpleValues == nil {
+ simpleValues = defaultSimpleValues
+ }
+
+ if !opts.TimeTagToAny.valid() {
+ return nil, errors.New("cbor: invalid TimeTagToAny " + strconv.Itoa(int(opts.TimeTagToAny)))
+ }
+
+ if !opts.NaN.valid() {
+ return nil, errors.New("cbor: invalid NaNDec " + strconv.Itoa(int(opts.NaN)))
+ }
+
+ if !opts.Inf.valid() {
+ return nil, errors.New("cbor: invalid InfDec " + strconv.Itoa(int(opts.Inf)))
+ }
+
+ if !opts.ByteStringToTime.valid() {
+ return nil, errors.New("cbor: invalid ByteStringToTime " + strconv.Itoa(int(opts.ByteStringToTime)))
+ }
+
+ if !opts.ByteStringExpectedFormat.valid() {
+ return nil, errors.New("cbor: invalid ByteStringExpectedFormat " + strconv.Itoa(int(opts.ByteStringExpectedFormat)))
+ }
+
+ if !opts.BignumTag.valid() {
+ return nil, errors.New("cbor: invalid BignumTag " + strconv.Itoa(int(opts.BignumTag)))
+ }
+
+ if !opts.BinaryUnmarshaler.valid() {
+ return nil, errors.New("cbor: invalid BinaryUnmarshaler " + strconv.Itoa(int(opts.BinaryUnmarshaler)))
+ }
+
+ dm := decMode{
+ dupMapKey: opts.DupMapKey,
+ timeTag: opts.TimeTag,
+ maxNestedLevels: opts.MaxNestedLevels,
+ maxArrayElements: opts.MaxArrayElements,
+ maxMapPairs: opts.MaxMapPairs,
+ indefLength: opts.IndefLength,
+ tagsMd: opts.TagsMd,
+ intDec: opts.IntDec,
+ mapKeyByteString: opts.MapKeyByteString,
+ extraReturnErrors: opts.ExtraReturnErrors,
+ defaultMapType: opts.DefaultMapType,
+ utf8: opts.UTF8,
+ fieldNameMatching: opts.FieldNameMatching,
+ bigIntDec: opts.BigIntDec,
+ defaultByteStringType: opts.DefaultByteStringType,
+ byteStringToString: opts.ByteStringToString,
+ fieldNameByteString: opts.FieldNameByteString,
+ unrecognizedTagToAny: opts.UnrecognizedTagToAny,
+ timeTagToAny: opts.TimeTagToAny,
+ simpleValues: simpleValues,
+ nanDec: opts.NaN,
+ infDec: opts.Inf,
+ byteStringToTime: opts.ByteStringToTime,
+ byteStringExpectedFormat: opts.ByteStringExpectedFormat,
+ bignumTag: opts.BignumTag,
+ binaryUnmarshaler: opts.BinaryUnmarshaler,
+ }
+
+ return &dm, nil
+}
+
+// DecMode is the main interface for CBOR decoding.
+type DecMode interface {
+ // Unmarshal parses the CBOR-encoded data into the value pointed to by v
+ // using the decoding mode. If v is nil, not a pointer, or a nil pointer,
+ // Unmarshal returns an error.
+ //
+ // See the documentation for Unmarshal for details.
+ Unmarshal(data []byte, v interface{}) error
+
+ // UnmarshalFirst parses the first CBOR data item into the value pointed to by v
+ // using the decoding mode. Any remaining bytes are returned in rest.
+ //
+ // If v is nil, not a pointer, or a nil pointer, UnmarshalFirst returns an error.
+ //
+ // See the documentation for Unmarshal for details.
+ UnmarshalFirst(data []byte, v interface{}) (rest []byte, err error)
+
+ // Valid checks whether data is a well-formed encoded CBOR data item and
+ // that it complies with configurable restrictions such as MaxNestedLevels,
+ // MaxArrayElements, MaxMapPairs, etc.
+ //
+ // If there are any remaining bytes after the CBOR data item,
+ // an ExtraneousDataError is returned.
+ //
+ // WARNING: Valid doesn't check if encoded CBOR data item is valid (i.e. validity)
+ // and RFC 8949 distinctly defines what is "Valid" and what is "Well-formed".
+ //
+ // Deprecated: Valid is kept for compatibility and should not be used.
+ // Use Wellformed instead because it has a more appropriate name.
+ Valid(data []byte) error
+
+ // Wellformed checks whether data is a well-formed encoded CBOR data item and
+ // that it complies with configurable restrictions such as MaxNestedLevels,
+ // MaxArrayElements, MaxMapPairs, etc.
+ //
+ // If there are any remaining bytes after the CBOR data item,
+ // an ExtraneousDataError is returned.
+ Wellformed(data []byte) error
+
+ // NewDecoder returns a new decoder that reads from r using dm DecMode.
+ NewDecoder(r io.Reader) *Decoder
+
+ // DecOptions returns user specified options used to create this DecMode.
+ DecOptions() DecOptions
+}
+
+type decMode struct {
+ tags tagProvider
+ dupMapKey DupMapKeyMode
+ timeTag DecTagMode
+ maxNestedLevels int
+ maxArrayElements int
+ maxMapPairs int
+ indefLength IndefLengthMode
+ tagsMd TagsMode
+ intDec IntDecMode
+ mapKeyByteString MapKeyByteStringMode
+ extraReturnErrors ExtraDecErrorCond
+ defaultMapType reflect.Type
+ utf8 UTF8Mode
+ fieldNameMatching FieldNameMatchingMode
+ bigIntDec BigIntDecMode
+ defaultByteStringType reflect.Type
+ byteStringToString ByteStringToStringMode
+ fieldNameByteString FieldNameByteStringMode
+ unrecognizedTagToAny UnrecognizedTagToAnyMode
+ timeTagToAny TimeTagToAnyMode
+ simpleValues *SimpleValueRegistry
+ nanDec NaNMode
+ infDec InfMode
+ byteStringToTime ByteStringToTimeMode
+ byteStringExpectedFormat ByteStringExpectedFormatMode
+ bignumTag BignumTagMode
+ binaryUnmarshaler BinaryUnmarshalerMode
+}
+
+var defaultDecMode, _ = DecOptions{}.decMode()
+
+// DecOptions returns user specified options used to create this DecMode.
+func (dm *decMode) DecOptions() DecOptions {
+ simpleValues := dm.simpleValues
+ if simpleValues == defaultSimpleValues {
+ // Users can't explicitly set this to defaultSimpleValues. It must have been nil in
+ // the original DecOptions.
+ simpleValues = nil
+ }
+
+ return DecOptions{
+ DupMapKey: dm.dupMapKey,
+ TimeTag: dm.timeTag,
+ MaxNestedLevels: dm.maxNestedLevels,
+ MaxArrayElements: dm.maxArrayElements,
+ MaxMapPairs: dm.maxMapPairs,
+ IndefLength: dm.indefLength,
+ TagsMd: dm.tagsMd,
+ IntDec: dm.intDec,
+ MapKeyByteString: dm.mapKeyByteString,
+ ExtraReturnErrors: dm.extraReturnErrors,
+ DefaultMapType: dm.defaultMapType,
+ UTF8: dm.utf8,
+ FieldNameMatching: dm.fieldNameMatching,
+ BigIntDec: dm.bigIntDec,
+ DefaultByteStringType: dm.defaultByteStringType,
+ ByteStringToString: dm.byteStringToString,
+ FieldNameByteString: dm.fieldNameByteString,
+ UnrecognizedTagToAny: dm.unrecognizedTagToAny,
+ TimeTagToAny: dm.timeTagToAny,
+ SimpleValues: simpleValues,
+ NaN: dm.nanDec,
+ Inf: dm.infDec,
+ ByteStringToTime: dm.byteStringToTime,
+ ByteStringExpectedFormat: dm.byteStringExpectedFormat,
+ BignumTag: dm.bignumTag,
+ BinaryUnmarshaler: dm.binaryUnmarshaler,
+ }
+}
+
+// Unmarshal parses the CBOR-encoded data into the value pointed to by v
+// using dm decoding mode. If v is nil, not a pointer, or a nil pointer,
+// Unmarshal returns an error.
+//
+// See the documentation for Unmarshal for details.
+func (dm *decMode) Unmarshal(data []byte, v interface{}) error {
+ d := decoder{data: data, dm: dm}
+
+ // Check well-formedness.
+ off := d.off // Save offset before data validation
+ err := d.wellformed(false, false) // don't allow any extra data after valid data item.
+ d.off = off // Restore offset
+ if err != nil {
+ return err
+ }
+
+ return d.value(v)
+}
+
+// UnmarshalFirst parses the first CBOR data item into the value pointed to by v
+// using dm decoding mode. Any remaining bytes are returned in rest.
+//
+// If v is nil, not a pointer, or a nil pointer, UnmarshalFirst returns an error.
+//
+// See the documentation for Unmarshal for details.
+func (dm *decMode) UnmarshalFirst(data []byte, v interface{}) (rest []byte, err error) {
+ d := decoder{data: data, dm: dm}
+
+ // check well-formedness.
+ off := d.off // Save offset before data validation
+ err = d.wellformed(true, false) // allow extra data after well-formed data item
+ d.off = off // Restore offset
+
+ // If it is well-formed, parse the value. This is structured like this to allow
+ // better test coverage
+ if err == nil {
+ err = d.value(v)
+ }
+
+ // If either wellformed or value returned an error, do not return rest bytes
+ if err != nil {
+ return nil, err
+ }
+
+ // Return the rest of the data slice (which might be len 0)
+ return d.data[d.off:], nil
+}
+
+// Valid checks whether data is a well-formed encoded CBOR data item and
+// that it complies with configurable restrictions such as MaxNestedLevels,
+// MaxArrayElements, MaxMapPairs, etc.
+//
+// If there are any remaining bytes after the CBOR data item,
+// an ExtraneousDataError is returned.
+//
+// WARNING: Valid doesn't check if encoded CBOR data item is valid (i.e. validity)
+// and RFC 8949 distinctly defines what is "Valid" and what is "Well-formed".
+//
+// Deprecated: Valid is kept for compatibility and should not be used.
+// Use Wellformed instead because it has a more appropriate name.
+func (dm *decMode) Valid(data []byte) error {
+ return dm.Wellformed(data)
+}
+
+// Wellformed checks whether data is a well-formed encoded CBOR data item and
+// that it complies with configurable restrictions such as MaxNestedLevels,
+// MaxArrayElements, MaxMapPairs, etc.
+//
+// If there are any remaining bytes after the CBOR data item,
+// an ExtraneousDataError is returned.
+func (dm *decMode) Wellformed(data []byte) error {
+ d := decoder{data: data, dm: dm}
+ return d.wellformed(false, false)
+}
+
+// NewDecoder returns a new decoder that reads from r using dm DecMode.
+func (dm *decMode) NewDecoder(r io.Reader) *Decoder {
+ return &Decoder{r: r, d: decoder{dm: dm}}
+}
+
+type decoder struct {
+ data []byte
+ off int // next read offset in data
+ dm *decMode
+
+ // expectedLaterEncodingTags stores a stack of encountered "Expected Later Encoding" tags,
+ // if any.
+ //
+ // The "Expected Later Encoding" tags (21 to 23) are valid for any data item. When decoding
+ // byte strings, the effective encoding comes from the tag nearest to the byte string being
+ // decoded. For example, the effective encoding of the byte string 21(22(h'41')) would be
+ // controlled by tag 22,and in the data item 23(h'42', 22([21(h'43')])]) the effective
+ // encoding of the byte strings h'42' and h'43' would be controlled by tag 23 and 21,
+ // respectively.
+ expectedLaterEncodingTags []uint64
+}
+
+// value decodes CBOR data item into the value pointed to by v.
+// If CBOR data item fails to be decoded into v,
+// error is returned and offset is moved to the next CBOR data item.
+// Precondition: d.data contains at least one well-formed CBOR data item.
+func (d *decoder) value(v interface{}) error {
+ // v can't be nil, non-pointer, or nil pointer value.
+ if v == nil {
+ return &InvalidUnmarshalError{"cbor: Unmarshal(nil)"}
+ }
+ rv := reflect.ValueOf(v)
+ if rv.Kind() != reflect.Ptr {
+ return &InvalidUnmarshalError{"cbor: Unmarshal(non-pointer " + rv.Type().String() + ")"}
+ } else if rv.IsNil() {
+ return &InvalidUnmarshalError{"cbor: Unmarshal(nil " + rv.Type().String() + ")"}
+ }
+ rv = rv.Elem()
+ return d.parseToValue(rv, getTypeInfo(rv.Type()))
+}
+
+// parseToValue decodes CBOR data to value. It assumes data is well-formed,
+// and does not perform bounds checking.
+func (d *decoder) parseToValue(v reflect.Value, tInfo *typeInfo) error { //nolint:gocyclo
+
+ // Decode CBOR nil or CBOR undefined to pointer value by setting pointer value to nil.
+ if d.nextCBORNil() && v.Kind() == reflect.Ptr {
+ d.skip()
+ v.Set(reflect.Zero(v.Type()))
+ return nil
+ }
+
+ if tInfo.spclType == specialTypeIface {
+ if !v.IsNil() {
+ // Use value type
+ v = v.Elem()
+ tInfo = getTypeInfo(v.Type())
+ } else { //nolint:gocritic
+ // Create and use registered type if CBOR data is registered tag
+ if d.dm.tags != nil && d.nextCBORType() == cborTypeTag {
+
+ off := d.off
+ var tagNums []uint64
+ for d.nextCBORType() == cborTypeTag {
+ _, _, tagNum := d.getHead()
+ tagNums = append(tagNums, tagNum)
+ }
+ d.off = off
+
+ registeredType := d.dm.tags.getTypeFromTagNum(tagNums)
+ if registeredType != nil {
+ if registeredType.Implements(tInfo.nonPtrType) ||
+ reflect.PtrTo(registeredType).Implements(tInfo.nonPtrType) {
+ v.Set(reflect.New(registeredType))
+ v = v.Elem()
+ tInfo = getTypeInfo(registeredType)
+ }
+ }
+ }
+ }
+ }
+
+ // Create new value for the pointer v to point to.
+ // At this point, CBOR value is not nil/undefined if v is a pointer.
+ for v.Kind() == reflect.Ptr {
+ if v.IsNil() {
+ if !v.CanSet() {
+ d.skip()
+ return errors.New("cbor: cannot set new value for " + v.Type().String())
+ }
+ v.Set(reflect.New(v.Type().Elem()))
+ }
+ v = v.Elem()
+ }
+
+ // Strip self-described CBOR tag number.
+ for d.nextCBORType() == cborTypeTag {
+ off := d.off
+ _, _, tagNum := d.getHead()
+ if tagNum != tagNumSelfDescribedCBOR {
+ d.off = off
+ break
+ }
+ }
+
+ // Check validity of supported built-in tags.
+ off := d.off
+ for d.nextCBORType() == cborTypeTag {
+ _, _, tagNum := d.getHead()
+ if err := validBuiltinTag(tagNum, d.data[d.off]); err != nil {
+ d.skip()
+ return err
+ }
+ }
+ d.off = off
+
+ if tInfo.spclType != specialTypeNone {
+ switch tInfo.spclType {
+ case specialTypeEmptyIface:
+ iv, err := d.parse(false) // Skipped self-described CBOR tag number already.
+ if iv != nil {
+ v.Set(reflect.ValueOf(iv))
+ }
+ return err
+
+ case specialTypeTag:
+ return d.parseToTag(v)
+
+ case specialTypeTime:
+ if d.nextCBORNil() {
+ // Decoding CBOR null and undefined to time.Time is no-op.
+ d.skip()
+ return nil
+ }
+ tm, ok, err := d.parseToTime()
+ if err != nil {
+ return err
+ }
+ if ok {
+ v.Set(reflect.ValueOf(tm))
+ }
+ return nil
+
+ case specialTypeUnmarshalerIface:
+ return d.parseToUnmarshaler(v)
+ }
+ }
+
+ // Check registered tag number
+ if tagItem := d.getRegisteredTagItem(tInfo.nonPtrType); tagItem != nil {
+ t := d.nextCBORType()
+ if t != cborTypeTag {
+ if tagItem.opts.DecTag == DecTagRequired {
+ d.skip() // Required tag number is absent, skip entire tag
+ return &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: tInfo.typ.String(),
+ errorMsg: "expect CBOR tag value"}
+ }
+ } else if err := d.validRegisteredTagNums(tagItem); err != nil {
+ d.skip() // Skip tag content
+ return err
+ }
+ }
+
+ t := d.nextCBORType()
+
+ switch t {
+ case cborTypePositiveInt:
+ _, _, val := d.getHead()
+ return fillPositiveInt(t, val, v)
+
+ case cborTypeNegativeInt:
+ _, _, val := d.getHead()
+ if val > math.MaxInt64 {
+ // CBOR negative integer overflows int64, use big.Int to store value.
+ bi := new(big.Int)
+ bi.SetUint64(val)
+ bi.Add(bi, big.NewInt(1))
+ bi.Neg(bi)
+
+ if tInfo.nonPtrType == typeBigInt {
+ v.Set(reflect.ValueOf(*bi))
+ return nil
+ }
+ return &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: tInfo.nonPtrType.String(),
+ errorMsg: bi.String() + " overflows Go's int64",
+ }
+ }
+ nValue := int64(-1) ^ int64(val)
+ return fillNegativeInt(t, nValue, v)
+
+ case cborTypeByteString:
+ b, copied := d.parseByteString()
+ b, converted, err := d.applyByteStringTextConversion(b, v.Type())
+ if err != nil {
+ return err
+ }
+ copied = copied || converted
+ return fillByteString(t, b, !copied, v, d.dm.byteStringToString, d.dm.binaryUnmarshaler)
+
+ case cborTypeTextString:
+ b, err := d.parseTextString()
+ if err != nil {
+ return err
+ }
+ return fillTextString(t, b, v)
+
+ case cborTypePrimitives:
+ _, ai, val := d.getHead()
+ switch ai {
+ case additionalInformationAsFloat16:
+ f := float64(float16.Frombits(uint16(val)).Float32())
+ return fillFloat(t, f, v)
+
+ case additionalInformationAsFloat32:
+ f := float64(math.Float32frombits(uint32(val)))
+ return fillFloat(t, f, v)
+
+ case additionalInformationAsFloat64:
+ f := math.Float64frombits(val)
+ return fillFloat(t, f, v)
+
+ default: // ai <= 24
+ if d.dm.simpleValues.rejected[SimpleValue(val)] {
+ return &UnacceptableDataItemError{
+ CBORType: t.String(),
+ Message: "simple value " + strconv.FormatInt(int64(val), 10) + " is not recognized",
+ }
+ }
+
+ switch ai {
+ case additionalInformationAsFalse,
+ additionalInformationAsTrue:
+ return fillBool(t, ai == additionalInformationAsTrue, v)
+
+ case additionalInformationAsNull,
+ additionalInformationAsUndefined:
+ return fillNil(t, v)
+
+ default:
+ return fillPositiveInt(t, val, v)
+ }
+ }
+
+ case cborTypeTag:
+ _, _, tagNum := d.getHead()
+ switch tagNum {
+ case tagNumUnsignedBignum:
+ // Bignum (tag 2) can be decoded to uint, int, float, slice, array, or big.Int.
+ b, copied := d.parseByteString()
+ bi := new(big.Int).SetBytes(b)
+
+ if tInfo.nonPtrType == typeBigInt {
+ v.Set(reflect.ValueOf(*bi))
+ return nil
+ }
+ if tInfo.nonPtrKind == reflect.Slice || tInfo.nonPtrKind == reflect.Array {
+ return fillByteString(t, b, !copied, v, ByteStringToStringForbidden, d.dm.binaryUnmarshaler)
+ }
+ if bi.IsUint64() {
+ return fillPositiveInt(t, bi.Uint64(), v)
+ }
+ return &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: tInfo.nonPtrType.String(),
+ errorMsg: bi.String() + " overflows " + v.Type().String(),
+ }
+
+ case tagNumNegativeBignum:
+ // Bignum (tag 3) can be decoded to int, float, slice, array, or big.Int.
+ b, copied := d.parseByteString()
+ bi := new(big.Int).SetBytes(b)
+ bi.Add(bi, big.NewInt(1))
+ bi.Neg(bi)
+
+ if tInfo.nonPtrType == typeBigInt {
+ v.Set(reflect.ValueOf(*bi))
+ return nil
+ }
+ if tInfo.nonPtrKind == reflect.Slice || tInfo.nonPtrKind == reflect.Array {
+ return fillByteString(t, b, !copied, v, ByteStringToStringForbidden, d.dm.binaryUnmarshaler)
+ }
+ if bi.IsInt64() {
+ return fillNegativeInt(t, bi.Int64(), v)
+ }
+ return &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: tInfo.nonPtrType.String(),
+ errorMsg: bi.String() + " overflows " + v.Type().String(),
+ }
+
+ case tagNumExpectedLaterEncodingBase64URL, tagNumExpectedLaterEncodingBase64, tagNumExpectedLaterEncodingBase16:
+ // If conversion for interoperability with text encodings is not configured,
+ // treat tags 21-23 as unregistered tags.
+ if d.dm.byteStringToString == ByteStringToStringAllowedWithExpectedLaterEncoding || d.dm.byteStringExpectedFormat != ByteStringExpectedFormatNone {
+ d.expectedLaterEncodingTags = append(d.expectedLaterEncodingTags, tagNum)
+ defer func() {
+ d.expectedLaterEncodingTags = d.expectedLaterEncodingTags[:len(d.expectedLaterEncodingTags)-1]
+ }()
+ }
+ }
+
+ return d.parseToValue(v, tInfo)
+
+ case cborTypeArray:
+ if tInfo.nonPtrKind == reflect.Slice {
+ return d.parseArrayToSlice(v, tInfo)
+ } else if tInfo.nonPtrKind == reflect.Array {
+ return d.parseArrayToArray(v, tInfo)
+ } else if tInfo.nonPtrKind == reflect.Struct {
+ return d.parseArrayToStruct(v, tInfo)
+ }
+ d.skip()
+ return &UnmarshalTypeError{CBORType: t.String(), GoType: tInfo.nonPtrType.String()}
+
+ case cborTypeMap:
+ if tInfo.nonPtrKind == reflect.Struct {
+ return d.parseMapToStruct(v, tInfo)
+ } else if tInfo.nonPtrKind == reflect.Map {
+ return d.parseMapToMap(v, tInfo)
+ }
+ d.skip()
+ return &UnmarshalTypeError{CBORType: t.String(), GoType: tInfo.nonPtrType.String()}
+ }
+
+ return nil
+}
+
+func (d *decoder) parseToTag(v reflect.Value) error {
+ if d.nextCBORNil() {
+ // Decoding CBOR null and undefined to cbor.Tag is no-op.
+ d.skip()
+ return nil
+ }
+
+ t := d.nextCBORType()
+ if t != cborTypeTag {
+ d.skip()
+ return &UnmarshalTypeError{CBORType: t.String(), GoType: typeTag.String()}
+ }
+
+ // Unmarshal tag number
+ _, _, num := d.getHead()
+
+ // Unmarshal tag content
+ content, err := d.parse(false)
+ if err != nil {
+ return err
+ }
+
+ v.Set(reflect.ValueOf(Tag{num, content}))
+ return nil
+}
+
+// parseToTime decodes the current data item as a time.Time. The bool return value is false if and
+// only if the destination value should remain unmodified.
+func (d *decoder) parseToTime() (time.Time, bool, error) {
+ // Verify that tag number or absence of tag number is acceptable to specified timeTag.
+ if t := d.nextCBORType(); t == cborTypeTag {
+ if d.dm.timeTag == DecTagIgnored {
+ // Skip all enclosing tags
+ for t == cborTypeTag {
+ d.getHead()
+ t = d.nextCBORType()
+ }
+ if d.nextCBORNil() {
+ d.skip()
+ return time.Time{}, false, nil
+ }
+ } else {
+ // Read tag number
+ _, _, tagNum := d.getHead()
+ if tagNum != 0 && tagNum != 1 {
+ d.skip() // skip tag content
+ return time.Time{}, false, errors.New("cbor: wrong tag number for time.Time, got " + strconv.Itoa(int(tagNum)) + ", expect 0 or 1")
+ }
+ }
+ } else {
+ if d.dm.timeTag == DecTagRequired {
+ d.skip()
+ return time.Time{}, false, &UnmarshalTypeError{CBORType: t.String(), GoType: typeTime.String(), errorMsg: "expect CBOR tag value"}
+ }
+ }
+
+ switch t := d.nextCBORType(); t {
+ case cborTypeByteString:
+ if d.dm.byteStringToTime == ByteStringToTimeAllowed {
+ b, _ := d.parseByteString()
+ t, err := time.Parse(time.RFC3339, string(b))
+ if err != nil {
+ return time.Time{}, false, fmt.Errorf("cbor: cannot set %q for time.Time: %w", string(b), err)
+ }
+ return t, true, nil
+ }
+ return time.Time{}, false, &UnmarshalTypeError{CBORType: t.String(), GoType: typeTime.String()}
+
+ case cborTypeTextString:
+ s, err := d.parseTextString()
+ if err != nil {
+ return time.Time{}, false, err
+ }
+ t, err := time.Parse(time.RFC3339, string(s))
+ if err != nil {
+ return time.Time{}, false, errors.New("cbor: cannot set " + string(s) + " for time.Time: " + err.Error())
+ }
+ return t, true, nil
+
+ case cborTypePositiveInt:
+ _, _, val := d.getHead()
+ if val > math.MaxInt64 {
+ return time.Time{}, false, &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: typeTime.String(),
+ errorMsg: fmt.Sprintf("%d overflows Go's int64", val),
+ }
+ }
+ return time.Unix(int64(val), 0), true, nil
+
+ case cborTypeNegativeInt:
+ _, _, val := d.getHead()
+ if val > math.MaxInt64 {
+ if val == math.MaxUint64 {
+ // Maximum absolute value representable by negative integer is 2^64,
+ // not 2^64-1, so it overflows uint64.
+ return time.Time{}, false, &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: typeTime.String(),
+ errorMsg: "-18446744073709551616 overflows Go's int64",
+ }
+ }
+ return time.Time{}, false, &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: typeTime.String(),
+ errorMsg: fmt.Sprintf("-%d overflows Go's int64", val+1),
+ }
+ }
+ return time.Unix(int64(-1)^int64(val), 0), true, nil
+
+ case cborTypePrimitives:
+ _, ai, val := d.getHead()
+ var f float64
+ switch ai {
+ case additionalInformationAsFloat16:
+ f = float64(float16.Frombits(uint16(val)).Float32())
+
+ case additionalInformationAsFloat32:
+ f = float64(math.Float32frombits(uint32(val)))
+
+ case additionalInformationAsFloat64:
+ f = math.Float64frombits(val)
+
+ default:
+ return time.Time{}, false, &UnmarshalTypeError{CBORType: t.String(), GoType: typeTime.String()}
+ }
+
+ if math.IsNaN(f) || math.IsInf(f, 0) {
+ // https://www.rfc-editor.org/rfc/rfc8949.html#section-3.4.2-6
+ return time.Time{}, true, nil
+ }
+ seconds, fractional := math.Modf(f)
+ return time.Unix(int64(seconds), int64(fractional*1e9)), true, nil
+
+ default:
+ return time.Time{}, false, &UnmarshalTypeError{CBORType: t.String(), GoType: typeTime.String()}
+ }
+}
+
+// parseToUnmarshaler parses CBOR data to value implementing Unmarshaler interface.
+// It assumes data is well-formed, and does not perform bounds checking.
+func (d *decoder) parseToUnmarshaler(v reflect.Value) error {
+ if d.nextCBORNil() && v.Kind() == reflect.Ptr && v.IsNil() {
+ d.skip()
+ return nil
+ }
+
+ if v.Kind() != reflect.Ptr && v.CanAddr() {
+ v = v.Addr()
+ }
+ if u, ok := v.Interface().(Unmarshaler); ok {
+ start := d.off
+ d.skip()
+ return u.UnmarshalCBOR(d.data[start:d.off])
+ }
+ d.skip()
+ return errors.New("cbor: failed to assert " + v.Type().String() + " as cbor.Unmarshaler")
+}
+
+// parse parses CBOR data and returns value in default Go type.
+// It assumes data is well-formed, and does not perform bounds checking.
+func (d *decoder) parse(skipSelfDescribedTag bool) (interface{}, error) { //nolint:gocyclo
+ // Strip self-described CBOR tag number.
+ if skipSelfDescribedTag {
+ for d.nextCBORType() == cborTypeTag {
+ off := d.off
+ _, _, tagNum := d.getHead()
+ if tagNum != tagNumSelfDescribedCBOR {
+ d.off = off
+ break
+ }
+ }
+ }
+
+ // Check validity of supported built-in tags.
+ off := d.off
+ for d.nextCBORType() == cborTypeTag {
+ _, _, tagNum := d.getHead()
+ if err := validBuiltinTag(tagNum, d.data[d.off]); err != nil {
+ d.skip()
+ return nil, err
+ }
+ }
+ d.off = off
+
+ t := d.nextCBORType()
+ switch t {
+ case cborTypePositiveInt:
+ _, _, val := d.getHead()
+
+ switch d.dm.intDec {
+ case IntDecConvertNone:
+ return val, nil
+
+ case IntDecConvertSigned, IntDecConvertSignedOrFail:
+ if val > math.MaxInt64 {
+ return nil, &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: reflect.TypeOf(int64(0)).String(),
+ errorMsg: strconv.FormatUint(val, 10) + " overflows Go's int64",
+ }
+ }
+
+ return int64(val), nil
+
+ case IntDecConvertSignedOrBigInt:
+ if val > math.MaxInt64 {
+ bi := new(big.Int).SetUint64(val)
+ if d.dm.bigIntDec == BigIntDecodePointer {
+ return bi, nil
+ }
+ return *bi, nil
+ }
+
+ return int64(val), nil
+
+ default:
+ // not reachable
+ }
+
+ case cborTypeNegativeInt:
+ _, _, val := d.getHead()
+
+ if val > math.MaxInt64 {
+ // CBOR negative integer value overflows Go int64, use big.Int instead.
+ bi := new(big.Int).SetUint64(val)
+ bi.Add(bi, big.NewInt(1))
+ bi.Neg(bi)
+
+ if d.dm.intDec == IntDecConvertSignedOrFail {
+ return nil, &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: reflect.TypeOf(int64(0)).String(),
+ errorMsg: bi.String() + " overflows Go's int64",
+ }
+ }
+
+ if d.dm.bigIntDec == BigIntDecodePointer {
+ return bi, nil
+ }
+ return *bi, nil
+ }
+
+ nValue := int64(-1) ^ int64(val)
+ return nValue, nil
+
+ case cborTypeByteString:
+ b, copied := d.parseByteString()
+ var effectiveByteStringType = d.dm.defaultByteStringType
+ if effectiveByteStringType == nil {
+ effectiveByteStringType = typeByteSlice
+ }
+ b, converted, err := d.applyByteStringTextConversion(b, effectiveByteStringType)
+ if err != nil {
+ return nil, err
+ }
+ copied = copied || converted
+
+ switch effectiveByteStringType {
+ case typeByteSlice:
+ if copied {
+ return b, nil
+ }
+ clone := make([]byte, len(b))
+ copy(clone, b)
+ return clone, nil
+
+ case typeString:
+ return string(b), nil
+
+ default:
+ if copied || d.dm.defaultByteStringType.Kind() == reflect.String {
+ // Avoid an unnecessary copy since the conversion to string must
+ // copy the underlying bytes.
+ return reflect.ValueOf(b).Convert(d.dm.defaultByteStringType).Interface(), nil
+ }
+ clone := make([]byte, len(b))
+ copy(clone, b)
+ return reflect.ValueOf(clone).Convert(d.dm.defaultByteStringType).Interface(), nil
+ }
+
+ case cborTypeTextString:
+ b, err := d.parseTextString()
+ if err != nil {
+ return nil, err
+ }
+ return string(b), nil
+
+ case cborTypeTag:
+ tagOff := d.off
+ _, _, tagNum := d.getHead()
+ contentOff := d.off
+
+ switch tagNum {
+ case tagNumRFC3339Time, tagNumEpochTime:
+ d.off = tagOff
+ tm, _, err := d.parseToTime()
+ if err != nil {
+ return nil, err
+ }
+
+ switch d.dm.timeTagToAny {
+ case TimeTagToTime:
+ return tm, nil
+
+ case TimeTagToRFC3339:
+ if tagNum == 1 {
+ tm = tm.UTC()
+ }
+ // Call time.MarshalText() to format decoded time to RFC3339 format,
+ // and return error on time value that cannot be represented in
+ // RFC3339 format. E.g. year cannot exceed 9999, etc.
+ text, err := tm.Truncate(time.Second).MarshalText()
+ if err != nil {
+ return nil, fmt.Errorf("cbor: decoded time cannot be represented in RFC3339 format: %v", err)
+ }
+ return string(text), nil
+
+ case TimeTagToRFC3339Nano:
+ if tagNum == 1 {
+ tm = tm.UTC()
+ }
+ // Call time.MarshalText() to format decoded time to RFC3339 format,
+ // and return error on time value that cannot be represented in
+ // RFC3339 format with sub-second precision.
+ text, err := tm.MarshalText()
+ if err != nil {
+ return nil, fmt.Errorf("cbor: decoded time cannot be represented in RFC3339 format with sub-second precision: %v", err)
+ }
+ return string(text), nil
+
+ default:
+ // not reachable
+ }
+
+ case tagNumUnsignedBignum:
+ b, _ := d.parseByteString()
+ bi := new(big.Int).SetBytes(b)
+
+ if d.dm.bigIntDec == BigIntDecodePointer {
+ return bi, nil
+ }
+ return *bi, nil
+
+ case tagNumNegativeBignum:
+ b, _ := d.parseByteString()
+ bi := new(big.Int).SetBytes(b)
+ bi.Add(bi, big.NewInt(1))
+ bi.Neg(bi)
+
+ if d.dm.bigIntDec == BigIntDecodePointer {
+ return bi, nil
+ }
+ return *bi, nil
+
+ case tagNumExpectedLaterEncodingBase64URL, tagNumExpectedLaterEncodingBase64, tagNumExpectedLaterEncodingBase16:
+ // If conversion for interoperability with text encodings is not configured,
+ // treat tags 21-23 as unregistered tags.
+ if d.dm.byteStringToString == ByteStringToStringAllowedWithExpectedLaterEncoding ||
+ d.dm.byteStringExpectedFormat != ByteStringExpectedFormatNone {
+ d.expectedLaterEncodingTags = append(d.expectedLaterEncodingTags, tagNum)
+ defer func() {
+ d.expectedLaterEncodingTags = d.expectedLaterEncodingTags[:len(d.expectedLaterEncodingTags)-1]
+ }()
+ return d.parse(false)
+ }
+ }
+
+ if d.dm.tags != nil {
+ // Parse to specified type if tag number is registered.
+ tagNums := []uint64{tagNum}
+ for d.nextCBORType() == cborTypeTag {
+ _, _, num := d.getHead()
+ tagNums = append(tagNums, num)
+ }
+ registeredType := d.dm.tags.getTypeFromTagNum(tagNums)
+ if registeredType != nil {
+ d.off = tagOff
+ rv := reflect.New(registeredType)
+ if err := d.parseToValue(rv.Elem(), getTypeInfo(registeredType)); err != nil {
+ return nil, err
+ }
+ return rv.Elem().Interface(), nil
+ }
+ }
+
+ // Parse tag content
+ d.off = contentOff
+ content, err := d.parse(false)
+ if err != nil {
+ return nil, err
+ }
+ if d.dm.unrecognizedTagToAny == UnrecognizedTagContentToAny {
+ return content, nil
+ }
+ return Tag{tagNum, content}, nil
+
+ case cborTypePrimitives:
+ _, ai, val := d.getHead()
+ if ai <= 24 && d.dm.simpleValues.rejected[SimpleValue(val)] {
+ return nil, &UnacceptableDataItemError{
+ CBORType: t.String(),
+ Message: "simple value " + strconv.FormatInt(int64(val), 10) + " is not recognized",
+ }
+ }
+ if ai < 20 || ai == 24 {
+ return SimpleValue(val), nil
+ }
+
+ switch ai {
+ case additionalInformationAsFalse,
+ additionalInformationAsTrue:
+ return (ai == additionalInformationAsTrue), nil
+
+ case additionalInformationAsNull,
+ additionalInformationAsUndefined:
+ return nil, nil
+
+ case additionalInformationAsFloat16:
+ f := float64(float16.Frombits(uint16(val)).Float32())
+ return f, nil
+
+ case additionalInformationAsFloat32:
+ f := float64(math.Float32frombits(uint32(val)))
+ return f, nil
+
+ case additionalInformationAsFloat64:
+ f := math.Float64frombits(val)
+ return f, nil
+ }
+
+ case cborTypeArray:
+ return d.parseArray()
+
+ case cborTypeMap:
+ if d.dm.defaultMapType != nil {
+ m := reflect.New(d.dm.defaultMapType)
+ err := d.parseToValue(m, getTypeInfo(m.Elem().Type()))
+ if err != nil {
+ return nil, err
+ }
+ return m.Elem().Interface(), nil
+ }
+ return d.parseMap()
+ }
+
+ return nil, nil
+}
+
+// parseByteString parses a CBOR encoded byte string. The returned byte slice
+// may be backed directly by the input. The second return value will be true if
+// and only if the slice is backed by a copy of the input. Callers are
+// responsible for making a copy if necessary.
+func (d *decoder) parseByteString() ([]byte, bool) {
+ _, _, val, indefiniteLength := d.getHeadWithIndefiniteLengthFlag()
+ if !indefiniteLength {
+ b := d.data[d.off : d.off+int(val)]
+ d.off += int(val)
+ return b, false
+ }
+ // Process indefinite length string chunks.
+ b := []byte{}
+ for !d.foundBreak() {
+ _, _, val = d.getHead()
+ b = append(b, d.data[d.off:d.off+int(val)]...)
+ d.off += int(val)
+ }
+ return b, true
+}
+
+// applyByteStringTextConversion converts bytes read from a byte string to or from a configured text
+// encoding. If no transformation was performed (because it was not required), the original byte
+// slice is returned and the bool return value is false. Otherwise, a new slice containing the
+// converted bytes is returned along with the bool value true.
+func (d *decoder) applyByteStringTextConversion(
+ src []byte,
+ dstType reflect.Type,
+) (
+ dst []byte,
+ transformed bool,
+ err error,
+) {
+ switch dstType.Kind() {
+ case reflect.String:
+ if d.dm.byteStringToString != ByteStringToStringAllowedWithExpectedLaterEncoding || len(d.expectedLaterEncodingTags) == 0 {
+ return src, false, nil
+ }
+
+ switch d.expectedLaterEncodingTags[len(d.expectedLaterEncodingTags)-1] {
+ case tagNumExpectedLaterEncodingBase64URL:
+ encoded := make([]byte, base64.RawURLEncoding.EncodedLen(len(src)))
+ base64.RawURLEncoding.Encode(encoded, src)
+ return encoded, true, nil
+
+ case tagNumExpectedLaterEncodingBase64:
+ encoded := make([]byte, base64.StdEncoding.EncodedLen(len(src)))
+ base64.StdEncoding.Encode(encoded, src)
+ return encoded, true, nil
+
+ case tagNumExpectedLaterEncodingBase16:
+ encoded := make([]byte, hex.EncodedLen(len(src)))
+ hex.Encode(encoded, src)
+ return encoded, true, nil
+
+ default:
+ // If this happens, there is a bug: the decoder has pushed an invalid
+ // "expected later encoding" tag to the stack.
+ panic(fmt.Sprintf("unrecognized expected later encoding tag: %d", d.expectedLaterEncodingTags))
+ }
+
+ case reflect.Slice:
+ if dstType.Elem().Kind() != reflect.Uint8 || len(d.expectedLaterEncodingTags) > 0 {
+ // Either the destination is not a slice of bytes, or the encoder that
+ // produced the input indicated an expected text encoding tag and therefore
+ // the content of the byte string has NOT been text encoded.
+ return src, false, nil
+ }
+
+ switch d.dm.byteStringExpectedFormat {
+ case ByteStringExpectedBase64URL:
+ decoded := make([]byte, base64.RawURLEncoding.DecodedLen(len(src)))
+ n, err := base64.RawURLEncoding.Decode(decoded, src)
+ if err != nil {
+ return nil, false, newByteStringExpectedFormatError(ByteStringExpectedBase64URL, err)
+ }
+ return decoded[:n], true, nil
+
+ case ByteStringExpectedBase64:
+ decoded := make([]byte, base64.StdEncoding.DecodedLen(len(src)))
+ n, err := base64.StdEncoding.Decode(decoded, src)
+ if err != nil {
+ return nil, false, newByteStringExpectedFormatError(ByteStringExpectedBase64, err)
+ }
+ return decoded[:n], true, nil
+
+ case ByteStringExpectedBase16:
+ decoded := make([]byte, hex.DecodedLen(len(src)))
+ n, err := hex.Decode(decoded, src)
+ if err != nil {
+ return nil, false, newByteStringExpectedFormatError(ByteStringExpectedBase16, err)
+ }
+ return decoded[:n], true, nil
+ }
+ }
+
+ return src, false, nil
+}
+
+// parseTextString parses CBOR encoded text string. It returns a byte slice
+// to prevent creating an extra copy of string. Caller should wrap returned
+// byte slice as string when needed.
+func (d *decoder) parseTextString() ([]byte, error) {
+ _, _, val, indefiniteLength := d.getHeadWithIndefiniteLengthFlag()
+ if !indefiniteLength {
+ b := d.data[d.off : d.off+int(val)]
+ d.off += int(val)
+ if d.dm.utf8 == UTF8RejectInvalid && !utf8.Valid(b) {
+ return nil, &SemanticError{"cbor: invalid UTF-8 string"}
+ }
+ return b, nil
+ }
+ // Process indefinite length string chunks.
+ b := []byte{}
+ for !d.foundBreak() {
+ _, _, val = d.getHead()
+ x := d.data[d.off : d.off+int(val)]
+ d.off += int(val)
+ if d.dm.utf8 == UTF8RejectInvalid && !utf8.Valid(x) {
+ for !d.foundBreak() {
+ d.skip() // Skip remaining chunk on error
+ }
+ return nil, &SemanticError{"cbor: invalid UTF-8 string"}
+ }
+ b = append(b, x...)
+ }
+ return b, nil
+}
+
+func (d *decoder) parseArray() ([]interface{}, error) {
+ _, _, val, indefiniteLength := d.getHeadWithIndefiniteLengthFlag()
+ hasSize := !indefiniteLength
+ count := int(val)
+ if !hasSize {
+ count = d.numOfItemsUntilBreak() // peek ahead to get array size to preallocate slice for better performance
+ }
+ v := make([]interface{}, count)
+ var e interface{}
+ var err, lastErr error
+ for i := 0; (hasSize && i < count) || (!hasSize && !d.foundBreak()); i++ {
+ if e, lastErr = d.parse(true); lastErr != nil {
+ if err == nil {
+ err = lastErr
+ }
+ continue
+ }
+ v[i] = e
+ }
+ return v, err
+}
+
+func (d *decoder) parseArrayToSlice(v reflect.Value, tInfo *typeInfo) error {
+ _, _, val, indefiniteLength := d.getHeadWithIndefiniteLengthFlag()
+ hasSize := !indefiniteLength
+ count := int(val)
+ if !hasSize {
+ count = d.numOfItemsUntilBreak() // peek ahead to get array size to preallocate slice for better performance
+ }
+ if v.IsNil() || v.Cap() < count || count == 0 {
+ v.Set(reflect.MakeSlice(tInfo.nonPtrType, count, count))
+ }
+ v.SetLen(count)
+ var err error
+ for i := 0; (hasSize && i < count) || (!hasSize && !d.foundBreak()); i++ {
+ if lastErr := d.parseToValue(v.Index(i), tInfo.elemTypeInfo); lastErr != nil {
+ if err == nil {
+ err = lastErr
+ }
+ }
+ }
+ return err
+}
+
+func (d *decoder) parseArrayToArray(v reflect.Value, tInfo *typeInfo) error {
+ _, _, val, indefiniteLength := d.getHeadWithIndefiniteLengthFlag()
+ hasSize := !indefiniteLength
+ count := int(val)
+ gi := 0
+ vLen := v.Len()
+ var err error
+ for ci := 0; (hasSize && ci < count) || (!hasSize && !d.foundBreak()); ci++ {
+ if gi < vLen {
+ // Read CBOR array element and set array element
+ if lastErr := d.parseToValue(v.Index(gi), tInfo.elemTypeInfo); lastErr != nil {
+ if err == nil {
+ err = lastErr
+ }
+ }
+ gi++
+ } else {
+ d.skip() // Skip remaining CBOR array element
+ }
+ }
+ // Set remaining Go array elements to zero values.
+ if gi < vLen {
+ zeroV := reflect.Zero(tInfo.elemTypeInfo.typ)
+ for ; gi < vLen; gi++ {
+ v.Index(gi).Set(zeroV)
+ }
+ }
+ return err
+}
+
+func (d *decoder) parseMap() (interface{}, error) {
+ _, _, val, indefiniteLength := d.getHeadWithIndefiniteLengthFlag()
+ hasSize := !indefiniteLength
+ count := int(val)
+ m := make(map[interface{}]interface{})
+ var k, e interface{}
+ var err, lastErr error
+ keyCount := 0
+ for i := 0; (hasSize && i < count) || (!hasSize && !d.foundBreak()); i++ {
+ // Parse CBOR map key.
+ if k, lastErr = d.parse(true); lastErr != nil {
+ if err == nil {
+ err = lastErr
+ }
+ d.skip()
+ continue
+ }
+
+ // Detect if CBOR map key can be used as Go map key.
+ rv := reflect.ValueOf(k)
+ if !isHashableValue(rv) {
+ var converted bool
+ if d.dm.mapKeyByteString == MapKeyByteStringAllowed {
+ k, converted = convertByteSliceToByteString(k)
+ }
+ if !converted {
+ if err == nil {
+ err = &InvalidMapKeyTypeError{rv.Type().String()}
+ }
+ d.skip()
+ continue
+ }
+ }
+
+ // Parse CBOR map value.
+ if e, lastErr = d.parse(true); lastErr != nil {
+ if err == nil {
+ err = lastErr
+ }
+ continue
+ }
+
+ // Add key-value pair to Go map.
+ m[k] = e
+
+ // Detect duplicate map key.
+ if d.dm.dupMapKey == DupMapKeyEnforcedAPF {
+ newKeyCount := len(m)
+ if newKeyCount == keyCount {
+ m[k] = nil
+ err = &DupMapKeyError{k, i}
+ i++
+ // skip the rest of the map
+ for ; (hasSize && i < count) || (!hasSize && !d.foundBreak()); i++ {
+ d.skip() // Skip map key
+ d.skip() // Skip map value
+ }
+ return m, err
+ }
+ keyCount = newKeyCount
+ }
+ }
+ return m, err
+}
+
+func (d *decoder) parseMapToMap(v reflect.Value, tInfo *typeInfo) error { //nolint:gocyclo
+ _, _, val, indefiniteLength := d.getHeadWithIndefiniteLengthFlag()
+ hasSize := !indefiniteLength
+ count := int(val)
+ if v.IsNil() {
+ mapsize := count
+ if !hasSize {
+ mapsize = 0
+ }
+ v.Set(reflect.MakeMapWithSize(tInfo.nonPtrType, mapsize))
+ }
+ keyType, eleType := tInfo.keyTypeInfo.typ, tInfo.elemTypeInfo.typ
+ reuseKey, reuseEle := isImmutableKind(tInfo.keyTypeInfo.kind), isImmutableKind(tInfo.elemTypeInfo.kind)
+ var keyValue, eleValue, zeroKeyValue, zeroEleValue reflect.Value
+ keyIsInterfaceType := keyType == typeIntf // If key type is interface{}, need to check if key value is hashable.
+ var err, lastErr error
+ keyCount := v.Len()
+ var existingKeys map[interface{}]bool // Store existing map keys, used for detecting duplicate map key.
+ if d.dm.dupMapKey == DupMapKeyEnforcedAPF {
+ existingKeys = make(map[interface{}]bool, keyCount)
+ if keyCount > 0 {
+ vKeys := v.MapKeys()
+ for i := 0; i < len(vKeys); i++ {
+ existingKeys[vKeys[i].Interface()] = true
+ }
+ }
+ }
+ for i := 0; (hasSize && i < count) || (!hasSize && !d.foundBreak()); i++ {
+ // Parse CBOR map key.
+ if !keyValue.IsValid() {
+ keyValue = reflect.New(keyType).Elem()
+ } else if !reuseKey {
+ if !zeroKeyValue.IsValid() {
+ zeroKeyValue = reflect.Zero(keyType)
+ }
+ keyValue.Set(zeroKeyValue)
+ }
+ if lastErr = d.parseToValue(keyValue, tInfo.keyTypeInfo); lastErr != nil {
+ if err == nil {
+ err = lastErr
+ }
+ d.skip()
+ continue
+ }
+
+ // Detect if CBOR map key can be used as Go map key.
+ if keyIsInterfaceType && keyValue.Elem().IsValid() {
+ if !isHashableValue(keyValue.Elem()) {
+ var converted bool
+ if d.dm.mapKeyByteString == MapKeyByteStringAllowed {
+ var k interface{}
+ k, converted = convertByteSliceToByteString(keyValue.Elem().Interface())
+ if converted {
+ keyValue.Set(reflect.ValueOf(k))
+ }
+ }
+ if !converted {
+ if err == nil {
+ err = &InvalidMapKeyTypeError{keyValue.Elem().Type().String()}
+ }
+ d.skip()
+ continue
+ }
+ }
+ }
+
+ // Parse CBOR map value.
+ if !eleValue.IsValid() {
+ eleValue = reflect.New(eleType).Elem()
+ } else if !reuseEle {
+ if !zeroEleValue.IsValid() {
+ zeroEleValue = reflect.Zero(eleType)
+ }
+ eleValue.Set(zeroEleValue)
+ }
+ if lastErr := d.parseToValue(eleValue, tInfo.elemTypeInfo); lastErr != nil {
+ if err == nil {
+ err = lastErr
+ }
+ continue
+ }
+
+ // Add key-value pair to Go map.
+ v.SetMapIndex(keyValue, eleValue)
+
+ // Detect duplicate map key.
+ if d.dm.dupMapKey == DupMapKeyEnforcedAPF {
+ newKeyCount := v.Len()
+ if newKeyCount == keyCount {
+ kvi := keyValue.Interface()
+ if !existingKeys[kvi] {
+ v.SetMapIndex(keyValue, reflect.New(eleType).Elem())
+ err = &DupMapKeyError{kvi, i}
+ i++
+ // skip the rest of the map
+ for ; (hasSize && i < count) || (!hasSize && !d.foundBreak()); i++ {
+ d.skip() // skip map key
+ d.skip() // skip map value
+ }
+ return err
+ }
+ delete(existingKeys, kvi)
+ }
+ keyCount = newKeyCount
+ }
+ }
+ return err
+}
+
+func (d *decoder) parseArrayToStruct(v reflect.Value, tInfo *typeInfo) error {
+ structType := getDecodingStructType(tInfo.nonPtrType)
+ if structType.err != nil {
+ return structType.err
+ }
+
+ if !structType.toArray {
+ t := d.nextCBORType()
+ d.skip()
+ return &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: tInfo.nonPtrType.String(),
+ errorMsg: "cannot decode CBOR array to struct without toarray option",
+ }
+ }
+
+ start := d.off
+ _, _, val, indefiniteLength := d.getHeadWithIndefiniteLengthFlag()
+ hasSize := !indefiniteLength
+ count := int(val)
+ if !hasSize {
+ count = d.numOfItemsUntilBreak() // peek ahead to get array size
+ }
+ if count != len(structType.fields) {
+ d.off = start
+ d.skip()
+ return &UnmarshalTypeError{
+ CBORType: cborTypeArray.String(),
+ GoType: tInfo.typ.String(),
+ errorMsg: "cannot decode CBOR array to struct with different number of elements",
+ }
+ }
+ var err, lastErr error
+ for i := 0; (hasSize && i < count) || (!hasSize && !d.foundBreak()); i++ {
+ f := structType.fields[i]
+
+ // Get field value by index
+ var fv reflect.Value
+ if len(f.idx) == 1 {
+ fv = v.Field(f.idx[0])
+ } else {
+ fv, lastErr = getFieldValue(v, f.idx, func(v reflect.Value) (reflect.Value, error) {
+ // Return a new value for embedded field null pointer to point to, or return error.
+ if !v.CanSet() {
+ return reflect.Value{}, errors.New("cbor: cannot set embedded pointer to unexported struct: " + v.Type().String())
+ }
+ v.Set(reflect.New(v.Type().Elem()))
+ return v, nil
+ })
+ if lastErr != nil && err == nil {
+ err = lastErr
+ }
+ if !fv.IsValid() {
+ d.skip()
+ continue
+ }
+ }
+
+ if lastErr = d.parseToValue(fv, f.typInfo); lastErr != nil {
+ if err == nil {
+ if typeError, ok := lastErr.(*UnmarshalTypeError); ok {
+ typeError.StructFieldName = tInfo.typ.String() + "." + f.name
+ err = typeError
+ } else {
+ err = lastErr
+ }
+ }
+ }
+ }
+ return err
+}
+
+// parseMapToStruct needs to be fast so gocyclo can be ignored for now.
+func (d *decoder) parseMapToStruct(v reflect.Value, tInfo *typeInfo) error { //nolint:gocyclo
+ structType := getDecodingStructType(tInfo.nonPtrType)
+ if structType.err != nil {
+ return structType.err
+ }
+
+ if structType.toArray {
+ t := d.nextCBORType()
+ d.skip()
+ return &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: tInfo.nonPtrType.String(),
+ errorMsg: "cannot decode CBOR map to struct with toarray option",
+ }
+ }
+
+ var err, lastErr error
+
+ // Get CBOR map size
+ _, _, val, indefiniteLength := d.getHeadWithIndefiniteLengthFlag()
+ hasSize := !indefiniteLength
+ count := int(val)
+
+ // Keeps track of matched struct fields
+ var foundFldIdx []bool
+ {
+ const maxStackFields = 128
+ if nfields := len(structType.fields); nfields <= maxStackFields {
+ // For structs with typical field counts, expect that this can be
+ // stack-allocated.
+ var a [maxStackFields]bool
+ foundFldIdx = a[:nfields]
+ } else {
+ foundFldIdx = make([]bool, len(structType.fields))
+ }
+ }
+
+ // Keeps track of CBOR map keys to detect duplicate map key
+ keyCount := 0
+ var mapKeys map[interface{}]struct{}
+
+ errOnUnknownField := (d.dm.extraReturnErrors & ExtraDecErrorUnknownField) > 0
+
+MapEntryLoop:
+ for j := 0; (hasSize && j < count) || (!hasSize && !d.foundBreak()); j++ {
+ var f *field
+
+ // If duplicate field detection is enabled and the key at index j did not match any
+ // field, k will hold the map key.
+ var k interface{}
+
+ t := d.nextCBORType()
+ if t == cborTypeTextString || (t == cborTypeByteString && d.dm.fieldNameByteString == FieldNameByteStringAllowed) {
+ var keyBytes []byte
+ if t == cborTypeTextString {
+ keyBytes, lastErr = d.parseTextString()
+ if lastErr != nil {
+ if err == nil {
+ err = lastErr
+ }
+ d.skip() // skip value
+ continue
+ }
+ } else { // cborTypeByteString
+ keyBytes, _ = d.parseByteString()
+ }
+
+ // Check for exact match on field name.
+ if i, ok := structType.fieldIndicesByName[string(keyBytes)]; ok {
+ fld := structType.fields[i]
+
+ if !foundFldIdx[i] {
+ f = fld
+ foundFldIdx[i] = true
+ } else if d.dm.dupMapKey == DupMapKeyEnforcedAPF {
+ err = &DupMapKeyError{fld.name, j}
+ d.skip() // skip value
+ j++
+ // skip the rest of the map
+ for ; (hasSize && j < count) || (!hasSize && !d.foundBreak()); j++ {
+ d.skip()
+ d.skip()
+ }
+ return err
+ } else {
+ // discard repeated match
+ d.skip()
+ continue MapEntryLoop
+ }
+ }
+
+ // Find field with case-insensitive match
+ if f == nil && d.dm.fieldNameMatching == FieldNameMatchingPreferCaseSensitive {
+ keyLen := len(keyBytes)
+ keyString := string(keyBytes)
+ for i := 0; i < len(structType.fields); i++ {
+ fld := structType.fields[i]
+ if len(fld.name) == keyLen && strings.EqualFold(fld.name, keyString) {
+ if !foundFldIdx[i] {
+ f = fld
+ foundFldIdx[i] = true
+ } else if d.dm.dupMapKey == DupMapKeyEnforcedAPF {
+ err = &DupMapKeyError{keyString, j}
+ d.skip() // skip value
+ j++
+ // skip the rest of the map
+ for ; (hasSize && j < count) || (!hasSize && !d.foundBreak()); j++ {
+ d.skip()
+ d.skip()
+ }
+ return err
+ } else {
+ // discard repeated match
+ d.skip()
+ continue MapEntryLoop
+ }
+ break
+ }
+ }
+ }
+
+ if d.dm.dupMapKey == DupMapKeyEnforcedAPF && f == nil {
+ k = string(keyBytes)
+ }
+ } else if t <= cborTypeNegativeInt { // uint/int
+ var nameAsInt int64
+
+ if t == cborTypePositiveInt {
+ _, _, val := d.getHead()
+ nameAsInt = int64(val)
+ } else {
+ _, _, val := d.getHead()
+ if val > math.MaxInt64 {
+ if err == nil {
+ err = &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: reflect.TypeOf(int64(0)).String(),
+ errorMsg: "-1-" + strconv.FormatUint(val, 10) + " overflows Go's int64",
+ }
+ }
+ d.skip() // skip value
+ continue
+ }
+ nameAsInt = int64(-1) ^ int64(val)
+ }
+
+ // Find field
+ for i := 0; i < len(structType.fields); i++ {
+ fld := structType.fields[i]
+ if fld.keyAsInt && fld.nameAsInt == nameAsInt {
+ if !foundFldIdx[i] {
+ f = fld
+ foundFldIdx[i] = true
+ } else if d.dm.dupMapKey == DupMapKeyEnforcedAPF {
+ err = &DupMapKeyError{nameAsInt, j}
+ d.skip() // skip value
+ j++
+ // skip the rest of the map
+ for ; (hasSize && j < count) || (!hasSize && !d.foundBreak()); j++ {
+ d.skip()
+ d.skip()
+ }
+ return err
+ } else {
+ // discard repeated match
+ d.skip()
+ continue MapEntryLoop
+ }
+ break
+ }
+ }
+
+ if d.dm.dupMapKey == DupMapKeyEnforcedAPF && f == nil {
+ k = nameAsInt
+ }
+ } else {
+ if err == nil {
+ err = &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: reflect.TypeOf("").String(),
+ errorMsg: "map key is of type " + t.String() + " and cannot be used to match struct field name",
+ }
+ }
+ if d.dm.dupMapKey == DupMapKeyEnforcedAPF {
+ // parse key
+ k, lastErr = d.parse(true)
+ if lastErr != nil {
+ d.skip() // skip value
+ continue
+ }
+ // Detect if CBOR map key can be used as Go map key.
+ if !isHashableValue(reflect.ValueOf(k)) {
+ d.skip() // skip value
+ continue
+ }
+ } else {
+ d.skip() // skip key
+ }
+ }
+
+ if f == nil {
+ if errOnUnknownField {
+ err = &UnknownFieldError{j}
+ d.skip() // Skip value
+ j++
+ // skip the rest of the map
+ for ; (hasSize && j < count) || (!hasSize && !d.foundBreak()); j++ {
+ d.skip()
+ d.skip()
+ }
+ return err
+ }
+
+ // Two map keys that match the same struct field are immediately considered
+ // duplicates. This check detects duplicates between two map keys that do
+ // not match a struct field. If unknown field errors are enabled, then this
+ // check is never reached.
+ if d.dm.dupMapKey == DupMapKeyEnforcedAPF {
+ if mapKeys == nil {
+ mapKeys = make(map[interface{}]struct{}, 1)
+ }
+ mapKeys[k] = struct{}{}
+ newKeyCount := len(mapKeys)
+ if newKeyCount == keyCount {
+ err = &DupMapKeyError{k, j}
+ d.skip() // skip value
+ j++
+ // skip the rest of the map
+ for ; (hasSize && j < count) || (!hasSize && !d.foundBreak()); j++ {
+ d.skip()
+ d.skip()
+ }
+ return err
+ }
+ keyCount = newKeyCount
+ }
+
+ d.skip() // Skip value
+ continue
+ }
+
+ // Get field value by index
+ var fv reflect.Value
+ if len(f.idx) == 1 {
+ fv = v.Field(f.idx[0])
+ } else {
+ fv, lastErr = getFieldValue(v, f.idx, func(v reflect.Value) (reflect.Value, error) {
+ // Return a new value for embedded field null pointer to point to, or return error.
+ if !v.CanSet() {
+ return reflect.Value{}, errors.New("cbor: cannot set embedded pointer to unexported struct: " + v.Type().String())
+ }
+ v.Set(reflect.New(v.Type().Elem()))
+ return v, nil
+ })
+ if lastErr != nil && err == nil {
+ err = lastErr
+ }
+ if !fv.IsValid() {
+ d.skip()
+ continue
+ }
+ }
+
+ if lastErr = d.parseToValue(fv, f.typInfo); lastErr != nil {
+ if err == nil {
+ if typeError, ok := lastErr.(*UnmarshalTypeError); ok {
+ typeError.StructFieldName = tInfo.nonPtrType.String() + "." + f.name
+ err = typeError
+ } else {
+ err = lastErr
+ }
+ }
+ }
+ }
+ return err
+}
+
+// validRegisteredTagNums verifies that tag numbers match registered tag numbers of type t.
+// validRegisteredTagNums assumes next CBOR data type is tag. It scans all tag numbers, and stops at tag content.
+func (d *decoder) validRegisteredTagNums(registeredTag *tagItem) error {
+ // Scan until next cbor data is tag content.
+ tagNums := make([]uint64, 0, 1)
+ for d.nextCBORType() == cborTypeTag {
+ _, _, val := d.getHead()
+ tagNums = append(tagNums, val)
+ }
+
+ if !registeredTag.equalTagNum(tagNums) {
+ return &WrongTagError{registeredTag.contentType, registeredTag.num, tagNums}
+ }
+ return nil
+}
+
+func (d *decoder) getRegisteredTagItem(vt reflect.Type) *tagItem {
+ if d.dm.tags != nil {
+ return d.dm.tags.getTagItemFromType(vt)
+ }
+ return nil
+}
+
+// skip moves data offset to the next item. skip assumes data is well-formed,
+// and does not perform bounds checking.
+func (d *decoder) skip() {
+ t, _, val, indefiniteLength := d.getHeadWithIndefiniteLengthFlag()
+
+ if indefiniteLength {
+ switch t {
+ case cborTypeByteString, cborTypeTextString, cborTypeArray, cborTypeMap:
+ for {
+ if isBreakFlag(d.data[d.off]) {
+ d.off++
+ return
+ }
+ d.skip()
+ }
+ }
+ }
+
+ switch t {
+ case cborTypeByteString, cborTypeTextString:
+ d.off += int(val)
+
+ case cborTypeArray:
+ for i := 0; i < int(val); i++ {
+ d.skip()
+ }
+
+ case cborTypeMap:
+ for i := 0; i < int(val)*2; i++ {
+ d.skip()
+ }
+
+ case cborTypeTag:
+ d.skip()
+ }
+}
+
+func (d *decoder) getHeadWithIndefiniteLengthFlag() (
+ t cborType,
+ ai byte,
+ val uint64,
+ indefiniteLength bool,
+) {
+ t, ai, val = d.getHead()
+ indefiniteLength = additionalInformation(ai).isIndefiniteLength()
+ return
+}
+
+// getHead assumes data is well-formed, and does not perform bounds checking.
+func (d *decoder) getHead() (t cborType, ai byte, val uint64) {
+ t, ai = parseInitialByte(d.data[d.off])
+ val = uint64(ai)
+ d.off++
+
+ if ai <= maxAdditionalInformationWithoutArgument {
+ return
+ }
+
+ if ai == additionalInformationWith1ByteArgument {
+ val = uint64(d.data[d.off])
+ d.off++
+ return
+ }
+
+ if ai == additionalInformationWith2ByteArgument {
+ const argumentSize = 2
+ val = uint64(binary.BigEndian.Uint16(d.data[d.off : d.off+argumentSize]))
+ d.off += argumentSize
+ return
+ }
+
+ if ai == additionalInformationWith4ByteArgument {
+ const argumentSize = 4
+ val = uint64(binary.BigEndian.Uint32(d.data[d.off : d.off+argumentSize]))
+ d.off += argumentSize
+ return
+ }
+
+ if ai == additionalInformationWith8ByteArgument {
+ const argumentSize = 8
+ val = binary.BigEndian.Uint64(d.data[d.off : d.off+argumentSize])
+ d.off += argumentSize
+ return
+ }
+ return
+}
+
+func (d *decoder) numOfItemsUntilBreak() int {
+ savedOff := d.off
+ i := 0
+ for !d.foundBreak() {
+ d.skip()
+ i++
+ }
+ d.off = savedOff
+ return i
+}
+
+// foundBreak returns true if next byte is CBOR break code and moves cursor by 1,
+// otherwise it returns false.
+// foundBreak assumes data is well-formed, and does not perform bounds checking.
+func (d *decoder) foundBreak() bool {
+ if isBreakFlag(d.data[d.off]) {
+ d.off++
+ return true
+ }
+ return false
+}
+
+func (d *decoder) reset(data []byte) {
+ d.data = data
+ d.off = 0
+ d.expectedLaterEncodingTags = d.expectedLaterEncodingTags[:0]
+}
+
+func (d *decoder) nextCBORType() cborType {
+ return getType(d.data[d.off])
+}
+
+func (d *decoder) nextCBORNil() bool {
+ return d.data[d.off] == 0xf6 || d.data[d.off] == 0xf7
+}
+
+var (
+ typeIntf = reflect.TypeOf([]interface{}(nil)).Elem()
+ typeTime = reflect.TypeOf(time.Time{})
+ typeBigInt = reflect.TypeOf(big.Int{})
+ typeUnmarshaler = reflect.TypeOf((*Unmarshaler)(nil)).Elem()
+ typeBinaryUnmarshaler = reflect.TypeOf((*encoding.BinaryUnmarshaler)(nil)).Elem()
+ typeString = reflect.TypeOf("")
+ typeByteSlice = reflect.TypeOf([]byte(nil))
+)
+
+func fillNil(_ cborType, v reflect.Value) error {
+ switch v.Kind() {
+ case reflect.Slice, reflect.Map, reflect.Interface, reflect.Ptr:
+ v.Set(reflect.Zero(v.Type()))
+ return nil
+ }
+ return nil
+}
+
+func fillPositiveInt(t cborType, val uint64, v reflect.Value) error {
+ switch v.Kind() {
+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+ if val > math.MaxInt64 {
+ return &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: v.Type().String(),
+ errorMsg: strconv.FormatUint(val, 10) + " overflows " + v.Type().String(),
+ }
+ }
+ if v.OverflowInt(int64(val)) {
+ return &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: v.Type().String(),
+ errorMsg: strconv.FormatUint(val, 10) + " overflows " + v.Type().String(),
+ }
+ }
+ v.SetInt(int64(val))
+ return nil
+
+ case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
+ if v.OverflowUint(val) {
+ return &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: v.Type().String(),
+ errorMsg: strconv.FormatUint(val, 10) + " overflows " + v.Type().String(),
+ }
+ }
+ v.SetUint(val)
+ return nil
+
+ case reflect.Float32, reflect.Float64:
+ f := float64(val)
+ v.SetFloat(f)
+ return nil
+ }
+
+ if v.Type() == typeBigInt {
+ i := new(big.Int).SetUint64(val)
+ v.Set(reflect.ValueOf(*i))
+ return nil
+ }
+ return &UnmarshalTypeError{CBORType: t.String(), GoType: v.Type().String()}
+}
+
+func fillNegativeInt(t cborType, val int64, v reflect.Value) error {
+ switch v.Kind() {
+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+ if v.OverflowInt(val) {
+ return &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: v.Type().String(),
+ errorMsg: strconv.FormatInt(val, 10) + " overflows " + v.Type().String(),
+ }
+ }
+ v.SetInt(val)
+ return nil
+
+ case reflect.Float32, reflect.Float64:
+ f := float64(val)
+ v.SetFloat(f)
+ return nil
+ }
+ if v.Type() == typeBigInt {
+ i := new(big.Int).SetInt64(val)
+ v.Set(reflect.ValueOf(*i))
+ return nil
+ }
+ return &UnmarshalTypeError{CBORType: t.String(), GoType: v.Type().String()}
+}
+
+func fillBool(t cborType, val bool, v reflect.Value) error {
+ if v.Kind() == reflect.Bool {
+ v.SetBool(val)
+ return nil
+ }
+ return &UnmarshalTypeError{CBORType: t.String(), GoType: v.Type().String()}
+}
+
+func fillFloat(t cborType, val float64, v reflect.Value) error {
+ switch v.Kind() {
+ case reflect.Float32, reflect.Float64:
+ if v.OverflowFloat(val) {
+ return &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: v.Type().String(),
+ errorMsg: strconv.FormatFloat(val, 'E', -1, 64) + " overflows " + v.Type().String(),
+ }
+ }
+ v.SetFloat(val)
+ return nil
+ }
+ return &UnmarshalTypeError{CBORType: t.String(), GoType: v.Type().String()}
+}
+
+func fillByteString(t cborType, val []byte, shared bool, v reflect.Value, bsts ByteStringToStringMode, bum BinaryUnmarshalerMode) error {
+ if bum == BinaryUnmarshalerByteString && reflect.PtrTo(v.Type()).Implements(typeBinaryUnmarshaler) {
+ if v.CanAddr() {
+ v = v.Addr()
+ if u, ok := v.Interface().(encoding.BinaryUnmarshaler); ok {
+ // The contract of BinaryUnmarshaler forbids
+ // retaining the input bytes, so no copying is
+ // required even if val is shared.
+ return u.UnmarshalBinary(val)
+ }
+ }
+ return errors.New("cbor: cannot set new value for " + v.Type().String())
+ }
+ if bsts != ByteStringToStringForbidden && v.Kind() == reflect.String {
+ v.SetString(string(val))
+ return nil
+ }
+ if v.Kind() == reflect.Slice && v.Type().Elem().Kind() == reflect.Uint8 {
+ src := val
+ if shared {
+ // SetBytes shares the underlying bytes of the source slice.
+ src = make([]byte, len(val))
+ copy(src, val)
+ }
+ v.SetBytes(src)
+ return nil
+ }
+ if v.Kind() == reflect.Array && v.Type().Elem().Kind() == reflect.Uint8 {
+ vLen := v.Len()
+ i := 0
+ for ; i < vLen && i < len(val); i++ {
+ v.Index(i).SetUint(uint64(val[i]))
+ }
+ // Set remaining Go array elements to zero values.
+ if i < vLen {
+ zeroV := reflect.Zero(reflect.TypeOf(byte(0)))
+ for ; i < vLen; i++ {
+ v.Index(i).Set(zeroV)
+ }
+ }
+ return nil
+ }
+ return &UnmarshalTypeError{CBORType: t.String(), GoType: v.Type().String()}
+}
+
+func fillTextString(t cborType, val []byte, v reflect.Value) error {
+ if v.Kind() == reflect.String {
+ v.SetString(string(val))
+ return nil
+ }
+ return &UnmarshalTypeError{CBORType: t.String(), GoType: v.Type().String()}
+}
+
+func isImmutableKind(k reflect.Kind) bool {
+ switch k {
+ case reflect.Bool,
+ reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
+ reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,
+ reflect.Float32, reflect.Float64,
+ reflect.String:
+ return true
+
+ default:
+ return false
+ }
+}
+
+func isHashableValue(rv reflect.Value) bool {
+ switch rv.Kind() {
+ case reflect.Slice, reflect.Map, reflect.Func:
+ return false
+
+ case reflect.Struct:
+ switch rv.Type() {
+ case typeTag:
+ tag := rv.Interface().(Tag)
+ return isHashableValue(reflect.ValueOf(tag.Content))
+ case typeBigInt:
+ return false
+ }
+ }
+ return true
+}
+
+// convertByteSliceToByteString converts []byte to ByteString if
+// - v is []byte type, or
+// - v is Tag type and tag content type is []byte
+// This function also handles nested tags.
+// CBOR data is already verified to be well-formed before this function is used,
+// so the recursion won't exceed max nested levels.
+func convertByteSliceToByteString(v interface{}) (interface{}, bool) {
+ switch v := v.(type) {
+ case []byte:
+ return ByteString(v), true
+
+ case Tag:
+ content, converted := convertByteSliceToByteString(v.Content)
+ if converted {
+ return Tag{Number: v.Number, Content: content}, true
+ }
+ }
+ return v, false
+}
diff --git a/vendor/github.com/fxamacker/cbor/v2/diagnose.go b/vendor/github.com/fxamacker/cbor/v2/diagnose.go
new file mode 100644
index 000000000..44afb8660
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/diagnose.go
@@ -0,0 +1,724 @@
+// Copyright (c) Faye Amacker. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+package cbor
+
+import (
+ "bytes"
+ "encoding/base32"
+ "encoding/base64"
+ "encoding/hex"
+ "errors"
+ "fmt"
+ "io"
+ "math"
+ "math/big"
+ "strconv"
+ "unicode/utf16"
+ "unicode/utf8"
+
+ "github.com/x448/float16"
+)
+
+// DiagMode is the main interface for CBOR diagnostic notation.
+type DiagMode interface {
+ // Diagnose returns extended diagnostic notation (EDN) of CBOR data items using this DiagMode.
+ Diagnose([]byte) (string, error)
+
+ // DiagnoseFirst returns extended diagnostic notation (EDN) of the first CBOR data item using the DiagMode. Any remaining bytes are returned in rest.
+ DiagnoseFirst([]byte) (string, []byte, error)
+
+ // DiagOptions returns user specified options used to create this DiagMode.
+ DiagOptions() DiagOptions
+}
+
+// ByteStringEncoding specifies the base encoding that byte strings are notated.
+type ByteStringEncoding uint8
+
+const (
+ // ByteStringBase16Encoding encodes byte strings in base16, without padding.
+ ByteStringBase16Encoding ByteStringEncoding = iota
+
+ // ByteStringBase32Encoding encodes byte strings in base32, without padding.
+ ByteStringBase32Encoding
+
+ // ByteStringBase32HexEncoding encodes byte strings in base32hex, without padding.
+ ByteStringBase32HexEncoding
+
+ // ByteStringBase64Encoding encodes byte strings in base64url, without padding.
+ ByteStringBase64Encoding
+
+ maxByteStringEncoding
+)
+
+func (bse ByteStringEncoding) valid() error {
+ if bse >= maxByteStringEncoding {
+ return errors.New("cbor: invalid ByteStringEncoding " + strconv.Itoa(int(bse)))
+ }
+ return nil
+}
+
+// DiagOptions specifies Diag options.
+type DiagOptions struct {
+ // ByteStringEncoding specifies the base encoding that byte strings are notated.
+ // Default is ByteStringBase16Encoding.
+ ByteStringEncoding ByteStringEncoding
+
+ // ByteStringHexWhitespace specifies notating with whitespace in byte string
+ // when ByteStringEncoding is ByteStringBase16Encoding.
+ ByteStringHexWhitespace bool
+
+ // ByteStringText specifies notating with text in byte string
+ // if it is a valid UTF-8 text.
+ ByteStringText bool
+
+ // ByteStringEmbeddedCBOR specifies notating embedded CBOR in byte string
+ // if it is a valid CBOR bytes.
+ ByteStringEmbeddedCBOR bool
+
+ // CBORSequence specifies notating CBOR sequences.
+ // otherwise, it returns an error if there are more bytes after the first CBOR.
+ CBORSequence bool
+
+ // FloatPrecisionIndicator specifies appending a suffix to indicate float precision.
+ // Refer to https://www.rfc-editor.org/rfc/rfc8949.html#name-encoding-indicators.
+ FloatPrecisionIndicator bool
+
+ // MaxNestedLevels specifies the max nested levels allowed for any combination of CBOR array, maps, and tags.
+ // Default is 32 levels and it can be set to [4, 65535]. Note that higher maximum levels of nesting can
+ // require larger amounts of stack to deserialize. Don't increase this higher than you require.
+ MaxNestedLevels int
+
+ // MaxArrayElements specifies the max number of elements for CBOR arrays.
+ // Default is 128*1024=131072 and it can be set to [16, 2147483647]
+ MaxArrayElements int
+
+ // MaxMapPairs specifies the max number of key-value pairs for CBOR maps.
+ // Default is 128*1024=131072 and it can be set to [16, 2147483647]
+ MaxMapPairs int
+}
+
+// DiagMode returns a DiagMode with immutable options.
+func (opts DiagOptions) DiagMode() (DiagMode, error) {
+ return opts.diagMode()
+}
+
+func (opts DiagOptions) diagMode() (*diagMode, error) {
+ if err := opts.ByteStringEncoding.valid(); err != nil {
+ return nil, err
+ }
+
+ decMode, err := DecOptions{
+ MaxNestedLevels: opts.MaxNestedLevels,
+ MaxArrayElements: opts.MaxArrayElements,
+ MaxMapPairs: opts.MaxMapPairs,
+ }.decMode()
+ if err != nil {
+ return nil, err
+ }
+
+ return &diagMode{
+ byteStringEncoding: opts.ByteStringEncoding,
+ byteStringHexWhitespace: opts.ByteStringHexWhitespace,
+ byteStringText: opts.ByteStringText,
+ byteStringEmbeddedCBOR: opts.ByteStringEmbeddedCBOR,
+ cborSequence: opts.CBORSequence,
+ floatPrecisionIndicator: opts.FloatPrecisionIndicator,
+ decMode: decMode,
+ }, nil
+}
+
+type diagMode struct {
+ byteStringEncoding ByteStringEncoding
+ byteStringHexWhitespace bool
+ byteStringText bool
+ byteStringEmbeddedCBOR bool
+ cborSequence bool
+ floatPrecisionIndicator bool
+ decMode *decMode
+}
+
+// DiagOptions returns user specified options used to create this DiagMode.
+func (dm *diagMode) DiagOptions() DiagOptions {
+ return DiagOptions{
+ ByteStringEncoding: dm.byteStringEncoding,
+ ByteStringHexWhitespace: dm.byteStringHexWhitespace,
+ ByteStringText: dm.byteStringText,
+ ByteStringEmbeddedCBOR: dm.byteStringEmbeddedCBOR,
+ CBORSequence: dm.cborSequence,
+ FloatPrecisionIndicator: dm.floatPrecisionIndicator,
+ MaxNestedLevels: dm.decMode.maxNestedLevels,
+ MaxArrayElements: dm.decMode.maxArrayElements,
+ MaxMapPairs: dm.decMode.maxMapPairs,
+ }
+}
+
+// Diagnose returns extended diagnostic notation (EDN) of CBOR data items using the DiagMode.
+func (dm *diagMode) Diagnose(data []byte) (string, error) {
+ return newDiagnose(data, dm.decMode, dm).diag(dm.cborSequence)
+}
+
+// DiagnoseFirst returns extended diagnostic notation (EDN) of the first CBOR data item using the DiagMode. Any remaining bytes are returned in rest.
+func (dm *diagMode) DiagnoseFirst(data []byte) (diagNotation string, rest []byte, err error) {
+ return newDiagnose(data, dm.decMode, dm).diagFirst()
+}
+
+var defaultDiagMode, _ = DiagOptions{}.diagMode()
+
+// Diagnose returns extended diagnostic notation (EDN) of CBOR data items
+// using the default diagnostic mode.
+//
+// Refer to https://www.rfc-editor.org/rfc/rfc8949.html#name-diagnostic-notation.
+func Diagnose(data []byte) (string, error) {
+ return defaultDiagMode.Diagnose(data)
+}
+
+// Diagnose returns extended diagnostic notation (EDN) of the first CBOR data item using the DiagMode. Any remaining bytes are returned in rest.
+func DiagnoseFirst(data []byte) (diagNotation string, rest []byte, err error) {
+ return defaultDiagMode.DiagnoseFirst(data)
+}
+
+type diagnose struct {
+ dm *diagMode
+ d *decoder
+ w *bytes.Buffer
+}
+
+func newDiagnose(data []byte, decm *decMode, diagm *diagMode) *diagnose {
+ return &diagnose{
+ dm: diagm,
+ d: &decoder{data: data, dm: decm},
+ w: &bytes.Buffer{},
+ }
+}
+
+func (di *diagnose) diag(cborSequence bool) (string, error) {
+ // CBOR Sequence
+ firstItem := true
+ for {
+ switch err := di.wellformed(cborSequence); err {
+ case nil:
+ if !firstItem {
+ di.w.WriteString(", ")
+ }
+ firstItem = false
+ if itemErr := di.item(); itemErr != nil {
+ return di.w.String(), itemErr
+ }
+
+ case io.EOF:
+ if firstItem {
+ return di.w.String(), err
+ }
+ return di.w.String(), nil
+
+ default:
+ return di.w.String(), err
+ }
+ }
+}
+
+func (di *diagnose) diagFirst() (diagNotation string, rest []byte, err error) {
+ err = di.wellformed(true)
+ if err == nil {
+ err = di.item()
+ }
+
+ if err == nil {
+ // Return EDN and the rest of the data slice (which might be len 0)
+ return di.w.String(), di.d.data[di.d.off:], nil
+ }
+
+ return di.w.String(), nil, err
+}
+
+func (di *diagnose) wellformed(allowExtraData bool) error {
+ off := di.d.off
+ err := di.d.wellformed(allowExtraData, false)
+ di.d.off = off
+ return err
+}
+
+func (di *diagnose) item() error { //nolint:gocyclo
+ initialByte := di.d.data[di.d.off]
+ switch initialByte {
+ case cborByteStringWithIndefiniteLengthHead,
+ cborTextStringWithIndefiniteLengthHead: // indefinite-length byte/text string
+ di.d.off++
+ if isBreakFlag(di.d.data[di.d.off]) {
+ di.d.off++
+ switch initialByte {
+ case cborByteStringWithIndefiniteLengthHead:
+ // indefinite-length bytes with no chunks.
+ di.w.WriteString(`''_`)
+ return nil
+ case cborTextStringWithIndefiniteLengthHead:
+ // indefinite-length text with no chunks.
+ di.w.WriteString(`""_`)
+ return nil
+ }
+ }
+
+ di.w.WriteString("(_ ")
+
+ i := 0
+ for !di.d.foundBreak() {
+ if i > 0 {
+ di.w.WriteString(", ")
+ }
+
+ i++
+ // wellformedIndefiniteString() already checked that the next item is a byte/text string.
+ if err := di.item(); err != nil {
+ return err
+ }
+ }
+
+ di.w.WriteByte(')')
+ return nil
+
+ case cborArrayWithIndefiniteLengthHead: // indefinite-length array
+ di.d.off++
+ di.w.WriteString("[_ ")
+
+ i := 0
+ for !di.d.foundBreak() {
+ if i > 0 {
+ di.w.WriteString(", ")
+ }
+
+ i++
+ if err := di.item(); err != nil {
+ return err
+ }
+ }
+
+ di.w.WriteByte(']')
+ return nil
+
+ case cborMapWithIndefiniteLengthHead: // indefinite-length map
+ di.d.off++
+ di.w.WriteString("{_ ")
+
+ i := 0
+ for !di.d.foundBreak() {
+ if i > 0 {
+ di.w.WriteString(", ")
+ }
+
+ i++
+ // key
+ if err := di.item(); err != nil {
+ return err
+ }
+
+ di.w.WriteString(": ")
+
+ // value
+ if err := di.item(); err != nil {
+ return err
+ }
+ }
+
+ di.w.WriteByte('}')
+ return nil
+ }
+
+ t := di.d.nextCBORType()
+ switch t {
+ case cborTypePositiveInt:
+ _, _, val := di.d.getHead()
+ di.w.WriteString(strconv.FormatUint(val, 10))
+ return nil
+
+ case cborTypeNegativeInt:
+ _, _, val := di.d.getHead()
+ if val > math.MaxInt64 {
+ // CBOR negative integer overflows int64, use big.Int to store value.
+ bi := new(big.Int)
+ bi.SetUint64(val)
+ bi.Add(bi, big.NewInt(1))
+ bi.Neg(bi)
+ di.w.WriteString(bi.String())
+ return nil
+ }
+
+ nValue := int64(-1) ^ int64(val)
+ di.w.WriteString(strconv.FormatInt(nValue, 10))
+ return nil
+
+ case cborTypeByteString:
+ b, _ := di.d.parseByteString()
+ return di.encodeByteString(b)
+
+ case cborTypeTextString:
+ b, err := di.d.parseTextString()
+ if err != nil {
+ return err
+ }
+ return di.encodeTextString(string(b), '"')
+
+ case cborTypeArray:
+ _, _, val := di.d.getHead()
+ count := int(val)
+ di.w.WriteByte('[')
+
+ for i := 0; i < count; i++ {
+ if i > 0 {
+ di.w.WriteString(", ")
+ }
+ if err := di.item(); err != nil {
+ return err
+ }
+ }
+ di.w.WriteByte(']')
+ return nil
+
+ case cborTypeMap:
+ _, _, val := di.d.getHead()
+ count := int(val)
+ di.w.WriteByte('{')
+
+ for i := 0; i < count; i++ {
+ if i > 0 {
+ di.w.WriteString(", ")
+ }
+ // key
+ if err := di.item(); err != nil {
+ return err
+ }
+ di.w.WriteString(": ")
+ // value
+ if err := di.item(); err != nil {
+ return err
+ }
+ }
+ di.w.WriteByte('}')
+ return nil
+
+ case cborTypeTag:
+ _, _, tagNum := di.d.getHead()
+ switch tagNum {
+ case tagNumUnsignedBignum:
+ if nt := di.d.nextCBORType(); nt != cborTypeByteString {
+ return newInadmissibleTagContentTypeError(
+ tagNumUnsignedBignum,
+ "byte string",
+ nt.String())
+ }
+
+ b, _ := di.d.parseByteString()
+ bi := new(big.Int).SetBytes(b)
+ di.w.WriteString(bi.String())
+ return nil
+
+ case tagNumNegativeBignum:
+ if nt := di.d.nextCBORType(); nt != cborTypeByteString {
+ return newInadmissibleTagContentTypeError(
+ tagNumNegativeBignum,
+ "byte string",
+ nt.String(),
+ )
+ }
+
+ b, _ := di.d.parseByteString()
+ bi := new(big.Int).SetBytes(b)
+ bi.Add(bi, big.NewInt(1))
+ bi.Neg(bi)
+ di.w.WriteString(bi.String())
+ return nil
+
+ default:
+ di.w.WriteString(strconv.FormatUint(tagNum, 10))
+ di.w.WriteByte('(')
+ if err := di.item(); err != nil {
+ return err
+ }
+ di.w.WriteByte(')')
+ return nil
+ }
+
+ case cborTypePrimitives:
+ _, ai, val := di.d.getHead()
+ switch ai {
+ case additionalInformationAsFalse:
+ di.w.WriteString("false")
+ return nil
+
+ case additionalInformationAsTrue:
+ di.w.WriteString("true")
+ return nil
+
+ case additionalInformationAsNull:
+ di.w.WriteString("null")
+ return nil
+
+ case additionalInformationAsUndefined:
+ di.w.WriteString("undefined")
+ return nil
+
+ case additionalInformationAsFloat16,
+ additionalInformationAsFloat32,
+ additionalInformationAsFloat64:
+ return di.encodeFloat(ai, val)
+
+ default:
+ di.w.WriteString("simple(")
+ di.w.WriteString(strconv.FormatUint(val, 10))
+ di.w.WriteByte(')')
+ return nil
+ }
+ }
+
+ return nil
+}
+
+// writeU16 format a rune as "\uxxxx"
+func (di *diagnose) writeU16(val rune) {
+ di.w.WriteString("\\u")
+ var in [2]byte
+ in[0] = byte(val >> 8)
+ in[1] = byte(val)
+ sz := hex.EncodedLen(len(in))
+ di.w.Grow(sz)
+ dst := di.w.Bytes()[di.w.Len() : di.w.Len()+sz]
+ hex.Encode(dst, in[:])
+ di.w.Write(dst)
+}
+
+var rawBase32Encoding = base32.StdEncoding.WithPadding(base32.NoPadding)
+var rawBase32HexEncoding = base32.HexEncoding.WithPadding(base32.NoPadding)
+
+func (di *diagnose) encodeByteString(val []byte) error {
+ if len(val) > 0 {
+ if di.dm.byteStringText && utf8.Valid(val) {
+ return di.encodeTextString(string(val), '\'')
+ }
+
+ if di.dm.byteStringEmbeddedCBOR {
+ di2 := newDiagnose(val, di.dm.decMode, di.dm)
+ // should always notating embedded CBOR sequence.
+ if str, err := di2.diag(true); err == nil {
+ di.w.WriteString("<<")
+ di.w.WriteString(str)
+ di.w.WriteString(">>")
+ return nil
+ }
+ }
+ }
+
+ switch di.dm.byteStringEncoding {
+ case ByteStringBase16Encoding:
+ di.w.WriteString("h'")
+ if di.dm.byteStringHexWhitespace {
+ sz := hex.EncodedLen(len(val))
+ if len(val) > 0 {
+ sz += len(val) - 1
+ }
+ di.w.Grow(sz)
+
+ dst := di.w.Bytes()[di.w.Len():]
+ for i := range val {
+ if i > 0 {
+ dst = append(dst, ' ')
+ }
+ hex.Encode(dst[len(dst):len(dst)+2], val[i:i+1])
+ dst = dst[:len(dst)+2]
+ }
+ di.w.Write(dst)
+ } else {
+ sz := hex.EncodedLen(len(val))
+ di.w.Grow(sz)
+ dst := di.w.Bytes()[di.w.Len() : di.w.Len()+sz]
+ hex.Encode(dst, val)
+ di.w.Write(dst)
+ }
+ di.w.WriteByte('\'')
+ return nil
+
+ case ByteStringBase32Encoding:
+ di.w.WriteString("b32'")
+ sz := rawBase32Encoding.EncodedLen(len(val))
+ di.w.Grow(sz)
+ dst := di.w.Bytes()[di.w.Len() : di.w.Len()+sz]
+ rawBase32Encoding.Encode(dst, val)
+ di.w.Write(dst)
+ di.w.WriteByte('\'')
+ return nil
+
+ case ByteStringBase32HexEncoding:
+ di.w.WriteString("h32'")
+ sz := rawBase32HexEncoding.EncodedLen(len(val))
+ di.w.Grow(sz)
+ dst := di.w.Bytes()[di.w.Len() : di.w.Len()+sz]
+ rawBase32HexEncoding.Encode(dst, val)
+ di.w.Write(dst)
+ di.w.WriteByte('\'')
+ return nil
+
+ case ByteStringBase64Encoding:
+ di.w.WriteString("b64'")
+ sz := base64.RawURLEncoding.EncodedLen(len(val))
+ di.w.Grow(sz)
+ dst := di.w.Bytes()[di.w.Len() : di.w.Len()+sz]
+ base64.RawURLEncoding.Encode(dst, val)
+ di.w.Write(dst)
+ di.w.WriteByte('\'')
+ return nil
+
+ default:
+ // It should not be possible for users to construct a *diagMode with an invalid byte
+ // string encoding.
+ panic(fmt.Sprintf("diagmode has invalid ByteStringEncoding %v", di.dm.byteStringEncoding))
+ }
+}
+
+const utf16SurrSelf = rune(0x10000)
+
+// quote should be either `'` or `"`
+func (di *diagnose) encodeTextString(val string, quote byte) error {
+ di.w.WriteByte(quote)
+
+ for i := 0; i < len(val); {
+ if b := val[i]; b < utf8.RuneSelf {
+ switch {
+ case b == '\t', b == '\n', b == '\r', b == '\\', b == quote:
+ di.w.WriteByte('\\')
+
+ switch b {
+ case '\t':
+ b = 't'
+ case '\n':
+ b = 'n'
+ case '\r':
+ b = 'r'
+ }
+ di.w.WriteByte(b)
+
+ case b >= ' ' && b <= '~':
+ di.w.WriteByte(b)
+
+ default:
+ di.writeU16(rune(b))
+ }
+
+ i++
+ continue
+ }
+
+ c, size := utf8.DecodeRuneInString(val[i:])
+ switch {
+ case c == utf8.RuneError:
+ return &SemanticError{"cbor: invalid UTF-8 string"}
+
+ case c < utf16SurrSelf:
+ di.writeU16(c)
+
+ default:
+ c1, c2 := utf16.EncodeRune(c)
+ di.writeU16(c1)
+ di.writeU16(c2)
+ }
+
+ i += size
+ }
+
+ di.w.WriteByte(quote)
+ return nil
+}
+
+func (di *diagnose) encodeFloat(ai byte, val uint64) error {
+ f64 := float64(0)
+ switch ai {
+ case additionalInformationAsFloat16:
+ f16 := float16.Frombits(uint16(val))
+ switch {
+ case f16.IsNaN():
+ di.w.WriteString("NaN")
+ return nil
+ case f16.IsInf(1):
+ di.w.WriteString("Infinity")
+ return nil
+ case f16.IsInf(-1):
+ di.w.WriteString("-Infinity")
+ return nil
+ default:
+ f64 = float64(f16.Float32())
+ }
+
+ case additionalInformationAsFloat32:
+ f32 := math.Float32frombits(uint32(val))
+ switch {
+ case f32 != f32:
+ di.w.WriteString("NaN")
+ return nil
+ case f32 > math.MaxFloat32:
+ di.w.WriteString("Infinity")
+ return nil
+ case f32 < -math.MaxFloat32:
+ di.w.WriteString("-Infinity")
+ return nil
+ default:
+ f64 = float64(f32)
+ }
+
+ case additionalInformationAsFloat64:
+ f64 = math.Float64frombits(val)
+ switch {
+ case f64 != f64:
+ di.w.WriteString("NaN")
+ return nil
+ case f64 > math.MaxFloat64:
+ di.w.WriteString("Infinity")
+ return nil
+ case f64 < -math.MaxFloat64:
+ di.w.WriteString("-Infinity")
+ return nil
+ }
+ }
+ // Use ES6 number to string conversion which should match most JSON generators.
+ // Inspired by https://github.com/golang/go/blob/4df10fba1687a6d4f51d7238a403f8f2298f6a16/src/encoding/json/encode.go#L585
+ const bitSize = 64
+ b := make([]byte, 0, 32)
+ if abs := math.Abs(f64); abs != 0 && (abs < 1e-6 || abs >= 1e21) {
+ b = strconv.AppendFloat(b, f64, 'e', -1, bitSize)
+ // clean up e-09 to e-9
+ n := len(b)
+ if n >= 4 && string(b[n-4:n-1]) == "e-0" {
+ b = append(b[:n-2], b[n-1])
+ }
+ } else {
+ b = strconv.AppendFloat(b, f64, 'f', -1, bitSize)
+ }
+
+ // add decimal point and trailing zero if needed
+ if bytes.IndexByte(b, '.') < 0 {
+ if i := bytes.IndexByte(b, 'e'); i < 0 {
+ b = append(b, '.', '0')
+ } else {
+ b = append(b[:i+2], b[i:]...)
+ b[i] = '.'
+ b[i+1] = '0'
+ }
+ }
+
+ di.w.WriteString(string(b))
+
+ if di.dm.floatPrecisionIndicator {
+ switch ai {
+ case additionalInformationAsFloat16:
+ di.w.WriteString("_1")
+ return nil
+
+ case additionalInformationAsFloat32:
+ di.w.WriteString("_2")
+ return nil
+
+ case additionalInformationAsFloat64:
+ di.w.WriteString("_3")
+ return nil
+ }
+ }
+
+ return nil
+}
diff --git a/vendor/github.com/fxamacker/cbor/v2/doc.go b/vendor/github.com/fxamacker/cbor/v2/doc.go
new file mode 100644
index 000000000..23f68b984
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/doc.go
@@ -0,0 +1,129 @@
+// Copyright (c) Faye Amacker. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+/*
+Package cbor is a modern CBOR codec (RFC 8949 & RFC 7049) with CBOR tags,
+Go struct tags (toarray/keyasint/omitempty), Core Deterministic Encoding,
+CTAP2, Canonical CBOR, float64->32->16, and duplicate map key detection.
+
+Encoding options allow "preferred serialization" by encoding integers and floats
+to their smallest forms (e.g. float16) when values fit.
+
+Struct tags like "keyasint", "toarray" and "omitempty" make CBOR data smaller
+and easier to use with structs.
+
+For example, "toarray" tag makes struct fields encode to CBOR array elements. And
+"keyasint" makes a field encode to an element of CBOR map with specified int key.
+
+Latest docs can be viewed at https://github.com/fxamacker/cbor#cbor-library-in-go
+
+# Basics
+
+The Quick Start guide is at https://github.com/fxamacker/cbor#quick-start
+
+Function signatures identical to encoding/json include:
+
+ Marshal, Unmarshal, NewEncoder, NewDecoder, (*Encoder).Encode, (*Decoder).Decode.
+
+Standard interfaces include:
+
+ BinaryMarshaler, BinaryUnmarshaler, Marshaler, and Unmarshaler.
+
+Custom encoding and decoding is possible by implementing standard interfaces for
+user-defined Go types.
+
+Codec functions are available at package-level (using defaults options) or by
+creating modes from options at runtime.
+
+"Mode" in this API means definite way of encoding (EncMode) or decoding (DecMode).
+
+EncMode and DecMode interfaces are created from EncOptions or DecOptions structs.
+
+ em, err := cbor.EncOptions{...}.EncMode()
+ em, err := cbor.CanonicalEncOptions().EncMode()
+ em, err := cbor.CTAP2EncOptions().EncMode()
+
+Modes use immutable options to avoid side-effects and simplify concurrency. Behavior of
+modes won't accidentally change at runtime after they're created.
+
+Modes are intended to be reused and are safe for concurrent use.
+
+EncMode and DecMode Interfaces
+
+ // EncMode interface uses immutable options and is safe for concurrent use.
+ type EncMode interface {
+ Marshal(v interface{}) ([]byte, error)
+ NewEncoder(w io.Writer) *Encoder
+ EncOptions() EncOptions // returns copy of options
+ }
+
+ // DecMode interface uses immutable options and is safe for concurrent use.
+ type DecMode interface {
+ Unmarshal(data []byte, v interface{}) error
+ NewDecoder(r io.Reader) *Decoder
+ DecOptions() DecOptions // returns copy of options
+ }
+
+Using Default Encoding Mode
+
+ b, err := cbor.Marshal(v)
+
+ encoder := cbor.NewEncoder(w)
+ err = encoder.Encode(v)
+
+Using Default Decoding Mode
+
+ err := cbor.Unmarshal(b, &v)
+
+ decoder := cbor.NewDecoder(r)
+ err = decoder.Decode(&v)
+
+Creating and Using Encoding Modes
+
+ // Create EncOptions using either struct literal or a function.
+ opts := cbor.CanonicalEncOptions()
+
+ // If needed, modify encoding options
+ opts.Time = cbor.TimeUnix
+
+ // Create reusable EncMode interface with immutable options, safe for concurrent use.
+ em, err := opts.EncMode()
+
+ // Use EncMode like encoding/json, with same function signatures.
+ b, err := em.Marshal(v)
+ // or
+ encoder := em.NewEncoder(w)
+ err := encoder.Encode(v)
+
+ // NOTE: Both em.Marshal(v) and encoder.Encode(v) use encoding options
+ // specified during creation of em (encoding mode).
+
+# CBOR Options
+
+Predefined Encoding Options: https://github.com/fxamacker/cbor#predefined-encoding-options
+
+Encoding Options: https://github.com/fxamacker/cbor#encoding-options
+
+Decoding Options: https://github.com/fxamacker/cbor#decoding-options
+
+# Struct Tags
+
+Struct tags like `cbor:"name,omitempty"` and `json:"name,omitempty"` work as expected.
+If both struct tags are specified then `cbor` is used.
+
+Struct tags like "keyasint", "toarray", and "omitempty" make it easy to use
+very compact formats like COSE and CWT (CBOR Web Tokens) with structs.
+
+For example, "toarray" makes struct fields encode to array elements. And "keyasint"
+makes struct fields encode to elements of CBOR map with int keys.
+
+https://raw.githubusercontent.com/fxamacker/images/master/cbor/v2.0.0/cbor_easy_api.png
+
+Struct tags are listed at https://github.com/fxamacker/cbor#struct-tags-1
+
+# Tests and Fuzzing
+
+Over 375 tests are included in this package. Cover-guided fuzzing is handled by
+a private fuzzer that replaced fxamacker/cbor-fuzz years ago.
+*/
+package cbor
diff --git a/vendor/github.com/fxamacker/cbor/v2/encode.go b/vendor/github.com/fxamacker/cbor/v2/encode.go
new file mode 100644
index 000000000..6508e291d
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/encode.go
@@ -0,0 +1,1989 @@
+// Copyright (c) Faye Amacker. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+package cbor
+
+import (
+ "bytes"
+ "encoding"
+ "encoding/binary"
+ "errors"
+ "fmt"
+ "io"
+ "math"
+ "math/big"
+ "math/rand"
+ "reflect"
+ "sort"
+ "strconv"
+ "sync"
+ "time"
+
+ "github.com/x448/float16"
+)
+
+// Marshal returns the CBOR encoding of v using default encoding options.
+// See EncOptions for encoding options.
+//
+// Marshal uses the following encoding rules:
+//
+// If value implements the Marshaler interface, Marshal calls its
+// MarshalCBOR method.
+//
+// If value implements encoding.BinaryMarshaler, Marhsal calls its
+// MarshalBinary method and encode it as CBOR byte string.
+//
+// Boolean values encode as CBOR booleans (type 7).
+//
+// Positive integer values encode as CBOR positive integers (type 0).
+//
+// Negative integer values encode as CBOR negative integers (type 1).
+//
+// Floating point values encode as CBOR floating points (type 7).
+//
+// String values encode as CBOR text strings (type 3).
+//
+// []byte values encode as CBOR byte strings (type 2).
+//
+// Array and slice values encode as CBOR arrays (type 4).
+//
+// Map values encode as CBOR maps (type 5).
+//
+// Struct values encode as CBOR maps (type 5). Each exported struct field
+// becomes a pair with field name encoded as CBOR text string (type 3) and
+// field value encoded based on its type. See struct tag option "keyasint"
+// to encode field name as CBOR integer (type 0 and 1). Also see struct
+// tag option "toarray" for special field "_" to encode struct values as
+// CBOR array (type 4).
+//
+// Marshal supports format string stored under the "cbor" key in the struct
+// field's tag. CBOR format string can specify the name of the field,
+// "omitempty" and "keyasint" options, and special case "-" for field omission.
+// If "cbor" key is absent, Marshal uses "json" key.
+//
+// Struct field name is treated as integer if it has "keyasint" option in
+// its format string. The format string must specify an integer as its
+// field name.
+//
+// Special struct field "_" is used to specify struct level options, such as
+// "toarray". "toarray" option enables Go struct to be encoded as CBOR array.
+// "omitempty" is disabled by "toarray" to ensure that the same number
+// of elements are encoded every time.
+//
+// Anonymous struct fields are marshaled as if their exported fields
+// were fields in the outer struct. Marshal follows the same struct fields
+// visibility rules used by JSON encoding package.
+//
+// time.Time values encode as text strings specified in RFC3339 or numerical
+// representation of seconds since January 1, 1970 UTC depending on
+// EncOptions.Time setting. Also See EncOptions.TimeTag to encode
+// time.Time as CBOR tag with tag number 0 or 1.
+//
+// big.Int values encode as CBOR integers (type 0 and 1) if values fit.
+// Otherwise, big.Int values encode as CBOR bignums (tag 2 and 3). See
+// EncOptions.BigIntConvert to always encode big.Int values as CBOR
+// bignums.
+//
+// Pointer values encode as the value pointed to.
+//
+// Interface values encode as the value stored in the interface.
+//
+// Nil slice/map/pointer/interface values encode as CBOR nulls (type 7).
+//
+// Values of other types cannot be encoded in CBOR. Attempting
+// to encode such a value causes Marshal to return an UnsupportedTypeError.
+func Marshal(v interface{}) ([]byte, error) {
+ return defaultEncMode.Marshal(v)
+}
+
+// MarshalToBuffer encodes v into provided buffer (instead of using built-in buffer pool)
+// and uses default encoding options.
+//
+// NOTE: Unlike Marshal, the buffer provided to MarshalToBuffer can contain
+// partially encoded data if error is returned.
+//
+// See Marshal for more details.
+func MarshalToBuffer(v interface{}, buf *bytes.Buffer) error {
+ return defaultEncMode.MarshalToBuffer(v, buf)
+}
+
+// Marshaler is the interface implemented by types that can marshal themselves
+// into valid CBOR.
+type Marshaler interface {
+ MarshalCBOR() ([]byte, error)
+}
+
+// MarshalerError represents error from checking encoded CBOR data item
+// returned from MarshalCBOR for well-formedness and some very limited tag validation.
+type MarshalerError struct {
+ typ reflect.Type
+ err error
+}
+
+func (e *MarshalerError) Error() string {
+ return "cbor: error calling MarshalCBOR for type " +
+ e.typ.String() +
+ ": " + e.err.Error()
+}
+
+func (e *MarshalerError) Unwrap() error {
+ return e.err
+}
+
+// UnsupportedTypeError is returned by Marshal when attempting to encode value
+// of an unsupported type.
+type UnsupportedTypeError struct {
+ Type reflect.Type
+}
+
+func (e *UnsupportedTypeError) Error() string {
+ return "cbor: unsupported type: " + e.Type.String()
+}
+
+// UnsupportedValueError is returned by Marshal when attempting to encode an
+// unsupported value.
+type UnsupportedValueError struct {
+ msg string
+}
+
+func (e *UnsupportedValueError) Error() string {
+ return "cbor: unsupported value: " + e.msg
+}
+
+// SortMode identifies supported sorting order.
+type SortMode int
+
+const (
+ // SortNone encodes map pairs and struct fields in an arbitrary order.
+ SortNone SortMode = 0
+
+ // SortLengthFirst causes map keys or struct fields to be sorted such that:
+ // - If two keys have different lengths, the shorter one sorts earlier;
+ // - If two keys have the same length, the one with the lower value in
+ // (byte-wise) lexical order sorts earlier.
+ // It is used in "Canonical CBOR" encoding in RFC 7049 3.9.
+ SortLengthFirst SortMode = 1
+
+ // SortBytewiseLexical causes map keys or struct fields to be sorted in the
+ // bytewise lexicographic order of their deterministic CBOR encodings.
+ // It is used in "CTAP2 Canonical CBOR" and "Core Deterministic Encoding"
+ // in RFC 7049bis.
+ SortBytewiseLexical SortMode = 2
+
+ // SortShuffle encodes map pairs and struct fields in a shuffled
+ // order. This mode does not guarantee an unbiased permutation, but it
+ // does guarantee that the runtime of the shuffle algorithm used will be
+ // constant.
+ SortFastShuffle SortMode = 3
+
+ // SortCanonical is used in "Canonical CBOR" encoding in RFC 7049 3.9.
+ SortCanonical SortMode = SortLengthFirst
+
+ // SortCTAP2 is used in "CTAP2 Canonical CBOR".
+ SortCTAP2 SortMode = SortBytewiseLexical
+
+ // SortCoreDeterministic is used in "Core Deterministic Encoding" in RFC 7049bis.
+ SortCoreDeterministic SortMode = SortBytewiseLexical
+
+ maxSortMode SortMode = 4
+)
+
+func (sm SortMode) valid() bool {
+ return sm >= 0 && sm < maxSortMode
+}
+
+// StringMode specifies how to encode Go string values.
+type StringMode int
+
+const (
+ // StringToTextString encodes Go string to CBOR text string (major type 3).
+ StringToTextString StringMode = iota
+
+ // StringToByteString encodes Go string to CBOR byte string (major type 2).
+ StringToByteString
+)
+
+func (st StringMode) cborType() (cborType, error) {
+ switch st {
+ case StringToTextString:
+ return cborTypeTextString, nil
+
+ case StringToByteString:
+ return cborTypeByteString, nil
+ }
+ return 0, errors.New("cbor: invalid StringType " + strconv.Itoa(int(st)))
+}
+
+// ShortestFloatMode specifies which floating-point format should
+// be used as the shortest possible format for CBOR encoding.
+// It is not used for encoding Infinity and NaN values.
+type ShortestFloatMode int
+
+const (
+ // ShortestFloatNone makes float values encode without any conversion.
+ // This is the default for ShortestFloatMode in v1.
+ // E.g. a float32 in Go will encode to CBOR float32. And
+ // a float64 in Go will encode to CBOR float64.
+ ShortestFloatNone ShortestFloatMode = iota
+
+ // ShortestFloat16 specifies float16 as the shortest form that preserves value.
+ // E.g. if float64 can convert to float32 while preserving value, then
+ // encoding will also try to convert float32 to float16. So a float64 might
+ // encode as CBOR float64, float32 or float16 depending on the value.
+ ShortestFloat16
+
+ maxShortestFloat
+)
+
+func (sfm ShortestFloatMode) valid() bool {
+ return sfm >= 0 && sfm < maxShortestFloat
+}
+
+// NaNConvertMode specifies how to encode NaN and overrides ShortestFloatMode.
+// ShortestFloatMode is not used for encoding Infinity and NaN values.
+type NaNConvertMode int
+
+const (
+ // NaNConvert7e00 always encodes NaN to 0xf97e00 (CBOR float16 = 0x7e00).
+ NaNConvert7e00 NaNConvertMode = iota
+
+ // NaNConvertNone never modifies or converts NaN to other representations
+ // (float64 NaN stays float64, etc. even if it can use float16 without losing
+ // any bits).
+ NaNConvertNone
+
+ // NaNConvertPreserveSignal converts NaN to the smallest form that preserves
+ // value (quiet bit + payload) as described in RFC 7049bis Draft 12.
+ NaNConvertPreserveSignal
+
+ // NaNConvertQuiet always forces quiet bit = 1 and shortest form that preserves
+ // NaN payload.
+ NaNConvertQuiet
+
+ // NaNConvertReject returns UnsupportedValueError on attempts to encode a NaN value.
+ NaNConvertReject
+
+ maxNaNConvert
+)
+
+func (ncm NaNConvertMode) valid() bool {
+ return ncm >= 0 && ncm < maxNaNConvert
+}
+
+// InfConvertMode specifies how to encode Infinity and overrides ShortestFloatMode.
+// ShortestFloatMode is not used for encoding Infinity and NaN values.
+type InfConvertMode int
+
+const (
+ // InfConvertFloat16 always converts Inf to lossless IEEE binary16 (float16).
+ InfConvertFloat16 InfConvertMode = iota
+
+ // InfConvertNone never converts (used by CTAP2 Canonical CBOR).
+ InfConvertNone
+
+ // InfConvertReject returns UnsupportedValueError on attempts to encode an infinite value.
+ InfConvertReject
+
+ maxInfConvert
+)
+
+func (icm InfConvertMode) valid() bool {
+ return icm >= 0 && icm < maxInfConvert
+}
+
+// TimeMode specifies how to encode time.Time values.
+type TimeMode int
+
+const (
+ // TimeUnix causes time.Time to be encoded as epoch time in integer with second precision.
+ TimeUnix TimeMode = iota
+
+ // TimeUnixMicro causes time.Time to be encoded as epoch time in float-point rounded to microsecond precision.
+ TimeUnixMicro
+
+ // TimeUnixDynamic causes time.Time to be encoded as integer if time.Time doesn't have fractional seconds,
+ // otherwise float-point rounded to microsecond precision.
+ TimeUnixDynamic
+
+ // TimeRFC3339 causes time.Time to be encoded as RFC3339 formatted string with second precision.
+ TimeRFC3339
+
+ // TimeRFC3339Nano causes time.Time to be encoded as RFC3339 formatted string with nanosecond precision.
+ TimeRFC3339Nano
+
+ maxTimeMode
+)
+
+func (tm TimeMode) valid() bool {
+ return tm >= 0 && tm < maxTimeMode
+}
+
+// BigIntConvertMode specifies how to encode big.Int values.
+type BigIntConvertMode int
+
+const (
+ // BigIntConvertShortest makes big.Int encode to CBOR integer if value fits.
+ // E.g. if big.Int value can be converted to CBOR integer while preserving
+ // value, encoder will encode it to CBOR integer (major type 0 or 1).
+ BigIntConvertShortest BigIntConvertMode = iota
+
+ // BigIntConvertNone makes big.Int encode to CBOR bignum (tag 2 or 3) without
+ // converting it to another CBOR type.
+ BigIntConvertNone
+
+ // BigIntConvertReject returns an UnsupportedTypeError instead of marshaling a big.Int.
+ BigIntConvertReject
+
+ maxBigIntConvert
+)
+
+func (bim BigIntConvertMode) valid() bool {
+ return bim >= 0 && bim < maxBigIntConvert
+}
+
+// NilContainersMode specifies how to encode nil slices and maps.
+type NilContainersMode int
+
+const (
+ // NilContainerAsNull encodes nil slices and maps as CBOR null.
+ // This is the default.
+ NilContainerAsNull NilContainersMode = iota
+
+ // NilContainerAsEmpty encodes nil slices and maps as
+ // empty container (CBOR bytestring, array, or map).
+ NilContainerAsEmpty
+
+ maxNilContainersMode
+)
+
+func (m NilContainersMode) valid() bool {
+ return m >= 0 && m < maxNilContainersMode
+}
+
+// OmitEmptyMode specifies how to encode struct fields with omitempty tag.
+// The default behavior omits if field value would encode as empty CBOR value.
+type OmitEmptyMode int
+
+const (
+ // OmitEmptyCBORValue specifies that struct fields tagged with "omitempty"
+ // should be omitted from encoding if the field would be encoded as an empty
+ // CBOR value, such as CBOR false, 0, 0.0, nil, empty byte, empty string,
+ // empty array, or empty map.
+ OmitEmptyCBORValue OmitEmptyMode = iota
+
+ // OmitEmptyGoValue specifies that struct fields tagged with "omitempty"
+ // should be omitted from encoding if the field has an empty Go value,
+ // defined as false, 0, 0.0, a nil pointer, a nil interface value, and
+ // any empty array, slice, map, or string.
+ // This behavior is the same as the current (aka v1) encoding/json package
+ // included in Go.
+ OmitEmptyGoValue
+
+ maxOmitEmptyMode
+)
+
+func (om OmitEmptyMode) valid() bool {
+ return om >= 0 && om < maxOmitEmptyMode
+}
+
+// FieldNameMode specifies the CBOR type to use when encoding struct field names.
+type FieldNameMode int
+
+const (
+ // FieldNameToTextString encodes struct fields to CBOR text string (major type 3).
+ FieldNameToTextString FieldNameMode = iota
+
+ // FieldNameToTextString encodes struct fields to CBOR byte string (major type 2).
+ FieldNameToByteString
+
+ maxFieldNameMode
+)
+
+func (fnm FieldNameMode) valid() bool {
+ return fnm >= 0 && fnm < maxFieldNameMode
+}
+
+// ByteSliceLaterFormatMode specifies which later format conversion hint (CBOR tag 21-23)
+// to include (if any) when encoding Go byte slice to CBOR byte string. The encoder will
+// always encode unmodified bytes from the byte slice and just wrap it within
+// CBOR tag 21, 22, or 23 if specified.
+// See "Expected Later Encoding for CBOR-to-JSON Converters" in RFC 8949 Section 3.4.5.2.
+type ByteSliceLaterFormatMode int
+
+const (
+ // ByteSliceLaterFormatNone encodes unmodified bytes from Go byte slice to CBOR byte string (major type 2)
+ // without adding CBOR tag 21, 22, or 23.
+ ByteSliceLaterFormatNone ByteSliceLaterFormatMode = iota
+
+ // ByteSliceLaterFormatBase64URL encodes unmodified bytes from Go byte slice to CBOR byte string (major type 2)
+ // inside CBOR tag 21 (expected later conversion to base64url encoding, see RFC 8949 Section 3.4.5.2).
+ ByteSliceLaterFormatBase64URL
+
+ // ByteSliceLaterFormatBase64 encodes unmodified bytes from Go byte slice to CBOR byte string (major type 2)
+ // inside CBOR tag 22 (expected later conversion to base64 encoding, see RFC 8949 Section 3.4.5.2).
+ ByteSliceLaterFormatBase64
+
+ // ByteSliceLaterFormatBase16 encodes unmodified bytes from Go byte slice to CBOR byte string (major type 2)
+ // inside CBOR tag 23 (expected later conversion to base16 encoding, see RFC 8949 Section 3.4.5.2).
+ ByteSliceLaterFormatBase16
+)
+
+func (bsefm ByteSliceLaterFormatMode) encodingTag() (uint64, error) {
+ switch bsefm {
+ case ByteSliceLaterFormatNone:
+ return 0, nil
+
+ case ByteSliceLaterFormatBase64URL:
+ return tagNumExpectedLaterEncodingBase64URL, nil
+
+ case ByteSliceLaterFormatBase64:
+ return tagNumExpectedLaterEncodingBase64, nil
+
+ case ByteSliceLaterFormatBase16:
+ return tagNumExpectedLaterEncodingBase16, nil
+ }
+ return 0, errors.New("cbor: invalid ByteSliceLaterFormat " + strconv.Itoa(int(bsefm)))
+}
+
+// ByteArrayMode specifies how to encode byte arrays.
+type ByteArrayMode int
+
+const (
+ // ByteArrayToByteSlice encodes byte arrays the same way that a byte slice with identical
+ // length and contents is encoded.
+ ByteArrayToByteSlice ByteArrayMode = iota
+
+ // ByteArrayToArray encodes byte arrays to the CBOR array type with one unsigned integer
+ // item for each byte in the array.
+ ByteArrayToArray
+
+ maxByteArrayMode
+)
+
+func (bam ByteArrayMode) valid() bool {
+ return bam >= 0 && bam < maxByteArrayMode
+}
+
+// BinaryMarshalerMode specifies how to encode types that implement encoding.BinaryMarshaler.
+type BinaryMarshalerMode int
+
+const (
+ // BinaryMarshalerByteString encodes the output of MarshalBinary to a CBOR byte string.
+ BinaryMarshalerByteString BinaryMarshalerMode = iota
+
+ // BinaryMarshalerNone does not recognize BinaryMarshaler implementations during encode.
+ BinaryMarshalerNone
+
+ maxBinaryMarshalerMode
+)
+
+func (bmm BinaryMarshalerMode) valid() bool {
+ return bmm >= 0 && bmm < maxBinaryMarshalerMode
+}
+
+// EncOptions specifies encoding options.
+type EncOptions struct {
+ // Sort specifies sorting order.
+ Sort SortMode
+
+ // ShortestFloat specifies the shortest floating-point encoding that preserves
+ // the value being encoded.
+ ShortestFloat ShortestFloatMode
+
+ // NaNConvert specifies how to encode NaN and it overrides ShortestFloatMode.
+ NaNConvert NaNConvertMode
+
+ // InfConvert specifies how to encode Inf and it overrides ShortestFloatMode.
+ InfConvert InfConvertMode
+
+ // BigIntConvert specifies how to encode big.Int values.
+ BigIntConvert BigIntConvertMode
+
+ // Time specifies how to encode time.Time.
+ Time TimeMode
+
+ // TimeTag allows time.Time to be encoded with a tag number.
+ // RFC3339 format gets tag number 0, and numeric epoch time tag number 1.
+ TimeTag EncTagMode
+
+ // IndefLength specifies whether to allow indefinite length CBOR items.
+ IndefLength IndefLengthMode
+
+ // NilContainers specifies how to encode nil slices and maps.
+ NilContainers NilContainersMode
+
+ // TagsMd specifies whether to allow CBOR tags (major type 6).
+ TagsMd TagsMode
+
+ // OmitEmptyMode specifies how to encode struct fields with omitempty tag.
+ OmitEmpty OmitEmptyMode
+
+ // String specifies which CBOR type to use when encoding Go strings.
+ // - CBOR text string (major type 3) is default
+ // - CBOR byte string (major type 2)
+ String StringMode
+
+ // FieldName specifies the CBOR type to use when encoding struct field names.
+ FieldName FieldNameMode
+
+ // ByteSliceLaterFormat specifies which later format conversion hint (CBOR tag 21-23)
+ // to include (if any) when encoding Go byte slice to CBOR byte string. The encoder will
+ // always encode unmodified bytes from the byte slice and just wrap it within
+ // CBOR tag 21, 22, or 23 if specified.
+ // See "Expected Later Encoding for CBOR-to-JSON Converters" in RFC 8949 Section 3.4.5.2.
+ ByteSliceLaterFormat ByteSliceLaterFormatMode
+
+ // ByteArray specifies how to encode byte arrays.
+ ByteArray ByteArrayMode
+
+ // BinaryMarshaler specifies how to encode types that implement encoding.BinaryMarshaler.
+ BinaryMarshaler BinaryMarshalerMode
+}
+
+// CanonicalEncOptions returns EncOptions for "Canonical CBOR" encoding,
+// defined in RFC 7049 Section 3.9 with the following rules:
+//
+// 1. "Integers must be as small as possible."
+// 2. "The expression of lengths in major types 2 through 5 must be as short as possible."
+// 3. The keys in every map must be sorted in length-first sorting order.
+// See SortLengthFirst for details.
+// 4. "Indefinite-length items must be made into definite-length items."
+// 5. "If a protocol allows for IEEE floats, then additional canonicalization rules might
+// need to be added. One example rule might be to have all floats start as a 64-bit
+// float, then do a test conversion to a 32-bit float; if the result is the same numeric
+// value, use the shorter value and repeat the process with a test conversion to a
+// 16-bit float. (This rule selects 16-bit float for positive and negative Infinity
+// as well.) Also, there are many representations for NaN. If NaN is an allowed value,
+// it must always be represented as 0xf97e00."
+func CanonicalEncOptions() EncOptions {
+ return EncOptions{
+ Sort: SortCanonical,
+ ShortestFloat: ShortestFloat16,
+ NaNConvert: NaNConvert7e00,
+ InfConvert: InfConvertFloat16,
+ IndefLength: IndefLengthForbidden,
+ }
+}
+
+// CTAP2EncOptions returns EncOptions for "CTAP2 Canonical CBOR" encoding,
+// defined in CTAP specification, with the following rules:
+//
+// 1. "Integers must be encoded as small as possible."
+// 2. "The representations of any floating-point values are not changed."
+// 3. "The expression of lengths in major types 2 through 5 must be as short as possible."
+// 4. "Indefinite-length items must be made into definite-length items.""
+// 5. The keys in every map must be sorted in bytewise lexicographic order.
+// See SortBytewiseLexical for details.
+// 6. "Tags as defined in Section 2.4 in [RFC7049] MUST NOT be present."
+func CTAP2EncOptions() EncOptions {
+ return EncOptions{
+ Sort: SortCTAP2,
+ ShortestFloat: ShortestFloatNone,
+ NaNConvert: NaNConvertNone,
+ InfConvert: InfConvertNone,
+ IndefLength: IndefLengthForbidden,
+ TagsMd: TagsForbidden,
+ }
+}
+
+// CoreDetEncOptions returns EncOptions for "Core Deterministic" encoding,
+// defined in RFC 7049bis with the following rules:
+//
+// 1. "Preferred serialization MUST be used. In particular, this means that arguments
+// (see Section 3) for integers, lengths in major types 2 through 5, and tags MUST
+// be as short as possible"
+// "Floating point values also MUST use the shortest form that preserves the value"
+// 2. "Indefinite-length items MUST NOT appear."
+// 3. "The keys in every map MUST be sorted in the bytewise lexicographic order of
+// their deterministic encodings."
+func CoreDetEncOptions() EncOptions {
+ return EncOptions{
+ Sort: SortCoreDeterministic,
+ ShortestFloat: ShortestFloat16,
+ NaNConvert: NaNConvert7e00,
+ InfConvert: InfConvertFloat16,
+ IndefLength: IndefLengthForbidden,
+ }
+}
+
+// PreferredUnsortedEncOptions returns EncOptions for "Preferred Serialization" encoding,
+// defined in RFC 7049bis with the following rules:
+//
+// 1. "The preferred serialization always uses the shortest form of representing the argument
+// (Section 3);"
+// 2. "it also uses the shortest floating-point encoding that preserves the value being
+// encoded (see Section 5.5)."
+// "The preferred encoding for a floating-point value is the shortest floating-point encoding
+// that preserves its value, e.g., 0xf94580 for the number 5.5, and 0xfa45ad9c00 for the
+// number 5555.5, unless the CBOR-based protocol specifically excludes the use of the shorter
+// floating-point encodings. For NaN values, a shorter encoding is preferred if zero-padding
+// the shorter significand towards the right reconstitutes the original NaN value (for many
+// applications, the single NaN encoding 0xf97e00 will suffice)."
+// 3. "Definite length encoding is preferred whenever the length is known at the time the
+// serialization of the item starts."
+func PreferredUnsortedEncOptions() EncOptions {
+ return EncOptions{
+ Sort: SortNone,
+ ShortestFloat: ShortestFloat16,
+ NaNConvert: NaNConvert7e00,
+ InfConvert: InfConvertFloat16,
+ }
+}
+
+// EncMode returns EncMode with immutable options and no tags (safe for concurrency).
+func (opts EncOptions) EncMode() (EncMode, error) { //nolint:gocritic // ignore hugeParam
+ return opts.encMode()
+}
+
+// UserBufferEncMode returns UserBufferEncMode with immutable options and no tags (safe for concurrency).
+func (opts EncOptions) UserBufferEncMode() (UserBufferEncMode, error) { //nolint:gocritic // ignore hugeParam
+ return opts.encMode()
+}
+
+// EncModeWithTags returns EncMode with options and tags that are both immutable (safe for concurrency).
+func (opts EncOptions) EncModeWithTags(tags TagSet) (EncMode, error) { //nolint:gocritic // ignore hugeParam
+ return opts.UserBufferEncModeWithTags(tags)
+}
+
+// UserBufferEncModeWithTags returns UserBufferEncMode with options and tags that are both immutable (safe for concurrency).
+func (opts EncOptions) UserBufferEncModeWithTags(tags TagSet) (UserBufferEncMode, error) { //nolint:gocritic // ignore hugeParam
+ if opts.TagsMd == TagsForbidden {
+ return nil, errors.New("cbor: cannot create EncMode with TagSet when TagsMd is TagsForbidden")
+ }
+ if tags == nil {
+ return nil, errors.New("cbor: cannot create EncMode with nil value as TagSet")
+ }
+ em, err := opts.encMode()
+ if err != nil {
+ return nil, err
+ }
+ // Copy tags
+ ts := tagSet(make(map[reflect.Type]*tagItem))
+ syncTags := tags.(*syncTagSet)
+ syncTags.RLock()
+ for contentType, tag := range syncTags.t {
+ if tag.opts.EncTag != EncTagNone {
+ ts[contentType] = tag
+ }
+ }
+ syncTags.RUnlock()
+ if len(ts) > 0 {
+ em.tags = ts
+ }
+ return em, nil
+}
+
+// EncModeWithSharedTags returns EncMode with immutable options and mutable shared tags (safe for concurrency).
+func (opts EncOptions) EncModeWithSharedTags(tags TagSet) (EncMode, error) { //nolint:gocritic // ignore hugeParam
+ return opts.UserBufferEncModeWithSharedTags(tags)
+}
+
+// UserBufferEncModeWithSharedTags returns UserBufferEncMode with immutable options and mutable shared tags (safe for concurrency).
+func (opts EncOptions) UserBufferEncModeWithSharedTags(tags TagSet) (UserBufferEncMode, error) { //nolint:gocritic // ignore hugeParam
+ if opts.TagsMd == TagsForbidden {
+ return nil, errors.New("cbor: cannot create EncMode with TagSet when TagsMd is TagsForbidden")
+ }
+ if tags == nil {
+ return nil, errors.New("cbor: cannot create EncMode with nil value as TagSet")
+ }
+ em, err := opts.encMode()
+ if err != nil {
+ return nil, err
+ }
+ em.tags = tags
+ return em, nil
+}
+
+func (opts EncOptions) encMode() (*encMode, error) { //nolint:gocritic // ignore hugeParam
+ if !opts.Sort.valid() {
+ return nil, errors.New("cbor: invalid SortMode " + strconv.Itoa(int(opts.Sort)))
+ }
+ if !opts.ShortestFloat.valid() {
+ return nil, errors.New("cbor: invalid ShortestFloatMode " + strconv.Itoa(int(opts.ShortestFloat)))
+ }
+ if !opts.NaNConvert.valid() {
+ return nil, errors.New("cbor: invalid NaNConvertMode " + strconv.Itoa(int(opts.NaNConvert)))
+ }
+ if !opts.InfConvert.valid() {
+ return nil, errors.New("cbor: invalid InfConvertMode " + strconv.Itoa(int(opts.InfConvert)))
+ }
+ if !opts.BigIntConvert.valid() {
+ return nil, errors.New("cbor: invalid BigIntConvertMode " + strconv.Itoa(int(opts.BigIntConvert)))
+ }
+ if !opts.Time.valid() {
+ return nil, errors.New("cbor: invalid TimeMode " + strconv.Itoa(int(opts.Time)))
+ }
+ if !opts.TimeTag.valid() {
+ return nil, errors.New("cbor: invalid TimeTag " + strconv.Itoa(int(opts.TimeTag)))
+ }
+ if !opts.IndefLength.valid() {
+ return nil, errors.New("cbor: invalid IndefLength " + strconv.Itoa(int(opts.IndefLength)))
+ }
+ if !opts.NilContainers.valid() {
+ return nil, errors.New("cbor: invalid NilContainers " + strconv.Itoa(int(opts.NilContainers)))
+ }
+ if !opts.TagsMd.valid() {
+ return nil, errors.New("cbor: invalid TagsMd " + strconv.Itoa(int(opts.TagsMd)))
+ }
+ if opts.TagsMd == TagsForbidden && opts.TimeTag == EncTagRequired {
+ return nil, errors.New("cbor: cannot set TagsMd to TagsForbidden when TimeTag is EncTagRequired")
+ }
+ if !opts.OmitEmpty.valid() {
+ return nil, errors.New("cbor: invalid OmitEmpty " + strconv.Itoa(int(opts.OmitEmpty)))
+ }
+ stringMajorType, err := opts.String.cborType()
+ if err != nil {
+ return nil, err
+ }
+ if !opts.FieldName.valid() {
+ return nil, errors.New("cbor: invalid FieldName " + strconv.Itoa(int(opts.FieldName)))
+ }
+ byteSliceLaterEncodingTag, err := opts.ByteSliceLaterFormat.encodingTag()
+ if err != nil {
+ return nil, err
+ }
+ if !opts.ByteArray.valid() {
+ return nil, errors.New("cbor: invalid ByteArray " + strconv.Itoa(int(opts.ByteArray)))
+ }
+ if !opts.BinaryMarshaler.valid() {
+ return nil, errors.New("cbor: invalid BinaryMarshaler " + strconv.Itoa(int(opts.BinaryMarshaler)))
+ }
+ em := encMode{
+ sort: opts.Sort,
+ shortestFloat: opts.ShortestFloat,
+ nanConvert: opts.NaNConvert,
+ infConvert: opts.InfConvert,
+ bigIntConvert: opts.BigIntConvert,
+ time: opts.Time,
+ timeTag: opts.TimeTag,
+ indefLength: opts.IndefLength,
+ nilContainers: opts.NilContainers,
+ tagsMd: opts.TagsMd,
+ omitEmpty: opts.OmitEmpty,
+ stringType: opts.String,
+ stringMajorType: stringMajorType,
+ fieldName: opts.FieldName,
+ byteSliceLaterFormat: opts.ByteSliceLaterFormat,
+ byteSliceLaterEncodingTag: byteSliceLaterEncodingTag,
+ byteArray: opts.ByteArray,
+ binaryMarshaler: opts.BinaryMarshaler,
+ }
+ return &em, nil
+}
+
+// EncMode is the main interface for CBOR encoding.
+type EncMode interface {
+ Marshal(v interface{}) ([]byte, error)
+ NewEncoder(w io.Writer) *Encoder
+ EncOptions() EncOptions
+}
+
+// UserBufferEncMode is an interface for CBOR encoding, which extends EncMode by
+// adding MarshalToBuffer to support user specified buffer rather than encoding
+// into the built-in buffer pool.
+type UserBufferEncMode interface {
+ EncMode
+ MarshalToBuffer(v interface{}, buf *bytes.Buffer) error
+
+ // This private method is to prevent users implementing
+ // this interface and so future additions to it will
+ // not be breaking changes.
+ // See https://go.dev/blog/module-compatibility
+ unexport()
+}
+
+type encMode struct {
+ tags tagProvider
+ sort SortMode
+ shortestFloat ShortestFloatMode
+ nanConvert NaNConvertMode
+ infConvert InfConvertMode
+ bigIntConvert BigIntConvertMode
+ time TimeMode
+ timeTag EncTagMode
+ indefLength IndefLengthMode
+ nilContainers NilContainersMode
+ tagsMd TagsMode
+ omitEmpty OmitEmptyMode
+ stringType StringMode
+ stringMajorType cborType
+ fieldName FieldNameMode
+ byteSliceLaterFormat ByteSliceLaterFormatMode
+ byteSliceLaterEncodingTag uint64
+ byteArray ByteArrayMode
+ binaryMarshaler BinaryMarshalerMode
+}
+
+var defaultEncMode, _ = EncOptions{}.encMode()
+
+// These four decoding modes are used by getMarshalerDecMode.
+// maxNestedLevels, maxArrayElements, and maxMapPairs are
+// set to max allowed limits to avoid rejecting Marshaler
+// output that would have been the allowable output of a
+// non-Marshaler object that exceeds default limits.
+var (
+ marshalerForbidIndefLengthForbidTagsDecMode = decMode{
+ maxNestedLevels: maxMaxNestedLevels,
+ maxArrayElements: maxMaxArrayElements,
+ maxMapPairs: maxMaxMapPairs,
+ indefLength: IndefLengthForbidden,
+ tagsMd: TagsForbidden,
+ }
+
+ marshalerAllowIndefLengthForbidTagsDecMode = decMode{
+ maxNestedLevels: maxMaxNestedLevels,
+ maxArrayElements: maxMaxArrayElements,
+ maxMapPairs: maxMaxMapPairs,
+ indefLength: IndefLengthAllowed,
+ tagsMd: TagsForbidden,
+ }
+
+ marshalerForbidIndefLengthAllowTagsDecMode = decMode{
+ maxNestedLevels: maxMaxNestedLevels,
+ maxArrayElements: maxMaxArrayElements,
+ maxMapPairs: maxMaxMapPairs,
+ indefLength: IndefLengthForbidden,
+ tagsMd: TagsAllowed,
+ }
+
+ marshalerAllowIndefLengthAllowTagsDecMode = decMode{
+ maxNestedLevels: maxMaxNestedLevels,
+ maxArrayElements: maxMaxArrayElements,
+ maxMapPairs: maxMaxMapPairs,
+ indefLength: IndefLengthAllowed,
+ tagsMd: TagsAllowed,
+ }
+)
+
+// getMarshalerDecMode returns one of four existing decoding modes
+// which can be reused (safe for parallel use) for the purpose of
+// checking if data returned by Marshaler is well-formed.
+func getMarshalerDecMode(indefLength IndefLengthMode, tagsMd TagsMode) *decMode {
+ switch {
+ case indefLength == IndefLengthAllowed && tagsMd == TagsAllowed:
+ return &marshalerAllowIndefLengthAllowTagsDecMode
+
+ case indefLength == IndefLengthAllowed && tagsMd == TagsForbidden:
+ return &marshalerAllowIndefLengthForbidTagsDecMode
+
+ case indefLength == IndefLengthForbidden && tagsMd == TagsAllowed:
+ return &marshalerForbidIndefLengthAllowTagsDecMode
+
+ case indefLength == IndefLengthForbidden && tagsMd == TagsForbidden:
+ return &marshalerForbidIndefLengthForbidTagsDecMode
+
+ default:
+ // This should never happen, unless we add new options to
+ // IndefLengthMode or TagsMode without updating this function.
+ return &decMode{
+ maxNestedLevels: maxMaxNestedLevels,
+ maxArrayElements: maxMaxArrayElements,
+ maxMapPairs: maxMaxMapPairs,
+ indefLength: indefLength,
+ tagsMd: tagsMd,
+ }
+ }
+}
+
+// EncOptions returns user specified options used to create this EncMode.
+func (em *encMode) EncOptions() EncOptions {
+ return EncOptions{
+ Sort: em.sort,
+ ShortestFloat: em.shortestFloat,
+ NaNConvert: em.nanConvert,
+ InfConvert: em.infConvert,
+ BigIntConvert: em.bigIntConvert,
+ Time: em.time,
+ TimeTag: em.timeTag,
+ IndefLength: em.indefLength,
+ NilContainers: em.nilContainers,
+ TagsMd: em.tagsMd,
+ OmitEmpty: em.omitEmpty,
+ String: em.stringType,
+ FieldName: em.fieldName,
+ ByteSliceLaterFormat: em.byteSliceLaterFormat,
+ ByteArray: em.byteArray,
+ BinaryMarshaler: em.binaryMarshaler,
+ }
+}
+
+func (em *encMode) unexport() {}
+
+func (em *encMode) encTagBytes(t reflect.Type) []byte {
+ if em.tags != nil {
+ if tagItem := em.tags.getTagItemFromType(t); tagItem != nil {
+ return tagItem.cborTagNum
+ }
+ }
+ return nil
+}
+
+// Marshal returns the CBOR encoding of v using em encoding mode.
+//
+// See the documentation for Marshal for details.
+func (em *encMode) Marshal(v interface{}) ([]byte, error) {
+ e := getEncodeBuffer()
+
+ if err := encode(e, em, reflect.ValueOf(v)); err != nil {
+ putEncodeBuffer(e)
+ return nil, err
+ }
+
+ buf := make([]byte, e.Len())
+ copy(buf, e.Bytes())
+
+ putEncodeBuffer(e)
+ return buf, nil
+}
+
+// MarshalToBuffer encodes v into provided buffer (instead of using built-in buffer pool)
+// and uses em encoding mode.
+//
+// NOTE: Unlike Marshal, the buffer provided to MarshalToBuffer can contain
+// partially encoded data if error is returned.
+//
+// See Marshal for more details.
+func (em *encMode) MarshalToBuffer(v interface{}, buf *bytes.Buffer) error {
+ if buf == nil {
+ return fmt.Errorf("cbor: encoding buffer provided by user is nil")
+ }
+ return encode(buf, em, reflect.ValueOf(v))
+}
+
+// NewEncoder returns a new encoder that writes to w using em EncMode.
+func (em *encMode) NewEncoder(w io.Writer) *Encoder {
+ return &Encoder{w: w, em: em}
+}
+
+// encodeBufferPool caches unused bytes.Buffer objects for later reuse.
+var encodeBufferPool = sync.Pool{
+ New: func() interface{} {
+ e := new(bytes.Buffer)
+ e.Grow(32) // TODO: make this configurable
+ return e
+ },
+}
+
+func getEncodeBuffer() *bytes.Buffer {
+ return encodeBufferPool.Get().(*bytes.Buffer)
+}
+
+func putEncodeBuffer(e *bytes.Buffer) {
+ e.Reset()
+ encodeBufferPool.Put(e)
+}
+
+type encodeFunc func(e *bytes.Buffer, em *encMode, v reflect.Value) error
+type isEmptyFunc func(em *encMode, v reflect.Value) (empty bool, err error)
+
+func encode(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if !v.IsValid() {
+ // v is zero value
+ e.Write(cborNil)
+ return nil
+ }
+ vt := v.Type()
+ f, _ := getEncodeFunc(vt)
+ if f == nil {
+ return &UnsupportedTypeError{vt}
+ }
+
+ return f(e, em, v)
+}
+
+func encodeBool(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if b := em.encTagBytes(v.Type()); b != nil {
+ e.Write(b)
+ }
+ b := cborFalse
+ if v.Bool() {
+ b = cborTrue
+ }
+ e.Write(b)
+ return nil
+}
+
+func encodeInt(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if b := em.encTagBytes(v.Type()); b != nil {
+ e.Write(b)
+ }
+ i := v.Int()
+ if i >= 0 {
+ encodeHead(e, byte(cborTypePositiveInt), uint64(i))
+ return nil
+ }
+ i = i*(-1) - 1
+ encodeHead(e, byte(cborTypeNegativeInt), uint64(i))
+ return nil
+}
+
+func encodeUint(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if b := em.encTagBytes(v.Type()); b != nil {
+ e.Write(b)
+ }
+ encodeHead(e, byte(cborTypePositiveInt), v.Uint())
+ return nil
+}
+
+func encodeFloat(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if b := em.encTagBytes(v.Type()); b != nil {
+ e.Write(b)
+ }
+ f64 := v.Float()
+ if math.IsNaN(f64) {
+ return encodeNaN(e, em, v)
+ }
+ if math.IsInf(f64, 0) {
+ return encodeInf(e, em, v)
+ }
+ fopt := em.shortestFloat
+ if v.Kind() == reflect.Float64 && (fopt == ShortestFloatNone || cannotFitFloat32(f64)) {
+ // Encode float64
+ // Don't use encodeFloat64() because it cannot be inlined.
+ const argumentSize = 8
+ const headSize = 1 + argumentSize
+ var scratch [headSize]byte
+ scratch[0] = byte(cborTypePrimitives) | byte(additionalInformationAsFloat64)
+ binary.BigEndian.PutUint64(scratch[1:], math.Float64bits(f64))
+ e.Write(scratch[:])
+ return nil
+ }
+
+ f32 := float32(f64)
+ if fopt == ShortestFloat16 {
+ var f16 float16.Float16
+ p := float16.PrecisionFromfloat32(f32)
+ if p == float16.PrecisionExact {
+ // Roundtrip float32->float16->float32 test isn't needed.
+ f16 = float16.Fromfloat32(f32)
+ } else if p == float16.PrecisionUnknown {
+ // Try roundtrip float32->float16->float32 to determine if float32 can fit into float16.
+ f16 = float16.Fromfloat32(f32)
+ if f16.Float32() == f32 {
+ p = float16.PrecisionExact
+ }
+ }
+ if p == float16.PrecisionExact {
+ // Encode float16
+ // Don't use encodeFloat16() because it cannot be inlined.
+ const argumentSize = 2
+ const headSize = 1 + argumentSize
+ var scratch [headSize]byte
+ scratch[0] = byte(cborTypePrimitives) | additionalInformationAsFloat16
+ binary.BigEndian.PutUint16(scratch[1:], uint16(f16))
+ e.Write(scratch[:])
+ return nil
+ }
+ }
+
+ // Encode float32
+ // Don't use encodeFloat32() because it cannot be inlined.
+ const argumentSize = 4
+ const headSize = 1 + argumentSize
+ var scratch [headSize]byte
+ scratch[0] = byte(cborTypePrimitives) | additionalInformationAsFloat32
+ binary.BigEndian.PutUint32(scratch[1:], math.Float32bits(f32))
+ e.Write(scratch[:])
+ return nil
+}
+
+func encodeInf(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ f64 := v.Float()
+ switch em.infConvert {
+ case InfConvertReject:
+ return &UnsupportedValueError{msg: "floating-point infinity"}
+
+ case InfConvertFloat16:
+ if f64 > 0 {
+ e.Write(cborPositiveInfinity)
+ } else {
+ e.Write(cborNegativeInfinity)
+ }
+ return nil
+ }
+ if v.Kind() == reflect.Float64 {
+ return encodeFloat64(e, f64)
+ }
+ return encodeFloat32(e, float32(f64))
+}
+
+func encodeNaN(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ switch em.nanConvert {
+ case NaNConvert7e00:
+ e.Write(cborNaN)
+ return nil
+
+ case NaNConvertNone:
+ if v.Kind() == reflect.Float64 {
+ return encodeFloat64(e, v.Float())
+ }
+ f32 := float32NaNFromReflectValue(v)
+ return encodeFloat32(e, f32)
+
+ case NaNConvertReject:
+ return &UnsupportedValueError{msg: "floating-point NaN"}
+
+ default: // NaNConvertPreserveSignal, NaNConvertQuiet
+ if v.Kind() == reflect.Float64 {
+ f64 := v.Float()
+ f64bits := math.Float64bits(f64)
+ if em.nanConvert == NaNConvertQuiet && f64bits&(1<<51) == 0 {
+ f64bits |= 1 << 51 // Set quiet bit = 1
+ f64 = math.Float64frombits(f64bits)
+ }
+ // The lower 29 bits are dropped when converting from float64 to float32.
+ if f64bits&0x1fffffff != 0 {
+ // Encode NaN as float64 because dropped coef bits from float64 to float32 are not all 0s.
+ return encodeFloat64(e, f64)
+ }
+ // Create float32 from float64 manually because float32(f64) always turns on NaN's quiet bits.
+ sign := uint32(f64bits>>32) & (1 << 31)
+ exp := uint32(0x7f800000)
+ coef := uint32((f64bits & 0xfffffffffffff) >> 29)
+ f32bits := sign | exp | coef
+ f32 := math.Float32frombits(f32bits)
+ // The lower 13 bits are dropped when converting from float32 to float16.
+ if f32bits&0x1fff != 0 {
+ // Encode NaN as float32 because dropped coef bits from float32 to float16 are not all 0s.
+ return encodeFloat32(e, f32)
+ }
+ // Encode NaN as float16
+ f16, _ := float16.FromNaN32ps(f32) // Ignore err because it only returns error when f32 is not a NaN.
+ return encodeFloat16(e, f16)
+ }
+
+ f32 := float32NaNFromReflectValue(v)
+ f32bits := math.Float32bits(f32)
+ if em.nanConvert == NaNConvertQuiet && f32bits&(1<<22) == 0 {
+ f32bits |= 1 << 22 // Set quiet bit = 1
+ f32 = math.Float32frombits(f32bits)
+ }
+ // The lower 13 bits are dropped coef bits when converting from float32 to float16.
+ if f32bits&0x1fff != 0 {
+ // Encode NaN as float32 because dropped coef bits from float32 to float16 are not all 0s.
+ return encodeFloat32(e, f32)
+ }
+ f16, _ := float16.FromNaN32ps(f32) // Ignore err because it only returns error when f32 is not a NaN.
+ return encodeFloat16(e, f16)
+ }
+}
+
+func encodeFloat16(e *bytes.Buffer, f16 float16.Float16) error {
+ const argumentSize = 2
+ const headSize = 1 + argumentSize
+ var scratch [headSize]byte
+ scratch[0] = byte(cborTypePrimitives) | additionalInformationAsFloat16
+ binary.BigEndian.PutUint16(scratch[1:], uint16(f16))
+ e.Write(scratch[:])
+ return nil
+}
+
+func encodeFloat32(e *bytes.Buffer, f32 float32) error {
+ const argumentSize = 4
+ const headSize = 1 + argumentSize
+ var scratch [headSize]byte
+ scratch[0] = byte(cborTypePrimitives) | additionalInformationAsFloat32
+ binary.BigEndian.PutUint32(scratch[1:], math.Float32bits(f32))
+ e.Write(scratch[:])
+ return nil
+}
+
+func encodeFloat64(e *bytes.Buffer, f64 float64) error {
+ const argumentSize = 8
+ const headSize = 1 + argumentSize
+ var scratch [headSize]byte
+ scratch[0] = byte(cborTypePrimitives) | additionalInformationAsFloat64
+ binary.BigEndian.PutUint64(scratch[1:], math.Float64bits(f64))
+ e.Write(scratch[:])
+ return nil
+}
+
+func encodeByteString(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ vk := v.Kind()
+ if vk == reflect.Slice && v.IsNil() && em.nilContainers == NilContainerAsNull {
+ e.Write(cborNil)
+ return nil
+ }
+ if vk == reflect.Slice && v.Type().Elem().Kind() == reflect.Uint8 && em.byteSliceLaterEncodingTag != 0 {
+ encodeHead(e, byte(cborTypeTag), em.byteSliceLaterEncodingTag)
+ }
+ if b := em.encTagBytes(v.Type()); b != nil {
+ e.Write(b)
+ }
+ slen := v.Len()
+ if slen == 0 {
+ return e.WriteByte(byte(cborTypeByteString))
+ }
+ encodeHead(e, byte(cborTypeByteString), uint64(slen))
+ if vk == reflect.Array {
+ for i := 0; i < slen; i++ {
+ e.WriteByte(byte(v.Index(i).Uint()))
+ }
+ return nil
+ }
+ e.Write(v.Bytes())
+ return nil
+}
+
+func encodeString(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if b := em.encTagBytes(v.Type()); b != nil {
+ e.Write(b)
+ }
+ s := v.String()
+ encodeHead(e, byte(em.stringMajorType), uint64(len(s)))
+ e.WriteString(s)
+ return nil
+}
+
+type arrayEncodeFunc struct {
+ f encodeFunc
+}
+
+func (ae arrayEncodeFunc) encode(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if em.byteArray == ByteArrayToByteSlice && v.Type().Elem().Kind() == reflect.Uint8 {
+ return encodeByteString(e, em, v)
+ }
+ if v.Kind() == reflect.Slice && v.IsNil() && em.nilContainers == NilContainerAsNull {
+ e.Write(cborNil)
+ return nil
+ }
+ if b := em.encTagBytes(v.Type()); b != nil {
+ e.Write(b)
+ }
+ alen := v.Len()
+ if alen == 0 {
+ return e.WriteByte(byte(cborTypeArray))
+ }
+ encodeHead(e, byte(cborTypeArray), uint64(alen))
+ for i := 0; i < alen; i++ {
+ if err := ae.f(e, em, v.Index(i)); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+// encodeKeyValueFunc encodes key/value pairs in map (v).
+// If kvs is provided (having the same length as v), length of encoded key and value are stored in kvs.
+// kvs is used for canonical encoding of map.
+type encodeKeyValueFunc func(e *bytes.Buffer, em *encMode, v reflect.Value, kvs []keyValue) error
+
+type mapEncodeFunc struct {
+ e encodeKeyValueFunc
+}
+
+func (me mapEncodeFunc) encode(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if v.IsNil() && em.nilContainers == NilContainerAsNull {
+ e.Write(cborNil)
+ return nil
+ }
+ if b := em.encTagBytes(v.Type()); b != nil {
+ e.Write(b)
+ }
+ mlen := v.Len()
+ if mlen == 0 {
+ return e.WriteByte(byte(cborTypeMap))
+ }
+
+ encodeHead(e, byte(cborTypeMap), uint64(mlen))
+ if em.sort == SortNone || em.sort == SortFastShuffle || mlen <= 1 {
+ return me.e(e, em, v, nil)
+ }
+
+ kvsp := getKeyValues(v.Len()) // for sorting keys
+ defer putKeyValues(kvsp)
+ kvs := *kvsp
+
+ kvBeginOffset := e.Len()
+ if err := me.e(e, em, v, kvs); err != nil {
+ return err
+ }
+ kvTotalLen := e.Len() - kvBeginOffset
+
+ // Use the capacity at the tail of the encode buffer as a staging area to rearrange the
+ // encoded pairs into sorted order.
+ e.Grow(kvTotalLen)
+ tmp := e.Bytes()[e.Len() : e.Len()+kvTotalLen] // Can use e.AvailableBuffer() in Go 1.21+.
+ dst := e.Bytes()[kvBeginOffset:]
+
+ if em.sort == SortBytewiseLexical {
+ sort.Sort(&bytewiseKeyValueSorter{kvs: kvs, data: dst})
+ } else {
+ sort.Sort(&lengthFirstKeyValueSorter{kvs: kvs, data: dst})
+ }
+
+ // This is where the encoded bytes are actually rearranged in the output buffer to reflect
+ // the desired order.
+ sortedOffset := 0
+ for _, kv := range kvs {
+ copy(tmp[sortedOffset:], dst[kv.offset:kv.nextOffset])
+ sortedOffset += kv.nextOffset - kv.offset
+ }
+ copy(dst, tmp[:kvTotalLen])
+
+ return nil
+
+}
+
+// keyValue is the position of an encoded pair in a buffer. All offsets are zero-based and relative
+// to the first byte of the first encoded pair.
+type keyValue struct {
+ offset int
+ valueOffset int
+ nextOffset int
+}
+
+type bytewiseKeyValueSorter struct {
+ kvs []keyValue
+ data []byte
+}
+
+func (x *bytewiseKeyValueSorter) Len() int {
+ return len(x.kvs)
+}
+
+func (x *bytewiseKeyValueSorter) Swap(i, j int) {
+ x.kvs[i], x.kvs[j] = x.kvs[j], x.kvs[i]
+}
+
+func (x *bytewiseKeyValueSorter) Less(i, j int) bool {
+ kvi, kvj := x.kvs[i], x.kvs[j]
+ return bytes.Compare(x.data[kvi.offset:kvi.valueOffset], x.data[kvj.offset:kvj.valueOffset]) <= 0
+}
+
+type lengthFirstKeyValueSorter struct {
+ kvs []keyValue
+ data []byte
+}
+
+func (x *lengthFirstKeyValueSorter) Len() int {
+ return len(x.kvs)
+}
+
+func (x *lengthFirstKeyValueSorter) Swap(i, j int) {
+ x.kvs[i], x.kvs[j] = x.kvs[j], x.kvs[i]
+}
+
+func (x *lengthFirstKeyValueSorter) Less(i, j int) bool {
+ kvi, kvj := x.kvs[i], x.kvs[j]
+ if keyLengthDifference := (kvi.valueOffset - kvi.offset) - (kvj.valueOffset - kvj.offset); keyLengthDifference != 0 {
+ return keyLengthDifference < 0
+ }
+ return bytes.Compare(x.data[kvi.offset:kvi.valueOffset], x.data[kvj.offset:kvj.valueOffset]) <= 0
+}
+
+var keyValuePool = sync.Pool{}
+
+func getKeyValues(length int) *[]keyValue {
+ v := keyValuePool.Get()
+ if v == nil {
+ y := make([]keyValue, length)
+ return &y
+ }
+ x := v.(*[]keyValue)
+ if cap(*x) >= length {
+ *x = (*x)[:length]
+ return x
+ }
+ // []keyValue from the pool does not have enough capacity.
+ // Return it back to the pool and create a new one.
+ keyValuePool.Put(x)
+ y := make([]keyValue, length)
+ return &y
+}
+
+func putKeyValues(x *[]keyValue) {
+ *x = (*x)[:0]
+ keyValuePool.Put(x)
+}
+
+func encodeStructToArray(e *bytes.Buffer, em *encMode, v reflect.Value) (err error) {
+ structType, err := getEncodingStructType(v.Type())
+ if err != nil {
+ return err
+ }
+
+ if b := em.encTagBytes(v.Type()); b != nil {
+ e.Write(b)
+ }
+
+ flds := structType.fields
+
+ encodeHead(e, byte(cborTypeArray), uint64(len(flds)))
+ for i := 0; i < len(flds); i++ {
+ f := flds[i]
+
+ var fv reflect.Value
+ if len(f.idx) == 1 {
+ fv = v.Field(f.idx[0])
+ } else {
+ // Get embedded field value. No error is expected.
+ fv, _ = getFieldValue(v, f.idx, func(reflect.Value) (reflect.Value, error) {
+ // Write CBOR nil for null pointer to embedded struct
+ e.Write(cborNil)
+ return reflect.Value{}, nil
+ })
+ if !fv.IsValid() {
+ continue
+ }
+ }
+
+ if err := f.ef(e, em, fv); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+func encodeStruct(e *bytes.Buffer, em *encMode, v reflect.Value) (err error) {
+ structType, err := getEncodingStructType(v.Type())
+ if err != nil {
+ return err
+ }
+
+ flds := structType.getFields(em)
+
+ start := 0
+ if em.sort == SortFastShuffle && len(flds) > 0 {
+ start = rand.Intn(len(flds)) //nolint:gosec // Don't need a CSPRNG for deck cutting.
+ }
+
+ if b := em.encTagBytes(v.Type()); b != nil {
+ e.Write(b)
+ }
+
+ // Encode head with struct field count.
+ // Head is rewritten later if actual encoded field count is different from struct field count.
+ encodedHeadLen := encodeHead(e, byte(cborTypeMap), uint64(len(flds)))
+
+ kvbegin := e.Len()
+ kvcount := 0
+ for offset := 0; offset < len(flds); offset++ {
+ f := flds[(start+offset)%len(flds)]
+
+ var fv reflect.Value
+ if len(f.idx) == 1 {
+ fv = v.Field(f.idx[0])
+ } else {
+ // Get embedded field value. No error is expected.
+ fv, _ = getFieldValue(v, f.idx, func(reflect.Value) (reflect.Value, error) {
+ // Skip null pointer to embedded struct
+ return reflect.Value{}, nil
+ })
+ if !fv.IsValid() {
+ continue
+ }
+ }
+ if f.omitEmpty {
+ empty, err := f.ief(em, fv)
+ if err != nil {
+ return err
+ }
+ if empty {
+ continue
+ }
+ }
+
+ if !f.keyAsInt && em.fieldName == FieldNameToByteString {
+ e.Write(f.cborNameByteString)
+ } else { // int or text string
+ e.Write(f.cborName)
+ }
+
+ if err := f.ef(e, em, fv); err != nil {
+ return err
+ }
+
+ kvcount++
+ }
+
+ if len(flds) == kvcount {
+ // Encoded element count in head is the same as actual element count.
+ return nil
+ }
+
+ // Overwrite the bytes that were reserved for the head before encoding the map entries.
+ var actualHeadLen int
+ {
+ headbuf := *bytes.NewBuffer(e.Bytes()[kvbegin-encodedHeadLen : kvbegin-encodedHeadLen : kvbegin])
+ actualHeadLen = encodeHead(&headbuf, byte(cborTypeMap), uint64(kvcount))
+ }
+
+ if actualHeadLen == encodedHeadLen {
+ // The bytes reserved for the encoded head were exactly the right size, so the
+ // encoded entries are already in their final positions.
+ return nil
+ }
+
+ // We reserved more bytes than needed for the encoded head, based on the number of fields
+ // encoded. The encoded entries are offset to the right by the number of excess reserved
+ // bytes. Shift the entries left to remove the gap.
+ excessReservedBytes := encodedHeadLen - actualHeadLen
+ dst := e.Bytes()[kvbegin-excessReservedBytes : e.Len()-excessReservedBytes]
+ src := e.Bytes()[kvbegin:e.Len()]
+ copy(dst, src)
+
+ // After shifting, the excess bytes are at the end of the output buffer and they are
+ // garbage.
+ e.Truncate(e.Len() - excessReservedBytes)
+ return nil
+}
+
+func encodeIntf(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if v.IsNil() {
+ e.Write(cborNil)
+ return nil
+ }
+ return encode(e, em, v.Elem())
+}
+
+func encodeTime(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ t := v.Interface().(time.Time)
+ if t.IsZero() {
+ e.Write(cborNil) // Even if tag is required, encode as CBOR null.
+ return nil
+ }
+ if em.timeTag == EncTagRequired {
+ tagNumber := 1
+ if em.time == TimeRFC3339 || em.time == TimeRFC3339Nano {
+ tagNumber = 0
+ }
+ encodeHead(e, byte(cborTypeTag), uint64(tagNumber))
+ }
+ switch em.time {
+ case TimeUnix:
+ secs := t.Unix()
+ return encodeInt(e, em, reflect.ValueOf(secs))
+
+ case TimeUnixMicro:
+ t = t.UTC().Round(time.Microsecond)
+ f := float64(t.UnixNano()) / 1e9
+ return encodeFloat(e, em, reflect.ValueOf(f))
+
+ case TimeUnixDynamic:
+ t = t.UTC().Round(time.Microsecond)
+ secs, nsecs := t.Unix(), uint64(t.Nanosecond())
+ if nsecs == 0 {
+ return encodeInt(e, em, reflect.ValueOf(secs))
+ }
+ f := float64(secs) + float64(nsecs)/1e9
+ return encodeFloat(e, em, reflect.ValueOf(f))
+
+ case TimeRFC3339:
+ s := t.Format(time.RFC3339)
+ return encodeString(e, em, reflect.ValueOf(s))
+
+ default: // TimeRFC3339Nano
+ s := t.Format(time.RFC3339Nano)
+ return encodeString(e, em, reflect.ValueOf(s))
+ }
+}
+
+func encodeBigInt(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if em.bigIntConvert == BigIntConvertReject {
+ return &UnsupportedTypeError{Type: typeBigInt}
+ }
+
+ vbi := v.Interface().(big.Int)
+ sign := vbi.Sign()
+ bi := new(big.Int).SetBytes(vbi.Bytes()) // bi is absolute value of v
+ if sign < 0 {
+ // For negative number, convert to CBOR encoded number (-v-1).
+ bi.Sub(bi, big.NewInt(1))
+ }
+
+ if em.bigIntConvert == BigIntConvertShortest {
+ if bi.IsUint64() {
+ if sign >= 0 {
+ // Encode as CBOR pos int (major type 0)
+ encodeHead(e, byte(cborTypePositiveInt), bi.Uint64())
+ return nil
+ }
+ // Encode as CBOR neg int (major type 1)
+ encodeHead(e, byte(cborTypeNegativeInt), bi.Uint64())
+ return nil
+ }
+ }
+
+ tagNum := 2
+ if sign < 0 {
+ tagNum = 3
+ }
+ // Write tag number
+ encodeHead(e, byte(cborTypeTag), uint64(tagNum))
+ // Write bignum byte string
+ b := bi.Bytes()
+ encodeHead(e, byte(cborTypeByteString), uint64(len(b)))
+ e.Write(b)
+ return nil
+}
+
+type binaryMarshalerEncoder struct {
+ alternateEncode encodeFunc
+ alternateIsEmpty isEmptyFunc
+}
+
+func (bme binaryMarshalerEncoder) encode(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if em.binaryMarshaler != BinaryMarshalerByteString {
+ return bme.alternateEncode(e, em, v)
+ }
+
+ vt := v.Type()
+ m, ok := v.Interface().(encoding.BinaryMarshaler)
+ if !ok {
+ pv := reflect.New(vt)
+ pv.Elem().Set(v)
+ m = pv.Interface().(encoding.BinaryMarshaler)
+ }
+ data, err := m.MarshalBinary()
+ if err != nil {
+ return err
+ }
+ if b := em.encTagBytes(vt); b != nil {
+ e.Write(b)
+ }
+ encodeHead(e, byte(cborTypeByteString), uint64(len(data)))
+ e.Write(data)
+ return nil
+}
+
+func (bme binaryMarshalerEncoder) isEmpty(em *encMode, v reflect.Value) (bool, error) {
+ if em.binaryMarshaler != BinaryMarshalerByteString {
+ return bme.alternateIsEmpty(em, v)
+ }
+
+ m, ok := v.Interface().(encoding.BinaryMarshaler)
+ if !ok {
+ pv := reflect.New(v.Type())
+ pv.Elem().Set(v)
+ m = pv.Interface().(encoding.BinaryMarshaler)
+ }
+ data, err := m.MarshalBinary()
+ if err != nil {
+ return false, err
+ }
+ return len(data) == 0, nil
+}
+
+func encodeMarshalerType(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if em.tagsMd == TagsForbidden && v.Type() == typeRawTag {
+ return errors.New("cbor: cannot encode cbor.RawTag when TagsMd is TagsForbidden")
+ }
+ m, ok := v.Interface().(Marshaler)
+ if !ok {
+ pv := reflect.New(v.Type())
+ pv.Elem().Set(v)
+ m = pv.Interface().(Marshaler)
+ }
+ data, err := m.MarshalCBOR()
+ if err != nil {
+ return err
+ }
+
+ // Verify returned CBOR data item from MarshalCBOR() is well-formed and passes tag validity for builtin tags 0-3.
+ d := decoder{data: data, dm: getMarshalerDecMode(em.indefLength, em.tagsMd)}
+ err = d.wellformed(false, true)
+ if err != nil {
+ return &MarshalerError{typ: v.Type(), err: err}
+ }
+
+ e.Write(data)
+ return nil
+}
+
+func encodeTag(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if em.tagsMd == TagsForbidden {
+ return errors.New("cbor: cannot encode cbor.Tag when TagsMd is TagsForbidden")
+ }
+
+ t := v.Interface().(Tag)
+
+ if t.Number == 0 && t.Content == nil {
+ // Marshal uninitialized cbor.Tag
+ e.Write(cborNil)
+ return nil
+ }
+
+ // Marshal tag number
+ encodeHead(e, byte(cborTypeTag), t.Number)
+
+ vem := *em // shallow copy
+
+ // For built-in tags, disable settings that may introduce tag validity errors when
+ // marshaling certain Content values.
+ switch t.Number {
+ case tagNumRFC3339Time:
+ vem.stringType = StringToTextString
+ vem.stringMajorType = cborTypeTextString
+ case tagNumUnsignedBignum, tagNumNegativeBignum:
+ vem.byteSliceLaterFormat = ByteSliceLaterFormatNone
+ vem.byteSliceLaterEncodingTag = 0
+ }
+
+ // Marshal tag content
+ return encode(e, &vem, reflect.ValueOf(t.Content))
+}
+
+// encodeHead writes CBOR head of specified type t and returns number of bytes written.
+func encodeHead(e *bytes.Buffer, t byte, n uint64) int {
+ if n <= maxAdditionalInformationWithoutArgument {
+ const headSize = 1
+ e.WriteByte(t | byte(n))
+ return headSize
+ }
+
+ if n <= math.MaxUint8 {
+ const headSize = 2
+ scratch := [headSize]byte{
+ t | byte(additionalInformationWith1ByteArgument),
+ byte(n),
+ }
+ e.Write(scratch[:])
+ return headSize
+ }
+
+ if n <= math.MaxUint16 {
+ const headSize = 3
+ var scratch [headSize]byte
+ scratch[0] = t | byte(additionalInformationWith2ByteArgument)
+ binary.BigEndian.PutUint16(scratch[1:], uint16(n))
+ e.Write(scratch[:])
+ return headSize
+ }
+
+ if n <= math.MaxUint32 {
+ const headSize = 5
+ var scratch [headSize]byte
+ scratch[0] = t | byte(additionalInformationWith4ByteArgument)
+ binary.BigEndian.PutUint32(scratch[1:], uint32(n))
+ e.Write(scratch[:])
+ return headSize
+ }
+
+ const headSize = 9
+ var scratch [headSize]byte
+ scratch[0] = t | byte(additionalInformationWith8ByteArgument)
+ binary.BigEndian.PutUint64(scratch[1:], n)
+ e.Write(scratch[:])
+ return headSize
+}
+
+var (
+ typeMarshaler = reflect.TypeOf((*Marshaler)(nil)).Elem()
+ typeBinaryMarshaler = reflect.TypeOf((*encoding.BinaryMarshaler)(nil)).Elem()
+ typeRawMessage = reflect.TypeOf(RawMessage(nil))
+ typeByteString = reflect.TypeOf(ByteString(""))
+)
+
+func getEncodeFuncInternal(t reflect.Type) (ef encodeFunc, ief isEmptyFunc) {
+ k := t.Kind()
+ if k == reflect.Ptr {
+ return getEncodeIndirectValueFunc(t), isEmptyPtr
+ }
+ switch t {
+ case typeSimpleValue:
+ return encodeMarshalerType, isEmptyUint
+
+ case typeTag:
+ return encodeTag, alwaysNotEmpty
+
+ case typeTime:
+ return encodeTime, alwaysNotEmpty
+
+ case typeBigInt:
+ return encodeBigInt, alwaysNotEmpty
+
+ case typeRawMessage:
+ return encodeMarshalerType, isEmptySlice
+
+ case typeByteString:
+ return encodeMarshalerType, isEmptyString
+ }
+ if reflect.PtrTo(t).Implements(typeMarshaler) {
+ return encodeMarshalerType, alwaysNotEmpty
+ }
+ if reflect.PtrTo(t).Implements(typeBinaryMarshaler) {
+ defer func() {
+ // capture encoding method used for modes that disable BinaryMarshaler
+ bme := binaryMarshalerEncoder{
+ alternateEncode: ef,
+ alternateIsEmpty: ief,
+ }
+ ef = bme.encode
+ ief = bme.isEmpty
+ }()
+ }
+ switch k {
+ case reflect.Bool:
+ return encodeBool, isEmptyBool
+
+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+ return encodeInt, isEmptyInt
+
+ case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
+ return encodeUint, isEmptyUint
+
+ case reflect.Float32, reflect.Float64:
+ return encodeFloat, isEmptyFloat
+
+ case reflect.String:
+ return encodeString, isEmptyString
+
+ case reflect.Slice:
+ if t.Elem().Kind() == reflect.Uint8 {
+ return encodeByteString, isEmptySlice
+ }
+ fallthrough
+
+ case reflect.Array:
+ f, _ := getEncodeFunc(t.Elem())
+ if f == nil {
+ return nil, nil
+ }
+ return arrayEncodeFunc{f: f}.encode, isEmptySlice
+
+ case reflect.Map:
+ f := getEncodeMapFunc(t)
+ if f == nil {
+ return nil, nil
+ }
+ return f, isEmptyMap
+
+ case reflect.Struct:
+ // Get struct's special field "_" tag options
+ if f, ok := t.FieldByName("_"); ok {
+ tag := f.Tag.Get("cbor")
+ if tag != "-" {
+ if hasToArrayOption(tag) {
+ return encodeStructToArray, isEmptyStruct
+ }
+ }
+ }
+ return encodeStruct, isEmptyStruct
+
+ case reflect.Interface:
+ return encodeIntf, isEmptyIntf
+ }
+ return nil, nil
+}
+
+func getEncodeIndirectValueFunc(t reflect.Type) encodeFunc {
+ for t.Kind() == reflect.Ptr {
+ t = t.Elem()
+ }
+ f, _ := getEncodeFunc(t)
+ if f == nil {
+ return nil
+ }
+ return func(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ for v.Kind() == reflect.Ptr && !v.IsNil() {
+ v = v.Elem()
+ }
+ if v.Kind() == reflect.Ptr && v.IsNil() {
+ e.Write(cborNil)
+ return nil
+ }
+ return f(e, em, v)
+ }
+}
+
+func alwaysNotEmpty(_ *encMode, _ reflect.Value) (empty bool, err error) {
+ return false, nil
+}
+
+func isEmptyBool(_ *encMode, v reflect.Value) (bool, error) {
+ return !v.Bool(), nil
+}
+
+func isEmptyInt(_ *encMode, v reflect.Value) (bool, error) {
+ return v.Int() == 0, nil
+}
+
+func isEmptyUint(_ *encMode, v reflect.Value) (bool, error) {
+ return v.Uint() == 0, nil
+}
+
+func isEmptyFloat(_ *encMode, v reflect.Value) (bool, error) {
+ return v.Float() == 0.0, nil
+}
+
+func isEmptyString(_ *encMode, v reflect.Value) (bool, error) {
+ return v.Len() == 0, nil
+}
+
+func isEmptySlice(_ *encMode, v reflect.Value) (bool, error) {
+ return v.Len() == 0, nil
+}
+
+func isEmptyMap(_ *encMode, v reflect.Value) (bool, error) {
+ return v.Len() == 0, nil
+}
+
+func isEmptyPtr(_ *encMode, v reflect.Value) (bool, error) {
+ return v.IsNil(), nil
+}
+
+func isEmptyIntf(_ *encMode, v reflect.Value) (bool, error) {
+ return v.IsNil(), nil
+}
+
+func isEmptyStruct(em *encMode, v reflect.Value) (bool, error) {
+ structType, err := getEncodingStructType(v.Type())
+ if err != nil {
+ return false, err
+ }
+
+ if em.omitEmpty == OmitEmptyGoValue {
+ return false, nil
+ }
+
+ if structType.toArray {
+ return len(structType.fields) == 0, nil
+ }
+
+ if len(structType.fields) > len(structType.omitEmptyFieldsIdx) {
+ return false, nil
+ }
+
+ for _, i := range structType.omitEmptyFieldsIdx {
+ f := structType.fields[i]
+
+ // Get field value
+ var fv reflect.Value
+ if len(f.idx) == 1 {
+ fv = v.Field(f.idx[0])
+ } else {
+ // Get embedded field value. No error is expected.
+ fv, _ = getFieldValue(v, f.idx, func(reflect.Value) (reflect.Value, error) {
+ // Skip null pointer to embedded struct
+ return reflect.Value{}, nil
+ })
+ if !fv.IsValid() {
+ continue
+ }
+ }
+
+ empty, err := f.ief(em, fv)
+ if err != nil {
+ return false, err
+ }
+ if !empty {
+ return false, nil
+ }
+ }
+ return true, nil
+}
+
+func cannotFitFloat32(f64 float64) bool {
+ f32 := float32(f64)
+ return float64(f32) != f64
+}
+
+// float32NaNFromReflectValue extracts float32 NaN from reflect.Value while preserving NaN's quiet bit.
+func float32NaNFromReflectValue(v reflect.Value) float32 {
+ // Keith Randall's workaround for issue https://github.com/golang/go/issues/36400
+ p := reflect.New(v.Type())
+ p.Elem().Set(v)
+ f32 := p.Convert(reflect.TypeOf((*float32)(nil))).Elem().Interface().(float32)
+ return f32
+}
diff --git a/vendor/github.com/fxamacker/cbor/v2/encode_map.go b/vendor/github.com/fxamacker/cbor/v2/encode_map.go
new file mode 100644
index 000000000..8b4b4bbc5
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/encode_map.go
@@ -0,0 +1,94 @@
+// Copyright (c) Faye Amacker. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+//go:build go1.20
+
+package cbor
+
+import (
+ "bytes"
+ "reflect"
+ "sync"
+)
+
+type mapKeyValueEncodeFunc struct {
+ kf, ef encodeFunc
+ kpool, vpool sync.Pool
+}
+
+func (me *mapKeyValueEncodeFunc) encodeKeyValues(e *bytes.Buffer, em *encMode, v reflect.Value, kvs []keyValue) error {
+ iterk := me.kpool.Get().(*reflect.Value)
+ defer func() {
+ iterk.SetZero()
+ me.kpool.Put(iterk)
+ }()
+ iterv := me.vpool.Get().(*reflect.Value)
+ defer func() {
+ iterv.SetZero()
+ me.vpool.Put(iterv)
+ }()
+
+ if kvs == nil {
+ for i, iter := 0, v.MapRange(); iter.Next(); i++ {
+ iterk.SetIterKey(iter)
+ iterv.SetIterValue(iter)
+
+ if err := me.kf(e, em, *iterk); err != nil {
+ return err
+ }
+ if err := me.ef(e, em, *iterv); err != nil {
+ return err
+ }
+ }
+ return nil
+ }
+
+ initial := e.Len()
+ for i, iter := 0, v.MapRange(); iter.Next(); i++ {
+ iterk.SetIterKey(iter)
+ iterv.SetIterValue(iter)
+
+ offset := e.Len()
+ if err := me.kf(e, em, *iterk); err != nil {
+ return err
+ }
+ valueOffset := e.Len()
+ if err := me.ef(e, em, *iterv); err != nil {
+ return err
+ }
+ kvs[i] = keyValue{
+ offset: offset - initial,
+ valueOffset: valueOffset - initial,
+ nextOffset: e.Len() - initial,
+ }
+ }
+
+ return nil
+}
+
+func getEncodeMapFunc(t reflect.Type) encodeFunc {
+ kf, _ := getEncodeFunc(t.Key())
+ ef, _ := getEncodeFunc(t.Elem())
+ if kf == nil || ef == nil {
+ return nil
+ }
+ mkv := &mapKeyValueEncodeFunc{
+ kf: kf,
+ ef: ef,
+ kpool: sync.Pool{
+ New: func() interface{} {
+ rk := reflect.New(t.Key()).Elem()
+ return &rk
+ },
+ },
+ vpool: sync.Pool{
+ New: func() interface{} {
+ rv := reflect.New(t.Elem()).Elem()
+ return &rv
+ },
+ },
+ }
+ return mapEncodeFunc{
+ e: mkv.encodeKeyValues,
+ }.encode
+}
diff --git a/vendor/github.com/fxamacker/cbor/v2/encode_map_go117.go b/vendor/github.com/fxamacker/cbor/v2/encode_map_go117.go
new file mode 100644
index 000000000..31c39336d
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/encode_map_go117.go
@@ -0,0 +1,60 @@
+// Copyright (c) Faye Amacker. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+//go:build !go1.20
+
+package cbor
+
+import (
+ "bytes"
+ "reflect"
+)
+
+type mapKeyValueEncodeFunc struct {
+ kf, ef encodeFunc
+}
+
+func (me *mapKeyValueEncodeFunc) encodeKeyValues(e *bytes.Buffer, em *encMode, v reflect.Value, kvs []keyValue) error {
+ if kvs == nil {
+ for i, iter := 0, v.MapRange(); iter.Next(); i++ {
+ if err := me.kf(e, em, iter.Key()); err != nil {
+ return err
+ }
+ if err := me.ef(e, em, iter.Value()); err != nil {
+ return err
+ }
+ }
+ return nil
+ }
+
+ initial := e.Len()
+ for i, iter := 0, v.MapRange(); iter.Next(); i++ {
+ offset := e.Len()
+ if err := me.kf(e, em, iter.Key()); err != nil {
+ return err
+ }
+ valueOffset := e.Len()
+ if err := me.ef(e, em, iter.Value()); err != nil {
+ return err
+ }
+ kvs[i] = keyValue{
+ offset: offset - initial,
+ valueOffset: valueOffset - initial,
+ nextOffset: e.Len() - initial,
+ }
+ }
+
+ return nil
+}
+
+func getEncodeMapFunc(t reflect.Type) encodeFunc {
+ kf, _ := getEncodeFunc(t.Key())
+ ef, _ := getEncodeFunc(t.Elem())
+ if kf == nil || ef == nil {
+ return nil
+ }
+ mkv := &mapKeyValueEncodeFunc{kf: kf, ef: ef}
+ return mapEncodeFunc{
+ e: mkv.encodeKeyValues,
+ }.encode
+}
diff --git a/vendor/github.com/fxamacker/cbor/v2/simplevalue.go b/vendor/github.com/fxamacker/cbor/v2/simplevalue.go
new file mode 100644
index 000000000..de175cee4
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/simplevalue.go
@@ -0,0 +1,69 @@
+package cbor
+
+import (
+ "errors"
+ "fmt"
+ "reflect"
+)
+
+// SimpleValue represents CBOR simple value.
+// CBOR simple value is:
+// - an extension point like CBOR tag.
+// - a subset of CBOR major type 7 that isn't floating-point.
+// - "identified by a number between 0 and 255, but distinct from that number itself".
+// For example, "a simple value 2 is not equivalent to an integer 2" as a CBOR map key.
+//
+// CBOR simple values identified by 20..23 are: "false", "true" , "null", and "undefined".
+// Other CBOR simple values are currently unassigned/reserved by IANA.
+type SimpleValue uint8
+
+var (
+ typeSimpleValue = reflect.TypeOf(SimpleValue(0))
+)
+
+// MarshalCBOR encodes SimpleValue as CBOR simple value (major type 7).
+func (sv SimpleValue) MarshalCBOR() ([]byte, error) {
+ // RFC 8949 3.3. Floating-Point Numbers and Values with No Content says:
+ // "An encoder MUST NOT issue two-byte sequences that start with 0xf8
+ // (major type 7, additional information 24) and continue with a byte
+ // less than 0x20 (32 decimal). Such sequences are not well-formed.
+ // (This implies that an encoder cannot encode false, true, null, or
+ // undefined in two-byte sequences and that only the one-byte variants
+ // of these are well-formed; more generally speaking, each simple value
+ // only has a single representation variant)."
+
+ switch {
+ case sv <= maxSimpleValueInAdditionalInformation:
+ return []byte{byte(cborTypePrimitives) | byte(sv)}, nil
+
+ case sv >= minSimpleValueIn1ByteArgument:
+ return []byte{byte(cborTypePrimitives) | additionalInformationWith1ByteArgument, byte(sv)}, nil
+
+ default:
+ return nil, &UnsupportedValueError{msg: fmt.Sprintf("SimpleValue(%d)", sv)}
+ }
+}
+
+// UnmarshalCBOR decodes CBOR simple value (major type 7) to SimpleValue.
+func (sv *SimpleValue) UnmarshalCBOR(data []byte) error {
+ if sv == nil {
+ return errors.New("cbor.SimpleValue: UnmarshalCBOR on nil pointer")
+ }
+
+ d := decoder{data: data, dm: defaultDecMode}
+
+ typ, ai, val := d.getHead()
+
+ if typ != cborTypePrimitives {
+ return &UnmarshalTypeError{CBORType: typ.String(), GoType: "SimpleValue"}
+ }
+ if ai > additionalInformationWith1ByteArgument {
+ return &UnmarshalTypeError{CBORType: typ.String(), GoType: "SimpleValue", errorMsg: "not simple values"}
+ }
+
+ // It is safe to cast val to uint8 here because
+ // - data is already verified to be well-formed CBOR simple value and
+ // - val is <= math.MaxUint8.
+ *sv = SimpleValue(val)
+ return nil
+}
diff --git a/vendor/github.com/fxamacker/cbor/v2/stream.go b/vendor/github.com/fxamacker/cbor/v2/stream.go
new file mode 100644
index 000000000..507ab6c18
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/stream.go
@@ -0,0 +1,277 @@
+// Copyright (c) Faye Amacker. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+package cbor
+
+import (
+ "bytes"
+ "errors"
+ "io"
+ "reflect"
+)
+
+// Decoder reads and decodes CBOR values from io.Reader.
+type Decoder struct {
+ r io.Reader
+ d decoder
+ buf []byte
+ off int // next read offset in buf
+ bytesRead int
+}
+
+// NewDecoder returns a new decoder that reads and decodes from r using
+// the default decoding options.
+func NewDecoder(r io.Reader) *Decoder {
+ return defaultDecMode.NewDecoder(r)
+}
+
+// Decode reads CBOR value and decodes it into the value pointed to by v.
+func (dec *Decoder) Decode(v interface{}) error {
+ _, err := dec.readNext()
+ if err != nil {
+ // Return validation error or read error.
+ return err
+ }
+
+ dec.d.reset(dec.buf[dec.off:])
+ err = dec.d.value(v)
+
+ // Increment dec.off even if decoding err is not nil because
+ // dec.d.off points to the next CBOR data item if current
+ // CBOR data item is valid but failed to be decoded into v.
+ // This allows next CBOR data item to be decoded in next
+ // call to this function.
+ dec.off += dec.d.off
+ dec.bytesRead += dec.d.off
+
+ return err
+}
+
+// Skip skips to the next CBOR data item (if there is any),
+// otherwise it returns error such as io.EOF, io.UnexpectedEOF, etc.
+func (dec *Decoder) Skip() error {
+ n, err := dec.readNext()
+ if err != nil {
+ // Return validation error or read error.
+ return err
+ }
+
+ dec.off += n
+ dec.bytesRead += n
+ return nil
+}
+
+// NumBytesRead returns the number of bytes read.
+func (dec *Decoder) NumBytesRead() int {
+ return dec.bytesRead
+}
+
+// Buffered returns a reader for data remaining in Decoder's buffer.
+// Returned reader is valid until the next call to Decode or Skip.
+func (dec *Decoder) Buffered() io.Reader {
+ return bytes.NewReader(dec.buf[dec.off:])
+}
+
+// readNext() reads next CBOR data item from Reader to buffer.
+// It returns the size of next CBOR data item.
+// It also returns validation error or read error if any.
+func (dec *Decoder) readNext() (int, error) {
+ var readErr error
+ var validErr error
+
+ for {
+ // Process any unread data in dec.buf.
+ if dec.off < len(dec.buf) {
+ dec.d.reset(dec.buf[dec.off:])
+ off := dec.off // Save offset before data validation
+ validErr = dec.d.wellformed(true, false)
+ dec.off = off // Restore offset
+
+ if validErr == nil {
+ return dec.d.off, nil
+ }
+
+ if validErr != io.ErrUnexpectedEOF {
+ return 0, validErr
+ }
+
+ // Process last read error on io.ErrUnexpectedEOF.
+ if readErr != nil {
+ if readErr == io.EOF {
+ // current CBOR data item is incomplete.
+ return 0, io.ErrUnexpectedEOF
+ }
+ return 0, readErr
+ }
+ }
+
+ // More data is needed and there was no read error.
+ var n int
+ for n == 0 {
+ n, readErr = dec.read()
+ if n == 0 && readErr != nil {
+ // No more data can be read and read error is encountered.
+ // At this point, validErr is either nil or io.ErrUnexpectedEOF.
+ if readErr == io.EOF {
+ if validErr == io.ErrUnexpectedEOF {
+ // current CBOR data item is incomplete.
+ return 0, io.ErrUnexpectedEOF
+ }
+ }
+ return 0, readErr
+ }
+ }
+
+ // At this point, dec.buf contains new data from last read (n > 0).
+ }
+}
+
+// read() reads data from Reader to buffer.
+// It returns number of bytes read and any read error encountered.
+// Postconditions:
+// - dec.buf contains previously unread data and new data.
+// - dec.off is 0.
+func (dec *Decoder) read() (int, error) {
+ // Grow buf if needed.
+ const minRead = 512
+ if cap(dec.buf)-len(dec.buf)+dec.off < minRead {
+ oldUnreadBuf := dec.buf[dec.off:]
+ dec.buf = make([]byte, len(dec.buf)-dec.off, 2*cap(dec.buf)+minRead)
+ dec.overwriteBuf(oldUnreadBuf)
+ }
+
+ // Copy unread data over read data and reset off to 0.
+ if dec.off > 0 {
+ dec.overwriteBuf(dec.buf[dec.off:])
+ }
+
+ // Read from reader and reslice buf.
+ n, err := dec.r.Read(dec.buf[len(dec.buf):cap(dec.buf)])
+ dec.buf = dec.buf[0 : len(dec.buf)+n]
+ return n, err
+}
+
+func (dec *Decoder) overwriteBuf(newBuf []byte) {
+ n := copy(dec.buf, newBuf)
+ dec.buf = dec.buf[:n]
+ dec.off = 0
+}
+
+// Encoder writes CBOR values to io.Writer.
+type Encoder struct {
+ w io.Writer
+ em *encMode
+ indefTypes []cborType
+}
+
+// NewEncoder returns a new encoder that writes to w using the default encoding options.
+func NewEncoder(w io.Writer) *Encoder {
+ return defaultEncMode.NewEncoder(w)
+}
+
+// Encode writes the CBOR encoding of v.
+func (enc *Encoder) Encode(v interface{}) error {
+ if len(enc.indefTypes) > 0 && v != nil {
+ indefType := enc.indefTypes[len(enc.indefTypes)-1]
+ if indefType == cborTypeTextString {
+ k := reflect.TypeOf(v).Kind()
+ if k != reflect.String {
+ return errors.New("cbor: cannot encode item type " + k.String() + " for indefinite-length text string")
+ }
+ } else if indefType == cborTypeByteString {
+ t := reflect.TypeOf(v)
+ k := t.Kind()
+ if (k != reflect.Array && k != reflect.Slice) || t.Elem().Kind() != reflect.Uint8 {
+ return errors.New("cbor: cannot encode item type " + k.String() + " for indefinite-length byte string")
+ }
+ }
+ }
+
+ buf := getEncodeBuffer()
+
+ err := encode(buf, enc.em, reflect.ValueOf(v))
+ if err == nil {
+ _, err = enc.w.Write(buf.Bytes())
+ }
+
+ putEncodeBuffer(buf)
+ return err
+}
+
+// StartIndefiniteByteString starts byte string encoding of indefinite length.
+// Subsequent calls of (*Encoder).Encode() encodes definite length byte strings
+// ("chunks") as one contiguous string until EndIndefinite is called.
+func (enc *Encoder) StartIndefiniteByteString() error {
+ return enc.startIndefinite(cborTypeByteString)
+}
+
+// StartIndefiniteTextString starts text string encoding of indefinite length.
+// Subsequent calls of (*Encoder).Encode() encodes definite length text strings
+// ("chunks") as one contiguous string until EndIndefinite is called.
+func (enc *Encoder) StartIndefiniteTextString() error {
+ return enc.startIndefinite(cborTypeTextString)
+}
+
+// StartIndefiniteArray starts array encoding of indefinite length.
+// Subsequent calls of (*Encoder).Encode() encodes elements of the array
+// until EndIndefinite is called.
+func (enc *Encoder) StartIndefiniteArray() error {
+ return enc.startIndefinite(cborTypeArray)
+}
+
+// StartIndefiniteMap starts array encoding of indefinite length.
+// Subsequent calls of (*Encoder).Encode() encodes elements of the map
+// until EndIndefinite is called.
+func (enc *Encoder) StartIndefiniteMap() error {
+ return enc.startIndefinite(cborTypeMap)
+}
+
+// EndIndefinite closes last opened indefinite length value.
+func (enc *Encoder) EndIndefinite() error {
+ if len(enc.indefTypes) == 0 {
+ return errors.New("cbor: cannot encode \"break\" code outside indefinite length values")
+ }
+ _, err := enc.w.Write([]byte{cborBreakFlag})
+ if err == nil {
+ enc.indefTypes = enc.indefTypes[:len(enc.indefTypes)-1]
+ }
+ return err
+}
+
+var cborIndefHeader = map[cborType][]byte{
+ cborTypeByteString: {cborByteStringWithIndefiniteLengthHead},
+ cborTypeTextString: {cborTextStringWithIndefiniteLengthHead},
+ cborTypeArray: {cborArrayWithIndefiniteLengthHead},
+ cborTypeMap: {cborMapWithIndefiniteLengthHead},
+}
+
+func (enc *Encoder) startIndefinite(typ cborType) error {
+ if enc.em.indefLength == IndefLengthForbidden {
+ return &IndefiniteLengthError{typ}
+ }
+ _, err := enc.w.Write(cborIndefHeader[typ])
+ if err == nil {
+ enc.indefTypes = append(enc.indefTypes, typ)
+ }
+ return err
+}
+
+// RawMessage is a raw encoded CBOR value.
+type RawMessage []byte
+
+// MarshalCBOR returns m or CBOR nil if m is nil.
+func (m RawMessage) MarshalCBOR() ([]byte, error) {
+ if len(m) == 0 {
+ return cborNil, nil
+ }
+ return m, nil
+}
+
+// UnmarshalCBOR creates a copy of data and saves to *m.
+func (m *RawMessage) UnmarshalCBOR(data []byte) error {
+ if m == nil {
+ return errors.New("cbor.RawMessage: UnmarshalCBOR on nil pointer")
+ }
+ *m = append((*m)[0:0], data...)
+ return nil
+}
diff --git a/vendor/github.com/fxamacker/cbor/v2/structfields.go b/vendor/github.com/fxamacker/cbor/v2/structfields.go
new file mode 100644
index 000000000..81228acf0
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/structfields.go
@@ -0,0 +1,260 @@
+// Copyright (c) Faye Amacker. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+package cbor
+
+import (
+ "reflect"
+ "sort"
+ "strings"
+)
+
+type field struct {
+ name string
+ nameAsInt int64 // used to decoder to match field name with CBOR int
+ cborName []byte
+ cborNameByteString []byte // major type 2 name encoding iff cborName has major type 3
+ idx []int
+ typ reflect.Type
+ ef encodeFunc
+ ief isEmptyFunc
+ typInfo *typeInfo // used to decoder to reuse type info
+ tagged bool // used to choose dominant field (at the same level tagged fields dominate untagged fields)
+ omitEmpty bool // used to skip empty field
+ keyAsInt bool // used to encode/decode field name as int
+}
+
+type fields []*field
+
+// indexFieldSorter sorts fields by field idx at each level, breaking ties with idx depth.
+type indexFieldSorter struct {
+ fields fields
+}
+
+func (x *indexFieldSorter) Len() int {
+ return len(x.fields)
+}
+
+func (x *indexFieldSorter) Swap(i, j int) {
+ x.fields[i], x.fields[j] = x.fields[j], x.fields[i]
+}
+
+func (x *indexFieldSorter) Less(i, j int) bool {
+ iIdx, jIdx := x.fields[i].idx, x.fields[j].idx
+ for k := 0; k < len(iIdx) && k < len(jIdx); k++ {
+ if iIdx[k] != jIdx[k] {
+ return iIdx[k] < jIdx[k]
+ }
+ }
+ return len(iIdx) <= len(jIdx)
+}
+
+// nameLevelAndTagFieldSorter sorts fields by field name, idx depth, and presence of tag.
+type nameLevelAndTagFieldSorter struct {
+ fields fields
+}
+
+func (x *nameLevelAndTagFieldSorter) Len() int {
+ return len(x.fields)
+}
+
+func (x *nameLevelAndTagFieldSorter) Swap(i, j int) {
+ x.fields[i], x.fields[j] = x.fields[j], x.fields[i]
+}
+
+func (x *nameLevelAndTagFieldSorter) Less(i, j int) bool {
+ fi, fj := x.fields[i], x.fields[j]
+ if fi.name != fj.name {
+ return fi.name < fj.name
+ }
+ if len(fi.idx) != len(fj.idx) {
+ return len(fi.idx) < len(fj.idx)
+ }
+ if fi.tagged != fj.tagged {
+ return fi.tagged
+ }
+ return i < j // Field i and j have the same name, depth, and tagged status. Nothing else matters.
+}
+
+// getFields returns visible fields of struct type t following visibility rules for JSON encoding.
+func getFields(t reflect.Type) (flds fields, structOptions string) {
+ // Get special field "_" tag options
+ if f, ok := t.FieldByName("_"); ok {
+ tag := f.Tag.Get("cbor")
+ if tag != "-" {
+ structOptions = tag
+ }
+ }
+
+ // nTypes contains next level anonymous fields' types and indexes
+ // (there can be multiple fields of the same type at the same level)
+ flds, nTypes := appendFields(t, nil, nil, nil)
+
+ if len(nTypes) > 0 {
+
+ var cTypes map[reflect.Type][][]int // current level anonymous fields' types and indexes
+ vTypes := map[reflect.Type]bool{t: true} // visited field types at less nested levels
+
+ for len(nTypes) > 0 {
+ cTypes, nTypes = nTypes, nil
+
+ for t, idx := range cTypes {
+ // If there are multiple anonymous fields of the same struct type at the same level, all are ignored.
+ if len(idx) > 1 {
+ continue
+ }
+
+ // Anonymous field of the same type at deeper nested level is ignored.
+ if vTypes[t] {
+ continue
+ }
+ vTypes[t] = true
+
+ flds, nTypes = appendFields(t, idx[0], flds, nTypes)
+ }
+ }
+ }
+
+ sort.Sort(&nameLevelAndTagFieldSorter{flds})
+
+ // Keep visible fields.
+ j := 0 // index of next unique field
+ for i := 0; i < len(flds); {
+ name := flds[i].name
+ if i == len(flds)-1 || // last field
+ name != flds[i+1].name || // field i has unique field name
+ len(flds[i].idx) < len(flds[i+1].idx) || // field i is at a less nested level than field i+1
+ (flds[i].tagged && !flds[i+1].tagged) { // field i is tagged while field i+1 is not
+ flds[j] = flds[i]
+ j++
+ }
+
+ // Skip fields with the same field name.
+ for i++; i < len(flds) && name == flds[i].name; i++ { //nolint:revive
+ }
+ }
+ if j != len(flds) {
+ flds = flds[:j]
+ }
+
+ // Sort fields by field index
+ sort.Sort(&indexFieldSorter{flds})
+
+ return flds, structOptions
+}
+
+// appendFields appends type t's exportable fields to flds and anonymous struct fields to nTypes .
+func appendFields(
+ t reflect.Type,
+ idx []int,
+ flds fields,
+ nTypes map[reflect.Type][][]int,
+) (
+ _flds fields,
+ _nTypes map[reflect.Type][][]int,
+) {
+ for i := 0; i < t.NumField(); i++ {
+ f := t.Field(i)
+
+ ft := f.Type
+ for ft.Kind() == reflect.Ptr {
+ ft = ft.Elem()
+ }
+
+ if !isFieldExportable(f, ft.Kind()) {
+ continue
+ }
+
+ tag := f.Tag.Get("cbor")
+ if tag == "" {
+ tag = f.Tag.Get("json")
+ }
+ if tag == "-" {
+ continue
+ }
+
+ tagged := tag != ""
+
+ // Parse field tag options
+ var tagFieldName string
+ var omitempty, keyasint bool
+ for j := 0; tag != ""; j++ {
+ var token string
+ idx := strings.IndexByte(tag, ',')
+ if idx == -1 {
+ token, tag = tag, ""
+ } else {
+ token, tag = tag[:idx], tag[idx+1:]
+ }
+ if j == 0 {
+ tagFieldName = token
+ } else {
+ switch token {
+ case "omitempty":
+ omitempty = true
+ case "keyasint":
+ keyasint = true
+ }
+ }
+ }
+
+ fieldName := tagFieldName
+ if tagFieldName == "" {
+ fieldName = f.Name
+ }
+
+ fIdx := make([]int, len(idx)+1)
+ copy(fIdx, idx)
+ fIdx[len(fIdx)-1] = i
+
+ if !f.Anonymous || ft.Kind() != reflect.Struct || tagFieldName != "" {
+ flds = append(flds, &field{
+ name: fieldName,
+ idx: fIdx,
+ typ: f.Type,
+ omitEmpty: omitempty,
+ keyAsInt: keyasint,
+ tagged: tagged})
+ } else {
+ if nTypes == nil {
+ nTypes = make(map[reflect.Type][][]int)
+ }
+ nTypes[ft] = append(nTypes[ft], fIdx)
+ }
+ }
+
+ return flds, nTypes
+}
+
+// isFieldExportable returns true if f is an exportable (regular or anonymous) field or
+// a nonexportable anonymous field of struct type.
+// Nonexportable anonymous field of struct type can contain exportable fields.
+func isFieldExportable(f reflect.StructField, fk reflect.Kind) bool { //nolint:gocritic // ignore hugeParam
+ exportable := f.PkgPath == ""
+ return exportable || (f.Anonymous && fk == reflect.Struct)
+}
+
+type embeddedFieldNullPtrFunc func(reflect.Value) (reflect.Value, error)
+
+// getFieldValue returns field value of struct v by index. When encountering null pointer
+// to anonymous (embedded) struct field, f is called with the last traversed field value.
+func getFieldValue(v reflect.Value, idx []int, f embeddedFieldNullPtrFunc) (fv reflect.Value, err error) {
+ fv = v
+ for i, n := range idx {
+ fv = fv.Field(n)
+
+ if i < len(idx)-1 {
+ if fv.Kind() == reflect.Ptr && fv.Type().Elem().Kind() == reflect.Struct {
+ if fv.IsNil() {
+ // Null pointer to embedded struct field
+ fv, err = f(fv)
+ if err != nil || !fv.IsValid() {
+ return fv, err
+ }
+ }
+ fv = fv.Elem()
+ }
+ }
+ }
+ return fv, nil
+}
diff --git a/vendor/github.com/fxamacker/cbor/v2/tag.go b/vendor/github.com/fxamacker/cbor/v2/tag.go
new file mode 100644
index 000000000..5c4d2b7a4
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/tag.go
@@ -0,0 +1,299 @@
+package cbor
+
+import (
+ "errors"
+ "fmt"
+ "reflect"
+ "sync"
+)
+
+// Tag represents CBOR tag data, including tag number and unmarshaled tag content. Marshaling and
+// unmarshaling of tag content is subject to any encode and decode options that would apply to
+// enclosed data item if it were to appear outside of a tag.
+type Tag struct {
+ Number uint64
+ Content interface{}
+}
+
+// RawTag represents CBOR tag data, including tag number and raw tag content.
+// RawTag implements Unmarshaler and Marshaler interfaces.
+type RawTag struct {
+ Number uint64
+ Content RawMessage
+}
+
+// UnmarshalCBOR sets *t with tag number and raw tag content copied from data.
+func (t *RawTag) UnmarshalCBOR(data []byte) error {
+ if t == nil {
+ return errors.New("cbor.RawTag: UnmarshalCBOR on nil pointer")
+ }
+
+ // Decoding CBOR null and undefined to cbor.RawTag is no-op.
+ if len(data) == 1 && (data[0] == 0xf6 || data[0] == 0xf7) {
+ return nil
+ }
+
+ d := decoder{data: data, dm: defaultDecMode}
+
+ // Unmarshal tag number.
+ typ, _, num := d.getHead()
+ if typ != cborTypeTag {
+ return &UnmarshalTypeError{CBORType: typ.String(), GoType: typeRawTag.String()}
+ }
+ t.Number = num
+
+ // Unmarshal tag content.
+ c := d.data[d.off:]
+ t.Content = make([]byte, len(c))
+ copy(t.Content, c)
+ return nil
+}
+
+// MarshalCBOR returns CBOR encoding of t.
+func (t RawTag) MarshalCBOR() ([]byte, error) {
+ if t.Number == 0 && len(t.Content) == 0 {
+ // Marshal uninitialized cbor.RawTag
+ b := make([]byte, len(cborNil))
+ copy(b, cborNil)
+ return b, nil
+ }
+
+ e := getEncodeBuffer()
+
+ encodeHead(e, byte(cborTypeTag), t.Number)
+
+ content := t.Content
+ if len(content) == 0 {
+ content = cborNil
+ }
+
+ buf := make([]byte, len(e.Bytes())+len(content))
+ n := copy(buf, e.Bytes())
+ copy(buf[n:], content)
+
+ putEncodeBuffer(e)
+ return buf, nil
+}
+
+// DecTagMode specifies how decoder handles tag number.
+type DecTagMode int
+
+const (
+ // DecTagIgnored makes decoder ignore tag number (skips if present).
+ DecTagIgnored DecTagMode = iota
+
+ // DecTagOptional makes decoder verify tag number if it's present.
+ DecTagOptional
+
+ // DecTagRequired makes decoder verify tag number and tag number must be present.
+ DecTagRequired
+
+ maxDecTagMode
+)
+
+func (dtm DecTagMode) valid() bool {
+ return dtm >= 0 && dtm < maxDecTagMode
+}
+
+// EncTagMode specifies how encoder handles tag number.
+type EncTagMode int
+
+const (
+ // EncTagNone makes encoder not encode tag number.
+ EncTagNone EncTagMode = iota
+
+ // EncTagRequired makes encoder encode tag number.
+ EncTagRequired
+
+ maxEncTagMode
+)
+
+func (etm EncTagMode) valid() bool {
+ return etm >= 0 && etm < maxEncTagMode
+}
+
+// TagOptions specifies how encoder and decoder handle tag number.
+type TagOptions struct {
+ DecTag DecTagMode
+ EncTag EncTagMode
+}
+
+// TagSet is an interface to add and remove tag info. It is used by EncMode and DecMode
+// to provide CBOR tag support.
+type TagSet interface {
+ // Add adds given tag number(s), content type, and tag options to TagSet.
+ Add(opts TagOptions, contentType reflect.Type, num uint64, nestedNum ...uint64) error
+
+ // Remove removes given tag content type from TagSet.
+ Remove(contentType reflect.Type)
+
+ tagProvider
+}
+
+type tagProvider interface {
+ getTagItemFromType(t reflect.Type) *tagItem
+ getTypeFromTagNum(num []uint64) reflect.Type
+}
+
+type tagItem struct {
+ num []uint64
+ cborTagNum []byte
+ contentType reflect.Type
+ opts TagOptions
+}
+
+func (t *tagItem) equalTagNum(num []uint64) bool {
+ // Fast path to compare 1 tag number
+ if len(t.num) == 1 && len(num) == 1 && t.num[0] == num[0] {
+ return true
+ }
+
+ if len(t.num) != len(num) {
+ return false
+ }
+
+ for i := 0; i < len(t.num); i++ {
+ if t.num[i] != num[i] {
+ return false
+ }
+ }
+
+ return true
+}
+
+type (
+ tagSet map[reflect.Type]*tagItem
+
+ syncTagSet struct {
+ sync.RWMutex
+ t tagSet
+ }
+)
+
+func (t tagSet) getTagItemFromType(typ reflect.Type) *tagItem {
+ return t[typ]
+}
+
+func (t tagSet) getTypeFromTagNum(num []uint64) reflect.Type {
+ for typ, tag := range t {
+ if tag.equalTagNum(num) {
+ return typ
+ }
+ }
+ return nil
+}
+
+// NewTagSet returns TagSet (safe for concurrency).
+func NewTagSet() TagSet {
+ return &syncTagSet{t: make(map[reflect.Type]*tagItem)}
+}
+
+// Add adds given tag number(s), content type, and tag options to TagSet.
+func (t *syncTagSet) Add(opts TagOptions, contentType reflect.Type, num uint64, nestedNum ...uint64) error {
+ if contentType == nil {
+ return errors.New("cbor: cannot add nil content type to TagSet")
+ }
+ for contentType.Kind() == reflect.Ptr {
+ contentType = contentType.Elem()
+ }
+ tag, err := newTagItem(opts, contentType, num, nestedNum...)
+ if err != nil {
+ return err
+ }
+ t.Lock()
+ defer t.Unlock()
+ for typ, ti := range t.t {
+ if typ == contentType {
+ return errors.New("cbor: content type " + contentType.String() + " already exists in TagSet")
+ }
+ if ti.equalTagNum(tag.num) {
+ return fmt.Errorf("cbor: tag number %v already exists in TagSet", tag.num)
+ }
+ }
+ t.t[contentType] = tag
+ return nil
+}
+
+// Remove removes given tag content type from TagSet.
+func (t *syncTagSet) Remove(contentType reflect.Type) {
+ for contentType.Kind() == reflect.Ptr {
+ contentType = contentType.Elem()
+ }
+ t.Lock()
+ delete(t.t, contentType)
+ t.Unlock()
+}
+
+func (t *syncTagSet) getTagItemFromType(typ reflect.Type) *tagItem {
+ t.RLock()
+ ti := t.t[typ]
+ t.RUnlock()
+ return ti
+}
+
+func (t *syncTagSet) getTypeFromTagNum(num []uint64) reflect.Type {
+ t.RLock()
+ rt := t.t.getTypeFromTagNum(num)
+ t.RUnlock()
+ return rt
+}
+
+func newTagItem(opts TagOptions, contentType reflect.Type, num uint64, nestedNum ...uint64) (*tagItem, error) {
+ if opts.DecTag == DecTagIgnored && opts.EncTag == EncTagNone {
+ return nil, errors.New("cbor: cannot add tag with DecTagIgnored and EncTagNone options to TagSet")
+ }
+ if contentType.PkgPath() == "" || contentType.Kind() == reflect.Interface {
+ return nil, errors.New("cbor: can only add named types to TagSet, got " + contentType.String())
+ }
+ if contentType == typeTime {
+ return nil, errors.New("cbor: cannot add time.Time to TagSet, use EncOptions.TimeTag and DecOptions.TimeTag instead")
+ }
+ if contentType == typeBigInt {
+ return nil, errors.New("cbor: cannot add big.Int to TagSet, it's built-in and supported automatically")
+ }
+ if contentType == typeTag {
+ return nil, errors.New("cbor: cannot add cbor.Tag to TagSet")
+ }
+ if contentType == typeRawTag {
+ return nil, errors.New("cbor: cannot add cbor.RawTag to TagSet")
+ }
+ if num == 0 || num == 1 {
+ return nil, errors.New("cbor: cannot add tag number 0 or 1 to TagSet, use EncOptions.TimeTag and DecOptions.TimeTag instead")
+ }
+ if num == 2 || num == 3 {
+ return nil, errors.New("cbor: cannot add tag number 2 or 3 to TagSet, it's built-in and supported automatically")
+ }
+ if num == tagNumSelfDescribedCBOR {
+ return nil, errors.New("cbor: cannot add tag number 55799 to TagSet, it's built-in and ignored automatically")
+ }
+
+ te := tagItem{num: []uint64{num}, opts: opts, contentType: contentType}
+ te.num = append(te.num, nestedNum...)
+
+ // Cache encoded tag numbers
+ e := getEncodeBuffer()
+ for _, n := range te.num {
+ encodeHead(e, byte(cborTypeTag), n)
+ }
+ te.cborTagNum = make([]byte, e.Len())
+ copy(te.cborTagNum, e.Bytes())
+ putEncodeBuffer(e)
+
+ return &te, nil
+}
+
+var (
+ typeTag = reflect.TypeOf(Tag{})
+ typeRawTag = reflect.TypeOf(RawTag{})
+)
+
+// WrongTagError describes mismatch between CBOR tag and registered tag.
+type WrongTagError struct {
+ RegisteredType reflect.Type
+ RegisteredTagNum []uint64
+ TagNum []uint64
+}
+
+func (e *WrongTagError) Error() string {
+ return fmt.Sprintf("cbor: wrong tag number for %s, got %v, expected %v", e.RegisteredType.String(), e.TagNum, e.RegisteredTagNum)
+}
diff --git a/vendor/github.com/fxamacker/cbor/v2/valid.go b/vendor/github.com/fxamacker/cbor/v2/valid.go
new file mode 100644
index 000000000..b40793b95
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/valid.go
@@ -0,0 +1,394 @@
+// Copyright (c) Faye Amacker. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+package cbor
+
+import (
+ "encoding/binary"
+ "errors"
+ "io"
+ "math"
+ "strconv"
+
+ "github.com/x448/float16"
+)
+
+// SyntaxError is a description of a CBOR syntax error.
+type SyntaxError struct {
+ msg string
+}
+
+func (e *SyntaxError) Error() string { return e.msg }
+
+// SemanticError is a description of a CBOR semantic error.
+type SemanticError struct {
+ msg string
+}
+
+func (e *SemanticError) Error() string { return e.msg }
+
+// MaxNestedLevelError indicates exceeded max nested level of any combination of CBOR arrays/maps/tags.
+type MaxNestedLevelError struct {
+ maxNestedLevels int
+}
+
+func (e *MaxNestedLevelError) Error() string {
+ return "cbor: exceeded max nested level " + strconv.Itoa(e.maxNestedLevels)
+}
+
+// MaxArrayElementsError indicates exceeded max number of elements for CBOR arrays.
+type MaxArrayElementsError struct {
+ maxArrayElements int
+}
+
+func (e *MaxArrayElementsError) Error() string {
+ return "cbor: exceeded max number of elements " + strconv.Itoa(e.maxArrayElements) + " for CBOR array"
+}
+
+// MaxMapPairsError indicates exceeded max number of key-value pairs for CBOR maps.
+type MaxMapPairsError struct {
+ maxMapPairs int
+}
+
+func (e *MaxMapPairsError) Error() string {
+ return "cbor: exceeded max number of key-value pairs " + strconv.Itoa(e.maxMapPairs) + " for CBOR map"
+}
+
+// IndefiniteLengthError indicates found disallowed indefinite length items.
+type IndefiniteLengthError struct {
+ t cborType
+}
+
+func (e *IndefiniteLengthError) Error() string {
+ return "cbor: indefinite-length " + e.t.String() + " isn't allowed"
+}
+
+// TagsMdError indicates found disallowed CBOR tags.
+type TagsMdError struct {
+}
+
+func (e *TagsMdError) Error() string {
+ return "cbor: CBOR tag isn't allowed"
+}
+
+// ExtraneousDataError indicates found extraneous data following well-formed CBOR data item.
+type ExtraneousDataError struct {
+ numOfBytes int // number of bytes of extraneous data
+ index int // location of extraneous data
+}
+
+func (e *ExtraneousDataError) Error() string {
+ return "cbor: " + strconv.Itoa(e.numOfBytes) + " bytes of extraneous data starting at index " + strconv.Itoa(e.index)
+}
+
+// wellformed checks whether the CBOR data item is well-formed.
+// allowExtraData indicates if extraneous data is allowed after the CBOR data item.
+// - use allowExtraData = true when using Decoder.Decode()
+// - use allowExtraData = false when using Unmarshal()
+func (d *decoder) wellformed(allowExtraData bool, checkBuiltinTags bool) error {
+ if len(d.data) == d.off {
+ return io.EOF
+ }
+ _, err := d.wellformedInternal(0, checkBuiltinTags)
+ if err == nil {
+ if !allowExtraData && d.off != len(d.data) {
+ err = &ExtraneousDataError{len(d.data) - d.off, d.off}
+ }
+ }
+ return err
+}
+
+// wellformedInternal checks data's well-formedness and returns max depth and error.
+func (d *decoder) wellformedInternal(depth int, checkBuiltinTags bool) (int, error) { //nolint:gocyclo
+ t, _, val, indefiniteLength, err := d.wellformedHeadWithIndefiniteLengthFlag()
+ if err != nil {
+ return 0, err
+ }
+
+ switch t {
+ case cborTypeByteString, cborTypeTextString:
+ if indefiniteLength {
+ if d.dm.indefLength == IndefLengthForbidden {
+ return 0, &IndefiniteLengthError{t}
+ }
+ return d.wellformedIndefiniteString(t, depth, checkBuiltinTags)
+ }
+ valInt := int(val)
+ if valInt < 0 {
+ // Detect integer overflow
+ return 0, errors.New("cbor: " + t.String() + " length " + strconv.FormatUint(val, 10) + " is too large, causing integer overflow")
+ }
+ if len(d.data)-d.off < valInt { // valInt+off may overflow integer
+ return 0, io.ErrUnexpectedEOF
+ }
+ d.off += valInt
+
+ case cborTypeArray, cborTypeMap:
+ depth++
+ if depth > d.dm.maxNestedLevels {
+ return 0, &MaxNestedLevelError{d.dm.maxNestedLevels}
+ }
+
+ if indefiniteLength {
+ if d.dm.indefLength == IndefLengthForbidden {
+ return 0, &IndefiniteLengthError{t}
+ }
+ return d.wellformedIndefiniteArrayOrMap(t, depth, checkBuiltinTags)
+ }
+
+ valInt := int(val)
+ if valInt < 0 {
+ // Detect integer overflow
+ return 0, errors.New("cbor: " + t.String() + " length " + strconv.FormatUint(val, 10) + " is too large, it would cause integer overflow")
+ }
+
+ if t == cborTypeArray {
+ if valInt > d.dm.maxArrayElements {
+ return 0, &MaxArrayElementsError{d.dm.maxArrayElements}
+ }
+ } else {
+ if valInt > d.dm.maxMapPairs {
+ return 0, &MaxMapPairsError{d.dm.maxMapPairs}
+ }
+ }
+
+ count := 1
+ if t == cborTypeMap {
+ count = 2
+ }
+ maxDepth := depth
+ for j := 0; j < count; j++ {
+ for i := 0; i < valInt; i++ {
+ var dpt int
+ if dpt, err = d.wellformedInternal(depth, checkBuiltinTags); err != nil {
+ return 0, err
+ }
+ if dpt > maxDepth {
+ maxDepth = dpt // Save max depth
+ }
+ }
+ }
+ depth = maxDepth
+
+ case cborTypeTag:
+ if d.dm.tagsMd == TagsForbidden {
+ return 0, &TagsMdError{}
+ }
+
+ tagNum := val
+
+ // Scan nested tag numbers to avoid recursion.
+ for {
+ if len(d.data) == d.off { // Tag number must be followed by tag content.
+ return 0, io.ErrUnexpectedEOF
+ }
+ if checkBuiltinTags {
+ err = validBuiltinTag(tagNum, d.data[d.off])
+ if err != nil {
+ return 0, err
+ }
+ }
+ if d.dm.bignumTag == BignumTagForbidden && (tagNum == 2 || tagNum == 3) {
+ return 0, &UnacceptableDataItemError{
+ CBORType: cborTypeTag.String(),
+ Message: "bignum",
+ }
+ }
+ if getType(d.data[d.off]) != cborTypeTag {
+ break
+ }
+ if _, _, tagNum, err = d.wellformedHead(); err != nil {
+ return 0, err
+ }
+ depth++
+ if depth > d.dm.maxNestedLevels {
+ return 0, &MaxNestedLevelError{d.dm.maxNestedLevels}
+ }
+ }
+ // Check tag content.
+ return d.wellformedInternal(depth, checkBuiltinTags)
+ }
+
+ return depth, nil
+}
+
+// wellformedIndefiniteString checks indefinite length byte/text string's well-formedness and returns max depth and error.
+func (d *decoder) wellformedIndefiniteString(t cborType, depth int, checkBuiltinTags bool) (int, error) {
+ var err error
+ for {
+ if len(d.data) == d.off {
+ return 0, io.ErrUnexpectedEOF
+ }
+ if isBreakFlag(d.data[d.off]) {
+ d.off++
+ break
+ }
+ // Peek ahead to get next type and indefinite length status.
+ nt, ai := parseInitialByte(d.data[d.off])
+ if t != nt {
+ return 0, &SyntaxError{"cbor: wrong element type " + nt.String() + " for indefinite-length " + t.String()}
+ }
+ if additionalInformation(ai).isIndefiniteLength() {
+ return 0, &SyntaxError{"cbor: indefinite-length " + t.String() + " chunk is not definite-length"}
+ }
+ if depth, err = d.wellformedInternal(depth, checkBuiltinTags); err != nil {
+ return 0, err
+ }
+ }
+ return depth, nil
+}
+
+// wellformedIndefiniteArrayOrMap checks indefinite length array/map's well-formedness and returns max depth and error.
+func (d *decoder) wellformedIndefiniteArrayOrMap(t cborType, depth int, checkBuiltinTags bool) (int, error) {
+ var err error
+ maxDepth := depth
+ i := 0
+ for {
+ if len(d.data) == d.off {
+ return 0, io.ErrUnexpectedEOF
+ }
+ if isBreakFlag(d.data[d.off]) {
+ d.off++
+ break
+ }
+ var dpt int
+ if dpt, err = d.wellformedInternal(depth, checkBuiltinTags); err != nil {
+ return 0, err
+ }
+ if dpt > maxDepth {
+ maxDepth = dpt
+ }
+ i++
+ if t == cborTypeArray {
+ if i > d.dm.maxArrayElements {
+ return 0, &MaxArrayElementsError{d.dm.maxArrayElements}
+ }
+ } else {
+ if i%2 == 0 && i/2 > d.dm.maxMapPairs {
+ return 0, &MaxMapPairsError{d.dm.maxMapPairs}
+ }
+ }
+ }
+ if t == cborTypeMap && i%2 == 1 {
+ return 0, &SyntaxError{"cbor: unexpected \"break\" code"}
+ }
+ return maxDepth, nil
+}
+
+func (d *decoder) wellformedHeadWithIndefiniteLengthFlag() (
+ t cborType,
+ ai byte,
+ val uint64,
+ indefiniteLength bool,
+ err error,
+) {
+ t, ai, val, err = d.wellformedHead()
+ if err != nil {
+ return
+ }
+ indefiniteLength = additionalInformation(ai).isIndefiniteLength()
+ return
+}
+
+func (d *decoder) wellformedHead() (t cborType, ai byte, val uint64, err error) {
+ dataLen := len(d.data) - d.off
+ if dataLen == 0 {
+ return 0, 0, 0, io.ErrUnexpectedEOF
+ }
+
+ t, ai = parseInitialByte(d.data[d.off])
+ val = uint64(ai)
+ d.off++
+ dataLen--
+
+ if ai <= maxAdditionalInformationWithoutArgument {
+ return t, ai, val, nil
+ }
+
+ if ai == additionalInformationWith1ByteArgument {
+ const argumentSize = 1
+ if dataLen < argumentSize {
+ return 0, 0, 0, io.ErrUnexpectedEOF
+ }
+ val = uint64(d.data[d.off])
+ d.off++
+ if t == cborTypePrimitives && val < 32 {
+ return 0, 0, 0, &SyntaxError{"cbor: invalid simple value " + strconv.Itoa(int(val)) + " for type " + t.String()}
+ }
+ return t, ai, val, nil
+ }
+
+ if ai == additionalInformationWith2ByteArgument {
+ const argumentSize = 2
+ if dataLen < argumentSize {
+ return 0, 0, 0, io.ErrUnexpectedEOF
+ }
+ val = uint64(binary.BigEndian.Uint16(d.data[d.off : d.off+argumentSize]))
+ d.off += argumentSize
+ if t == cborTypePrimitives {
+ if err := d.acceptableFloat(float64(float16.Frombits(uint16(val)).Float32())); err != nil {
+ return 0, 0, 0, err
+ }
+ }
+ return t, ai, val, nil
+ }
+
+ if ai == additionalInformationWith4ByteArgument {
+ const argumentSize = 4
+ if dataLen < argumentSize {
+ return 0, 0, 0, io.ErrUnexpectedEOF
+ }
+ val = uint64(binary.BigEndian.Uint32(d.data[d.off : d.off+argumentSize]))
+ d.off += argumentSize
+ if t == cborTypePrimitives {
+ if err := d.acceptableFloat(float64(math.Float32frombits(uint32(val)))); err != nil {
+ return 0, 0, 0, err
+ }
+ }
+ return t, ai, val, nil
+ }
+
+ if ai == additionalInformationWith8ByteArgument {
+ const argumentSize = 8
+ if dataLen < argumentSize {
+ return 0, 0, 0, io.ErrUnexpectedEOF
+ }
+ val = binary.BigEndian.Uint64(d.data[d.off : d.off+argumentSize])
+ d.off += argumentSize
+ if t == cborTypePrimitives {
+ if err := d.acceptableFloat(math.Float64frombits(val)); err != nil {
+ return 0, 0, 0, err
+ }
+ }
+ return t, ai, val, nil
+ }
+
+ if additionalInformation(ai).isIndefiniteLength() {
+ switch t {
+ case cborTypePositiveInt, cborTypeNegativeInt, cborTypeTag:
+ return 0, 0, 0, &SyntaxError{"cbor: invalid additional information " + strconv.Itoa(int(ai)) + " for type " + t.String()}
+ case cborTypePrimitives: // 0xff (break code) should not be outside wellformedIndefinite().
+ return 0, 0, 0, &SyntaxError{"cbor: unexpected \"break\" code"}
+ }
+ return t, ai, val, nil
+ }
+
+ // ai == 28, 29, 30
+ return 0, 0, 0, &SyntaxError{"cbor: invalid additional information " + strconv.Itoa(int(ai)) + " for type " + t.String()}
+}
+
+func (d *decoder) acceptableFloat(f float64) error {
+ switch {
+ case d.dm.nanDec == NaNDecodeForbidden && math.IsNaN(f):
+ return &UnacceptableDataItemError{
+ CBORType: cborTypePrimitives.String(),
+ Message: "floating-point NaN",
+ }
+ case d.dm.infDec == InfDecodeForbidden && math.IsInf(f, 0):
+ return &UnacceptableDataItemError{
+ CBORType: cborTypePrimitives.String(),
+ Message: "floating-point infinity",
+ }
+ }
+ return nil
+}
diff --git a/vendor/github.com/go-logr/logr/.golangci.yaml b/vendor/github.com/go-logr/logr/.golangci.yaml
index 94ff801df..0cffafa7b 100644
--- a/vendor/github.com/go-logr/logr/.golangci.yaml
+++ b/vendor/github.com/go-logr/logr/.golangci.yaml
@@ -6,7 +6,6 @@ linters:
disable-all: true
enable:
- asciicheck
- - deadcode
- errcheck
- forcetypeassert
- gocritic
@@ -18,10 +17,8 @@ linters:
- misspell
- revive
- staticcheck
- - structcheck
- typecheck
- unused
- - varcheck
issues:
exclude-use-default: false
diff --git a/vendor/github.com/go-logr/logr/README.md b/vendor/github.com/go-logr/logr/README.md
index ad825f5f0..7c7f0c69c 100644
--- a/vendor/github.com/go-logr/logr/README.md
+++ b/vendor/github.com/go-logr/logr/README.md
@@ -1,6 +1,8 @@
# A minimal logging API for Go
[![Go Reference](https://pkg.go.dev/badge/github.com/go-logr/logr.svg)](https://pkg.go.dev/github.com/go-logr/logr)
+[![Go Report Card](https://goreportcard.com/badge/github.com/go-logr/logr)](https://goreportcard.com/report/github.com/go-logr/logr)
+[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/go-logr/logr/badge)](https://securityscorecards.dev/viewer/?platform=github.com&org=go-logr&repo=logr)
logr offers an(other) opinion on how Go programs and libraries can do logging
without becoming coupled to a particular logging implementation. This is not
@@ -73,6 +75,30 @@ received:
If the Go standard library had defined an interface for logging, this project
probably would not be needed. Alas, here we are.
+When the Go developers started developing such an interface with
+[slog](https://github.com/golang/go/issues/56345), they adopted some of the
+logr design but also left out some parts and changed others:
+
+| Feature | logr | slog |
+|---------|------|------|
+| High-level API | `Logger` (passed by value) | `Logger` (passed by [pointer](https://github.com/golang/go/issues/59126)) |
+| Low-level API | `LogSink` | `Handler` |
+| Stack unwinding | done by `LogSink` | done by `Logger` |
+| Skipping helper functions | `WithCallDepth`, `WithCallStackHelper` | [not supported by Logger](https://github.com/golang/go/issues/59145) |
+| Generating a value for logging on demand | `Marshaler` | `LogValuer` |
+| Log levels | >= 0, higher meaning "less important" | positive and negative, with 0 for "info" and higher meaning "more important" |
+| Error log entries | always logged, don't have a verbosity level | normal log entries with level >= `LevelError` |
+| Passing logger via context | `NewContext`, `FromContext` | no API |
+| Adding a name to a logger | `WithName` | no API |
+| Modify verbosity of log entries in a call chain | `V` | no API |
+| Grouping of key/value pairs | not supported | `WithGroup`, `GroupValue` |
+| Pass context for extracting additional values | no API | API variants like `InfoCtx` |
+
+The high-level slog API is explicitly meant to be one of many different APIs
+that can be layered on top of a shared `slog.Handler`. logr is one such
+alternative API, with [interoperability](#slog-interoperability) provided by
+some conversion functions.
+
### Inspiration
Before you consider this package, please read [this blog post by the
@@ -105,14 +131,115 @@ with higher verbosity means more (and less important) logs will be generated.
There are implementations for the following logging libraries:
- **a function** (can bridge to non-structured libraries): [funcr](https://github.com/go-logr/logr/tree/master/funcr)
+- **a testing.T** (for use in Go tests, with JSON-like output): [testr](https://github.com/go-logr/logr/tree/master/testr)
- **github.com/google/glog**: [glogr](https://github.com/go-logr/glogr)
- **k8s.io/klog** (for Kubernetes): [klogr](https://git.k8s.io/klog/klogr)
+- **a testing.T** (with klog-like text output): [ktesting](https://git.k8s.io/klog/ktesting)
- **go.uber.org/zap**: [zapr](https://github.com/go-logr/zapr)
- **log** (the Go standard library logger): [stdr](https://github.com/go-logr/stdr)
- **github.com/sirupsen/logrus**: [logrusr](https://github.com/bombsimon/logrusr)
- **github.com/wojas/genericr**: [genericr](https://github.com/wojas/genericr) (makes it easy to implement your own backend)
- **logfmt** (Heroku style [logging](https://www.brandur.org/logfmt)): [logfmtr](https://github.com/iand/logfmtr)
- **github.com/rs/zerolog**: [zerologr](https://github.com/go-logr/zerologr)
+- **github.com/go-kit/log**: [gokitlogr](https://github.com/tonglil/gokitlogr) (also compatible with github.com/go-kit/kit/log since v0.12.0)
+- **bytes.Buffer** (writing to a buffer): [bufrlogr](https://github.com/tonglil/buflogr) (useful for ensuring values were logged, like during testing)
+
+## slog interoperability
+
+Interoperability goes both ways, using the `logr.Logger` API with a `slog.Handler`
+and using the `slog.Logger` API with a `logr.LogSink`. `FromSlogHandler` and
+`ToSlogHandler` convert between a `logr.Logger` and a `slog.Handler`.
+As usual, `slog.New` can be used to wrap such a `slog.Handler` in the high-level
+slog API.
+
+### Using a `logr.LogSink` as backend for slog
+
+Ideally, a logr sink implementation should support both logr and slog by
+implementing both the normal logr interface(s) and `SlogSink`. Because
+of a conflict in the parameters of the common `Enabled` method, it is [not
+possible to implement both slog.Handler and logr.Sink in the same
+type](https://github.com/golang/go/issues/59110).
+
+If both are supported, log calls can go from the high-level APIs to the backend
+without the need to convert parameters. `FromSlogHandler` and `ToSlogHandler` can
+convert back and forth without adding additional wrappers, with one exception:
+when `Logger.V` was used to adjust the verbosity for a `slog.Handler`, then
+`ToSlogHandler` has to use a wrapper which adjusts the verbosity for future
+log calls.
+
+Such an implementation should also support values that implement specific
+interfaces from both packages for logging (`logr.Marshaler`, `slog.LogValuer`,
+`slog.GroupValue`). logr does not convert those.
+
+Not supporting slog has several drawbacks:
+- Recording source code locations works correctly if the handler gets called
+ through `slog.Logger`, but may be wrong in other cases. That's because a
+ `logr.Sink` does its own stack unwinding instead of using the program counter
+ provided by the high-level API.
+- slog levels <= 0 can be mapped to logr levels by negating the level without a
+ loss of information. But all slog levels > 0 (e.g. `slog.LevelWarning` as
+ used by `slog.Logger.Warn`) must be mapped to 0 before calling the sink
+ because logr does not support "more important than info" levels.
+- The slog group concept is supported by prefixing each key in a key/value
+ pair with the group names, separated by a dot. For structured output like
+ JSON it would be better to group the key/value pairs inside an object.
+- Special slog values and interfaces don't work as expected.
+- The overhead is likely to be higher.
+
+These drawbacks are severe enough that applications using a mixture of slog and
+logr should switch to a different backend.
+
+### Using a `slog.Handler` as backend for logr
+
+Using a plain `slog.Handler` without support for logr works better than the
+other direction:
+- All logr verbosity levels can be mapped 1:1 to their corresponding slog level
+ by negating them.
+- Stack unwinding is done by the `SlogSink` and the resulting program
+ counter is passed to the `slog.Handler`.
+- Names added via `Logger.WithName` are gathered and recorded in an additional
+ attribute with `logger` as key and the names separated by slash as value.
+- `Logger.Error` is turned into a log record with `slog.LevelError` as level
+ and an additional attribute with `err` as key, if an error was provided.
+
+The main drawback is that `logr.Marshaler` will not be supported. Types should
+ideally support both `logr.Marshaler` and `slog.Valuer`. If compatibility
+with logr implementations without slog support is not important, then
+`slog.Valuer` is sufficient.
+
+### Context support for slog
+
+Storing a logger in a `context.Context` is not supported by
+slog. `NewContextWithSlogLogger` and `FromContextAsSlogLogger` can be
+used to fill this gap. They store and retrieve a `slog.Logger` pointer
+under the same context key that is also used by `NewContext` and
+`FromContext` for `logr.Logger` value.
+
+When `NewContextWithSlogLogger` is followed by `FromContext`, the latter will
+automatically convert the `slog.Logger` to a
+`logr.Logger`. `FromContextAsSlogLogger` does the same for the other direction.
+
+With this approach, binaries which use either slog or logr are as efficient as
+possible with no unnecessary allocations. This is also why the API stores a
+`slog.Logger` pointer: when storing a `slog.Handler`, creating a `slog.Logger`
+on retrieval would need to allocate one.
+
+The downside is that switching back and forth needs more allocations. Because
+logr is the API that is already in use by different packages, in particular
+Kubernetes, the recommendation is to use the `logr.Logger` API in code which
+uses contextual logging.
+
+An alternative to adding values to a logger and storing that logger in the
+context is to store the values in the context and to configure a logging
+backend to extract those values when emitting log entries. This only works when
+log calls are passed the context, which is not supported by the logr API.
+
+With the slog API, it is possible, but not
+required. https://github.com/veqryn/slog-context is a package for slog which
+provides additional support code for this approach. It also contains wrappers
+for the context functions in logr, so developers who prefer to not use the logr
+APIs directly can use those instead and the resulting code will still be
+interoperable with logr.
## FAQ
@@ -237,7 +364,9 @@ Otherwise, you can start out with `0` as "you always want to see this",
Then gradually choose levels in between as you need them, working your way
down from 10 (for debug and trace style logs) and up from 1 (for chattier
-info-type logs.)
+info-type logs). For reference, slog pre-defines -4 for debug logs
+(corresponds to 4 in logr), which matches what is
+[recommended for Kubernetes](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/logging.md#what-method-to-use).
#### How do I choose my keys?
diff --git a/vendor/github.com/go-logr/logr/SECURITY.md b/vendor/github.com/go-logr/logr/SECURITY.md
new file mode 100644
index 000000000..1ca756fc7
--- /dev/null
+++ b/vendor/github.com/go-logr/logr/SECURITY.md
@@ -0,0 +1,18 @@
+# Security Policy
+
+If you have discovered a security vulnerability in this project, please report it
+privately. **Do not disclose it as a public issue.** This gives us time to work with you
+to fix the issue before public exposure, reducing the chance that the exploit will be
+used before a patch is released.
+
+You may submit the report in the following ways:
+
+- send an email to go-logr-security@googlegroups.com
+- send us a [private vulnerability report](https://github.com/go-logr/logr/security/advisories/new)
+
+Please provide the following information in your report:
+
+- A description of the vulnerability and its impact
+- How to reproduce the issue
+
+We ask that you give us 90 days to work on a fix before public exposure.
diff --git a/vendor/github.com/go-logr/logr/context.go b/vendor/github.com/go-logr/logr/context.go
new file mode 100644
index 000000000..de8bcc3ad
--- /dev/null
+++ b/vendor/github.com/go-logr/logr/context.go
@@ -0,0 +1,33 @@
+/*
+Copyright 2023 The logr Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package logr
+
+// contextKey is how we find Loggers in a context.Context. With Go < 1.21,
+// the value is always a Logger value. With Go >= 1.21, the value can be a
+// Logger value or a slog.Logger pointer.
+type contextKey struct{}
+
+// notFoundError exists to carry an IsNotFound method.
+type notFoundError struct{}
+
+func (notFoundError) Error() string {
+ return "no logr.Logger was present"
+}
+
+func (notFoundError) IsNotFound() bool {
+ return true
+}
diff --git a/vendor/github.com/go-logr/logr/context_noslog.go b/vendor/github.com/go-logr/logr/context_noslog.go
new file mode 100644
index 000000000..f012f9a18
--- /dev/null
+++ b/vendor/github.com/go-logr/logr/context_noslog.go
@@ -0,0 +1,49 @@
+//go:build !go1.21
+// +build !go1.21
+
+/*
+Copyright 2019 The logr Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package logr
+
+import (
+ "context"
+)
+
+// FromContext returns a Logger from ctx or an error if no Logger is found.
+func FromContext(ctx context.Context) (Logger, error) {
+ if v, ok := ctx.Value(contextKey{}).(Logger); ok {
+ return v, nil
+ }
+
+ return Logger{}, notFoundError{}
+}
+
+// FromContextOrDiscard returns a Logger from ctx. If no Logger is found, this
+// returns a Logger that discards all log messages.
+func FromContextOrDiscard(ctx context.Context) Logger {
+ if v, ok := ctx.Value(contextKey{}).(Logger); ok {
+ return v
+ }
+
+ return Discard()
+}
+
+// NewContext returns a new Context, derived from ctx, which carries the
+// provided Logger.
+func NewContext(ctx context.Context, logger Logger) context.Context {
+ return context.WithValue(ctx, contextKey{}, logger)
+}
diff --git a/vendor/github.com/go-logr/logr/context_slog.go b/vendor/github.com/go-logr/logr/context_slog.go
new file mode 100644
index 000000000..065ef0b82
--- /dev/null
+++ b/vendor/github.com/go-logr/logr/context_slog.go
@@ -0,0 +1,83 @@
+//go:build go1.21
+// +build go1.21
+
+/*
+Copyright 2019 The logr Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package logr
+
+import (
+ "context"
+ "fmt"
+ "log/slog"
+)
+
+// FromContext returns a Logger from ctx or an error if no Logger is found.
+func FromContext(ctx context.Context) (Logger, error) {
+ v := ctx.Value(contextKey{})
+ if v == nil {
+ return Logger{}, notFoundError{}
+ }
+
+ switch v := v.(type) {
+ case Logger:
+ return v, nil
+ case *slog.Logger:
+ return FromSlogHandler(v.Handler()), nil
+ default:
+ // Not reached.
+ panic(fmt.Sprintf("unexpected value type for logr context key: %T", v))
+ }
+}
+
+// FromContextAsSlogLogger returns a slog.Logger from ctx or nil if no such Logger is found.
+func FromContextAsSlogLogger(ctx context.Context) *slog.Logger {
+ v := ctx.Value(contextKey{})
+ if v == nil {
+ return nil
+ }
+
+ switch v := v.(type) {
+ case Logger:
+ return slog.New(ToSlogHandler(v))
+ case *slog.Logger:
+ return v
+ default:
+ // Not reached.
+ panic(fmt.Sprintf("unexpected value type for logr context key: %T", v))
+ }
+}
+
+// FromContextOrDiscard returns a Logger from ctx. If no Logger is found, this
+// returns a Logger that discards all log messages.
+func FromContextOrDiscard(ctx context.Context) Logger {
+ if logger, err := FromContext(ctx); err == nil {
+ return logger
+ }
+ return Discard()
+}
+
+// NewContext returns a new Context, derived from ctx, which carries the
+// provided Logger.
+func NewContext(ctx context.Context, logger Logger) context.Context {
+ return context.WithValue(ctx, contextKey{}, logger)
+}
+
+// NewContextWithSlogLogger returns a new Context, derived from ctx, which carries the
+// provided slog.Logger.
+func NewContextWithSlogLogger(ctx context.Context, logger *slog.Logger) context.Context {
+ return context.WithValue(ctx, contextKey{}, logger)
+}
diff --git a/vendor/github.com/go-logr/logr/discard.go b/vendor/github.com/go-logr/logr/discard.go
index 9d92a38f1..99fe8be93 100644
--- a/vendor/github.com/go-logr/logr/discard.go
+++ b/vendor/github.com/go-logr/logr/discard.go
@@ -20,35 +20,5 @@ package logr
// used whenever the caller is not interested in the logs. Logger instances
// produced by this function always compare as equal.
func Discard() Logger {
- return Logger{
- level: 0,
- sink: discardLogSink{},
- }
-}
-
-// discardLogSink is a LogSink that discards all messages.
-type discardLogSink struct{}
-
-// Verify that it actually implements the interface
-var _ LogSink = discardLogSink{}
-
-func (l discardLogSink) Init(RuntimeInfo) {
-}
-
-func (l discardLogSink) Enabled(int) bool {
- return false
-}
-
-func (l discardLogSink) Info(int, string, ...interface{}) {
-}
-
-func (l discardLogSink) Error(error, string, ...interface{}) {
-}
-
-func (l discardLogSink) WithValues(...interface{}) LogSink {
- return l
-}
-
-func (l discardLogSink) WithName(string) LogSink {
- return l
+ return New(nil)
}
diff --git a/vendor/github.com/go-logr/logr/logr.go b/vendor/github.com/go-logr/logr/logr.go
index 44cd398c9..b4428e105 100644
--- a/vendor/github.com/go-logr/logr/logr.go
+++ b/vendor/github.com/go-logr/logr/logr.go
@@ -21,7 +21,7 @@ limitations under the License.
// to back that API. Packages in the Go ecosystem can depend on this package,
// while callers can implement logging with whatever backend is appropriate.
//
-// Usage
+// # Usage
//
// Logging is done using a Logger instance. Logger is a concrete type with
// methods, which defers the actual logging to a LogSink interface. The main
@@ -30,22 +30,28 @@ limitations under the License.
// "structured logging".
//
// With Go's standard log package, we might write:
-// log.Printf("setting target value %s", targetValue)
+//
+// log.Printf("setting target value %s", targetValue)
//
// With logr's structured logging, we'd write:
-// logger.Info("setting target", "value", targetValue)
+//
+// logger.Info("setting target", "value", targetValue)
//
// Errors are much the same. Instead of:
-// log.Printf("failed to open the pod bay door for user %s: %v", user, err)
+//
+// log.Printf("failed to open the pod bay door for user %s: %v", user, err)
//
// We'd write:
-// logger.Error(err, "failed to open the pod bay door", "user", user)
+//
+// logger.Error(err, "failed to open the pod bay door", "user", user)
//
// Info() and Error() are very similar, but they are separate methods so that
// LogSink implementations can choose to do things like attach additional
-// information (such as stack traces) on calls to Error().
+// information (such as stack traces) on calls to Error(). Error() messages are
+// always logged, regardless of the current verbosity. If there is no error
+// instance available, passing nil is valid.
//
-// Verbosity
+// # Verbosity
//
// Often we want to log information only when the application in "verbose
// mode". To write log lines that are more verbose, Logger has a V() method.
@@ -53,22 +59,25 @@ limitations under the License.
// Log-lines with V-levels that are not enabled (as per the LogSink) will not
// be written. Level V(0) is the default, and logger.V(0).Info() has the same
// meaning as logger.Info(). Negative V-levels have the same meaning as V(0).
+// Error messages do not have a verbosity level and are always logged.
//
// Where we might have written:
-// if flVerbose >= 2 {
-// log.Printf("an unusual thing happened")
-// }
+//
+// if flVerbose >= 2 {
+// log.Printf("an unusual thing happened")
+// }
//
// We can write:
-// logger.V(2).Info("an unusual thing happened")
//
-// Logger Names
+// logger.V(2).Info("an unusual thing happened")
+//
+// # Logger Names
//
// Logger instances can have name strings so that all messages logged through
// that instance have additional context. For example, you might want to add
// a subsystem name:
//
-// logger.WithName("compactor").Info("started", "time", time.Now())
+// logger.WithName("compactor").Info("started", "time", time.Now())
//
// The WithName() method returns a new Logger, which can be passed to
// constructors or other functions for further use. Repeated use of WithName()
@@ -79,25 +88,27 @@ limitations under the License.
// joining operation (e.g. whitespace, commas, periods, slashes, brackets,
// quotes, etc).
//
-// Saved Values
+// # Saved Values
//
// Logger instances can store any number of key/value pairs, which will be
// logged alongside all messages logged through that instance. For example,
// you might want to create a Logger instance per managed object:
//
// With the standard log package, we might write:
-// log.Printf("decided to set field foo to value %q for object %s/%s",
-// targetValue, object.Namespace, object.Name)
+//
+// log.Printf("decided to set field foo to value %q for object %s/%s",
+// targetValue, object.Namespace, object.Name)
//
// With logr we'd write:
-// // Elsewhere: set up the logger to log the object name.
-// obj.logger = mainLogger.WithValues(
-// "name", obj.name, "namespace", obj.namespace)
//
-// // later on...
-// obj.logger.Info("setting foo", "value", targetValue)
+// // Elsewhere: set up the logger to log the object name.
+// obj.logger = mainLogger.WithValues(
+// "name", obj.name, "namespace", obj.namespace)
+//
+// // later on...
+// obj.logger.Info("setting foo", "value", targetValue)
//
-// Best Practices
+// # Best Practices
//
// Logger has very few hard rules, with the goal that LogSink implementations
// might have a lot of freedom to differentiate. There are, however, some
@@ -112,15 +123,24 @@ limitations under the License.
// may be any Go value, but how the value is formatted is determined by the
// LogSink implementation.
//
-// Key Naming Conventions
+// Logger instances are meant to be passed around by value. Code that receives
+// such a value can call its methods without having to check whether the
+// instance is ready for use.
+//
+// The zero logger (= Logger{}) is identical to Discard() and discards all log
+// entries. Code that receives a Logger by value can simply call it, the methods
+// will never crash. For cases where passing a logger is optional, a pointer to Logger
+// should be used.
+//
+// # Key Naming Conventions
//
// Keys are not strictly required to conform to any specification or regex, but
// it is recommended that they:
-// * be human-readable and meaningful (not auto-generated or simple ordinals)
-// * be constant (not dependent on input data)
-// * contain only printable characters
-// * not contain whitespace or punctuation
-// * use lower case for simple keys and lowerCamelCase for more complex ones
+// - be human-readable and meaningful (not auto-generated or simple ordinals)
+// - be constant (not dependent on input data)
+// - contain only printable characters
+// - not contain whitespace or punctuation
+// - use lower case for simple keys and lowerCamelCase for more complex ones
//
// These guidelines help ensure that log data is processed properly regardless
// of the log implementation. For example, log implementations will try to
@@ -129,51 +149,54 @@ limitations under the License.
// While users are generally free to use key names of their choice, it's
// generally best to avoid using the following keys, as they're frequently used
// by implementations:
-// * "caller": the calling information (file/line) of a particular log line
-// * "error": the underlying error value in the `Error` method
-// * "level": the log level
-// * "logger": the name of the associated logger
-// * "msg": the log message
-// * "stacktrace": the stack trace associated with a particular log line or
-// error (often from the `Error` message)
-// * "ts": the timestamp for a log line
+// - "caller": the calling information (file/line) of a particular log line
+// - "error": the underlying error value in the `Error` method
+// - "level": the log level
+// - "logger": the name of the associated logger
+// - "msg": the log message
+// - "stacktrace": the stack trace associated with a particular log line or
+// error (often from the `Error` message)
+// - "ts": the timestamp for a log line
//
// Implementations are encouraged to make use of these keys to represent the
// above concepts, when necessary (for example, in a pure-JSON output form, it
// would be necessary to represent at least message and timestamp as ordinary
// named values).
//
-// Break Glass
+// # Break Glass
//
// Implementations may choose to give callers access to the underlying
// logging implementation. The recommended pattern for this is:
-// // Underlier exposes access to the underlying logging implementation.
-// // Since callers only have a logr.Logger, they have to know which
-// // implementation is in use, so this interface is less of an abstraction
-// // and more of way to test type conversion.
-// type Underlier interface {
-// GetUnderlying()
-// }
+//
+// // Underlier exposes access to the underlying logging implementation.
+// // Since callers only have a logr.Logger, they have to know which
+// // implementation is in use, so this interface is less of an abstraction
+// // and more of way to test type conversion.
+// type Underlier interface {
+// GetUnderlying()
+// }
//
// Logger grants access to the sink to enable type assertions like this:
-// func DoSomethingWithImpl(log logr.Logger) {
-// if underlier, ok := log.GetSink()(impl.Underlier) {
-// implLogger := underlier.GetUnderlying()
-// ...
-// }
-// }
+//
+// func DoSomethingWithImpl(log logr.Logger) {
+// if underlier, ok := log.GetSink().(impl.Underlier); ok {
+// implLogger := underlier.GetUnderlying()
+// ...
+// }
+// }
//
// Custom `With*` functions can be implemented by copying the complete
// Logger struct and replacing the sink in the copy:
-// // WithFooBar changes the foobar parameter in the log sink and returns a
-// // new logger with that modified sink. It does nothing for loggers where
-// // the sink doesn't support that parameter.
-// func WithFoobar(log logr.Logger, foobar int) logr.Logger {
-// if foobarLogSink, ok := log.GetSink()(FoobarSink); ok {
-// log = log.WithSink(foobarLogSink.WithFooBar(foobar))
-// }
-// return log
-// }
+//
+// // WithFooBar changes the foobar parameter in the log sink and returns a
+// // new logger with that modified sink. It does nothing for loggers where
+// // the sink doesn't support that parameter.
+// func WithFoobar(log logr.Logger, foobar int) logr.Logger {
+// if foobarLogSink, ok := log.GetSink().(FoobarSink); ok {
+// log = log.WithSink(foobarLogSink.WithFooBar(foobar))
+// }
+// return log
+// }
//
// Don't use New to construct a new Logger with a LogSink retrieved from an
// existing Logger. Source code attribution might not work correctly and
@@ -184,16 +207,15 @@ limitations under the License.
// those.
package logr
-import (
- "context"
-)
-
// New returns a new Logger instance. This is primarily used by libraries
-// implementing LogSink, rather than end users.
+// implementing LogSink, rather than end users. Passing a nil sink will create
+// a Logger which discards all log lines.
func New(sink LogSink) Logger {
logger := Logger{}
logger.setSink(sink)
- sink.Init(runtimeInfo)
+ if sink != nil {
+ sink.Init(runtimeInfo)
+ }
return logger
}
@@ -232,7 +254,13 @@ type Logger struct {
// Enabled tests whether this Logger is enabled. For example, commandline
// flags might be used to set the logging verbosity and disable some info logs.
func (l Logger) Enabled() bool {
- return l.sink.Enabled(l.level)
+ // Some implementations of LogSink look at the caller in Enabled (e.g.
+ // different verbosity levels per package or file), but we only pass one
+ // CallDepth in (via Init). This means that all calls from Logger to the
+ // LogSink's Enabled, Info, and Error methods must have the same number of
+ // frames. In other words, Logger methods can't call other Logger methods
+ // which call these LogSink methods unless we do it the same in all paths.
+ return l.sink != nil && l.sink.Enabled(l.level)
}
// Info logs a non-error message with the given key/value pairs as context.
@@ -241,8 +269,11 @@ func (l Logger) Enabled() bool {
// line. The key/value pairs can then be used to add additional variable
// information. The key/value pairs must alternate string keys and arbitrary
// values.
-func (l Logger) Info(msg string, keysAndValues ...interface{}) {
- if l.Enabled() {
+func (l Logger) Info(msg string, keysAndValues ...any) {
+ if l.sink == nil {
+ return
+ }
+ if l.sink.Enabled(l.level) { // see comment in Enabled
if withHelper, ok := l.sink.(CallStackHelperLogSink); ok {
withHelper.GetCallStackHelper()()
}
@@ -253,12 +284,17 @@ func (l Logger) Info(msg string, keysAndValues ...interface{}) {
// Error logs an error, with the given message and key/value pairs as context.
// It functions similarly to Info, but may have unique behavior, and should be
// preferred for logging errors (see the package documentations for more
-// information).
+// information). The log message will always be emitted, regardless of
+// verbosity level.
//
// The msg argument should be used to add context to any underlying error,
// while the err argument should be used to attach the actual error that
-// triggered this log line, if present.
-func (l Logger) Error(err error, msg string, keysAndValues ...interface{}) {
+// triggered this log line, if present. The err parameter is optional
+// and nil may be passed instead of an error instance.
+func (l Logger) Error(err error, msg string, keysAndValues ...any) {
+ if l.sink == nil {
+ return
+ }
if withHelper, ok := l.sink.(CallStackHelperLogSink); ok {
withHelper.GetCallStackHelper()()
}
@@ -270,6 +306,9 @@ func (l Logger) Error(err error, msg string, keysAndValues ...interface{}) {
// level means a log message is less important. Negative V-levels are treated
// as 0.
func (l Logger) V(level int) Logger {
+ if l.sink == nil {
+ return l
+ }
if level < 0 {
level = 0
}
@@ -277,9 +316,19 @@ func (l Logger) V(level int) Logger {
return l
}
+// GetV returns the verbosity level of the logger. If the logger's LogSink is
+// nil as in the Discard logger, this will always return 0.
+func (l Logger) GetV() int {
+ // 0 if l.sink nil because of the if check in V above.
+ return l.level
+}
+
// WithValues returns a new Logger instance with additional key/value pairs.
// See Info for documentation on how key/value pairs work.
-func (l Logger) WithValues(keysAndValues ...interface{}) Logger {
+func (l Logger) WithValues(keysAndValues ...any) Logger {
+ if l.sink == nil {
+ return l
+ }
l.setSink(l.sink.WithValues(keysAndValues...))
return l
}
@@ -290,6 +339,9 @@ func (l Logger) WithValues(keysAndValues ...interface{}) Logger {
// contain only letters, digits, and hyphens (see the package documentation for
// more information).
func (l Logger) WithName(name string) Logger {
+ if l.sink == nil {
+ return l
+ }
l.setSink(l.sink.WithName(name))
return l
}
@@ -310,6 +362,9 @@ func (l Logger) WithName(name string) Logger {
// WithCallDepth(1) because it works with implementions that support the
// CallDepthLogSink and/or CallStackHelperLogSink interfaces.
func (l Logger) WithCallDepth(depth int) Logger {
+ if l.sink == nil {
+ return l
+ }
if withCallDepth, ok := l.sink.(CallDepthLogSink); ok {
l.setSink(withCallDepth.WithCallDepth(depth))
}
@@ -331,6 +386,9 @@ func (l Logger) WithCallDepth(depth int) Logger {
// implementation does not support either of these, the original Logger will be
// returned.
func (l Logger) WithCallStackHelper() (func(), Logger) {
+ if l.sink == nil {
+ return func() {}, l
+ }
var helper func()
if withCallDepth, ok := l.sink.(CallDepthLogSink); ok {
l.setSink(withCallDepth.WithCallDepth(1))
@@ -343,43 +401,9 @@ func (l Logger) WithCallStackHelper() (func(), Logger) {
return helper, l
}
-// contextKey is how we find Loggers in a context.Context.
-type contextKey struct{}
-
-// FromContext returns a Logger from ctx or an error if no Logger is found.
-func FromContext(ctx context.Context) (Logger, error) {
- if v, ok := ctx.Value(contextKey{}).(Logger); ok {
- return v, nil
- }
-
- return Logger{}, notFoundError{}
-}
-
-// notFoundError exists to carry an IsNotFound method.
-type notFoundError struct{}
-
-func (notFoundError) Error() string {
- return "no logr.Logger was present"
-}
-
-func (notFoundError) IsNotFound() bool {
- return true
-}
-
-// FromContextOrDiscard returns a Logger from ctx. If no Logger is found, this
-// returns a Logger that discards all log messages.
-func FromContextOrDiscard(ctx context.Context) Logger {
- if v, ok := ctx.Value(contextKey{}).(Logger); ok {
- return v
- }
-
- return Discard()
-}
-
-// NewContext returns a new Context, derived from ctx, which carries the
-// provided Logger.
-func NewContext(ctx context.Context, logger Logger) context.Context {
- return context.WithValue(ctx, contextKey{}, logger)
+// IsZero returns true if this logger is an uninitialized zero value
+func (l Logger) IsZero() bool {
+ return l.sink == nil
}
// RuntimeInfo holds information that the logr "core" library knows which
@@ -413,22 +437,22 @@ type LogSink interface {
// The level argument is provided for optional logging. This method will
// only be called when Enabled(level) is true. See Logger.Info for more
// details.
- Info(level int, msg string, keysAndValues ...interface{})
+ Info(level int, msg string, keysAndValues ...any)
// Error logs an error, with the given message and key/value pairs as
// context. See Logger.Error for more details.
- Error(err error, msg string, keysAndValues ...interface{})
+ Error(err error, msg string, keysAndValues ...any)
// WithValues returns a new LogSink with additional key/value pairs. See
// Logger.WithValues for more details.
- WithValues(keysAndValues ...interface{}) LogSink
+ WithValues(keysAndValues ...any) LogSink
// WithName returns a new LogSink with the specified name appended. See
// Logger.WithName for more details.
WithName(name string) LogSink
}
-// CallDepthLogSink represents a Logger that knows how to climb the call stack
+// CallDepthLogSink represents a LogSink that knows how to climb the call stack
// to identify the original call site and can offset the depth by a specified
// number of frames. This is useful for users who have helper functions
// between the "real" call site and the actual calls to Logger methods.
@@ -453,7 +477,7 @@ type CallDepthLogSink interface {
WithCallDepth(depth int) LogSink
}
-// CallStackHelperLogSink represents a Logger that knows how to climb
+// CallStackHelperLogSink represents a LogSink that knows how to climb
// the call stack to identify the original call site and can skip
// intermediate helper functions if they mark themselves as
// helper. Go's testing package uses that approach.
@@ -492,5 +516,5 @@ type Marshaler interface {
// with exported fields
//
// It may return any value of any type.
- MarshalLog() interface{}
+ MarshalLog() any
}
diff --git a/vendor/github.com/go-logr/logr/sloghandler.go b/vendor/github.com/go-logr/logr/sloghandler.go
new file mode 100644
index 000000000..82d1ba494
--- /dev/null
+++ b/vendor/github.com/go-logr/logr/sloghandler.go
@@ -0,0 +1,192 @@
+//go:build go1.21
+// +build go1.21
+
+/*
+Copyright 2023 The logr Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package logr
+
+import (
+ "context"
+ "log/slog"
+)
+
+type slogHandler struct {
+ // May be nil, in which case all logs get discarded.
+ sink LogSink
+ // Non-nil if sink is non-nil and implements SlogSink.
+ slogSink SlogSink
+
+ // groupPrefix collects values from WithGroup calls. It gets added as
+ // prefix to value keys when handling a log record.
+ groupPrefix string
+
+ // levelBias can be set when constructing the handler to influence the
+ // slog.Level of log records. A positive levelBias reduces the
+ // slog.Level value. slog has no API to influence this value after the
+ // handler got created, so it can only be set indirectly through
+ // Logger.V.
+ levelBias slog.Level
+}
+
+var _ slog.Handler = &slogHandler{}
+
+// groupSeparator is used to concatenate WithGroup names and attribute keys.
+const groupSeparator = "."
+
+// GetLevel is used for black box unit testing.
+func (l *slogHandler) GetLevel() slog.Level {
+ return l.levelBias
+}
+
+func (l *slogHandler) Enabled(_ context.Context, level slog.Level) bool {
+ return l.sink != nil && (level >= slog.LevelError || l.sink.Enabled(l.levelFromSlog(level)))
+}
+
+func (l *slogHandler) Handle(ctx context.Context, record slog.Record) error {
+ if l.slogSink != nil {
+ // Only adjust verbosity level of log entries < slog.LevelError.
+ if record.Level < slog.LevelError {
+ record.Level -= l.levelBias
+ }
+ return l.slogSink.Handle(ctx, record)
+ }
+
+ // No need to check for nil sink here because Handle will only be called
+ // when Enabled returned true.
+
+ kvList := make([]any, 0, 2*record.NumAttrs())
+ record.Attrs(func(attr slog.Attr) bool {
+ kvList = attrToKVs(attr, l.groupPrefix, kvList)
+ return true
+ })
+ if record.Level >= slog.LevelError {
+ l.sinkWithCallDepth().Error(nil, record.Message, kvList...)
+ } else {
+ level := l.levelFromSlog(record.Level)
+ l.sinkWithCallDepth().Info(level, record.Message, kvList...)
+ }
+ return nil
+}
+
+// sinkWithCallDepth adjusts the stack unwinding so that when Error or Info
+// are called by Handle, code in slog gets skipped.
+//
+// This offset currently (Go 1.21.0) works for calls through
+// slog.New(ToSlogHandler(...)). There's no guarantee that the call
+// chain won't change. Wrapping the handler will also break unwinding. It's
+// still better than not adjusting at all....
+//
+// This cannot be done when constructing the handler because FromSlogHandler needs
+// access to the original sink without this adjustment. A second copy would
+// work, but then WithAttrs would have to be called for both of them.
+func (l *slogHandler) sinkWithCallDepth() LogSink {
+ if sink, ok := l.sink.(CallDepthLogSink); ok {
+ return sink.WithCallDepth(2)
+ }
+ return l.sink
+}
+
+func (l *slogHandler) WithAttrs(attrs []slog.Attr) slog.Handler {
+ if l.sink == nil || len(attrs) == 0 {
+ return l
+ }
+
+ clone := *l
+ if l.slogSink != nil {
+ clone.slogSink = l.slogSink.WithAttrs(attrs)
+ clone.sink = clone.slogSink
+ } else {
+ kvList := make([]any, 0, 2*len(attrs))
+ for _, attr := range attrs {
+ kvList = attrToKVs(attr, l.groupPrefix, kvList)
+ }
+ clone.sink = l.sink.WithValues(kvList...)
+ }
+ return &clone
+}
+
+func (l *slogHandler) WithGroup(name string) slog.Handler {
+ if l.sink == nil {
+ return l
+ }
+ if name == "" {
+ // slog says to inline empty groups
+ return l
+ }
+ clone := *l
+ if l.slogSink != nil {
+ clone.slogSink = l.slogSink.WithGroup(name)
+ clone.sink = clone.slogSink
+ } else {
+ clone.groupPrefix = addPrefix(clone.groupPrefix, name)
+ }
+ return &clone
+}
+
+// attrToKVs appends a slog.Attr to a logr-style kvList. It handle slog Groups
+// and other details of slog.
+func attrToKVs(attr slog.Attr, groupPrefix string, kvList []any) []any {
+ attrVal := attr.Value.Resolve()
+ if attrVal.Kind() == slog.KindGroup {
+ groupVal := attrVal.Group()
+ grpKVs := make([]any, 0, 2*len(groupVal))
+ prefix := groupPrefix
+ if attr.Key != "" {
+ prefix = addPrefix(groupPrefix, attr.Key)
+ }
+ for _, attr := range groupVal {
+ grpKVs = attrToKVs(attr, prefix, grpKVs)
+ }
+ kvList = append(kvList, grpKVs...)
+ } else if attr.Key != "" {
+ kvList = append(kvList, addPrefix(groupPrefix, attr.Key), attrVal.Any())
+ }
+
+ return kvList
+}
+
+func addPrefix(prefix, name string) string {
+ if prefix == "" {
+ return name
+ }
+ if name == "" {
+ return prefix
+ }
+ return prefix + groupSeparator + name
+}
+
+// levelFromSlog adjusts the level by the logger's verbosity and negates it.
+// It ensures that the result is >= 0. This is necessary because the result is
+// passed to a LogSink and that API did not historically document whether
+// levels could be negative or what that meant.
+//
+// Some example usage:
+//
+// logrV0 := getMyLogger()
+// logrV2 := logrV0.V(2)
+// slogV2 := slog.New(logr.ToSlogHandler(logrV2))
+// slogV2.Debug("msg") // =~ logrV2.V(4) =~ logrV0.V(6)
+// slogV2.Info("msg") // =~ logrV2.V(0) =~ logrV0.V(2)
+// slogv2.Warn("msg") // =~ logrV2.V(-4) =~ logrV0.V(0)
+func (l *slogHandler) levelFromSlog(level slog.Level) int {
+ result := -level
+ result += l.levelBias // in case the original Logger had a V level
+ if result < 0 {
+ result = 0 // because LogSink doesn't expect negative V levels
+ }
+ return int(result)
+}
diff --git a/vendor/github.com/go-logr/logr/slogr.go b/vendor/github.com/go-logr/logr/slogr.go
new file mode 100644
index 000000000..28a83d024
--- /dev/null
+++ b/vendor/github.com/go-logr/logr/slogr.go
@@ -0,0 +1,100 @@
+//go:build go1.21
+// +build go1.21
+
+/*
+Copyright 2023 The logr Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package logr
+
+import (
+ "context"
+ "log/slog"
+)
+
+// FromSlogHandler returns a Logger which writes to the slog.Handler.
+//
+// The logr verbosity level is mapped to slog levels such that V(0) becomes
+// slog.LevelInfo and V(4) becomes slog.LevelDebug.
+func FromSlogHandler(handler slog.Handler) Logger {
+ if handler, ok := handler.(*slogHandler); ok {
+ if handler.sink == nil {
+ return Discard()
+ }
+ return New(handler.sink).V(int(handler.levelBias))
+ }
+ return New(&slogSink{handler: handler})
+}
+
+// ToSlogHandler returns a slog.Handler which writes to the same sink as the Logger.
+//
+// The returned logger writes all records with level >= slog.LevelError as
+// error log entries with LogSink.Error, regardless of the verbosity level of
+// the Logger:
+//
+// logger :=
+// slog.New(ToSlogHandler(logger.V(10))).Error(...) -> logSink.Error(...)
+//
+// The level of all other records gets reduced by the verbosity
+// level of the Logger and the result is negated. If it happens
+// to be negative, then it gets replaced by zero because a LogSink
+// is not expected to handled negative levels:
+//
+// slog.New(ToSlogHandler(logger)).Debug(...) -> logger.GetSink().Info(level=4, ...)
+// slog.New(ToSlogHandler(logger)).Warning(...) -> logger.GetSink().Info(level=0, ...)
+// slog.New(ToSlogHandler(logger)).Info(...) -> logger.GetSink().Info(level=0, ...)
+// slog.New(ToSlogHandler(logger.V(4))).Info(...) -> logger.GetSink().Info(level=4, ...)
+func ToSlogHandler(logger Logger) slog.Handler {
+ if sink, ok := logger.GetSink().(*slogSink); ok && logger.GetV() == 0 {
+ return sink.handler
+ }
+
+ handler := &slogHandler{sink: logger.GetSink(), levelBias: slog.Level(logger.GetV())}
+ if slogSink, ok := handler.sink.(SlogSink); ok {
+ handler.slogSink = slogSink
+ }
+ return handler
+}
+
+// SlogSink is an optional interface that a LogSink can implement to support
+// logging through the slog.Logger or slog.Handler APIs better. It then should
+// also support special slog values like slog.Group. When used as a
+// slog.Handler, the advantages are:
+//
+// - stack unwinding gets avoided in favor of logging the pre-recorded PC,
+// as intended by slog
+// - proper grouping of key/value pairs via WithGroup
+// - verbosity levels > slog.LevelInfo can be recorded
+// - less overhead
+//
+// Both APIs (Logger and slog.Logger/Handler) then are supported equally
+// well. Developers can pick whatever API suits them better and/or mix
+// packages which use either API in the same binary with a common logging
+// implementation.
+//
+// This interface is necessary because the type implementing the LogSink
+// interface cannot also implement the slog.Handler interface due to the
+// different prototype of the common Enabled method.
+//
+// An implementation could support both interfaces in two different types, but then
+// additional interfaces would be needed to convert between those types in FromSlogHandler
+// and ToSlogHandler.
+type SlogSink interface {
+ LogSink
+
+ Handle(ctx context.Context, record slog.Record) error
+ WithAttrs(attrs []slog.Attr) SlogSink
+ WithGroup(name string) SlogSink
+}
diff --git a/vendor/github.com/go-logr/logr/slogsink.go b/vendor/github.com/go-logr/logr/slogsink.go
new file mode 100644
index 000000000..4060fcbc2
--- /dev/null
+++ b/vendor/github.com/go-logr/logr/slogsink.go
@@ -0,0 +1,120 @@
+//go:build go1.21
+// +build go1.21
+
+/*
+Copyright 2023 The logr Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package logr
+
+import (
+ "context"
+ "log/slog"
+ "runtime"
+ "time"
+)
+
+var (
+ _ LogSink = &slogSink{}
+ _ CallDepthLogSink = &slogSink{}
+ _ Underlier = &slogSink{}
+)
+
+// Underlier is implemented by the LogSink returned by NewFromLogHandler.
+type Underlier interface {
+ // GetUnderlying returns the Handler used by the LogSink.
+ GetUnderlying() slog.Handler
+}
+
+const (
+ // nameKey is used to log the `WithName` values as an additional attribute.
+ nameKey = "logger"
+
+ // errKey is used to log the error parameter of Error as an additional attribute.
+ errKey = "err"
+)
+
+type slogSink struct {
+ callDepth int
+ name string
+ handler slog.Handler
+}
+
+func (l *slogSink) Init(info RuntimeInfo) {
+ l.callDepth = info.CallDepth
+}
+
+func (l *slogSink) GetUnderlying() slog.Handler {
+ return l.handler
+}
+
+func (l *slogSink) WithCallDepth(depth int) LogSink {
+ newLogger := *l
+ newLogger.callDepth += depth
+ return &newLogger
+}
+
+func (l *slogSink) Enabled(level int) bool {
+ return l.handler.Enabled(context.Background(), slog.Level(-level))
+}
+
+func (l *slogSink) Info(level int, msg string, kvList ...interface{}) {
+ l.log(nil, msg, slog.Level(-level), kvList...)
+}
+
+func (l *slogSink) Error(err error, msg string, kvList ...interface{}) {
+ l.log(err, msg, slog.LevelError, kvList...)
+}
+
+func (l *slogSink) log(err error, msg string, level slog.Level, kvList ...interface{}) {
+ var pcs [1]uintptr
+ // skip runtime.Callers, this function, Info/Error, and all helper functions above that.
+ runtime.Callers(3+l.callDepth, pcs[:])
+
+ record := slog.NewRecord(time.Now(), level, msg, pcs[0])
+ if l.name != "" {
+ record.AddAttrs(slog.String(nameKey, l.name))
+ }
+ if err != nil {
+ record.AddAttrs(slog.Any(errKey, err))
+ }
+ record.Add(kvList...)
+ _ = l.handler.Handle(context.Background(), record)
+}
+
+func (l slogSink) WithName(name string) LogSink {
+ if l.name != "" {
+ l.name += "/"
+ }
+ l.name += name
+ return &l
+}
+
+func (l slogSink) WithValues(kvList ...interface{}) LogSink {
+ l.handler = l.handler.WithAttrs(kvListToAttrs(kvList...))
+ return &l
+}
+
+func kvListToAttrs(kvList ...interface{}) []slog.Attr {
+ // We don't need the record itself, only its Add method.
+ record := slog.NewRecord(time.Time{}, 0, "", 0)
+ record.Add(kvList...)
+ attrs := make([]slog.Attr, 0, record.NumAttrs())
+ record.Attrs(func(attr slog.Attr) bool {
+ attrs = append(attrs, attr)
+ return true
+ })
+ return attrs
+}
diff --git a/vendor/github.com/go-openapi/jsonpointer/.editorconfig b/vendor/github.com/go-openapi/jsonpointer/.editorconfig
new file mode 100644
index 000000000..3152da69a
--- /dev/null
+++ b/vendor/github.com/go-openapi/jsonpointer/.editorconfig
@@ -0,0 +1,26 @@
+# top-most EditorConfig file
+root = true
+
+# Unix-style newlines with a newline ending every file
+[*]
+end_of_line = lf
+insert_final_newline = true
+indent_style = space
+indent_size = 2
+trim_trailing_whitespace = true
+
+# Set default charset
+[*.{js,py,go,scala,rb,java,html,css,less,sass,md}]
+charset = utf-8
+
+# Tab indentation (no size specified)
+[*.go]
+indent_style = tab
+
+[*.md]
+trim_trailing_whitespace = false
+
+# Matches the exact files either package.json or .travis.yml
+[{package.json,.travis.yml}]
+indent_style = space
+indent_size = 2
diff --git a/vendor/github.com/go-openapi/jsonpointer/.gitignore b/vendor/github.com/go-openapi/jsonpointer/.gitignore
new file mode 100644
index 000000000..769c24400
--- /dev/null
+++ b/vendor/github.com/go-openapi/jsonpointer/.gitignore
@@ -0,0 +1 @@
+secrets.yml
diff --git a/vendor/github.com/go-openapi/jsonpointer/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/jsonpointer/CODE_OF_CONDUCT.md
new file mode 100644
index 000000000..9322b065e
--- /dev/null
+++ b/vendor/github.com/go-openapi/jsonpointer/CODE_OF_CONDUCT.md
@@ -0,0 +1,74 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, gender identity and expression, level of experience,
+nationality, personal appearance, race, religion, or sexual identity and
+orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community. Examples of
+representing a project or community include using an official project e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event. Representation of a project may be
+further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at ivan+abuse@flanders.co.nz. All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at [http://contributor-covenant.org/version/1/4][version]
+
+[homepage]: http://contributor-covenant.org
+[version]: http://contributor-covenant.org/version/1/4/
diff --git a/vendor/github.com/go-openapi/jsonpointer/LICENSE b/vendor/github.com/go-openapi/jsonpointer/LICENSE
new file mode 100644
index 000000000..d64569567
--- /dev/null
+++ b/vendor/github.com/go-openapi/jsonpointer/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/vendor/github.com/go-openapi/jsonpointer/README.md b/vendor/github.com/go-openapi/jsonpointer/README.md
new file mode 100644
index 000000000..813788aff
--- /dev/null
+++ b/vendor/github.com/go-openapi/jsonpointer/README.md
@@ -0,0 +1,15 @@
+# gojsonpointer [![Build Status](https://travis-ci.org/go-openapi/jsonpointer.svg?branch=master)](https://travis-ci.org/go-openapi/jsonpointer) [![codecov](https://codecov.io/gh/go-openapi/jsonpointer/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/jsonpointer) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io)
+
+[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/jsonpointer/master/LICENSE) [![GoDoc](https://godoc.org/github.com/go-openapi/jsonpointer?status.svg)](http://godoc.org/github.com/go-openapi/jsonpointer)
+An implementation of JSON Pointer - Go language
+
+## Status
+Completed YES
+
+Tested YES
+
+## References
+http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-07
+
+### Note
+The 4.Evaluation part of the previous reference, starting with 'If the currently referenced value is a JSON array, the reference token MUST contain either...' is not implemented.
diff --git a/vendor/github.com/go-openapi/jsonpointer/pointer.go b/vendor/github.com/go-openapi/jsonpointer/pointer.go
new file mode 100644
index 000000000..7df9853de
--- /dev/null
+++ b/vendor/github.com/go-openapi/jsonpointer/pointer.go
@@ -0,0 +1,390 @@
+// Copyright 2013 sigu-399 ( https://github.com/sigu-399 )
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// author sigu-399
+// author-github https://github.com/sigu-399
+// author-mail sigu.399@gmail.com
+//
+// repository-name jsonpointer
+// repository-desc An implementation of JSON Pointer - Go language
+//
+// description Main and unique file.
+//
+// created 25-02-2013
+
+package jsonpointer
+
+import (
+ "errors"
+ "fmt"
+ "reflect"
+ "strconv"
+ "strings"
+
+ "github.com/go-openapi/swag"
+)
+
+const (
+ emptyPointer = ``
+ pointerSeparator = `/`
+
+ invalidStart = `JSON pointer must be empty or start with a "` + pointerSeparator
+)
+
+var jsonPointableType = reflect.TypeOf(new(JSONPointable)).Elem()
+var jsonSetableType = reflect.TypeOf(new(JSONSetable)).Elem()
+
+// JSONPointable is an interface for structs to implement when they need to customize the
+// json pointer process
+type JSONPointable interface {
+ JSONLookup(string) (interface{}, error)
+}
+
+// JSONSetable is an interface for structs to implement when they need to customize the
+// json pointer process
+type JSONSetable interface {
+ JSONSet(string, interface{}) error
+}
+
+// New creates a new json pointer for the given string
+func New(jsonPointerString string) (Pointer, error) {
+
+ var p Pointer
+ err := p.parse(jsonPointerString)
+ return p, err
+
+}
+
+// Pointer the json pointer reprsentation
+type Pointer struct {
+ referenceTokens []string
+}
+
+// "Constructor", parses the given string JSON pointer
+func (p *Pointer) parse(jsonPointerString string) error {
+
+ var err error
+
+ if jsonPointerString != emptyPointer {
+ if !strings.HasPrefix(jsonPointerString, pointerSeparator) {
+ err = errors.New(invalidStart)
+ } else {
+ referenceTokens := strings.Split(jsonPointerString, pointerSeparator)
+ for _, referenceToken := range referenceTokens[1:] {
+ p.referenceTokens = append(p.referenceTokens, referenceToken)
+ }
+ }
+ }
+
+ return err
+}
+
+// Get uses the pointer to retrieve a value from a JSON document
+func (p *Pointer) Get(document interface{}) (interface{}, reflect.Kind, error) {
+ return p.get(document, swag.DefaultJSONNameProvider)
+}
+
+// Set uses the pointer to set a value from a JSON document
+func (p *Pointer) Set(document interface{}, value interface{}) (interface{}, error) {
+ return document, p.set(document, value, swag.DefaultJSONNameProvider)
+}
+
+// GetForToken gets a value for a json pointer token 1 level deep
+func GetForToken(document interface{}, decodedToken string) (interface{}, reflect.Kind, error) {
+ return getSingleImpl(document, decodedToken, swag.DefaultJSONNameProvider)
+}
+
+// SetForToken gets a value for a json pointer token 1 level deep
+func SetForToken(document interface{}, decodedToken string, value interface{}) (interface{}, error) {
+ return document, setSingleImpl(document, value, decodedToken, swag.DefaultJSONNameProvider)
+}
+
+func getSingleImpl(node interface{}, decodedToken string, nameProvider *swag.NameProvider) (interface{}, reflect.Kind, error) {
+ rValue := reflect.Indirect(reflect.ValueOf(node))
+ kind := rValue.Kind()
+
+ if rValue.Type().Implements(jsonPointableType) {
+ r, err := node.(JSONPointable).JSONLookup(decodedToken)
+ if err != nil {
+ return nil, kind, err
+ }
+ return r, kind, nil
+ }
+
+ switch kind {
+ case reflect.Struct:
+ nm, ok := nameProvider.GetGoNameForType(rValue.Type(), decodedToken)
+ if !ok {
+ return nil, kind, fmt.Errorf("object has no field %q", decodedToken)
+ }
+ fld := rValue.FieldByName(nm)
+ return fld.Interface(), kind, nil
+
+ case reflect.Map:
+ kv := reflect.ValueOf(decodedToken)
+ mv := rValue.MapIndex(kv)
+
+ if mv.IsValid() {
+ return mv.Interface(), kind, nil
+ }
+ return nil, kind, fmt.Errorf("object has no key %q", decodedToken)
+
+ case reflect.Slice:
+ tokenIndex, err := strconv.Atoi(decodedToken)
+ if err != nil {
+ return nil, kind, err
+ }
+ sLength := rValue.Len()
+ if tokenIndex < 0 || tokenIndex >= sLength {
+ return nil, kind, fmt.Errorf("index out of bounds array[0,%d] index '%d'", sLength-1, tokenIndex)
+ }
+
+ elem := rValue.Index(tokenIndex)
+ return elem.Interface(), kind, nil
+
+ default:
+ return nil, kind, fmt.Errorf("invalid token reference %q", decodedToken)
+ }
+
+}
+
+func setSingleImpl(node, data interface{}, decodedToken string, nameProvider *swag.NameProvider) error {
+ rValue := reflect.Indirect(reflect.ValueOf(node))
+
+ if ns, ok := node.(JSONSetable); ok { // pointer impl
+ return ns.JSONSet(decodedToken, data)
+ }
+
+ if rValue.Type().Implements(jsonSetableType) {
+ return node.(JSONSetable).JSONSet(decodedToken, data)
+ }
+
+ switch rValue.Kind() {
+ case reflect.Struct:
+ nm, ok := nameProvider.GetGoNameForType(rValue.Type(), decodedToken)
+ if !ok {
+ return fmt.Errorf("object has no field %q", decodedToken)
+ }
+ fld := rValue.FieldByName(nm)
+ if fld.IsValid() {
+ fld.Set(reflect.ValueOf(data))
+ }
+ return nil
+
+ case reflect.Map:
+ kv := reflect.ValueOf(decodedToken)
+ rValue.SetMapIndex(kv, reflect.ValueOf(data))
+ return nil
+
+ case reflect.Slice:
+ tokenIndex, err := strconv.Atoi(decodedToken)
+ if err != nil {
+ return err
+ }
+ sLength := rValue.Len()
+ if tokenIndex < 0 || tokenIndex >= sLength {
+ return fmt.Errorf("index out of bounds array[0,%d] index '%d'", sLength, tokenIndex)
+ }
+
+ elem := rValue.Index(tokenIndex)
+ if !elem.CanSet() {
+ return fmt.Errorf("can't set slice index %s to %v", decodedToken, data)
+ }
+ elem.Set(reflect.ValueOf(data))
+ return nil
+
+ default:
+ return fmt.Errorf("invalid token reference %q", decodedToken)
+ }
+
+}
+
+func (p *Pointer) get(node interface{}, nameProvider *swag.NameProvider) (interface{}, reflect.Kind, error) {
+
+ if nameProvider == nil {
+ nameProvider = swag.DefaultJSONNameProvider
+ }
+
+ kind := reflect.Invalid
+
+ // Full document when empty
+ if len(p.referenceTokens) == 0 {
+ return node, kind, nil
+ }
+
+ for _, token := range p.referenceTokens {
+
+ decodedToken := Unescape(token)
+
+ r, knd, err := getSingleImpl(node, decodedToken, nameProvider)
+ if err != nil {
+ return nil, knd, err
+ }
+ node, kind = r, knd
+
+ }
+
+ rValue := reflect.ValueOf(node)
+ kind = rValue.Kind()
+
+ return node, kind, nil
+}
+
+func (p *Pointer) set(node, data interface{}, nameProvider *swag.NameProvider) error {
+ knd := reflect.ValueOf(node).Kind()
+
+ if knd != reflect.Ptr && knd != reflect.Struct && knd != reflect.Map && knd != reflect.Slice && knd != reflect.Array {
+ return fmt.Errorf("only structs, pointers, maps and slices are supported for setting values")
+ }
+
+ if nameProvider == nil {
+ nameProvider = swag.DefaultJSONNameProvider
+ }
+
+ // Full document when empty
+ if len(p.referenceTokens) == 0 {
+ return nil
+ }
+
+ lastI := len(p.referenceTokens) - 1
+ for i, token := range p.referenceTokens {
+ isLastToken := i == lastI
+ decodedToken := Unescape(token)
+
+ if isLastToken {
+
+ return setSingleImpl(node, data, decodedToken, nameProvider)
+ }
+
+ rValue := reflect.Indirect(reflect.ValueOf(node))
+ kind := rValue.Kind()
+
+ if rValue.Type().Implements(jsonPointableType) {
+ r, err := node.(JSONPointable).JSONLookup(decodedToken)
+ if err != nil {
+ return err
+ }
+ fld := reflect.ValueOf(r)
+ if fld.CanAddr() && fld.Kind() != reflect.Interface && fld.Kind() != reflect.Map && fld.Kind() != reflect.Slice && fld.Kind() != reflect.Ptr {
+ node = fld.Addr().Interface()
+ continue
+ }
+ node = r
+ continue
+ }
+
+ switch kind {
+ case reflect.Struct:
+ nm, ok := nameProvider.GetGoNameForType(rValue.Type(), decodedToken)
+ if !ok {
+ return fmt.Errorf("object has no field %q", decodedToken)
+ }
+ fld := rValue.FieldByName(nm)
+ if fld.CanAddr() && fld.Kind() != reflect.Interface && fld.Kind() != reflect.Map && fld.Kind() != reflect.Slice && fld.Kind() != reflect.Ptr {
+ node = fld.Addr().Interface()
+ continue
+ }
+ node = fld.Interface()
+
+ case reflect.Map:
+ kv := reflect.ValueOf(decodedToken)
+ mv := rValue.MapIndex(kv)
+
+ if !mv.IsValid() {
+ return fmt.Errorf("object has no key %q", decodedToken)
+ }
+ if mv.CanAddr() && mv.Kind() != reflect.Interface && mv.Kind() != reflect.Map && mv.Kind() != reflect.Slice && mv.Kind() != reflect.Ptr {
+ node = mv.Addr().Interface()
+ continue
+ }
+ node = mv.Interface()
+
+ case reflect.Slice:
+ tokenIndex, err := strconv.Atoi(decodedToken)
+ if err != nil {
+ return err
+ }
+ sLength := rValue.Len()
+ if tokenIndex < 0 || tokenIndex >= sLength {
+ return fmt.Errorf("index out of bounds array[0,%d] index '%d'", sLength, tokenIndex)
+ }
+
+ elem := rValue.Index(tokenIndex)
+ if elem.CanAddr() && elem.Kind() != reflect.Interface && elem.Kind() != reflect.Map && elem.Kind() != reflect.Slice && elem.Kind() != reflect.Ptr {
+ node = elem.Addr().Interface()
+ continue
+ }
+ node = elem.Interface()
+
+ default:
+ return fmt.Errorf("invalid token reference %q", decodedToken)
+ }
+
+ }
+
+ return nil
+}
+
+// DecodedTokens returns the decoded tokens
+func (p *Pointer) DecodedTokens() []string {
+ result := make([]string, 0, len(p.referenceTokens))
+ for _, t := range p.referenceTokens {
+ result = append(result, Unescape(t))
+ }
+ return result
+}
+
+// IsEmpty returns true if this is an empty json pointer
+// this indicates that it points to the root document
+func (p *Pointer) IsEmpty() bool {
+ return len(p.referenceTokens) == 0
+}
+
+// Pointer to string representation function
+func (p *Pointer) String() string {
+
+ if len(p.referenceTokens) == 0 {
+ return emptyPointer
+ }
+
+ pointerString := pointerSeparator + strings.Join(p.referenceTokens, pointerSeparator)
+
+ return pointerString
+}
+
+// Specific JSON pointer encoding here
+// ~0 => ~
+// ~1 => /
+// ... and vice versa
+
+const (
+ encRefTok0 = `~0`
+ encRefTok1 = `~1`
+ decRefTok0 = `~`
+ decRefTok1 = `/`
+)
+
+// Unescape unescapes a json pointer reference token string to the original representation
+func Unescape(token string) string {
+ step1 := strings.Replace(token, encRefTok1, decRefTok1, -1)
+ step2 := strings.Replace(step1, encRefTok0, decRefTok0, -1)
+ return step2
+}
+
+// Escape escapes a pointer reference token string
+func Escape(token string) string {
+ step1 := strings.Replace(token, decRefTok0, encRefTok0, -1)
+ step2 := strings.Replace(step1, decRefTok1, encRefTok1, -1)
+ return step2
+}
diff --git a/vendor/github.com/go-openapi/jsonreference/.gitignore b/vendor/github.com/go-openapi/jsonreference/.gitignore
new file mode 100644
index 000000000..769c24400
--- /dev/null
+++ b/vendor/github.com/go-openapi/jsonreference/.gitignore
@@ -0,0 +1 @@
+secrets.yml
diff --git a/vendor/github.com/go-openapi/jsonreference/.golangci.yml b/vendor/github.com/go-openapi/jsonreference/.golangci.yml
new file mode 100644
index 000000000..013fc1943
--- /dev/null
+++ b/vendor/github.com/go-openapi/jsonreference/.golangci.yml
@@ -0,0 +1,50 @@
+linters-settings:
+ govet:
+ check-shadowing: true
+ gocyclo:
+ min-complexity: 30
+ maligned:
+ suggest-new: true
+ dupl:
+ threshold: 100
+ goconst:
+ min-len: 2
+ min-occurrences: 4
+ paralleltest:
+ ignore-missing: true
+linters:
+ enable-all: true
+ disable:
+ - maligned
+ - lll
+ - gochecknoglobals
+ - godox
+ - gocognit
+ - whitespace
+ - wsl
+ - funlen
+ - gochecknoglobals
+ - gochecknoinits
+ - scopelint
+ - wrapcheck
+ - exhaustivestruct
+ - exhaustive
+ - nlreturn
+ - testpackage
+ - gci
+ - gofumpt
+ - goerr113
+ - gomnd
+ - tparallel
+ - nestif
+ - godot
+ - errorlint
+ - varcheck
+ - interfacer
+ - deadcode
+ - golint
+ - ifshort
+ - structcheck
+ - nosnakecase
+ - varnamelen
+ - exhaustruct
diff --git a/vendor/github.com/go-openapi/jsonreference/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/jsonreference/CODE_OF_CONDUCT.md
new file mode 100644
index 000000000..9322b065e
--- /dev/null
+++ b/vendor/github.com/go-openapi/jsonreference/CODE_OF_CONDUCT.md
@@ -0,0 +1,74 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, gender identity and expression, level of experience,
+nationality, personal appearance, race, religion, or sexual identity and
+orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community. Examples of
+representing a project or community include using an official project e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event. Representation of a project may be
+further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at ivan+abuse@flanders.co.nz. All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at [http://contributor-covenant.org/version/1/4][version]
+
+[homepage]: http://contributor-covenant.org
+[version]: http://contributor-covenant.org/version/1/4/
diff --git a/vendor/github.com/go-openapi/jsonreference/LICENSE b/vendor/github.com/go-openapi/jsonreference/LICENSE
new file mode 100644
index 000000000..d64569567
--- /dev/null
+++ b/vendor/github.com/go-openapi/jsonreference/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/vendor/github.com/go-openapi/jsonreference/README.md b/vendor/github.com/go-openapi/jsonreference/README.md
new file mode 100644
index 000000000..b94753aa5
--- /dev/null
+++ b/vendor/github.com/go-openapi/jsonreference/README.md
@@ -0,0 +1,15 @@
+# gojsonreference [![Build Status](https://travis-ci.org/go-openapi/jsonreference.svg?branch=master)](https://travis-ci.org/go-openapi/jsonreference) [![codecov](https://codecov.io/gh/go-openapi/jsonreference/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/jsonreference) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io)
+
+[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/jsonreference/master/LICENSE) [![GoDoc](https://godoc.org/github.com/go-openapi/jsonreference?status.svg)](http://godoc.org/github.com/go-openapi/jsonreference)
+An implementation of JSON Reference - Go language
+
+## Status
+Feature complete. Stable API
+
+## Dependencies
+https://github.com/go-openapi/jsonpointer
+
+## References
+http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-07
+
+http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03
diff --git a/vendor/github.com/go-openapi/jsonreference/internal/normalize_url.go b/vendor/github.com/go-openapi/jsonreference/internal/normalize_url.go
new file mode 100644
index 000000000..f0610cf1e
--- /dev/null
+++ b/vendor/github.com/go-openapi/jsonreference/internal/normalize_url.go
@@ -0,0 +1,69 @@
+package internal
+
+import (
+ "net/url"
+ "regexp"
+ "strings"
+)
+
+const (
+ defaultHTTPPort = ":80"
+ defaultHTTPSPort = ":443"
+)
+
+// Regular expressions used by the normalizations
+var rxPort = regexp.MustCompile(`(:\d+)/?$`)
+var rxDupSlashes = regexp.MustCompile(`/{2,}`)
+
+// NormalizeURL will normalize the specified URL
+// This was added to replace a previous call to the no longer maintained purell library:
+// The call that was used looked like the following:
+//
+// url.Parse(purell.NormalizeURL(parsed, purell.FlagsSafe|purell.FlagRemoveDuplicateSlashes))
+//
+// To explain all that was included in the call above, purell.FlagsSafe was really just the following:
+// - FlagLowercaseScheme
+// - FlagLowercaseHost
+// - FlagRemoveDefaultPort
+// - FlagRemoveDuplicateSlashes (and this was mixed in with the |)
+//
+// This also normalizes the URL into its urlencoded form by removing RawPath and RawFragment.
+func NormalizeURL(u *url.URL) {
+ lowercaseScheme(u)
+ lowercaseHost(u)
+ removeDefaultPort(u)
+ removeDuplicateSlashes(u)
+
+ u.RawPath = ""
+ u.RawFragment = ""
+}
+
+func lowercaseScheme(u *url.URL) {
+ if len(u.Scheme) > 0 {
+ u.Scheme = strings.ToLower(u.Scheme)
+ }
+}
+
+func lowercaseHost(u *url.URL) {
+ if len(u.Host) > 0 {
+ u.Host = strings.ToLower(u.Host)
+ }
+}
+
+func removeDefaultPort(u *url.URL) {
+ if len(u.Host) > 0 {
+ scheme := strings.ToLower(u.Scheme)
+ u.Host = rxPort.ReplaceAllStringFunc(u.Host, func(val string) string {
+ if (scheme == "http" && val == defaultHTTPPort) || (scheme == "https" && val == defaultHTTPSPort) {
+ return ""
+ }
+ return val
+ })
+ }
+}
+
+func removeDuplicateSlashes(u *url.URL) {
+ if len(u.Path) > 0 {
+ u.Path = rxDupSlashes.ReplaceAllString(u.Path, "/")
+ }
+}
diff --git a/vendor/github.com/go-openapi/jsonreference/reference.go b/vendor/github.com/go-openapi/jsonreference/reference.go
new file mode 100644
index 000000000..cfdef03e5
--- /dev/null
+++ b/vendor/github.com/go-openapi/jsonreference/reference.go
@@ -0,0 +1,158 @@
+// Copyright 2013 sigu-399 ( https://github.com/sigu-399 )
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// author sigu-399
+// author-github https://github.com/sigu-399
+// author-mail sigu.399@gmail.com
+//
+// repository-name jsonreference
+// repository-desc An implementation of JSON Reference - Go language
+//
+// description Main and unique file.
+//
+// created 26-02-2013
+
+package jsonreference
+
+import (
+ "errors"
+ "net/url"
+ "strings"
+
+ "github.com/go-openapi/jsonpointer"
+ "github.com/go-openapi/jsonreference/internal"
+)
+
+const (
+ fragmentRune = `#`
+)
+
+// New creates a new reference for the given string
+func New(jsonReferenceString string) (Ref, error) {
+
+ var r Ref
+ err := r.parse(jsonReferenceString)
+ return r, err
+
+}
+
+// MustCreateRef parses the ref string and panics when it's invalid.
+// Use the New method for a version that returns an error
+func MustCreateRef(ref string) Ref {
+ r, err := New(ref)
+ if err != nil {
+ panic(err)
+ }
+ return r
+}
+
+// Ref represents a json reference object
+type Ref struct {
+ referenceURL *url.URL
+ referencePointer jsonpointer.Pointer
+
+ HasFullURL bool
+ HasURLPathOnly bool
+ HasFragmentOnly bool
+ HasFileScheme bool
+ HasFullFilePath bool
+}
+
+// GetURL gets the URL for this reference
+func (r *Ref) GetURL() *url.URL {
+ return r.referenceURL
+}
+
+// GetPointer gets the json pointer for this reference
+func (r *Ref) GetPointer() *jsonpointer.Pointer {
+ return &r.referencePointer
+}
+
+// String returns the best version of the url for this reference
+func (r *Ref) String() string {
+
+ if r.referenceURL != nil {
+ return r.referenceURL.String()
+ }
+
+ if r.HasFragmentOnly {
+ return fragmentRune + r.referencePointer.String()
+ }
+
+ return r.referencePointer.String()
+}
+
+// IsRoot returns true if this reference is a root document
+func (r *Ref) IsRoot() bool {
+ return r.referenceURL != nil &&
+ !r.IsCanonical() &&
+ !r.HasURLPathOnly &&
+ r.referenceURL.Fragment == ""
+}
+
+// IsCanonical returns true when this pointer starts with http(s):// or file://
+func (r *Ref) IsCanonical() bool {
+ return (r.HasFileScheme && r.HasFullFilePath) || (!r.HasFileScheme && r.HasFullURL)
+}
+
+// "Constructor", parses the given string JSON reference
+func (r *Ref) parse(jsonReferenceString string) error {
+
+ parsed, err := url.Parse(jsonReferenceString)
+ if err != nil {
+ return err
+ }
+
+ internal.NormalizeURL(parsed)
+
+ r.referenceURL = parsed
+ refURL := r.referenceURL
+
+ if refURL.Scheme != "" && refURL.Host != "" {
+ r.HasFullURL = true
+ } else {
+ if refURL.Path != "" {
+ r.HasURLPathOnly = true
+ } else if refURL.RawQuery == "" && refURL.Fragment != "" {
+ r.HasFragmentOnly = true
+ }
+ }
+
+ r.HasFileScheme = refURL.Scheme == "file"
+ r.HasFullFilePath = strings.HasPrefix(refURL.Path, "/")
+
+ // invalid json-pointer error means url has no json-pointer fragment. simply ignore error
+ r.referencePointer, _ = jsonpointer.New(refURL.Fragment)
+
+ return nil
+}
+
+// Inherits creates a new reference from a parent and a child
+// If the child cannot inherit from the parent, an error is returned
+func (r *Ref) Inherits(child Ref) (*Ref, error) {
+ childURL := child.GetURL()
+ parentURL := r.GetURL()
+ if childURL == nil {
+ return nil, errors.New("child url is nil")
+ }
+ if parentURL == nil {
+ return &child, nil
+ }
+
+ ref, err := New(parentURL.ResolveReference(childURL).String())
+ if err != nil {
+ return nil, err
+ }
+ return &ref, nil
+}
diff --git a/vendor/github.com/go-openapi/swag/.editorconfig b/vendor/github.com/go-openapi/swag/.editorconfig
new file mode 100644
index 000000000..3152da69a
--- /dev/null
+++ b/vendor/github.com/go-openapi/swag/.editorconfig
@@ -0,0 +1,26 @@
+# top-most EditorConfig file
+root = true
+
+# Unix-style newlines with a newline ending every file
+[*]
+end_of_line = lf
+insert_final_newline = true
+indent_style = space
+indent_size = 2
+trim_trailing_whitespace = true
+
+# Set default charset
+[*.{js,py,go,scala,rb,java,html,css,less,sass,md}]
+charset = utf-8
+
+# Tab indentation (no size specified)
+[*.go]
+indent_style = tab
+
+[*.md]
+trim_trailing_whitespace = false
+
+# Matches the exact files either package.json or .travis.yml
+[{package.json,.travis.yml}]
+indent_style = space
+indent_size = 2
diff --git a/vendor/github.com/go-openapi/swag/.gitattributes b/vendor/github.com/go-openapi/swag/.gitattributes
new file mode 100644
index 000000000..49ad52766
--- /dev/null
+++ b/vendor/github.com/go-openapi/swag/.gitattributes
@@ -0,0 +1,2 @@
+# gofmt always uses LF, whereas Git uses CRLF on Windows.
+*.go text eol=lf
diff --git a/vendor/github.com/go-openapi/swag/.gitignore b/vendor/github.com/go-openapi/swag/.gitignore
new file mode 100644
index 000000000..d69b53acc
--- /dev/null
+++ b/vendor/github.com/go-openapi/swag/.gitignore
@@ -0,0 +1,4 @@
+secrets.yml
+vendor
+Godeps
+.idea
diff --git a/vendor/github.com/go-openapi/swag/.golangci.yml b/vendor/github.com/go-openapi/swag/.golangci.yml
new file mode 100644
index 000000000..bf503e400
--- /dev/null
+++ b/vendor/github.com/go-openapi/swag/.golangci.yml
@@ -0,0 +1,54 @@
+linters-settings:
+ govet:
+ check-shadowing: true
+ golint:
+ min-confidence: 0
+ gocyclo:
+ min-complexity: 25
+ maligned:
+ suggest-new: true
+ dupl:
+ threshold: 100
+ goconst:
+ min-len: 3
+ min-occurrences: 2
+
+linters:
+ enable-all: true
+ disable:
+ - maligned
+ - lll
+ - gochecknoinits
+ - gochecknoglobals
+ - nlreturn
+ - testpackage
+ - wrapcheck
+ - gomnd
+ - exhaustive
+ - exhaustivestruct
+ - goerr113
+ - wsl
+ - whitespace
+ - gofumpt
+ - godot
+ - nestif
+ - godox
+ - funlen
+ - gci
+ - gocognit
+ - paralleltest
+ - thelper
+ - ifshort
+ - gomoddirectives
+ - cyclop
+ - forcetypeassert
+ - ireturn
+ - tagliatelle
+ - varnamelen
+ - goimports
+ - tenv
+ - golint
+ - exhaustruct
+ - nilnil
+ - nonamedreturns
+ - nosnakecase
diff --git a/vendor/github.com/go-openapi/swag/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/swag/CODE_OF_CONDUCT.md
new file mode 100644
index 000000000..9322b065e
--- /dev/null
+++ b/vendor/github.com/go-openapi/swag/CODE_OF_CONDUCT.md
@@ -0,0 +1,74 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, gender identity and expression, level of experience,
+nationality, personal appearance, race, religion, or sexual identity and
+orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community. Examples of
+representing a project or community include using an official project e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event. Representation of a project may be
+further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at ivan+abuse@flanders.co.nz. All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at [http://contributor-covenant.org/version/1/4][version]
+
+[homepage]: http://contributor-covenant.org
+[version]: http://contributor-covenant.org/version/1/4/
diff --git a/vendor/github.com/go-openapi/swag/LICENSE b/vendor/github.com/go-openapi/swag/LICENSE
new file mode 100644
index 000000000..d64569567
--- /dev/null
+++ b/vendor/github.com/go-openapi/swag/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/vendor/github.com/go-openapi/swag/README.md b/vendor/github.com/go-openapi/swag/README.md
new file mode 100644
index 000000000..217f6fa50
--- /dev/null
+++ b/vendor/github.com/go-openapi/swag/README.md
@@ -0,0 +1,21 @@
+# Swag [![Build Status](https://travis-ci.org/go-openapi/swag.svg?branch=master)](https://travis-ci.org/go-openapi/swag) [![codecov](https://codecov.io/gh/go-openapi/swag/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/swag) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io)
+
+[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/swag/master/LICENSE)
+[![GoDoc](https://godoc.org/github.com/go-openapi/swag?status.svg)](http://godoc.org/github.com/go-openapi/swag)
+[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/swag)](https://goreportcard.com/report/github.com/go-openapi/swag)
+
+Contains a bunch of helper functions for go-openapi and go-swagger projects.
+
+You may also use it standalone for your projects.
+
+* convert between value and pointers for builtin types
+* convert from string to builtin types (wraps strconv)
+* fast json concatenation
+* search in path
+* load from file or http
+* name mangling
+
+
+This repo has only few dependencies outside of the standard library:
+
+* YAML utilities depend on gopkg.in/yaml.v2
diff --git a/vendor/github.com/go-openapi/swag/convert.go b/vendor/github.com/go-openapi/swag/convert.go
new file mode 100644
index 000000000..fc085aeb8
--- /dev/null
+++ b/vendor/github.com/go-openapi/swag/convert.go
@@ -0,0 +1,208 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package swag
+
+import (
+ "math"
+ "strconv"
+ "strings"
+)
+
+// same as ECMA Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER
+const (
+ maxJSONFloat = float64(1<<53 - 1) // 9007199254740991.0 2^53 - 1
+ minJSONFloat = -float64(1<<53 - 1) //-9007199254740991.0 -2^53 - 1
+ epsilon float64 = 1e-9
+)
+
+// IsFloat64AJSONInteger allow for integers [-2^53, 2^53-1] inclusive
+func IsFloat64AJSONInteger(f float64) bool {
+ if math.IsNaN(f) || math.IsInf(f, 0) || f < minJSONFloat || f > maxJSONFloat {
+ return false
+ }
+ fa := math.Abs(f)
+ g := float64(uint64(f))
+ ga := math.Abs(g)
+
+ diff := math.Abs(f - g)
+
+ // more info: https://floating-point-gui.de/errors/comparison/#look-out-for-edge-cases
+ switch {
+ case f == g: // best case
+ return true
+ case f == float64(int64(f)) || f == float64(uint64(f)): // optimistic case
+ return true
+ case f == 0 || g == 0 || diff < math.SmallestNonzeroFloat64: // very close to 0 values
+ return diff < (epsilon * math.SmallestNonzeroFloat64)
+ }
+ // check the relative error
+ return diff/math.Min(fa+ga, math.MaxFloat64) < epsilon
+}
+
+var evaluatesAsTrue map[string]struct{}
+
+func init() {
+ evaluatesAsTrue = map[string]struct{}{
+ "true": {},
+ "1": {},
+ "yes": {},
+ "ok": {},
+ "y": {},
+ "on": {},
+ "selected": {},
+ "checked": {},
+ "t": {},
+ "enabled": {},
+ }
+}
+
+// ConvertBool turn a string into a boolean
+func ConvertBool(str string) (bool, error) {
+ _, ok := evaluatesAsTrue[strings.ToLower(str)]
+ return ok, nil
+}
+
+// ConvertFloat32 turn a string into a float32
+func ConvertFloat32(str string) (float32, error) {
+ f, err := strconv.ParseFloat(str, 32)
+ if err != nil {
+ return 0, err
+ }
+ return float32(f), nil
+}
+
+// ConvertFloat64 turn a string into a float64
+func ConvertFloat64(str string) (float64, error) {
+ return strconv.ParseFloat(str, 64)
+}
+
+// ConvertInt8 turn a string into an int8
+func ConvertInt8(str string) (int8, error) {
+ i, err := strconv.ParseInt(str, 10, 8)
+ if err != nil {
+ return 0, err
+ }
+ return int8(i), nil
+}
+
+// ConvertInt16 turn a string into an int16
+func ConvertInt16(str string) (int16, error) {
+ i, err := strconv.ParseInt(str, 10, 16)
+ if err != nil {
+ return 0, err
+ }
+ return int16(i), nil
+}
+
+// ConvertInt32 turn a string into an int32
+func ConvertInt32(str string) (int32, error) {
+ i, err := strconv.ParseInt(str, 10, 32)
+ if err != nil {
+ return 0, err
+ }
+ return int32(i), nil
+}
+
+// ConvertInt64 turn a string into an int64
+func ConvertInt64(str string) (int64, error) {
+ return strconv.ParseInt(str, 10, 64)
+}
+
+// ConvertUint8 turn a string into an uint8
+func ConvertUint8(str string) (uint8, error) {
+ i, err := strconv.ParseUint(str, 10, 8)
+ if err != nil {
+ return 0, err
+ }
+ return uint8(i), nil
+}
+
+// ConvertUint16 turn a string into an uint16
+func ConvertUint16(str string) (uint16, error) {
+ i, err := strconv.ParseUint(str, 10, 16)
+ if err != nil {
+ return 0, err
+ }
+ return uint16(i), nil
+}
+
+// ConvertUint32 turn a string into an uint32
+func ConvertUint32(str string) (uint32, error) {
+ i, err := strconv.ParseUint(str, 10, 32)
+ if err != nil {
+ return 0, err
+ }
+ return uint32(i), nil
+}
+
+// ConvertUint64 turn a string into an uint64
+func ConvertUint64(str string) (uint64, error) {
+ return strconv.ParseUint(str, 10, 64)
+}
+
+// FormatBool turns a boolean into a string
+func FormatBool(value bool) string {
+ return strconv.FormatBool(value)
+}
+
+// FormatFloat32 turns a float32 into a string
+func FormatFloat32(value float32) string {
+ return strconv.FormatFloat(float64(value), 'f', -1, 32)
+}
+
+// FormatFloat64 turns a float64 into a string
+func FormatFloat64(value float64) string {
+ return strconv.FormatFloat(value, 'f', -1, 64)
+}
+
+// FormatInt8 turns an int8 into a string
+func FormatInt8(value int8) string {
+ return strconv.FormatInt(int64(value), 10)
+}
+
+// FormatInt16 turns an int16 into a string
+func FormatInt16(value int16) string {
+ return strconv.FormatInt(int64(value), 10)
+}
+
+// FormatInt32 turns an int32 into a string
+func FormatInt32(value int32) string {
+ return strconv.Itoa(int(value))
+}
+
+// FormatInt64 turns an int64 into a string
+func FormatInt64(value int64) string {
+ return strconv.FormatInt(value, 10)
+}
+
+// FormatUint8 turns an uint8 into a string
+func FormatUint8(value uint8) string {
+ return strconv.FormatUint(uint64(value), 10)
+}
+
+// FormatUint16 turns an uint16 into a string
+func FormatUint16(value uint16) string {
+ return strconv.FormatUint(uint64(value), 10)
+}
+
+// FormatUint32 turns an uint32 into a string
+func FormatUint32(value uint32) string {
+ return strconv.FormatUint(uint64(value), 10)
+}
+
+// FormatUint64 turns an uint64 into a string
+func FormatUint64(value uint64) string {
+ return strconv.FormatUint(value, 10)
+}
diff --git a/vendor/github.com/go-openapi/swag/convert_types.go b/vendor/github.com/go-openapi/swag/convert_types.go
new file mode 100644
index 000000000..c49cc473a
--- /dev/null
+++ b/vendor/github.com/go-openapi/swag/convert_types.go
@@ -0,0 +1,730 @@
+package swag
+
+import "time"
+
+// This file was taken from the aws go sdk
+
+// String returns a pointer to of the string value passed in.
+func String(v string) *string {
+ return &v
+}
+
+// StringValue returns the value of the string pointer passed in or
+// "" if the pointer is nil.
+func StringValue(v *string) string {
+ if v != nil {
+ return *v
+ }
+ return ""
+}
+
+// StringSlice converts a slice of string values into a slice of
+// string pointers
+func StringSlice(src []string) []*string {
+ dst := make([]*string, len(src))
+ for i := 0; i < len(src); i++ {
+ dst[i] = &(src[i])
+ }
+ return dst
+}
+
+// StringValueSlice converts a slice of string pointers into a slice of
+// string values
+func StringValueSlice(src []*string) []string {
+ dst := make([]string, len(src))
+ for i := 0; i < len(src); i++ {
+ if src[i] != nil {
+ dst[i] = *(src[i])
+ }
+ }
+ return dst
+}
+
+// StringMap converts a string map of string values into a string
+// map of string pointers
+func StringMap(src map[string]string) map[string]*string {
+ dst := make(map[string]*string)
+ for k, val := range src {
+ v := val
+ dst[k] = &v
+ }
+ return dst
+}
+
+// StringValueMap converts a string map of string pointers into a string
+// map of string values
+func StringValueMap(src map[string]*string) map[string]string {
+ dst := make(map[string]string)
+ for k, val := range src {
+ if val != nil {
+ dst[k] = *val
+ }
+ }
+ return dst
+}
+
+// Bool returns a pointer to of the bool value passed in.
+func Bool(v bool) *bool {
+ return &v
+}
+
+// BoolValue returns the value of the bool pointer passed in or
+// false if the pointer is nil.
+func BoolValue(v *bool) bool {
+ if v != nil {
+ return *v
+ }
+ return false
+}
+
+// BoolSlice converts a slice of bool values into a slice of
+// bool pointers
+func BoolSlice(src []bool) []*bool {
+ dst := make([]*bool, len(src))
+ for i := 0; i < len(src); i++ {
+ dst[i] = &(src[i])
+ }
+ return dst
+}
+
+// BoolValueSlice converts a slice of bool pointers into a slice of
+// bool values
+func BoolValueSlice(src []*bool) []bool {
+ dst := make([]bool, len(src))
+ for i := 0; i < len(src); i++ {
+ if src[i] != nil {
+ dst[i] = *(src[i])
+ }
+ }
+ return dst
+}
+
+// BoolMap converts a string map of bool values into a string
+// map of bool pointers
+func BoolMap(src map[string]bool) map[string]*bool {
+ dst := make(map[string]*bool)
+ for k, val := range src {
+ v := val
+ dst[k] = &v
+ }
+ return dst
+}
+
+// BoolValueMap converts a string map of bool pointers into a string
+// map of bool values
+func BoolValueMap(src map[string]*bool) map[string]bool {
+ dst := make(map[string]bool)
+ for k, val := range src {
+ if val != nil {
+ dst[k] = *val
+ }
+ }
+ return dst
+}
+
+// Int returns a pointer to of the int value passed in.
+func Int(v int) *int {
+ return &v
+}
+
+// IntValue returns the value of the int pointer passed in or
+// 0 if the pointer is nil.
+func IntValue(v *int) int {
+ if v != nil {
+ return *v
+ }
+ return 0
+}
+
+// IntSlice converts a slice of int values into a slice of
+// int pointers
+func IntSlice(src []int) []*int {
+ dst := make([]*int, len(src))
+ for i := 0; i < len(src); i++ {
+ dst[i] = &(src[i])
+ }
+ return dst
+}
+
+// IntValueSlice converts a slice of int pointers into a slice of
+// int values
+func IntValueSlice(src []*int) []int {
+ dst := make([]int, len(src))
+ for i := 0; i < len(src); i++ {
+ if src[i] != nil {
+ dst[i] = *(src[i])
+ }
+ }
+ return dst
+}
+
+// IntMap converts a string map of int values into a string
+// map of int pointers
+func IntMap(src map[string]int) map[string]*int {
+ dst := make(map[string]*int)
+ for k, val := range src {
+ v := val
+ dst[k] = &v
+ }
+ return dst
+}
+
+// IntValueMap converts a string map of int pointers into a string
+// map of int values
+func IntValueMap(src map[string]*int) map[string]int {
+ dst := make(map[string]int)
+ for k, val := range src {
+ if val != nil {
+ dst[k] = *val
+ }
+ }
+ return dst
+}
+
+// Int32 returns a pointer to of the int32 value passed in.
+func Int32(v int32) *int32 {
+ return &v
+}
+
+// Int32Value returns the value of the int32 pointer passed in or
+// 0 if the pointer is nil.
+func Int32Value(v *int32) int32 {
+ if v != nil {
+ return *v
+ }
+ return 0
+}
+
+// Int32Slice converts a slice of int32 values into a slice of
+// int32 pointers
+func Int32Slice(src []int32) []*int32 {
+ dst := make([]*int32, len(src))
+ for i := 0; i < len(src); i++ {
+ dst[i] = &(src[i])
+ }
+ return dst
+}
+
+// Int32ValueSlice converts a slice of int32 pointers into a slice of
+// int32 values
+func Int32ValueSlice(src []*int32) []int32 {
+ dst := make([]int32, len(src))
+ for i := 0; i < len(src); i++ {
+ if src[i] != nil {
+ dst[i] = *(src[i])
+ }
+ }
+ return dst
+}
+
+// Int32Map converts a string map of int32 values into a string
+// map of int32 pointers
+func Int32Map(src map[string]int32) map[string]*int32 {
+ dst := make(map[string]*int32)
+ for k, val := range src {
+ v := val
+ dst[k] = &v
+ }
+ return dst
+}
+
+// Int32ValueMap converts a string map of int32 pointers into a string
+// map of int32 values
+func Int32ValueMap(src map[string]*int32) map[string]int32 {
+ dst := make(map[string]int32)
+ for k, val := range src {
+ if val != nil {
+ dst[k] = *val
+ }
+ }
+ return dst
+}
+
+// Int64 returns a pointer to of the int64 value passed in.
+func Int64(v int64) *int64 {
+ return &v
+}
+
+// Int64Value returns the value of the int64 pointer passed in or
+// 0 if the pointer is nil.
+func Int64Value(v *int64) int64 {
+ if v != nil {
+ return *v
+ }
+ return 0
+}
+
+// Int64Slice converts a slice of int64 values into a slice of
+// int64 pointers
+func Int64Slice(src []int64) []*int64 {
+ dst := make([]*int64, len(src))
+ for i := 0; i < len(src); i++ {
+ dst[i] = &(src[i])
+ }
+ return dst
+}
+
+// Int64ValueSlice converts a slice of int64 pointers into a slice of
+// int64 values
+func Int64ValueSlice(src []*int64) []int64 {
+ dst := make([]int64, len(src))
+ for i := 0; i < len(src); i++ {
+ if src[i] != nil {
+ dst[i] = *(src[i])
+ }
+ }
+ return dst
+}
+
+// Int64Map converts a string map of int64 values into a string
+// map of int64 pointers
+func Int64Map(src map[string]int64) map[string]*int64 {
+ dst := make(map[string]*int64)
+ for k, val := range src {
+ v := val
+ dst[k] = &v
+ }
+ return dst
+}
+
+// Int64ValueMap converts a string map of int64 pointers into a string
+// map of int64 values
+func Int64ValueMap(src map[string]*int64) map[string]int64 {
+ dst := make(map[string]int64)
+ for k, val := range src {
+ if val != nil {
+ dst[k] = *val
+ }
+ }
+ return dst
+}
+
+// Uint16 returns a pointer to of the uint16 value passed in.
+func Uint16(v uint16) *uint16 {
+ return &v
+}
+
+// Uint16Value returns the value of the uint16 pointer passed in or
+// 0 if the pointer is nil.
+func Uint16Value(v *uint16) uint16 {
+ if v != nil {
+ return *v
+ }
+
+ return 0
+}
+
+// Uint16Slice converts a slice of uint16 values into a slice of
+// uint16 pointers
+func Uint16Slice(src []uint16) []*uint16 {
+ dst := make([]*uint16, len(src))
+ for i := 0; i < len(src); i++ {
+ dst[i] = &(src[i])
+ }
+
+ return dst
+}
+
+// Uint16ValueSlice converts a slice of uint16 pointers into a slice of
+// uint16 values
+func Uint16ValueSlice(src []*uint16) []uint16 {
+ dst := make([]uint16, len(src))
+
+ for i := 0; i < len(src); i++ {
+ if src[i] != nil {
+ dst[i] = *(src[i])
+ }
+ }
+
+ return dst
+}
+
+// Uint16Map converts a string map of uint16 values into a string
+// map of uint16 pointers
+func Uint16Map(src map[string]uint16) map[string]*uint16 {
+ dst := make(map[string]*uint16)
+
+ for k, val := range src {
+ v := val
+ dst[k] = &v
+ }
+
+ return dst
+}
+
+// Uint16ValueMap converts a string map of uint16 pointers into a string
+// map of uint16 values
+func Uint16ValueMap(src map[string]*uint16) map[string]uint16 {
+ dst := make(map[string]uint16)
+
+ for k, val := range src {
+ if val != nil {
+ dst[k] = *val
+ }
+ }
+
+ return dst
+}
+
+// Uint returns a pointer to of the uint value passed in.
+func Uint(v uint) *uint {
+ return &v
+}
+
+// UintValue returns the value of the uint pointer passed in or
+// 0 if the pointer is nil.
+func UintValue(v *uint) uint {
+ if v != nil {
+ return *v
+ }
+ return 0
+}
+
+// UintSlice converts a slice of uint values into a slice of
+// uint pointers
+func UintSlice(src []uint) []*uint {
+ dst := make([]*uint, len(src))
+ for i := 0; i < len(src); i++ {
+ dst[i] = &(src[i])
+ }
+ return dst
+}
+
+// UintValueSlice converts a slice of uint pointers into a slice of
+// uint values
+func UintValueSlice(src []*uint) []uint {
+ dst := make([]uint, len(src))
+ for i := 0; i < len(src); i++ {
+ if src[i] != nil {
+ dst[i] = *(src[i])
+ }
+ }
+ return dst
+}
+
+// UintMap converts a string map of uint values into a string
+// map of uint pointers
+func UintMap(src map[string]uint) map[string]*uint {
+ dst := make(map[string]*uint)
+ for k, val := range src {
+ v := val
+ dst[k] = &v
+ }
+ return dst
+}
+
+// UintValueMap converts a string map of uint pointers into a string
+// map of uint values
+func UintValueMap(src map[string]*uint) map[string]uint {
+ dst := make(map[string]uint)
+ for k, val := range src {
+ if val != nil {
+ dst[k] = *val
+ }
+ }
+ return dst
+}
+
+// Uint32 returns a pointer to of the uint32 value passed in.
+func Uint32(v uint32) *uint32 {
+ return &v
+}
+
+// Uint32Value returns the value of the uint32 pointer passed in or
+// 0 if the pointer is nil.
+func Uint32Value(v *uint32) uint32 {
+ if v != nil {
+ return *v
+ }
+ return 0
+}
+
+// Uint32Slice converts a slice of uint32 values into a slice of
+// uint32 pointers
+func Uint32Slice(src []uint32) []*uint32 {
+ dst := make([]*uint32, len(src))
+ for i := 0; i < len(src); i++ {
+ dst[i] = &(src[i])
+ }
+ return dst
+}
+
+// Uint32ValueSlice converts a slice of uint32 pointers into a slice of
+// uint32 values
+func Uint32ValueSlice(src []*uint32) []uint32 {
+ dst := make([]uint32, len(src))
+ for i := 0; i < len(src); i++ {
+ if src[i] != nil {
+ dst[i] = *(src[i])
+ }
+ }
+ return dst
+}
+
+// Uint32Map converts a string map of uint32 values into a string
+// map of uint32 pointers
+func Uint32Map(src map[string]uint32) map[string]*uint32 {
+ dst := make(map[string]*uint32)
+ for k, val := range src {
+ v := val
+ dst[k] = &v
+ }
+ return dst
+}
+
+// Uint32ValueMap converts a string map of uint32 pointers into a string
+// map of uint32 values
+func Uint32ValueMap(src map[string]*uint32) map[string]uint32 {
+ dst := make(map[string]uint32)
+ for k, val := range src {
+ if val != nil {
+ dst[k] = *val
+ }
+ }
+ return dst
+}
+
+// Uint64 returns a pointer to of the uint64 value passed in.
+func Uint64(v uint64) *uint64 {
+ return &v
+}
+
+// Uint64Value returns the value of the uint64 pointer passed in or
+// 0 if the pointer is nil.
+func Uint64Value(v *uint64) uint64 {
+ if v != nil {
+ return *v
+ }
+ return 0
+}
+
+// Uint64Slice converts a slice of uint64 values into a slice of
+// uint64 pointers
+func Uint64Slice(src []uint64) []*uint64 {
+ dst := make([]*uint64, len(src))
+ for i := 0; i < len(src); i++ {
+ dst[i] = &(src[i])
+ }
+ return dst
+}
+
+// Uint64ValueSlice converts a slice of uint64 pointers into a slice of
+// uint64 values
+func Uint64ValueSlice(src []*uint64) []uint64 {
+ dst := make([]uint64, len(src))
+ for i := 0; i < len(src); i++ {
+ if src[i] != nil {
+ dst[i] = *(src[i])
+ }
+ }
+ return dst
+}
+
+// Uint64Map converts a string map of uint64 values into a string
+// map of uint64 pointers
+func Uint64Map(src map[string]uint64) map[string]*uint64 {
+ dst := make(map[string]*uint64)
+ for k, val := range src {
+ v := val
+ dst[k] = &v
+ }
+ return dst
+}
+
+// Uint64ValueMap converts a string map of uint64 pointers into a string
+// map of uint64 values
+func Uint64ValueMap(src map[string]*uint64) map[string]uint64 {
+ dst := make(map[string]uint64)
+ for k, val := range src {
+ if val != nil {
+ dst[k] = *val
+ }
+ }
+ return dst
+}
+
+// Float32 returns a pointer to of the float32 value passed in.
+func Float32(v float32) *float32 {
+ return &v
+}
+
+// Float32Value returns the value of the float32 pointer passed in or
+// 0 if the pointer is nil.
+func Float32Value(v *float32) float32 {
+ if v != nil {
+ return *v
+ }
+
+ return 0
+}
+
+// Float32Slice converts a slice of float32 values into a slice of
+// float32 pointers
+func Float32Slice(src []float32) []*float32 {
+ dst := make([]*float32, len(src))
+
+ for i := 0; i < len(src); i++ {
+ dst[i] = &(src[i])
+ }
+
+ return dst
+}
+
+// Float32ValueSlice converts a slice of float32 pointers into a slice of
+// float32 values
+func Float32ValueSlice(src []*float32) []float32 {
+ dst := make([]float32, len(src))
+
+ for i := 0; i < len(src); i++ {
+ if src[i] != nil {
+ dst[i] = *(src[i])
+ }
+ }
+
+ return dst
+}
+
+// Float32Map converts a string map of float32 values into a string
+// map of float32 pointers
+func Float32Map(src map[string]float32) map[string]*float32 {
+ dst := make(map[string]*float32)
+
+ for k, val := range src {
+ v := val
+ dst[k] = &v
+ }
+
+ return dst
+}
+
+// Float32ValueMap converts a string map of float32 pointers into a string
+// map of float32 values
+func Float32ValueMap(src map[string]*float32) map[string]float32 {
+ dst := make(map[string]float32)
+
+ for k, val := range src {
+ if val != nil {
+ dst[k] = *val
+ }
+ }
+
+ return dst
+}
+
+// Float64 returns a pointer to of the float64 value passed in.
+func Float64(v float64) *float64 {
+ return &v
+}
+
+// Float64Value returns the value of the float64 pointer passed in or
+// 0 if the pointer is nil.
+func Float64Value(v *float64) float64 {
+ if v != nil {
+ return *v
+ }
+ return 0
+}
+
+// Float64Slice converts a slice of float64 values into a slice of
+// float64 pointers
+func Float64Slice(src []float64) []*float64 {
+ dst := make([]*float64, len(src))
+ for i := 0; i < len(src); i++ {
+ dst[i] = &(src[i])
+ }
+ return dst
+}
+
+// Float64ValueSlice converts a slice of float64 pointers into a slice of
+// float64 values
+func Float64ValueSlice(src []*float64) []float64 {
+ dst := make([]float64, len(src))
+ for i := 0; i < len(src); i++ {
+ if src[i] != nil {
+ dst[i] = *(src[i])
+ }
+ }
+ return dst
+}
+
+// Float64Map converts a string map of float64 values into a string
+// map of float64 pointers
+func Float64Map(src map[string]float64) map[string]*float64 {
+ dst := make(map[string]*float64)
+ for k, val := range src {
+ v := val
+ dst[k] = &v
+ }
+ return dst
+}
+
+// Float64ValueMap converts a string map of float64 pointers into a string
+// map of float64 values
+func Float64ValueMap(src map[string]*float64) map[string]float64 {
+ dst := make(map[string]float64)
+ for k, val := range src {
+ if val != nil {
+ dst[k] = *val
+ }
+ }
+ return dst
+}
+
+// Time returns a pointer to of the time.Time value passed in.
+func Time(v time.Time) *time.Time {
+ return &v
+}
+
+// TimeValue returns the value of the time.Time pointer passed in or
+// time.Time{} if the pointer is nil.
+func TimeValue(v *time.Time) time.Time {
+ if v != nil {
+ return *v
+ }
+ return time.Time{}
+}
+
+// TimeSlice converts a slice of time.Time values into a slice of
+// time.Time pointers
+func TimeSlice(src []time.Time) []*time.Time {
+ dst := make([]*time.Time, len(src))
+ for i := 0; i < len(src); i++ {
+ dst[i] = &(src[i])
+ }
+ return dst
+}
+
+// TimeValueSlice converts a slice of time.Time pointers into a slice of
+// time.Time values
+func TimeValueSlice(src []*time.Time) []time.Time {
+ dst := make([]time.Time, len(src))
+ for i := 0; i < len(src); i++ {
+ if src[i] != nil {
+ dst[i] = *(src[i])
+ }
+ }
+ return dst
+}
+
+// TimeMap converts a string map of time.Time values into a string
+// map of time.Time pointers
+func TimeMap(src map[string]time.Time) map[string]*time.Time {
+ dst := make(map[string]*time.Time)
+ for k, val := range src {
+ v := val
+ dst[k] = &v
+ }
+ return dst
+}
+
+// TimeValueMap converts a string map of time.Time pointers into a string
+// map of time.Time values
+func TimeValueMap(src map[string]*time.Time) map[string]time.Time {
+ dst := make(map[string]time.Time)
+ for k, val := range src {
+ if val != nil {
+ dst[k] = *val
+ }
+ }
+ return dst
+}
diff --git a/vendor/github.com/go-openapi/swag/doc.go b/vendor/github.com/go-openapi/swag/doc.go
new file mode 100644
index 000000000..55094cb74
--- /dev/null
+++ b/vendor/github.com/go-openapi/swag/doc.go
@@ -0,0 +1,31 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+/*
+Package swag contains a bunch of helper functions for go-openapi and go-swagger projects.
+
+You may also use it standalone for your projects.
+
+ - convert between value and pointers for builtin types
+ - convert from string to builtin types (wraps strconv)
+ - fast json concatenation
+ - search in path
+ - load from file or http
+ - name mangling
+
+This repo has only few dependencies outside of the standard library:
+
+ - YAML utilities depend on gopkg.in/yaml.v2
+*/
+package swag
diff --git a/vendor/github.com/go-openapi/swag/file.go b/vendor/github.com/go-openapi/swag/file.go
new file mode 100644
index 000000000..16accc55f
--- /dev/null
+++ b/vendor/github.com/go-openapi/swag/file.go
@@ -0,0 +1,33 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package swag
+
+import "mime/multipart"
+
+// File represents an uploaded file.
+type File struct {
+ Data multipart.File
+ Header *multipart.FileHeader
+}
+
+// Read bytes from the file
+func (f *File) Read(p []byte) (n int, err error) {
+ return f.Data.Read(p)
+}
+
+// Close the file
+func (f *File) Close() error {
+ return f.Data.Close()
+}
diff --git a/vendor/github.com/go-openapi/swag/json.go b/vendor/github.com/go-openapi/swag/json.go
new file mode 100644
index 000000000..7e9902ca3
--- /dev/null
+++ b/vendor/github.com/go-openapi/swag/json.go
@@ -0,0 +1,312 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package swag
+
+import (
+ "bytes"
+ "encoding/json"
+ "log"
+ "reflect"
+ "strings"
+ "sync"
+
+ "github.com/mailru/easyjson/jlexer"
+ "github.com/mailru/easyjson/jwriter"
+)
+
+// nullJSON represents a JSON object with null type
+var nullJSON = []byte("null")
+
+// DefaultJSONNameProvider the default cache for types
+var DefaultJSONNameProvider = NewNameProvider()
+
+const comma = byte(',')
+
+var closers map[byte]byte
+
+func init() {
+ closers = map[byte]byte{
+ '{': '}',
+ '[': ']',
+ }
+}
+
+type ejMarshaler interface {
+ MarshalEasyJSON(w *jwriter.Writer)
+}
+
+type ejUnmarshaler interface {
+ UnmarshalEasyJSON(w *jlexer.Lexer)
+}
+
+// WriteJSON writes json data, prefers finding an appropriate interface to short-circuit the marshaler
+// so it takes the fastest option available.
+func WriteJSON(data interface{}) ([]byte, error) {
+ if d, ok := data.(ejMarshaler); ok {
+ jw := new(jwriter.Writer)
+ d.MarshalEasyJSON(jw)
+ return jw.BuildBytes()
+ }
+ if d, ok := data.(json.Marshaler); ok {
+ return d.MarshalJSON()
+ }
+ return json.Marshal(data)
+}
+
+// ReadJSON reads json data, prefers finding an appropriate interface to short-circuit the unmarshaler
+// so it takes the fastest option available
+func ReadJSON(data []byte, value interface{}) error {
+ trimmedData := bytes.Trim(data, "\x00")
+ if d, ok := value.(ejUnmarshaler); ok {
+ jl := &jlexer.Lexer{Data: trimmedData}
+ d.UnmarshalEasyJSON(jl)
+ return jl.Error()
+ }
+ if d, ok := value.(json.Unmarshaler); ok {
+ return d.UnmarshalJSON(trimmedData)
+ }
+ return json.Unmarshal(trimmedData, value)
+}
+
+// DynamicJSONToStruct converts an untyped json structure into a struct
+func DynamicJSONToStruct(data interface{}, target interface{}) error {
+ // TODO: convert straight to a json typed map (mergo + iterate?)
+ b, err := WriteJSON(data)
+ if err != nil {
+ return err
+ }
+ return ReadJSON(b, target)
+}
+
+// ConcatJSON concatenates multiple json objects efficiently
+func ConcatJSON(blobs ...[]byte) []byte {
+ if len(blobs) == 0 {
+ return nil
+ }
+
+ last := len(blobs) - 1
+ for blobs[last] == nil || bytes.Equal(blobs[last], nullJSON) {
+ // strips trailing null objects
+ last--
+ if last < 0 {
+ // there was nothing but "null"s or nil...
+ return nil
+ }
+ }
+ if last == 0 {
+ return blobs[0]
+ }
+
+ var opening, closing byte
+ var idx, a int
+ buf := bytes.NewBuffer(nil)
+
+ for i, b := range blobs[:last+1] {
+ if b == nil || bytes.Equal(b, nullJSON) {
+ // a null object is in the list: skip it
+ continue
+ }
+ if len(b) > 0 && opening == 0 { // is this an array or an object?
+ opening, closing = b[0], closers[b[0]]
+ }
+
+ if opening != '{' && opening != '[' {
+ continue // don't know how to concatenate non container objects
+ }
+
+ if len(b) < 3 { // yep empty but also the last one, so closing this thing
+ if i == last && a > 0 {
+ if err := buf.WriteByte(closing); err != nil {
+ log.Println(err)
+ }
+ }
+ continue
+ }
+
+ idx = 0
+ if a > 0 { // we need to join with a comma for everything beyond the first non-empty item
+ if err := buf.WriteByte(comma); err != nil {
+ log.Println(err)
+ }
+ idx = 1 // this is not the first or the last so we want to drop the leading bracket
+ }
+
+ if i != last { // not the last one, strip brackets
+ if _, err := buf.Write(b[idx : len(b)-1]); err != nil {
+ log.Println(err)
+ }
+ } else { // last one, strip only the leading bracket
+ if _, err := buf.Write(b[idx:]); err != nil {
+ log.Println(err)
+ }
+ }
+ a++
+ }
+ // somehow it ended up being empty, so provide a default value
+ if buf.Len() == 0 {
+ if err := buf.WriteByte(opening); err != nil {
+ log.Println(err)
+ }
+ if err := buf.WriteByte(closing); err != nil {
+ log.Println(err)
+ }
+ }
+ return buf.Bytes()
+}
+
+// ToDynamicJSON turns an object into a properly JSON typed structure
+func ToDynamicJSON(data interface{}) interface{} {
+ // TODO: convert straight to a json typed map (mergo + iterate?)
+ b, err := json.Marshal(data)
+ if err != nil {
+ log.Println(err)
+ }
+ var res interface{}
+ if err := json.Unmarshal(b, &res); err != nil {
+ log.Println(err)
+ }
+ return res
+}
+
+// FromDynamicJSON turns an object into a properly JSON typed structure
+func FromDynamicJSON(data, target interface{}) error {
+ b, err := json.Marshal(data)
+ if err != nil {
+ log.Println(err)
+ }
+ return json.Unmarshal(b, target)
+}
+
+// NameProvider represents an object capable of translating from go property names
+// to json property names
+// This type is thread-safe.
+type NameProvider struct {
+ lock *sync.Mutex
+ index map[reflect.Type]nameIndex
+}
+
+type nameIndex struct {
+ jsonNames map[string]string
+ goNames map[string]string
+}
+
+// NewNameProvider creates a new name provider
+func NewNameProvider() *NameProvider {
+ return &NameProvider{
+ lock: &sync.Mutex{},
+ index: make(map[reflect.Type]nameIndex),
+ }
+}
+
+func buildnameIndex(tpe reflect.Type, idx, reverseIdx map[string]string) {
+ for i := 0; i < tpe.NumField(); i++ {
+ targetDes := tpe.Field(i)
+
+ if targetDes.PkgPath != "" { // unexported
+ continue
+ }
+
+ if targetDes.Anonymous { // walk embedded structures tree down first
+ buildnameIndex(targetDes.Type, idx, reverseIdx)
+ continue
+ }
+
+ if tag := targetDes.Tag.Get("json"); tag != "" {
+
+ parts := strings.Split(tag, ",")
+ if len(parts) == 0 {
+ continue
+ }
+
+ nm := parts[0]
+ if nm == "-" {
+ continue
+ }
+ if nm == "" { // empty string means we want to use the Go name
+ nm = targetDes.Name
+ }
+
+ idx[nm] = targetDes.Name
+ reverseIdx[targetDes.Name] = nm
+ }
+ }
+}
+
+func newNameIndex(tpe reflect.Type) nameIndex {
+ var idx = make(map[string]string, tpe.NumField())
+ var reverseIdx = make(map[string]string, tpe.NumField())
+
+ buildnameIndex(tpe, idx, reverseIdx)
+ return nameIndex{jsonNames: idx, goNames: reverseIdx}
+}
+
+// GetJSONNames gets all the json property names for a type
+func (n *NameProvider) GetJSONNames(subject interface{}) []string {
+ n.lock.Lock()
+ defer n.lock.Unlock()
+ tpe := reflect.Indirect(reflect.ValueOf(subject)).Type()
+ names, ok := n.index[tpe]
+ if !ok {
+ names = n.makeNameIndex(tpe)
+ }
+
+ res := make([]string, 0, len(names.jsonNames))
+ for k := range names.jsonNames {
+ res = append(res, k)
+ }
+ return res
+}
+
+// GetJSONName gets the json name for a go property name
+func (n *NameProvider) GetJSONName(subject interface{}, name string) (string, bool) {
+ tpe := reflect.Indirect(reflect.ValueOf(subject)).Type()
+ return n.GetJSONNameForType(tpe, name)
+}
+
+// GetJSONNameForType gets the json name for a go property name on a given type
+func (n *NameProvider) GetJSONNameForType(tpe reflect.Type, name string) (string, bool) {
+ n.lock.Lock()
+ defer n.lock.Unlock()
+ names, ok := n.index[tpe]
+ if !ok {
+ names = n.makeNameIndex(tpe)
+ }
+ nme, ok := names.goNames[name]
+ return nme, ok
+}
+
+func (n *NameProvider) makeNameIndex(tpe reflect.Type) nameIndex {
+ names := newNameIndex(tpe)
+ n.index[tpe] = names
+ return names
+}
+
+// GetGoName gets the go name for a json property name
+func (n *NameProvider) GetGoName(subject interface{}, name string) (string, bool) {
+ tpe := reflect.Indirect(reflect.ValueOf(subject)).Type()
+ return n.GetGoNameForType(tpe, name)
+}
+
+// GetGoNameForType gets the go name for a given type for a json property name
+func (n *NameProvider) GetGoNameForType(tpe reflect.Type, name string) (string, bool) {
+ n.lock.Lock()
+ defer n.lock.Unlock()
+ names, ok := n.index[tpe]
+ if !ok {
+ names = n.makeNameIndex(tpe)
+ }
+ nme, ok := names.jsonNames[name]
+ return nme, ok
+}
diff --git a/vendor/github.com/go-openapi/swag/loading.go b/vendor/github.com/go-openapi/swag/loading.go
new file mode 100644
index 000000000..00038c377
--- /dev/null
+++ b/vendor/github.com/go-openapi/swag/loading.go
@@ -0,0 +1,121 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package swag
+
+import (
+ "fmt"
+ "io"
+ "log"
+ "net/http"
+ "net/url"
+ "os"
+ "path/filepath"
+ "runtime"
+ "strings"
+ "time"
+)
+
+// LoadHTTPTimeout the default timeout for load requests
+var LoadHTTPTimeout = 30 * time.Second
+
+// LoadHTTPBasicAuthUsername the username to use when load requests require basic auth
+var LoadHTTPBasicAuthUsername = ""
+
+// LoadHTTPBasicAuthPassword the password to use when load requests require basic auth
+var LoadHTTPBasicAuthPassword = ""
+
+// LoadHTTPCustomHeaders an optional collection of custom HTTP headers for load requests
+var LoadHTTPCustomHeaders = map[string]string{}
+
+// LoadFromFileOrHTTP loads the bytes from a file or a remote http server based on the path passed in
+func LoadFromFileOrHTTP(path string) ([]byte, error) {
+ return LoadStrategy(path, os.ReadFile, loadHTTPBytes(LoadHTTPTimeout))(path)
+}
+
+// LoadFromFileOrHTTPWithTimeout loads the bytes from a file or a remote http server based on the path passed in
+// timeout arg allows for per request overriding of the request timeout
+func LoadFromFileOrHTTPWithTimeout(path string, timeout time.Duration) ([]byte, error) {
+ return LoadStrategy(path, os.ReadFile, loadHTTPBytes(timeout))(path)
+}
+
+// LoadStrategy returns a loader function for a given path or uri
+func LoadStrategy(path string, local, remote func(string) ([]byte, error)) func(string) ([]byte, error) {
+ if strings.HasPrefix(path, "http") {
+ return remote
+ }
+ return func(pth string) ([]byte, error) {
+ upth, err := pathUnescape(pth)
+ if err != nil {
+ return nil, err
+ }
+
+ if strings.HasPrefix(pth, `file://`) {
+ if runtime.GOOS == "windows" {
+ // support for canonical file URIs on windows.
+ // Zero tolerance here for dodgy URIs.
+ u, _ := url.Parse(upth)
+ if u.Host != "" {
+ // assume UNC name (volume share)
+ // file://host/share/folder\... ==> \\host\share\path\folder
+ // NOTE: UNC port not yet supported
+ upth = strings.Join([]string{`\`, u.Host, u.Path}, `\`)
+ } else {
+ // file:///c:/folder/... ==> just remove the leading slash
+ upth = strings.TrimPrefix(upth, `file:///`)
+ }
+ } else {
+ upth = strings.TrimPrefix(upth, `file://`)
+ }
+ }
+
+ return local(filepath.FromSlash(upth))
+ }
+}
+
+func loadHTTPBytes(timeout time.Duration) func(path string) ([]byte, error) {
+ return func(path string) ([]byte, error) {
+ client := &http.Client{Timeout: timeout}
+ req, err := http.NewRequest(http.MethodGet, path, nil) //nolint:noctx
+ if err != nil {
+ return nil, err
+ }
+
+ if LoadHTTPBasicAuthUsername != "" && LoadHTTPBasicAuthPassword != "" {
+ req.SetBasicAuth(LoadHTTPBasicAuthUsername, LoadHTTPBasicAuthPassword)
+ }
+
+ for key, val := range LoadHTTPCustomHeaders {
+ req.Header.Set(key, val)
+ }
+
+ resp, err := client.Do(req)
+ defer func() {
+ if resp != nil {
+ if e := resp.Body.Close(); e != nil {
+ log.Println(e)
+ }
+ }
+ }()
+ if err != nil {
+ return nil, err
+ }
+
+ if resp.StatusCode != http.StatusOK {
+ return nil, fmt.Errorf("could not access document at %q [%s] ", path, resp.Status)
+ }
+
+ return io.ReadAll(resp.Body)
+ }
+}
diff --git a/vendor/github.com/go-openapi/swag/name_lexem.go b/vendor/github.com/go-openapi/swag/name_lexem.go
new file mode 100644
index 000000000..aa7f6a9bb
--- /dev/null
+++ b/vendor/github.com/go-openapi/swag/name_lexem.go
@@ -0,0 +1,87 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package swag
+
+import "unicode"
+
+type (
+ nameLexem interface {
+ GetUnsafeGoName() string
+ GetOriginal() string
+ IsInitialism() bool
+ }
+
+ initialismNameLexem struct {
+ original string
+ matchedInitialism string
+ }
+
+ casualNameLexem struct {
+ original string
+ }
+)
+
+func newInitialismNameLexem(original, matchedInitialism string) *initialismNameLexem {
+ return &initialismNameLexem{
+ original: original,
+ matchedInitialism: matchedInitialism,
+ }
+}
+
+func newCasualNameLexem(original string) *casualNameLexem {
+ return &casualNameLexem{
+ original: original,
+ }
+}
+
+func (l *initialismNameLexem) GetUnsafeGoName() string {
+ return l.matchedInitialism
+}
+
+func (l *casualNameLexem) GetUnsafeGoName() string {
+ var first rune
+ var rest string
+ for i, orig := range l.original {
+ if i == 0 {
+ first = orig
+ continue
+ }
+ if i > 0 {
+ rest = l.original[i:]
+ break
+ }
+ }
+ if len(l.original) > 1 {
+ return string(unicode.ToUpper(first)) + lower(rest)
+ }
+
+ return l.original
+}
+
+func (l *initialismNameLexem) GetOriginal() string {
+ return l.original
+}
+
+func (l *casualNameLexem) GetOriginal() string {
+ return l.original
+}
+
+func (l *initialismNameLexem) IsInitialism() bool {
+ return true
+}
+
+func (l *casualNameLexem) IsInitialism() bool {
+ return false
+}
diff --git a/vendor/github.com/go-openapi/swag/net.go b/vendor/github.com/go-openapi/swag/net.go
new file mode 100644
index 000000000..821235f84
--- /dev/null
+++ b/vendor/github.com/go-openapi/swag/net.go
@@ -0,0 +1,38 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package swag
+
+import (
+ "net"
+ "strconv"
+)
+
+// SplitHostPort splits a network address into a host and a port.
+// The port is -1 when there is no port to be found
+func SplitHostPort(addr string) (host string, port int, err error) {
+ h, p, err := net.SplitHostPort(addr)
+ if err != nil {
+ return "", -1, err
+ }
+ if p == "" {
+ return "", -1, &net.AddrError{Err: "missing port in address", Addr: addr}
+ }
+
+ pi, err := strconv.Atoi(p)
+ if err != nil {
+ return "", -1, err
+ }
+ return h, pi, nil
+}
diff --git a/vendor/github.com/go-openapi/swag/path.go b/vendor/github.com/go-openapi/swag/path.go
new file mode 100644
index 000000000..941bd0176
--- /dev/null
+++ b/vendor/github.com/go-openapi/swag/path.go
@@ -0,0 +1,59 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package swag
+
+import (
+ "os"
+ "path/filepath"
+ "runtime"
+ "strings"
+)
+
+const (
+ // GOPATHKey represents the env key for gopath
+ GOPATHKey = "GOPATH"
+)
+
+// FindInSearchPath finds a package in a provided lists of paths
+func FindInSearchPath(searchPath, pkg string) string {
+ pathsList := filepath.SplitList(searchPath)
+ for _, path := range pathsList {
+ if evaluatedPath, err := filepath.EvalSymlinks(filepath.Join(path, "src", pkg)); err == nil {
+ if _, err := os.Stat(evaluatedPath); err == nil {
+ return evaluatedPath
+ }
+ }
+ }
+ return ""
+}
+
+// FindInGoSearchPath finds a package in the $GOPATH:$GOROOT
+func FindInGoSearchPath(pkg string) string {
+ return FindInSearchPath(FullGoSearchPath(), pkg)
+}
+
+// FullGoSearchPath gets the search paths for finding packages
+func FullGoSearchPath() string {
+ allPaths := os.Getenv(GOPATHKey)
+ if allPaths == "" {
+ allPaths = filepath.Join(os.Getenv("HOME"), "go")
+ }
+ if allPaths != "" {
+ allPaths = strings.Join([]string{allPaths, runtime.GOROOT()}, ":")
+ } else {
+ allPaths = runtime.GOROOT()
+ }
+ return allPaths
+}
diff --git a/vendor/github.com/go-openapi/swag/post_go18.go b/vendor/github.com/go-openapi/swag/post_go18.go
new file mode 100644
index 000000000..f5228b82c
--- /dev/null
+++ b/vendor/github.com/go-openapi/swag/post_go18.go
@@ -0,0 +1,24 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+//go:build go1.8
+// +build go1.8
+
+package swag
+
+import "net/url"
+
+func pathUnescape(path string) (string, error) {
+ return url.PathUnescape(path)
+}
diff --git a/vendor/github.com/go-openapi/swag/post_go19.go b/vendor/github.com/go-openapi/swag/post_go19.go
new file mode 100644
index 000000000..7c7da9c08
--- /dev/null
+++ b/vendor/github.com/go-openapi/swag/post_go19.go
@@ -0,0 +1,68 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+//go:build go1.9
+// +build go1.9
+
+package swag
+
+import (
+ "sort"
+ "sync"
+)
+
+// indexOfInitialisms is a thread-safe implementation of the sorted index of initialisms.
+// Since go1.9, this may be implemented with sync.Map.
+type indexOfInitialisms struct {
+ sortMutex *sync.Mutex
+ index *sync.Map
+}
+
+func newIndexOfInitialisms() *indexOfInitialisms {
+ return &indexOfInitialisms{
+ sortMutex: new(sync.Mutex),
+ index: new(sync.Map),
+ }
+}
+
+func (m *indexOfInitialisms) load(initial map[string]bool) *indexOfInitialisms {
+ m.sortMutex.Lock()
+ defer m.sortMutex.Unlock()
+ for k, v := range initial {
+ m.index.Store(k, v)
+ }
+ return m
+}
+
+func (m *indexOfInitialisms) isInitialism(key string) bool {
+ _, ok := m.index.Load(key)
+ return ok
+}
+
+func (m *indexOfInitialisms) add(key string) *indexOfInitialisms {
+ m.index.Store(key, true)
+ return m
+}
+
+func (m *indexOfInitialisms) sorted() (result []string) {
+ m.sortMutex.Lock()
+ defer m.sortMutex.Unlock()
+ m.index.Range(func(key, value interface{}) bool {
+ k := key.(string)
+ result = append(result, k)
+ return true
+ })
+ sort.Sort(sort.Reverse(byInitialism(result)))
+ return
+}
diff --git a/vendor/github.com/go-openapi/swag/pre_go18.go b/vendor/github.com/go-openapi/swag/pre_go18.go
new file mode 100644
index 000000000..2757d9b95
--- /dev/null
+++ b/vendor/github.com/go-openapi/swag/pre_go18.go
@@ -0,0 +1,24 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+//go:build !go1.8
+// +build !go1.8
+
+package swag
+
+import "net/url"
+
+func pathUnescape(path string) (string, error) {
+ return url.QueryUnescape(path)
+}
diff --git a/vendor/github.com/go-openapi/swag/pre_go19.go b/vendor/github.com/go-openapi/swag/pre_go19.go
new file mode 100644
index 000000000..0565db377
--- /dev/null
+++ b/vendor/github.com/go-openapi/swag/pre_go19.go
@@ -0,0 +1,70 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+//go:build !go1.9
+// +build !go1.9
+
+package swag
+
+import (
+ "sort"
+ "sync"
+)
+
+// indexOfInitialisms is a thread-safe implementation of the sorted index of initialisms.
+// Before go1.9, this may be implemented with a mutex on the map.
+type indexOfInitialisms struct {
+ getMutex *sync.Mutex
+ index map[string]bool
+}
+
+func newIndexOfInitialisms() *indexOfInitialisms {
+ return &indexOfInitialisms{
+ getMutex: new(sync.Mutex),
+ index: make(map[string]bool, 50),
+ }
+}
+
+func (m *indexOfInitialisms) load(initial map[string]bool) *indexOfInitialisms {
+ m.getMutex.Lock()
+ defer m.getMutex.Unlock()
+ for k, v := range initial {
+ m.index[k] = v
+ }
+ return m
+}
+
+func (m *indexOfInitialisms) isInitialism(key string) bool {
+ m.getMutex.Lock()
+ defer m.getMutex.Unlock()
+ _, ok := m.index[key]
+ return ok
+}
+
+func (m *indexOfInitialisms) add(key string) *indexOfInitialisms {
+ m.getMutex.Lock()
+ defer m.getMutex.Unlock()
+ m.index[key] = true
+ return m
+}
+
+func (m *indexOfInitialisms) sorted() (result []string) {
+ m.getMutex.Lock()
+ defer m.getMutex.Unlock()
+ for k := range m.index {
+ result = append(result, k)
+ }
+ sort.Sort(sort.Reverse(byInitialism(result)))
+ return
+}
diff --git a/vendor/github.com/go-openapi/swag/split.go b/vendor/github.com/go-openapi/swag/split.go
new file mode 100644
index 000000000..a1825fb7d
--- /dev/null
+++ b/vendor/github.com/go-openapi/swag/split.go
@@ -0,0 +1,262 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package swag
+
+import (
+ "unicode"
+)
+
+var nameReplaceTable = map[rune]string{
+ '@': "At ",
+ '&': "And ",
+ '|': "Pipe ",
+ '$': "Dollar ",
+ '!': "Bang ",
+ '-': "",
+ '_': "",
+}
+
+type (
+ splitter struct {
+ postSplitInitialismCheck bool
+ initialisms []string
+ }
+
+ splitterOption func(*splitter) *splitter
+)
+
+// split calls the splitter; splitter provides more control and post options
+func split(str string) []string {
+ lexems := newSplitter().split(str)
+ result := make([]string, 0, len(lexems))
+
+ for _, lexem := range lexems {
+ result = append(result, lexem.GetOriginal())
+ }
+
+ return result
+
+}
+
+func (s *splitter) split(str string) []nameLexem {
+ return s.toNameLexems(str)
+}
+
+func newSplitter(options ...splitterOption) *splitter {
+ splitter := &splitter{
+ postSplitInitialismCheck: false,
+ initialisms: initialisms,
+ }
+
+ for _, option := range options {
+ splitter = option(splitter)
+ }
+
+ return splitter
+}
+
+// withPostSplitInitialismCheck allows to catch initialisms after main split process
+func withPostSplitInitialismCheck(s *splitter) *splitter {
+ s.postSplitInitialismCheck = true
+ return s
+}
+
+type (
+ initialismMatch struct {
+ start, end int
+ body []rune
+ complete bool
+ }
+ initialismMatches []*initialismMatch
+)
+
+func (s *splitter) toNameLexems(name string) []nameLexem {
+ nameRunes := []rune(name)
+ matches := s.gatherInitialismMatches(nameRunes)
+ return s.mapMatchesToNameLexems(nameRunes, matches)
+}
+
+func (s *splitter) gatherInitialismMatches(nameRunes []rune) initialismMatches {
+ matches := make(initialismMatches, 0)
+
+ for currentRunePosition, currentRune := range nameRunes {
+ newMatches := make(initialismMatches, 0, len(matches))
+
+ // check current initialism matches
+ for _, match := range matches {
+ if keepCompleteMatch := match.complete; keepCompleteMatch {
+ newMatches = append(newMatches, match)
+ continue
+ }
+
+ // drop failed match
+ currentMatchRune := match.body[currentRunePosition-match.start]
+ if !s.initialismRuneEqual(currentMatchRune, currentRune) {
+ continue
+ }
+
+ // try to complete ongoing match
+ if currentRunePosition-match.start == len(match.body)-1 {
+ // we are close; the next step is to check the symbol ahead
+ // if it is a small letter, then it is not the end of match
+ // but beginning of the next word
+
+ if currentRunePosition < len(nameRunes)-1 {
+ nextRune := nameRunes[currentRunePosition+1]
+ if newWord := unicode.IsLower(nextRune); newWord {
+ // oh ok, it was the start of a new word
+ continue
+ }
+ }
+
+ match.complete = true
+ match.end = currentRunePosition
+ }
+
+ newMatches = append(newMatches, match)
+ }
+
+ // check for new initialism matches
+ for _, initialism := range s.initialisms {
+ initialismRunes := []rune(initialism)
+ if s.initialismRuneEqual(initialismRunes[0], currentRune) {
+ newMatches = append(newMatches, &initialismMatch{
+ start: currentRunePosition,
+ body: initialismRunes,
+ complete: false,
+ })
+ }
+ }
+
+ matches = newMatches
+ }
+
+ return matches
+}
+
+func (s *splitter) mapMatchesToNameLexems(nameRunes []rune, matches initialismMatches) []nameLexem {
+ nameLexems := make([]nameLexem, 0)
+
+ var lastAcceptedMatch *initialismMatch
+ for _, match := range matches {
+ if !match.complete {
+ continue
+ }
+
+ if firstMatch := lastAcceptedMatch == nil; firstMatch {
+ nameLexems = append(nameLexems, s.breakCasualString(nameRunes[:match.start])...)
+ nameLexems = append(nameLexems, s.breakInitialism(string(match.body)))
+
+ lastAcceptedMatch = match
+
+ continue
+ }
+
+ if overlappedMatch := match.start <= lastAcceptedMatch.end; overlappedMatch {
+ continue
+ }
+
+ middle := nameRunes[lastAcceptedMatch.end+1 : match.start]
+ nameLexems = append(nameLexems, s.breakCasualString(middle)...)
+ nameLexems = append(nameLexems, s.breakInitialism(string(match.body)))
+
+ lastAcceptedMatch = match
+ }
+
+ // we have not found any accepted matches
+ if lastAcceptedMatch == nil {
+ return s.breakCasualString(nameRunes)
+ }
+
+ if lastAcceptedMatch.end+1 != len(nameRunes) {
+ rest := nameRunes[lastAcceptedMatch.end+1:]
+ nameLexems = append(nameLexems, s.breakCasualString(rest)...)
+ }
+
+ return nameLexems
+}
+
+func (s *splitter) initialismRuneEqual(a, b rune) bool {
+ return a == b
+}
+
+func (s *splitter) breakInitialism(original string) nameLexem {
+ return newInitialismNameLexem(original, original)
+}
+
+func (s *splitter) breakCasualString(str []rune) []nameLexem {
+ segments := make([]nameLexem, 0)
+ currentSegment := ""
+
+ addCasualNameLexem := func(original string) {
+ segments = append(segments, newCasualNameLexem(original))
+ }
+
+ addInitialismNameLexem := func(original, match string) {
+ segments = append(segments, newInitialismNameLexem(original, match))
+ }
+
+ addNameLexem := func(original string) {
+ if s.postSplitInitialismCheck {
+ for _, initialism := range s.initialisms {
+ if upper(initialism) == upper(original) {
+ addInitialismNameLexem(original, initialism)
+ return
+ }
+ }
+ }
+
+ addCasualNameLexem(original)
+ }
+
+ for _, rn := range string(str) {
+ if replace, found := nameReplaceTable[rn]; found {
+ if currentSegment != "" {
+ addNameLexem(currentSegment)
+ currentSegment = ""
+ }
+
+ if replace != "" {
+ addNameLexem(replace)
+ }
+
+ continue
+ }
+
+ if !unicode.In(rn, unicode.L, unicode.M, unicode.N, unicode.Pc) {
+ if currentSegment != "" {
+ addNameLexem(currentSegment)
+ currentSegment = ""
+ }
+
+ continue
+ }
+
+ if unicode.IsUpper(rn) {
+ if currentSegment != "" {
+ addNameLexem(currentSegment)
+ }
+ currentSegment = ""
+ }
+
+ currentSegment += string(rn)
+ }
+
+ if currentSegment != "" {
+ addNameLexem(currentSegment)
+ }
+
+ return segments
+}
diff --git a/vendor/github.com/go-openapi/swag/util.go b/vendor/github.com/go-openapi/swag/util.go
new file mode 100644
index 000000000..d971fbe34
--- /dev/null
+++ b/vendor/github.com/go-openapi/swag/util.go
@@ -0,0 +1,394 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package swag
+
+import (
+ "reflect"
+ "strings"
+ "unicode"
+)
+
+// commonInitialisms are common acronyms that are kept as whole uppercased words.
+var commonInitialisms *indexOfInitialisms
+
+// initialisms is a slice of sorted initialisms
+var initialisms []string
+
+var isInitialism func(string) bool
+
+// GoNamePrefixFunc sets an optional rule to prefix go names
+// which do not start with a letter.
+//
+// e.g. to help convert "123" into "{prefix}123"
+//
+// The default is to prefix with "X"
+var GoNamePrefixFunc func(string) string
+
+func init() {
+ // Taken from https://github.com/golang/lint/blob/3390df4df2787994aea98de825b964ac7944b817/lint.go#L732-L769
+ var configuredInitialisms = map[string]bool{
+ "ACL": true,
+ "API": true,
+ "ASCII": true,
+ "CPU": true,
+ "CSS": true,
+ "DNS": true,
+ "EOF": true,
+ "GUID": true,
+ "HTML": true,
+ "HTTPS": true,
+ "HTTP": true,
+ "ID": true,
+ "IP": true,
+ "IPv4": true,
+ "IPv6": true,
+ "JSON": true,
+ "LHS": true,
+ "OAI": true,
+ "QPS": true,
+ "RAM": true,
+ "RHS": true,
+ "RPC": true,
+ "SLA": true,
+ "SMTP": true,
+ "SQL": true,
+ "SSH": true,
+ "TCP": true,
+ "TLS": true,
+ "TTL": true,
+ "UDP": true,
+ "UI": true,
+ "UID": true,
+ "UUID": true,
+ "URI": true,
+ "URL": true,
+ "UTF8": true,
+ "VM": true,
+ "XML": true,
+ "XMPP": true,
+ "XSRF": true,
+ "XSS": true,
+ }
+
+ // a thread-safe index of initialisms
+ commonInitialisms = newIndexOfInitialisms().load(configuredInitialisms)
+ initialisms = commonInitialisms.sorted()
+
+ // a test function
+ isInitialism = commonInitialisms.isInitialism
+}
+
+const (
+ // collectionFormatComma = "csv"
+ collectionFormatSpace = "ssv"
+ collectionFormatTab = "tsv"
+ collectionFormatPipe = "pipes"
+ collectionFormatMulti = "multi"
+)
+
+// JoinByFormat joins a string array by a known format (e.g. swagger's collectionFormat attribute):
+//
+// ssv: space separated value
+// tsv: tab separated value
+// pipes: pipe (|) separated value
+// csv: comma separated value (default)
+func JoinByFormat(data []string, format string) []string {
+ if len(data) == 0 {
+ return data
+ }
+ var sep string
+ switch format {
+ case collectionFormatSpace:
+ sep = " "
+ case collectionFormatTab:
+ sep = "\t"
+ case collectionFormatPipe:
+ sep = "|"
+ case collectionFormatMulti:
+ return data
+ default:
+ sep = ","
+ }
+ return []string{strings.Join(data, sep)}
+}
+
+// SplitByFormat splits a string by a known format:
+//
+// ssv: space separated value
+// tsv: tab separated value
+// pipes: pipe (|) separated value
+// csv: comma separated value (default)
+func SplitByFormat(data, format string) []string {
+ if data == "" {
+ return nil
+ }
+ var sep string
+ switch format {
+ case collectionFormatSpace:
+ sep = " "
+ case collectionFormatTab:
+ sep = "\t"
+ case collectionFormatPipe:
+ sep = "|"
+ case collectionFormatMulti:
+ return nil
+ default:
+ sep = ","
+ }
+ var result []string
+ for _, s := range strings.Split(data, sep) {
+ if ts := strings.TrimSpace(s); ts != "" {
+ result = append(result, ts)
+ }
+ }
+ return result
+}
+
+type byInitialism []string
+
+func (s byInitialism) Len() int {
+ return len(s)
+}
+func (s byInitialism) Swap(i, j int) {
+ s[i], s[j] = s[j], s[i]
+}
+func (s byInitialism) Less(i, j int) bool {
+ if len(s[i]) != len(s[j]) {
+ return len(s[i]) < len(s[j])
+ }
+
+ return strings.Compare(s[i], s[j]) > 0
+}
+
+// Removes leading whitespaces
+func trim(str string) string {
+ return strings.Trim(str, " ")
+}
+
+// Shortcut to strings.ToUpper()
+func upper(str string) string {
+ return strings.ToUpper(trim(str))
+}
+
+// Shortcut to strings.ToLower()
+func lower(str string) string {
+ return strings.ToLower(trim(str))
+}
+
+// Camelize an uppercased word
+func Camelize(word string) (camelized string) {
+ for pos, ru := range []rune(word) {
+ if pos > 0 {
+ camelized += string(unicode.ToLower(ru))
+ } else {
+ camelized += string(unicode.ToUpper(ru))
+ }
+ }
+ return
+}
+
+// ToFileName lowercases and underscores a go type name
+func ToFileName(name string) string {
+ in := split(name)
+ out := make([]string, 0, len(in))
+
+ for _, w := range in {
+ out = append(out, lower(w))
+ }
+
+ return strings.Join(out, "_")
+}
+
+// ToCommandName lowercases and underscores a go type name
+func ToCommandName(name string) string {
+ in := split(name)
+ out := make([]string, 0, len(in))
+
+ for _, w := range in {
+ out = append(out, lower(w))
+ }
+ return strings.Join(out, "-")
+}
+
+// ToHumanNameLower represents a code name as a human series of words
+func ToHumanNameLower(name string) string {
+ in := newSplitter(withPostSplitInitialismCheck).split(name)
+ out := make([]string, 0, len(in))
+
+ for _, w := range in {
+ if !w.IsInitialism() {
+ out = append(out, lower(w.GetOriginal()))
+ } else {
+ out = append(out, w.GetOriginal())
+ }
+ }
+
+ return strings.Join(out, " ")
+}
+
+// ToHumanNameTitle represents a code name as a human series of words with the first letters titleized
+func ToHumanNameTitle(name string) string {
+ in := newSplitter(withPostSplitInitialismCheck).split(name)
+
+ out := make([]string, 0, len(in))
+ for _, w := range in {
+ original := w.GetOriginal()
+ if !w.IsInitialism() {
+ out = append(out, Camelize(original))
+ } else {
+ out = append(out, original)
+ }
+ }
+ return strings.Join(out, " ")
+}
+
+// ToJSONName camelcases a name which can be underscored or pascal cased
+func ToJSONName(name string) string {
+ in := split(name)
+ out := make([]string, 0, len(in))
+
+ for i, w := range in {
+ if i == 0 {
+ out = append(out, lower(w))
+ continue
+ }
+ out = append(out, Camelize(w))
+ }
+ return strings.Join(out, "")
+}
+
+// ToVarName camelcases a name which can be underscored or pascal cased
+func ToVarName(name string) string {
+ res := ToGoName(name)
+ if isInitialism(res) {
+ return lower(res)
+ }
+ if len(res) <= 1 {
+ return lower(res)
+ }
+ return lower(res[:1]) + res[1:]
+}
+
+// ToGoName translates a swagger name which can be underscored or camel cased to a name that golint likes
+func ToGoName(name string) string {
+ lexems := newSplitter(withPostSplitInitialismCheck).split(name)
+
+ result := ""
+ for _, lexem := range lexems {
+ goName := lexem.GetUnsafeGoName()
+
+ // to support old behavior
+ if lexem.IsInitialism() {
+ goName = upper(goName)
+ }
+ result += goName
+ }
+
+ if len(result) > 0 {
+ // Only prefix with X when the first character isn't an ascii letter
+ first := []rune(result)[0]
+ if !unicode.IsLetter(first) || (first > unicode.MaxASCII && !unicode.IsUpper(first)) {
+ if GoNamePrefixFunc == nil {
+ return "X" + result
+ }
+ result = GoNamePrefixFunc(name) + result
+ }
+ first = []rune(result)[0]
+ if unicode.IsLetter(first) && !unicode.IsUpper(first) {
+ result = string(append([]rune{unicode.ToUpper(first)}, []rune(result)[1:]...))
+ }
+ }
+
+ return result
+}
+
+// ContainsStrings searches a slice of strings for a case-sensitive match
+func ContainsStrings(coll []string, item string) bool {
+ for _, a := range coll {
+ if a == item {
+ return true
+ }
+ }
+ return false
+}
+
+// ContainsStringsCI searches a slice of strings for a case-insensitive match
+func ContainsStringsCI(coll []string, item string) bool {
+ for _, a := range coll {
+ if strings.EqualFold(a, item) {
+ return true
+ }
+ }
+ return false
+}
+
+type zeroable interface {
+ IsZero() bool
+}
+
+// IsZero returns true when the value passed into the function is a zero value.
+// This allows for safer checking of interface values.
+func IsZero(data interface{}) bool {
+ v := reflect.ValueOf(data)
+ // check for nil data
+ switch v.Kind() {
+ case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:
+ if v.IsNil() {
+ return true
+ }
+ }
+
+ // check for things that have an IsZero method instead
+ if vv, ok := data.(zeroable); ok {
+ return vv.IsZero()
+ }
+
+ // continue with slightly more complex reflection
+ switch v.Kind() {
+ case reflect.String:
+ return v.Len() == 0
+ case reflect.Bool:
+ return !v.Bool()
+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+ return v.Int() == 0
+ case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
+ return v.Uint() == 0
+ case reflect.Float32, reflect.Float64:
+ return v.Float() == 0
+ case reflect.Struct, reflect.Array:
+ return reflect.DeepEqual(data, reflect.Zero(v.Type()).Interface())
+ case reflect.Invalid:
+ return true
+ default:
+ return false
+ }
+}
+
+// AddInitialisms add additional initialisms
+func AddInitialisms(words ...string) {
+ for _, word := range words {
+ // commonInitialisms[upper(word)] = true
+ commonInitialisms.add(upper(word))
+ }
+ // sort again
+ initialisms = commonInitialisms.sorted()
+}
+
+// CommandLineOptionsGroup represents a group of user-defined command line options
+type CommandLineOptionsGroup struct {
+ ShortDescription string
+ LongDescription string
+ Options interface{}
+}
diff --git a/vendor/github.com/go-openapi/swag/yaml.go b/vendor/github.com/go-openapi/swag/yaml.go
new file mode 100644
index 000000000..f09ee609f
--- /dev/null
+++ b/vendor/github.com/go-openapi/swag/yaml.go
@@ -0,0 +1,450 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package swag
+
+import (
+ "encoding/json"
+ "fmt"
+ "path/filepath"
+ "strconv"
+
+ "github.com/mailru/easyjson/jlexer"
+ "github.com/mailru/easyjson/jwriter"
+ yaml "gopkg.in/yaml.v3"
+)
+
+// YAMLMatcher matches yaml
+func YAMLMatcher(path string) bool {
+ ext := filepath.Ext(path)
+ return ext == ".yaml" || ext == ".yml"
+}
+
+// YAMLToJSON converts YAML unmarshaled data into json compatible data
+func YAMLToJSON(data interface{}) (json.RawMessage, error) {
+ jm, err := transformData(data)
+ if err != nil {
+ return nil, err
+ }
+ b, err := WriteJSON(jm)
+ return json.RawMessage(b), err
+}
+
+// BytesToYAMLDoc converts a byte slice into a YAML document
+func BytesToYAMLDoc(data []byte) (interface{}, error) {
+ var document yaml.Node // preserve order that is present in the document
+ if err := yaml.Unmarshal(data, &document); err != nil {
+ return nil, err
+ }
+ if document.Kind != yaml.DocumentNode || len(document.Content) != 1 || document.Content[0].Kind != yaml.MappingNode {
+ return nil, fmt.Errorf("only YAML documents that are objects are supported")
+ }
+ return &document, nil
+}
+
+func yamlNode(root *yaml.Node) (interface{}, error) {
+ switch root.Kind {
+ case yaml.DocumentNode:
+ return yamlDocument(root)
+ case yaml.SequenceNode:
+ return yamlSequence(root)
+ case yaml.MappingNode:
+ return yamlMapping(root)
+ case yaml.ScalarNode:
+ return yamlScalar(root)
+ case yaml.AliasNode:
+ return yamlNode(root.Alias)
+ default:
+ return nil, fmt.Errorf("unsupported YAML node type: %v", root.Kind)
+ }
+}
+
+func yamlDocument(node *yaml.Node) (interface{}, error) {
+ if len(node.Content) != 1 {
+ return nil, fmt.Errorf("unexpected YAML Document node content length: %d", len(node.Content))
+ }
+ return yamlNode(node.Content[0])
+}
+
+func yamlMapping(node *yaml.Node) (interface{}, error) {
+ m := make(JSONMapSlice, len(node.Content)/2)
+
+ var j int
+ for i := 0; i < len(node.Content); i += 2 {
+ var nmi JSONMapItem
+ k, err := yamlStringScalarC(node.Content[i])
+ if err != nil {
+ return nil, fmt.Errorf("unable to decode YAML map key: %w", err)
+ }
+ nmi.Key = k
+ v, err := yamlNode(node.Content[i+1])
+ if err != nil {
+ return nil, fmt.Errorf("unable to process YAML map value for key %q: %w", k, err)
+ }
+ nmi.Value = v
+ m[j] = nmi
+ j++
+ }
+ return m, nil
+}
+
+func yamlSequence(node *yaml.Node) (interface{}, error) {
+ s := make([]interface{}, 0)
+
+ for i := 0; i < len(node.Content); i++ {
+
+ v, err := yamlNode(node.Content[i])
+ if err != nil {
+ return nil, fmt.Errorf("unable to decode YAML sequence value: %w", err)
+ }
+ s = append(s, v)
+ }
+ return s, nil
+}
+
+const ( // See https://yaml.org/type/
+ yamlStringScalar = "tag:yaml.org,2002:str"
+ yamlIntScalar = "tag:yaml.org,2002:int"
+ yamlBoolScalar = "tag:yaml.org,2002:bool"
+ yamlFloatScalar = "tag:yaml.org,2002:float"
+ yamlTimestamp = "tag:yaml.org,2002:timestamp"
+ yamlNull = "tag:yaml.org,2002:null"
+)
+
+func yamlScalar(node *yaml.Node) (interface{}, error) {
+ switch node.LongTag() {
+ case yamlStringScalar:
+ return node.Value, nil
+ case yamlBoolScalar:
+ b, err := strconv.ParseBool(node.Value)
+ if err != nil {
+ return nil, fmt.Errorf("unable to process scalar node. Got %q. Expecting bool content: %w", node.Value, err)
+ }
+ return b, nil
+ case yamlIntScalar:
+ i, err := strconv.ParseInt(node.Value, 10, 64)
+ if err != nil {
+ return nil, fmt.Errorf("unable to process scalar node. Got %q. Expecting integer content: %w", node.Value, err)
+ }
+ return i, nil
+ case yamlFloatScalar:
+ f, err := strconv.ParseFloat(node.Value, 64)
+ if err != nil {
+ return nil, fmt.Errorf("unable to process scalar node. Got %q. Expecting float content: %w", node.Value, err)
+ }
+ return f, nil
+ case yamlTimestamp:
+ return node.Value, nil
+ case yamlNull:
+ return nil, nil
+ default:
+ return nil, fmt.Errorf("YAML tag %q is not supported", node.LongTag())
+ }
+}
+
+func yamlStringScalarC(node *yaml.Node) (string, error) {
+ if node.Kind != yaml.ScalarNode {
+ return "", fmt.Errorf("expecting a string scalar but got %q", node.Kind)
+ }
+ switch node.LongTag() {
+ case yamlStringScalar, yamlIntScalar, yamlFloatScalar:
+ return node.Value, nil
+ default:
+ return "", fmt.Errorf("YAML tag %q is not supported as map key", node.LongTag())
+ }
+}
+
+// JSONMapSlice represent a JSON object, with the order of keys maintained
+type JSONMapSlice []JSONMapItem
+
+// MarshalJSON renders a JSONMapSlice as JSON
+func (s JSONMapSlice) MarshalJSON() ([]byte, error) {
+ w := &jwriter.Writer{Flags: jwriter.NilMapAsEmpty | jwriter.NilSliceAsEmpty}
+ s.MarshalEasyJSON(w)
+ return w.BuildBytes()
+}
+
+// MarshalEasyJSON renders a JSONMapSlice as JSON, using easyJSON
+func (s JSONMapSlice) MarshalEasyJSON(w *jwriter.Writer) {
+ w.RawByte('{')
+
+ ln := len(s)
+ last := ln - 1
+ for i := 0; i < ln; i++ {
+ s[i].MarshalEasyJSON(w)
+ if i != last { // last item
+ w.RawByte(',')
+ }
+ }
+
+ w.RawByte('}')
+}
+
+// UnmarshalJSON makes a JSONMapSlice from JSON
+func (s *JSONMapSlice) UnmarshalJSON(data []byte) error {
+ l := jlexer.Lexer{Data: data}
+ s.UnmarshalEasyJSON(&l)
+ return l.Error()
+}
+
+// UnmarshalEasyJSON makes a JSONMapSlice from JSON, using easyJSON
+func (s *JSONMapSlice) UnmarshalEasyJSON(in *jlexer.Lexer) {
+ if in.IsNull() {
+ in.Skip()
+ return
+ }
+
+ var result JSONMapSlice
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ var mi JSONMapItem
+ mi.UnmarshalEasyJSON(in)
+ result = append(result, mi)
+ }
+ *s = result
+}
+
+func (s JSONMapSlice) MarshalYAML() (interface{}, error) {
+ var n yaml.Node
+ n.Kind = yaml.DocumentNode
+ var nodes []*yaml.Node
+ for _, item := range s {
+ nn, err := json2yaml(item.Value)
+ if err != nil {
+ return nil, err
+ }
+ ns := []*yaml.Node{
+ {
+ Kind: yaml.ScalarNode,
+ Tag: yamlStringScalar,
+ Value: item.Key,
+ },
+ nn,
+ }
+ nodes = append(nodes, ns...)
+ }
+
+ n.Content = []*yaml.Node{
+ {
+ Kind: yaml.MappingNode,
+ Content: nodes,
+ },
+ }
+
+ return yaml.Marshal(&n)
+}
+
+func json2yaml(item interface{}) (*yaml.Node, error) {
+ switch val := item.(type) {
+ case JSONMapSlice:
+ var n yaml.Node
+ n.Kind = yaml.MappingNode
+ for i := range val {
+ childNode, err := json2yaml(&val[i].Value)
+ if err != nil {
+ return nil, err
+ }
+ n.Content = append(n.Content, &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: yamlStringScalar,
+ Value: val[i].Key,
+ }, childNode)
+ }
+ return &n, nil
+ case map[string]interface{}:
+ var n yaml.Node
+ n.Kind = yaml.MappingNode
+ for k, v := range val {
+ childNode, err := json2yaml(v)
+ if err != nil {
+ return nil, err
+ }
+ n.Content = append(n.Content, &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: yamlStringScalar,
+ Value: k,
+ }, childNode)
+ }
+ return &n, nil
+ case []interface{}:
+ var n yaml.Node
+ n.Kind = yaml.SequenceNode
+ for i := range val {
+ childNode, err := json2yaml(val[i])
+ if err != nil {
+ return nil, err
+ }
+ n.Content = append(n.Content, childNode)
+ }
+ return &n, nil
+ case string:
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: yamlStringScalar,
+ Value: val,
+ }, nil
+ case float64:
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: yamlFloatScalar,
+ Value: strconv.FormatFloat(val, 'f', -1, 64),
+ }, nil
+ case int64:
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: yamlIntScalar,
+ Value: strconv.FormatInt(val, 10),
+ }, nil
+ case uint64:
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: yamlIntScalar,
+ Value: strconv.FormatUint(val, 10),
+ }, nil
+ case bool:
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: yamlBoolScalar,
+ Value: strconv.FormatBool(val),
+ }, nil
+ }
+ return nil, nil
+}
+
+// JSONMapItem represents the value of a key in a JSON object held by JSONMapSlice
+type JSONMapItem struct {
+ Key string
+ Value interface{}
+}
+
+// MarshalJSON renders a JSONMapItem as JSON
+func (s JSONMapItem) MarshalJSON() ([]byte, error) {
+ w := &jwriter.Writer{Flags: jwriter.NilMapAsEmpty | jwriter.NilSliceAsEmpty}
+ s.MarshalEasyJSON(w)
+ return w.BuildBytes()
+}
+
+// MarshalEasyJSON renders a JSONMapItem as JSON, using easyJSON
+func (s JSONMapItem) MarshalEasyJSON(w *jwriter.Writer) {
+ w.String(s.Key)
+ w.RawByte(':')
+ w.Raw(WriteJSON(s.Value))
+}
+
+// UnmarshalJSON makes a JSONMapItem from JSON
+func (s *JSONMapItem) UnmarshalJSON(data []byte) error {
+ l := jlexer.Lexer{Data: data}
+ s.UnmarshalEasyJSON(&l)
+ return l.Error()
+}
+
+// UnmarshalEasyJSON makes a JSONMapItem from JSON, using easyJSON
+func (s *JSONMapItem) UnmarshalEasyJSON(in *jlexer.Lexer) {
+ key := in.UnsafeString()
+ in.WantColon()
+ value := in.Interface()
+ in.WantComma()
+ s.Key = key
+ s.Value = value
+}
+
+func transformData(input interface{}) (out interface{}, err error) {
+ format := func(t interface{}) (string, error) {
+ switch k := t.(type) {
+ case string:
+ return k, nil
+ case uint:
+ return strconv.FormatUint(uint64(k), 10), nil
+ case uint8:
+ return strconv.FormatUint(uint64(k), 10), nil
+ case uint16:
+ return strconv.FormatUint(uint64(k), 10), nil
+ case uint32:
+ return strconv.FormatUint(uint64(k), 10), nil
+ case uint64:
+ return strconv.FormatUint(k, 10), nil
+ case int:
+ return strconv.Itoa(k), nil
+ case int8:
+ return strconv.FormatInt(int64(k), 10), nil
+ case int16:
+ return strconv.FormatInt(int64(k), 10), nil
+ case int32:
+ return strconv.FormatInt(int64(k), 10), nil
+ case int64:
+ return strconv.FormatInt(k, 10), nil
+ default:
+ return "", fmt.Errorf("unexpected map key type, got: %T", k)
+ }
+ }
+
+ switch in := input.(type) {
+ case yaml.Node:
+ return yamlNode(&in)
+ case *yaml.Node:
+ return yamlNode(in)
+ case map[interface{}]interface{}:
+ o := make(JSONMapSlice, 0, len(in))
+ for ke, va := range in {
+ var nmi JSONMapItem
+ if nmi.Key, err = format(ke); err != nil {
+ return nil, err
+ }
+
+ v, ert := transformData(va)
+ if ert != nil {
+ return nil, ert
+ }
+ nmi.Value = v
+ o = append(o, nmi)
+ }
+ return o, nil
+ case []interface{}:
+ len1 := len(in)
+ o := make([]interface{}, len1)
+ for i := 0; i < len1; i++ {
+ o[i], err = transformData(in[i])
+ if err != nil {
+ return nil, err
+ }
+ }
+ return o, nil
+ }
+ return input, nil
+}
+
+// YAMLDoc loads a yaml document from either http or a file and converts it to json
+func YAMLDoc(path string) (json.RawMessage, error) {
+ yamlDoc, err := YAMLData(path)
+ if err != nil {
+ return nil, err
+ }
+
+ data, err := YAMLToJSON(yamlDoc)
+ if err != nil {
+ return nil, err
+ }
+
+ return data, nil
+}
+
+// YAMLData loads a yaml document from either http or a file
+func YAMLData(path string) (interface{}, error) {
+ data, err := LoadFromFileOrHTTP(path)
+ if err != nil {
+ return nil, err
+ }
+
+ return BytesToYAMLDoc(data)
+}
diff --git a/vendor/github.com/golang/protobuf/ptypes/any.go b/vendor/github.com/golang/protobuf/ptypes/any.go
index 85f9f5736..fdff3fdb4 100644
--- a/vendor/github.com/golang/protobuf/ptypes/any.go
+++ b/vendor/github.com/golang/protobuf/ptypes/any.go
@@ -127,9 +127,10 @@ func Is(any *anypb.Any, m proto.Message) bool {
// The allocated message is stored in the embedded proto.Message.
//
// Example:
-// var x ptypes.DynamicAny
-// if err := ptypes.UnmarshalAny(a, &x); err != nil { ... }
-// fmt.Printf("unmarshaled message: %v", x.Message)
+//
+// var x ptypes.DynamicAny
+// if err := ptypes.UnmarshalAny(a, &x); err != nil { ... }
+// fmt.Printf("unmarshaled message: %v", x.Message)
//
// Deprecated: Use the any.UnmarshalNew method instead to unmarshal
// the any message contents into a new instance of the underlying message.
diff --git a/vendor/github.com/google/gnostic-models/LICENSE b/vendor/github.com/google/gnostic-models/LICENSE
new file mode 100644
index 000000000..6b0b1270f
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/LICENSE
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
diff --git a/vendor/github.com/google/gnostic-models/compiler/README.md b/vendor/github.com/google/gnostic-models/compiler/README.md
new file mode 100644
index 000000000..ee9783d23
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/compiler/README.md
@@ -0,0 +1,4 @@
+# Compiler support code
+
+This directory contains compiler support code used by Gnostic and Gnostic
+extensions.
diff --git a/vendor/github.com/google/gnostic-models/compiler/context.go b/vendor/github.com/google/gnostic-models/compiler/context.go
new file mode 100644
index 000000000..1bfe96121
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/compiler/context.go
@@ -0,0 +1,49 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package compiler
+
+import (
+ yaml "gopkg.in/yaml.v3"
+)
+
+// Context contains state of the compiler as it traverses a document.
+type Context struct {
+ Parent *Context
+ Name string
+ Node *yaml.Node
+ ExtensionHandlers *[]ExtensionHandler
+}
+
+// NewContextWithExtensions returns a new object representing the compiler state
+func NewContextWithExtensions(name string, node *yaml.Node, parent *Context, extensionHandlers *[]ExtensionHandler) *Context {
+ return &Context{Name: name, Node: node, Parent: parent, ExtensionHandlers: extensionHandlers}
+}
+
+// NewContext returns a new object representing the compiler state
+func NewContext(name string, node *yaml.Node, parent *Context) *Context {
+ if parent != nil {
+ return &Context{Name: name, Node: node, Parent: parent, ExtensionHandlers: parent.ExtensionHandlers}
+ }
+ return &Context{Name: name, Parent: parent, ExtensionHandlers: nil}
+}
+
+// Description returns a text description of the compiler state
+func (context *Context) Description() string {
+ name := context.Name
+ if context.Parent != nil {
+ name = context.Parent.Description() + "." + name
+ }
+ return name
+}
diff --git a/vendor/github.com/google/gnostic-models/compiler/error.go b/vendor/github.com/google/gnostic-models/compiler/error.go
new file mode 100644
index 000000000..6f40515d6
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/compiler/error.go
@@ -0,0 +1,70 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package compiler
+
+import "fmt"
+
+// Error represents compiler errors and their location in the document.
+type Error struct {
+ Context *Context
+ Message string
+}
+
+// NewError creates an Error.
+func NewError(context *Context, message string) *Error {
+ return &Error{Context: context, Message: message}
+}
+
+func (err *Error) locationDescription() string {
+ if err.Context.Node != nil {
+ return fmt.Sprintf("[%d,%d] %s", err.Context.Node.Line, err.Context.Node.Column, err.Context.Description())
+ }
+ return err.Context.Description()
+}
+
+// Error returns the string value of an Error.
+func (err *Error) Error() string {
+ if err.Context == nil {
+ return err.Message
+ }
+ return err.locationDescription() + " " + err.Message
+}
+
+// ErrorGroup is a container for groups of Error values.
+type ErrorGroup struct {
+ Errors []error
+}
+
+// NewErrorGroupOrNil returns a new ErrorGroup for a slice of errors or nil if the slice is empty.
+func NewErrorGroupOrNil(errors []error) error {
+ if len(errors) == 0 {
+ return nil
+ } else if len(errors) == 1 {
+ return errors[0]
+ } else {
+ return &ErrorGroup{Errors: errors}
+ }
+}
+
+func (group *ErrorGroup) Error() string {
+ result := ""
+ for i, err := range group.Errors {
+ if i > 0 {
+ result += "\n"
+ }
+ result += err.Error()
+ }
+ return result
+}
diff --git a/vendor/github.com/google/gnostic-models/compiler/extensions.go b/vendor/github.com/google/gnostic-models/compiler/extensions.go
new file mode 100644
index 000000000..250c81e8c
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/compiler/extensions.go
@@ -0,0 +1,86 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package compiler
+
+import (
+ "bytes"
+ "fmt"
+ "os/exec"
+ "strings"
+
+ "github.com/golang/protobuf/proto"
+ "github.com/golang/protobuf/ptypes/any"
+ yaml "gopkg.in/yaml.v3"
+
+ extensions "github.com/google/gnostic-models/extensions"
+)
+
+// ExtensionHandler describes a binary that is called by the compiler to handle specification extensions.
+type ExtensionHandler struct {
+ Name string
+}
+
+// CallExtension calls a binary extension handler.
+func CallExtension(context *Context, in *yaml.Node, extensionName string) (handled bool, response *any.Any, err error) {
+ if context == nil || context.ExtensionHandlers == nil {
+ return false, nil, nil
+ }
+ handled = false
+ for _, handler := range *(context.ExtensionHandlers) {
+ response, err = handler.handle(in, extensionName)
+ if response == nil {
+ continue
+ } else {
+ handled = true
+ break
+ }
+ }
+ return handled, response, err
+}
+
+func (extensionHandlers *ExtensionHandler) handle(in *yaml.Node, extensionName string) (*any.Any, error) {
+ if extensionHandlers.Name != "" {
+ yamlData, _ := yaml.Marshal(in)
+ request := &extensions.ExtensionHandlerRequest{
+ CompilerVersion: &extensions.Version{
+ Major: 0,
+ Minor: 1,
+ Patch: 0,
+ },
+ Wrapper: &extensions.Wrapper{
+ Version: "unknown", // TODO: set this to the type/version of spec being parsed.
+ Yaml: string(yamlData),
+ ExtensionName: extensionName,
+ },
+ }
+ requestBytes, _ := proto.Marshal(request)
+ cmd := exec.Command(extensionHandlers.Name)
+ cmd.Stdin = bytes.NewReader(requestBytes)
+ output, err := cmd.Output()
+ if err != nil {
+ return nil, err
+ }
+ response := &extensions.ExtensionHandlerResponse{}
+ err = proto.Unmarshal(output, response)
+ if err != nil || !response.Handled {
+ return nil, err
+ }
+ if len(response.Errors) != 0 {
+ return nil, fmt.Errorf("Errors when parsing: %+v for field %s by vendor extension handler %s. Details %+v", in, extensionName, extensionHandlers.Name, strings.Join(response.Errors, ","))
+ }
+ return response.Value, nil
+ }
+ return nil, nil
+}
diff --git a/vendor/github.com/google/gnostic-models/compiler/helpers.go b/vendor/github.com/google/gnostic-models/compiler/helpers.go
new file mode 100644
index 000000000..975d65e8f
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/compiler/helpers.go
@@ -0,0 +1,397 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package compiler
+
+import (
+ "fmt"
+ "regexp"
+ "sort"
+ "strconv"
+
+ "gopkg.in/yaml.v3"
+
+ "github.com/google/gnostic-models/jsonschema"
+)
+
+// compiler helper functions, usually called from generated code
+
+// UnpackMap gets a *yaml.Node if possible.
+func UnpackMap(in *yaml.Node) (*yaml.Node, bool) {
+ if in == nil {
+ return nil, false
+ }
+ return in, true
+}
+
+// SortedKeysForMap returns the sorted keys of a yamlv2.MapSlice.
+func SortedKeysForMap(m *yaml.Node) []string {
+ keys := make([]string, 0)
+ if m.Kind == yaml.MappingNode {
+ for i := 0; i < len(m.Content); i += 2 {
+ keys = append(keys, m.Content[i].Value)
+ }
+ }
+ sort.Strings(keys)
+ return keys
+}
+
+// MapHasKey returns true if a yamlv2.MapSlice contains a specified key.
+func MapHasKey(m *yaml.Node, key string) bool {
+ if m == nil {
+ return false
+ }
+ if m.Kind == yaml.MappingNode {
+ for i := 0; i < len(m.Content); i += 2 {
+ itemKey := m.Content[i].Value
+ if key == itemKey {
+ return true
+ }
+ }
+ }
+ return false
+}
+
+// MapValueForKey gets the value of a map value for a specified key.
+func MapValueForKey(m *yaml.Node, key string) *yaml.Node {
+ if m == nil {
+ return nil
+ }
+ if m.Kind == yaml.MappingNode {
+ for i := 0; i < len(m.Content); i += 2 {
+ itemKey := m.Content[i].Value
+ if key == itemKey {
+ return m.Content[i+1]
+ }
+ }
+ }
+ return nil
+}
+
+// ConvertInterfaceArrayToStringArray converts an array of interfaces to an array of strings, if possible.
+func ConvertInterfaceArrayToStringArray(interfaceArray []interface{}) []string {
+ stringArray := make([]string, 0)
+ for _, item := range interfaceArray {
+ v, ok := item.(string)
+ if ok {
+ stringArray = append(stringArray, v)
+ }
+ }
+ return stringArray
+}
+
+// SequenceNodeForNode returns a node if it is a SequenceNode.
+func SequenceNodeForNode(node *yaml.Node) (*yaml.Node, bool) {
+ if node.Kind != yaml.SequenceNode {
+ return nil, false
+ }
+ return node, true
+}
+
+// BoolForScalarNode returns the bool value of a node.
+func BoolForScalarNode(node *yaml.Node) (bool, bool) {
+ if node == nil {
+ return false, false
+ }
+ if node.Kind == yaml.DocumentNode {
+ return BoolForScalarNode(node.Content[0])
+ }
+ if node.Kind != yaml.ScalarNode {
+ return false, false
+ }
+ if node.Tag != "!!bool" {
+ return false, false
+ }
+ v, err := strconv.ParseBool(node.Value)
+ if err != nil {
+ return false, false
+ }
+ return v, true
+}
+
+// IntForScalarNode returns the integer value of a node.
+func IntForScalarNode(node *yaml.Node) (int64, bool) {
+ if node == nil {
+ return 0, false
+ }
+ if node.Kind == yaml.DocumentNode {
+ return IntForScalarNode(node.Content[0])
+ }
+ if node.Kind != yaml.ScalarNode {
+ return 0, false
+ }
+ if node.Tag != "!!int" {
+ return 0, false
+ }
+ v, err := strconv.ParseInt(node.Value, 10, 64)
+ if err != nil {
+ return 0, false
+ }
+ return v, true
+}
+
+// FloatForScalarNode returns the float value of a node.
+func FloatForScalarNode(node *yaml.Node) (float64, bool) {
+ if node == nil {
+ return 0.0, false
+ }
+ if node.Kind == yaml.DocumentNode {
+ return FloatForScalarNode(node.Content[0])
+ }
+ if node.Kind != yaml.ScalarNode {
+ return 0.0, false
+ }
+ if (node.Tag != "!!int") && (node.Tag != "!!float") {
+ return 0.0, false
+ }
+ v, err := strconv.ParseFloat(node.Value, 64)
+ if err != nil {
+ return 0.0, false
+ }
+ return v, true
+}
+
+// StringForScalarNode returns the string value of a node.
+func StringForScalarNode(node *yaml.Node) (string, bool) {
+ if node == nil {
+ return "", false
+ }
+ if node.Kind == yaml.DocumentNode {
+ return StringForScalarNode(node.Content[0])
+ }
+ switch node.Kind {
+ case yaml.ScalarNode:
+ switch node.Tag {
+ case "!!int":
+ return node.Value, true
+ case "!!str":
+ return node.Value, true
+ case "!!timestamp":
+ return node.Value, true
+ case "!!null":
+ return "", true
+ default:
+ return "", false
+ }
+ default:
+ return "", false
+ }
+}
+
+// StringArrayForSequenceNode converts a sequence node to an array of strings, if possible.
+func StringArrayForSequenceNode(node *yaml.Node) []string {
+ stringArray := make([]string, 0)
+ for _, item := range node.Content {
+ v, ok := StringForScalarNode(item)
+ if ok {
+ stringArray = append(stringArray, v)
+ }
+ }
+ return stringArray
+}
+
+// MissingKeysInMap identifies which keys from a list of required keys are not in a map.
+func MissingKeysInMap(m *yaml.Node, requiredKeys []string) []string {
+ missingKeys := make([]string, 0)
+ for _, k := range requiredKeys {
+ if !MapHasKey(m, k) {
+ missingKeys = append(missingKeys, k)
+ }
+ }
+ return missingKeys
+}
+
+// InvalidKeysInMap returns keys in a map that don't match a list of allowed keys and patterns.
+func InvalidKeysInMap(m *yaml.Node, allowedKeys []string, allowedPatterns []*regexp.Regexp) []string {
+ invalidKeys := make([]string, 0)
+ if m == nil || m.Kind != yaml.MappingNode {
+ return invalidKeys
+ }
+ for i := 0; i < len(m.Content); i += 2 {
+ key := m.Content[i].Value
+ found := false
+ // does the key match an allowed key?
+ for _, allowedKey := range allowedKeys {
+ if key == allowedKey {
+ found = true
+ break
+ }
+ }
+ if !found {
+ // does the key match an allowed pattern?
+ for _, allowedPattern := range allowedPatterns {
+ if allowedPattern.MatchString(key) {
+ found = true
+ break
+ }
+ }
+ if !found {
+ invalidKeys = append(invalidKeys, key)
+ }
+ }
+ }
+ return invalidKeys
+}
+
+// NewNullNode creates a new Null node.
+func NewNullNode() *yaml.Node {
+ node := &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: "!!null",
+ }
+ return node
+}
+
+// NewMappingNode creates a new Mapping node.
+func NewMappingNode() *yaml.Node {
+ return &yaml.Node{
+ Kind: yaml.MappingNode,
+ Content: make([]*yaml.Node, 0),
+ }
+}
+
+// NewSequenceNode creates a new Sequence node.
+func NewSequenceNode() *yaml.Node {
+ node := &yaml.Node{
+ Kind: yaml.SequenceNode,
+ Content: make([]*yaml.Node, 0),
+ }
+ return node
+}
+
+// NewScalarNodeForString creates a new node to hold a string.
+func NewScalarNodeForString(s string) *yaml.Node {
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: "!!str",
+ Value: s,
+ }
+}
+
+// NewSequenceNodeForStringArray creates a new node to hold an array of strings.
+func NewSequenceNodeForStringArray(strings []string) *yaml.Node {
+ node := &yaml.Node{
+ Kind: yaml.SequenceNode,
+ Content: make([]*yaml.Node, 0),
+ }
+ for _, s := range strings {
+ node.Content = append(node.Content, NewScalarNodeForString(s))
+ }
+ return node
+}
+
+// NewScalarNodeForBool creates a new node to hold a bool.
+func NewScalarNodeForBool(b bool) *yaml.Node {
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: "!!bool",
+ Value: fmt.Sprintf("%t", b),
+ }
+}
+
+// NewScalarNodeForFloat creates a new node to hold a float.
+func NewScalarNodeForFloat(f float64) *yaml.Node {
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: "!!float",
+ Value: fmt.Sprintf("%g", f),
+ }
+}
+
+// NewScalarNodeForInt creates a new node to hold an integer.
+func NewScalarNodeForInt(i int64) *yaml.Node {
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: "!!int",
+ Value: fmt.Sprintf("%d", i),
+ }
+}
+
+// PluralProperties returns the string "properties" pluralized.
+func PluralProperties(count int) string {
+ if count == 1 {
+ return "property"
+ }
+ return "properties"
+}
+
+// StringArrayContainsValue returns true if a string array contains a specified value.
+func StringArrayContainsValue(array []string, value string) bool {
+ for _, item := range array {
+ if item == value {
+ return true
+ }
+ }
+ return false
+}
+
+// StringArrayContainsValues returns true if a string array contains all of a list of specified values.
+func StringArrayContainsValues(array []string, values []string) bool {
+ for _, value := range values {
+ if !StringArrayContainsValue(array, value) {
+ return false
+ }
+ }
+ return true
+}
+
+// StringValue returns the string value of an item.
+func StringValue(item interface{}) (value string, ok bool) {
+ value, ok = item.(string)
+ if ok {
+ return value, ok
+ }
+ intValue, ok := item.(int)
+ if ok {
+ return strconv.Itoa(intValue), true
+ }
+ return "", false
+}
+
+// Description returns a human-readable represention of an item.
+func Description(item interface{}) string {
+ value, ok := item.(*yaml.Node)
+ if ok {
+ return jsonschema.Render(value)
+ }
+ return fmt.Sprintf("%+v", item)
+}
+
+// Display returns a description of a node for use in error messages.
+func Display(node *yaml.Node) string {
+ switch node.Kind {
+ case yaml.ScalarNode:
+ switch node.Tag {
+ case "!!str":
+ return fmt.Sprintf("%s (string)", node.Value)
+ }
+ }
+ return fmt.Sprintf("%+v (%T)", node, node)
+}
+
+// Marshal creates a yaml version of a structure in our preferred style
+func Marshal(in *yaml.Node) []byte {
+ clearStyle(in)
+ //bytes, _ := yaml.Marshal(&yaml.Node{Kind: yaml.DocumentNode, Content: []*yaml.Node{in}})
+ bytes, _ := yaml.Marshal(in)
+
+ return bytes
+}
+
+func clearStyle(node *yaml.Node) {
+ node.Style = 0
+ for _, c := range node.Content {
+ clearStyle(c)
+ }
+}
diff --git a/vendor/github.com/google/gnostic-models/compiler/main.go b/vendor/github.com/google/gnostic-models/compiler/main.go
new file mode 100644
index 000000000..ce9fcc456
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/compiler/main.go
@@ -0,0 +1,16 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package compiler provides support functions to generated compiler code.
+package compiler
diff --git a/vendor/github.com/google/gnostic-models/compiler/reader.go b/vendor/github.com/google/gnostic-models/compiler/reader.go
new file mode 100644
index 000000000..be0e8b40c
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/compiler/reader.go
@@ -0,0 +1,307 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package compiler
+
+import (
+ "fmt"
+ "io/ioutil"
+ "log"
+ "net/http"
+ "net/url"
+ "path/filepath"
+ "strings"
+ "sync"
+
+ yaml "gopkg.in/yaml.v3"
+)
+
+var verboseReader = false
+
+var fileCache map[string][]byte
+var infoCache map[string]*yaml.Node
+
+var fileCacheEnable = true
+var infoCacheEnable = true
+
+// These locks are used to synchronize accesses to the fileCache and infoCache
+// maps (above). They are global state and can throw thread-related errors
+// when modified from separate goroutines. The general strategy is to protect
+// all public functions in this file with mutex Lock() calls. As a result, to
+// avoid deadlock, these public functions should not call other public
+// functions, so some public functions have private equivalents.
+// In the future, we might consider replacing the maps with sync.Map and
+// eliminating these mutexes.
+var fileCacheMutex sync.Mutex
+var infoCacheMutex sync.Mutex
+
+func initializeFileCache() {
+ if fileCache == nil {
+ fileCache = make(map[string][]byte, 0)
+ }
+}
+
+func initializeInfoCache() {
+ if infoCache == nil {
+ infoCache = make(map[string]*yaml.Node, 0)
+ }
+}
+
+// EnableFileCache turns on file caching.
+func EnableFileCache() {
+ fileCacheMutex.Lock()
+ defer fileCacheMutex.Unlock()
+ fileCacheEnable = true
+}
+
+// EnableInfoCache turns on parsed info caching.
+func EnableInfoCache() {
+ infoCacheMutex.Lock()
+ defer infoCacheMutex.Unlock()
+ infoCacheEnable = true
+}
+
+// DisableFileCache turns off file caching.
+func DisableFileCache() {
+ fileCacheMutex.Lock()
+ defer fileCacheMutex.Unlock()
+ fileCacheEnable = false
+}
+
+// DisableInfoCache turns off parsed info caching.
+func DisableInfoCache() {
+ infoCacheMutex.Lock()
+ defer infoCacheMutex.Unlock()
+ infoCacheEnable = false
+}
+
+// RemoveFromFileCache removes an entry from the file cache.
+func RemoveFromFileCache(fileurl string) {
+ fileCacheMutex.Lock()
+ defer fileCacheMutex.Unlock()
+ if !fileCacheEnable {
+ return
+ }
+ initializeFileCache()
+ delete(fileCache, fileurl)
+}
+
+// RemoveFromInfoCache removes an entry from the info cache.
+func RemoveFromInfoCache(filename string) {
+ infoCacheMutex.Lock()
+ defer infoCacheMutex.Unlock()
+ if !infoCacheEnable {
+ return
+ }
+ initializeInfoCache()
+ delete(infoCache, filename)
+}
+
+// GetInfoCache returns the info cache map.
+func GetInfoCache() map[string]*yaml.Node {
+ infoCacheMutex.Lock()
+ defer infoCacheMutex.Unlock()
+ if infoCache == nil {
+ initializeInfoCache()
+ }
+ return infoCache
+}
+
+// ClearFileCache clears the file cache.
+func ClearFileCache() {
+ fileCacheMutex.Lock()
+ defer fileCacheMutex.Unlock()
+ fileCache = make(map[string][]byte, 0)
+}
+
+// ClearInfoCache clears the info cache.
+func ClearInfoCache() {
+ infoCacheMutex.Lock()
+ defer infoCacheMutex.Unlock()
+ infoCache = make(map[string]*yaml.Node)
+}
+
+// ClearCaches clears all caches.
+func ClearCaches() {
+ ClearFileCache()
+ ClearInfoCache()
+}
+
+// FetchFile gets a specified file from the local filesystem or a remote location.
+func FetchFile(fileurl string) ([]byte, error) {
+ fileCacheMutex.Lock()
+ defer fileCacheMutex.Unlock()
+ return fetchFile(fileurl)
+}
+
+func fetchFile(fileurl string) ([]byte, error) {
+ var bytes []byte
+ initializeFileCache()
+ if fileCacheEnable {
+ bytes, ok := fileCache[fileurl]
+ if ok {
+ if verboseReader {
+ log.Printf("Cache hit %s", fileurl)
+ }
+ return bytes, nil
+ }
+ if verboseReader {
+ log.Printf("Fetching %s", fileurl)
+ }
+ }
+ response, err := http.Get(fileurl)
+ if err != nil {
+ return nil, err
+ }
+ defer response.Body.Close()
+ if response.StatusCode != 200 {
+ return nil, fmt.Errorf("Error downloading %s: %s", fileurl, response.Status)
+ }
+ bytes, err = ioutil.ReadAll(response.Body)
+ if fileCacheEnable && err == nil {
+ fileCache[fileurl] = bytes
+ }
+ return bytes, err
+}
+
+// ReadBytesForFile reads the bytes of a file.
+func ReadBytesForFile(filename string) ([]byte, error) {
+ fileCacheMutex.Lock()
+ defer fileCacheMutex.Unlock()
+ return readBytesForFile(filename)
+}
+
+func readBytesForFile(filename string) ([]byte, error) {
+ // is the filename a url?
+ fileurl, _ := url.Parse(filename)
+ if fileurl.Scheme != "" {
+ // yes, fetch it
+ bytes, err := fetchFile(filename)
+ if err != nil {
+ return nil, err
+ }
+ return bytes, nil
+ }
+ // no, it's a local filename
+ bytes, err := ioutil.ReadFile(filename)
+ if err != nil {
+ return nil, err
+ }
+ return bytes, nil
+}
+
+// ReadInfoFromBytes unmarshals a file as a *yaml.Node.
+func ReadInfoFromBytes(filename string, bytes []byte) (*yaml.Node, error) {
+ infoCacheMutex.Lock()
+ defer infoCacheMutex.Unlock()
+ return readInfoFromBytes(filename, bytes)
+}
+
+func readInfoFromBytes(filename string, bytes []byte) (*yaml.Node, error) {
+ initializeInfoCache()
+ if infoCacheEnable {
+ cachedInfo, ok := infoCache[filename]
+ if ok {
+ if verboseReader {
+ log.Printf("Cache hit info for file %s", filename)
+ }
+ return cachedInfo, nil
+ }
+ if verboseReader {
+ log.Printf("Reading info for file %s", filename)
+ }
+ }
+ var info yaml.Node
+ err := yaml.Unmarshal(bytes, &info)
+ if err != nil {
+ return nil, err
+ }
+ if infoCacheEnable && len(filename) > 0 {
+ infoCache[filename] = &info
+ }
+ return &info, nil
+}
+
+// ReadInfoForRef reads a file and return the fragment needed to resolve a $ref.
+func ReadInfoForRef(basefile string, ref string) (*yaml.Node, error) {
+ fileCacheMutex.Lock()
+ defer fileCacheMutex.Unlock()
+ infoCacheMutex.Lock()
+ defer infoCacheMutex.Unlock()
+ initializeInfoCache()
+ if infoCacheEnable {
+ info, ok := infoCache[ref]
+ if ok {
+ if verboseReader {
+ log.Printf("Cache hit for ref %s#%s", basefile, ref)
+ }
+ return info, nil
+ }
+ if verboseReader {
+ log.Printf("Reading info for ref %s#%s", basefile, ref)
+ }
+ }
+ basedir, _ := filepath.Split(basefile)
+ parts := strings.Split(ref, "#")
+ var filename string
+ if parts[0] != "" {
+ filename = parts[0]
+ if _, err := url.ParseRequestURI(parts[0]); err != nil {
+ // It is not an URL, so the file is local
+ filename = basedir + parts[0]
+ }
+ } else {
+ filename = basefile
+ }
+ bytes, err := readBytesForFile(filename)
+ if err != nil {
+ return nil, err
+ }
+ info, err := readInfoFromBytes(filename, bytes)
+ if info != nil && info.Kind == yaml.DocumentNode {
+ info = info.Content[0]
+ }
+ if err != nil {
+ log.Printf("File error: %v\n", err)
+ } else {
+ if info == nil {
+ return nil, NewError(nil, fmt.Sprintf("could not resolve %s", ref))
+ }
+ if len(parts) > 1 {
+ path := strings.Split(parts[1], "/")
+ for i, key := range path {
+ if i > 0 {
+ m := info
+ if true {
+ found := false
+ for i := 0; i < len(m.Content); i += 2 {
+ if m.Content[i].Value == key {
+ info = m.Content[i+1]
+ found = true
+ }
+ }
+ if !found {
+ infoCache[ref] = nil
+ return nil, NewError(nil, fmt.Sprintf("could not resolve %s", ref))
+ }
+ }
+ }
+ }
+ }
+ }
+ if infoCacheEnable {
+ infoCache[ref] = info
+ }
+ return info, nil
+}
diff --git a/vendor/github.com/google/gnostic-models/extensions/README.md b/vendor/github.com/google/gnostic-models/extensions/README.md
new file mode 100644
index 000000000..4b5d63e58
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/extensions/README.md
@@ -0,0 +1,13 @@
+# Extensions
+
+**Extension Support is experimental.**
+
+This directory contains support code for building Gnostic extensio handlers and
+associated examples.
+
+Extension handlers can be used to compile vendor or specification extensions
+into protocol buffer structures.
+
+Like plugins, extension handlers are built as separate executables. Extension
+bodies are written to extension handlers as serialized
+ExtensionHandlerRequests.
diff --git a/vendor/github.com/google/gnostic-models/extensions/extension.pb.go b/vendor/github.com/google/gnostic-models/extensions/extension.pb.go
new file mode 100644
index 000000000..a71df8abe
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/extensions/extension.pb.go
@@ -0,0 +1,461 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.27.1
+// protoc v3.19.3
+// source: extensions/extension.proto
+
+package gnostic_extension_v1
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ anypb "google.golang.org/protobuf/types/known/anypb"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+// The version number of Gnostic.
+type Version struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Major int32 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"`
+ Minor int32 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"`
+ Patch int32 `protobuf:"varint,3,opt,name=patch,proto3" json:"patch,omitempty"`
+ // A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
+ // be empty for mainline stable releases.
+ Suffix string `protobuf:"bytes,4,opt,name=suffix,proto3" json:"suffix,omitempty"`
+}
+
+func (x *Version) Reset() {
+ *x = Version{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_extensions_extension_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Version) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Version) ProtoMessage() {}
+
+func (x *Version) ProtoReflect() protoreflect.Message {
+ mi := &file_extensions_extension_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Version.ProtoReflect.Descriptor instead.
+func (*Version) Descriptor() ([]byte, []int) {
+ return file_extensions_extension_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *Version) GetMajor() int32 {
+ if x != nil {
+ return x.Major
+ }
+ return 0
+}
+
+func (x *Version) GetMinor() int32 {
+ if x != nil {
+ return x.Minor
+ }
+ return 0
+}
+
+func (x *Version) GetPatch() int32 {
+ if x != nil {
+ return x.Patch
+ }
+ return 0
+}
+
+func (x *Version) GetSuffix() string {
+ if x != nil {
+ return x.Suffix
+ }
+ return ""
+}
+
+// An encoded Request is written to the ExtensionHandler's stdin.
+type ExtensionHandlerRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The extension to process.
+ Wrapper *Wrapper `protobuf:"bytes,1,opt,name=wrapper,proto3" json:"wrapper,omitempty"`
+ // The version number of Gnostic.
+ CompilerVersion *Version `protobuf:"bytes,2,opt,name=compiler_version,json=compilerVersion,proto3" json:"compiler_version,omitempty"`
+}
+
+func (x *ExtensionHandlerRequest) Reset() {
+ *x = ExtensionHandlerRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_extensions_extension_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ExtensionHandlerRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ExtensionHandlerRequest) ProtoMessage() {}
+
+func (x *ExtensionHandlerRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_extensions_extension_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ExtensionHandlerRequest.ProtoReflect.Descriptor instead.
+func (*ExtensionHandlerRequest) Descriptor() ([]byte, []int) {
+ return file_extensions_extension_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *ExtensionHandlerRequest) GetWrapper() *Wrapper {
+ if x != nil {
+ return x.Wrapper
+ }
+ return nil
+}
+
+func (x *ExtensionHandlerRequest) GetCompilerVersion() *Version {
+ if x != nil {
+ return x.CompilerVersion
+ }
+ return nil
+}
+
+// The extensions writes an encoded ExtensionHandlerResponse to stdout.
+type ExtensionHandlerResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // true if the extension is handled by the extension handler; false otherwise
+ Handled bool `protobuf:"varint,1,opt,name=handled,proto3" json:"handled,omitempty"`
+ // Error message(s). If non-empty, the extension handling failed.
+ // The extension handler process should exit with status code zero
+ // even if it reports an error in this way.
+ //
+ // This should be used to indicate errors which prevent the extension from
+ // operating as intended. Errors which indicate a problem in gnostic
+ // itself -- such as the input Document being unparseable -- should be
+ // reported by writing a message to stderr and exiting with a non-zero
+ // status code.
+ Errors []string `protobuf:"bytes,2,rep,name=errors,proto3" json:"errors,omitempty"`
+ // text output
+ Value *anypb.Any `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *ExtensionHandlerResponse) Reset() {
+ *x = ExtensionHandlerResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_extensions_extension_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ExtensionHandlerResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ExtensionHandlerResponse) ProtoMessage() {}
+
+func (x *ExtensionHandlerResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_extensions_extension_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ExtensionHandlerResponse.ProtoReflect.Descriptor instead.
+func (*ExtensionHandlerResponse) Descriptor() ([]byte, []int) {
+ return file_extensions_extension_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *ExtensionHandlerResponse) GetHandled() bool {
+ if x != nil {
+ return x.Handled
+ }
+ return false
+}
+
+func (x *ExtensionHandlerResponse) GetErrors() []string {
+ if x != nil {
+ return x.Errors
+ }
+ return nil
+}
+
+func (x *ExtensionHandlerResponse) GetValue() *anypb.Any {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+type Wrapper struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // version of the OpenAPI specification in which this extension was written.
+ Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
+ // Name of the extension.
+ ExtensionName string `protobuf:"bytes,2,opt,name=extension_name,json=extensionName,proto3" json:"extension_name,omitempty"`
+ // YAML-formatted extension value.
+ Yaml string `protobuf:"bytes,3,opt,name=yaml,proto3" json:"yaml,omitempty"`
+}
+
+func (x *Wrapper) Reset() {
+ *x = Wrapper{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_extensions_extension_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Wrapper) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Wrapper) ProtoMessage() {}
+
+func (x *Wrapper) ProtoReflect() protoreflect.Message {
+ mi := &file_extensions_extension_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Wrapper.ProtoReflect.Descriptor instead.
+func (*Wrapper) Descriptor() ([]byte, []int) {
+ return file_extensions_extension_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *Wrapper) GetVersion() string {
+ if x != nil {
+ return x.Version
+ }
+ return ""
+}
+
+func (x *Wrapper) GetExtensionName() string {
+ if x != nil {
+ return x.ExtensionName
+ }
+ return ""
+}
+
+func (x *Wrapper) GetYaml() string {
+ if x != nil {
+ return x.Yaml
+ }
+ return ""
+}
+
+var File_extensions_extension_proto protoreflect.FileDescriptor
+
+var file_extensions_extension_proto_rawDesc = []byte{
+ 0x0a, 0x1a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x65, 0x78, 0x74,
+ 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x67, 0x6e,
+ 0x6f, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2e,
+ 0x76, 0x31, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+ 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x63, 0x0a,
+ 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x6a, 0x6f,
+ 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x12, 0x14,
+ 0x0a, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d,
+ 0x69, 0x6e, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20,
+ 0x01, 0x28, 0x05, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x75,
+ 0x66, 0x66, 0x69, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x75, 0x66, 0x66,
+ 0x69, 0x78, 0x22, 0x9c, 0x01, 0x0a, 0x17, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e,
+ 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x37,
+ 0x0a, 0x07, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x1d, 0x2e, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73,
+ 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x52, 0x07,
+ 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x12, 0x48, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x70, 0x69,
+ 0x6c, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x65, 0x78, 0x74, 0x65,
+ 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
+ 0x52, 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f,
+ 0x6e, 0x22, 0x78, 0x0a, 0x18, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x61,
+ 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a,
+ 0x07, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07,
+ 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72,
+ 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x12,
+ 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14,
+ 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
+ 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x5e, 0x0a, 0x07, 0x57,
+ 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
+ 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
+ 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61,
+ 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73,
+ 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x18,
+ 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x42, 0x4d, 0x0a, 0x0e, 0x6f,
+ 0x72, 0x67, 0x2e, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x76, 0x31, 0x42, 0x10, 0x47,
+ 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x50,
+ 0x01, 0x5a, 0x21, 0x2e, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x3b,
+ 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f,
+ 0x6e, 0x5f, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x47, 0x4e, 0x58, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
+ 0x6f, 0x33,
+}
+
+var (
+ file_extensions_extension_proto_rawDescOnce sync.Once
+ file_extensions_extension_proto_rawDescData = file_extensions_extension_proto_rawDesc
+)
+
+func file_extensions_extension_proto_rawDescGZIP() []byte {
+ file_extensions_extension_proto_rawDescOnce.Do(func() {
+ file_extensions_extension_proto_rawDescData = protoimpl.X.CompressGZIP(file_extensions_extension_proto_rawDescData)
+ })
+ return file_extensions_extension_proto_rawDescData
+}
+
+var file_extensions_extension_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
+var file_extensions_extension_proto_goTypes = []interface{}{
+ (*Version)(nil), // 0: gnostic.extension.v1.Version
+ (*ExtensionHandlerRequest)(nil), // 1: gnostic.extension.v1.ExtensionHandlerRequest
+ (*ExtensionHandlerResponse)(nil), // 2: gnostic.extension.v1.ExtensionHandlerResponse
+ (*Wrapper)(nil), // 3: gnostic.extension.v1.Wrapper
+ (*anypb.Any)(nil), // 4: google.protobuf.Any
+}
+var file_extensions_extension_proto_depIdxs = []int32{
+ 3, // 0: gnostic.extension.v1.ExtensionHandlerRequest.wrapper:type_name -> gnostic.extension.v1.Wrapper
+ 0, // 1: gnostic.extension.v1.ExtensionHandlerRequest.compiler_version:type_name -> gnostic.extension.v1.Version
+ 4, // 2: gnostic.extension.v1.ExtensionHandlerResponse.value:type_name -> google.protobuf.Any
+ 3, // [3:3] is the sub-list for method output_type
+ 3, // [3:3] is the sub-list for method input_type
+ 3, // [3:3] is the sub-list for extension type_name
+ 3, // [3:3] is the sub-list for extension extendee
+ 0, // [0:3] is the sub-list for field type_name
+}
+
+func init() { file_extensions_extension_proto_init() }
+func file_extensions_extension_proto_init() {
+ if File_extensions_extension_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_extensions_extension_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Version); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_extensions_extension_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ExtensionHandlerRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_extensions_extension_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ExtensionHandlerResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_extensions_extension_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Wrapper); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_extensions_extension_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 4,
+ NumExtensions: 0,
+ NumServices: 0,
+ },
+ GoTypes: file_extensions_extension_proto_goTypes,
+ DependencyIndexes: file_extensions_extension_proto_depIdxs,
+ MessageInfos: file_extensions_extension_proto_msgTypes,
+ }.Build()
+ File_extensions_extension_proto = out.File
+ file_extensions_extension_proto_rawDesc = nil
+ file_extensions_extension_proto_goTypes = nil
+ file_extensions_extension_proto_depIdxs = nil
+}
diff --git a/vendor/github.com/google/gnostic-models/extensions/extension.proto b/vendor/github.com/google/gnostic-models/extensions/extension.proto
new file mode 100644
index 000000000..875137c1a
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/extensions/extension.proto
@@ -0,0 +1,97 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+syntax = "proto3";
+
+package gnostic.extension.v1;
+
+import "google/protobuf/any.proto";
+
+// This option lets the proto compiler generate Java code inside the package
+// name (see below) instead of inside an outer class. It creates a simpler
+// developer experience by reducing one-level of name nesting and be
+// consistent with most programming languages that don't support outer classes.
+option java_multiple_files = true;
+
+// The Java outer classname should be the filename in UpperCamelCase. This
+// class is only used to hold proto descriptor, so developers don't need to
+// work with it directly.
+option java_outer_classname = "GnosticExtension";
+
+// The Java package name must be proto package name with proper prefix.
+option java_package = "org.gnostic.v1";
+
+// A reasonable prefix for the Objective-C symbols generated from the package.
+// It should at a minimum be 3 characters long, all uppercase, and convention
+// is to use an abbreviation of the package name. Something short, but
+// hopefully unique enough to not conflict with things that may come along in
+// the future. 'GPB' is reserved for the protocol buffer implementation itself.
+//
+// "Gnostic Extension"
+option objc_class_prefix = "GNX";
+
+// The Go package name.
+option go_package = "./extensions;gnostic_extension_v1";
+
+// The version number of Gnostic.
+message Version {
+ int32 major = 1;
+ int32 minor = 2;
+ int32 patch = 3;
+ // A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
+ // be empty for mainline stable releases.
+ string suffix = 4;
+}
+
+// An encoded Request is written to the ExtensionHandler's stdin.
+message ExtensionHandlerRequest {
+
+ // The extension to process.
+ Wrapper wrapper = 1;
+
+ // The version number of Gnostic.
+ Version compiler_version = 2;
+}
+
+// The extensions writes an encoded ExtensionHandlerResponse to stdout.
+message ExtensionHandlerResponse {
+
+ // true if the extension is handled by the extension handler; false otherwise
+ bool handled = 1;
+
+ // Error message(s). If non-empty, the extension handling failed.
+ // The extension handler process should exit with status code zero
+ // even if it reports an error in this way.
+ //
+ // This should be used to indicate errors which prevent the extension from
+ // operating as intended. Errors which indicate a problem in gnostic
+ // itself -- such as the input Document being unparseable -- should be
+ // reported by writing a message to stderr and exiting with a non-zero
+ // status code.
+ repeated string errors = 2;
+
+ // text output
+ google.protobuf.Any value = 3;
+}
+
+message Wrapper {
+ // version of the OpenAPI specification in which this extension was written.
+ string version = 1;
+
+ // Name of the extension.
+ string extension_name = 2;
+
+ // YAML-formatted extension value.
+ string yaml = 3;
+}
diff --git a/vendor/github.com/google/gnostic-models/extensions/extensions.go b/vendor/github.com/google/gnostic-models/extensions/extensions.go
new file mode 100644
index 000000000..ec8afd009
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/extensions/extensions.go
@@ -0,0 +1,64 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package gnostic_extension_v1
+
+import (
+ "io/ioutil"
+ "log"
+ "os"
+
+ "github.com/golang/protobuf/proto"
+ "github.com/golang/protobuf/ptypes"
+)
+
+type extensionHandler func(name string, yamlInput string) (bool, proto.Message, error)
+
+// Main implements the main program of an extension handler.
+func Main(handler extensionHandler) {
+ // unpack the request
+ data, err := ioutil.ReadAll(os.Stdin)
+ if err != nil {
+ log.Println("File error:", err.Error())
+ os.Exit(1)
+ }
+ if len(data) == 0 {
+ log.Println("No input data.")
+ os.Exit(1)
+ }
+ request := &ExtensionHandlerRequest{}
+ err = proto.Unmarshal(data, request)
+ if err != nil {
+ log.Println("Input error:", err.Error())
+ os.Exit(1)
+ }
+ // call the handler
+ handled, output, err := handler(request.Wrapper.ExtensionName, request.Wrapper.Yaml)
+ // respond with the output of the handler
+ response := &ExtensionHandlerResponse{
+ Handled: false, // default assumption
+ Errors: make([]string, 0),
+ }
+ if err != nil {
+ response.Errors = append(response.Errors, err.Error())
+ } else if handled {
+ response.Handled = true
+ response.Value, err = ptypes.MarshalAny(output)
+ if err != nil {
+ response.Errors = append(response.Errors, err.Error())
+ }
+ }
+ responseBytes, _ := proto.Marshal(response)
+ os.Stdout.Write(responseBytes)
+}
diff --git a/vendor/github.com/google/gnostic-models/jsonschema/README.md b/vendor/github.com/google/gnostic-models/jsonschema/README.md
new file mode 100644
index 000000000..6793c5179
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/jsonschema/README.md
@@ -0,0 +1,4 @@
+# jsonschema
+
+This directory contains code for reading, writing, and manipulating JSON
+schemas.
diff --git a/vendor/github.com/google/gnostic-models/jsonschema/base.go b/vendor/github.com/google/gnostic-models/jsonschema/base.go
new file mode 100644
index 000000000..5fcc4885a
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/jsonschema/base.go
@@ -0,0 +1,97 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// THIS FILE IS AUTOMATICALLY GENERATED.
+
+package jsonschema
+
+import (
+ "encoding/base64"
+)
+
+func baseSchemaBytes() ([]byte, error){
+ return base64.StdEncoding.DecodeString(
+`ewogICAgImlkIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDQvc2NoZW1hIyIsCiAgICAi
+JHNjaGVtYSI6ICJodHRwOi8vanNvbi1zY2hlbWEub3JnL2RyYWZ0LTA0L3NjaGVtYSMiLAogICAgImRl
+c2NyaXB0aW9uIjogIkNvcmUgc2NoZW1hIG1ldGEtc2NoZW1hIiwKICAgICJkZWZpbml0aW9ucyI6IHsK
+ICAgICAgICAic2NoZW1hQXJyYXkiOiB7CiAgICAgICAgICAgICJ0eXBlIjogImFycmF5IiwKICAgICAg
+ICAgICAgIm1pbkl0ZW1zIjogMSwKICAgICAgICAgICAgIml0ZW1zIjogeyAiJHJlZiI6ICIjIiB9CiAg
+ICAgICAgfSwKICAgICAgICAicG9zaXRpdmVJbnRlZ2VyIjogewogICAgICAgICAgICAidHlwZSI6ICJp
+bnRlZ2VyIiwKICAgICAgICAgICAgIm1pbmltdW0iOiAwCiAgICAgICAgfSwKICAgICAgICAicG9zaXRp
+dmVJbnRlZ2VyRGVmYXVsdDAiOiB7CiAgICAgICAgICAgICJhbGxPZiI6IFsgeyAiJHJlZiI6ICIjL2Rl
+ZmluaXRpb25zL3Bvc2l0aXZlSW50ZWdlciIgfSwgeyAiZGVmYXVsdCI6IDAgfSBdCiAgICAgICAgfSwK
+ICAgICAgICAic2ltcGxlVHlwZXMiOiB7CiAgICAgICAgICAgICJlbnVtIjogWyAiYXJyYXkiLCAiYm9v
+bGVhbiIsICJpbnRlZ2VyIiwgIm51bGwiLCAibnVtYmVyIiwgIm9iamVjdCIsICJzdHJpbmciIF0KICAg
+ICAgICB9LAogICAgICAgICJzdHJpbmdBcnJheSI6IHsKICAgICAgICAgICAgInR5cGUiOiAiYXJyYXki
+LAogICAgICAgICAgICAiaXRlbXMiOiB7ICJ0eXBlIjogInN0cmluZyIgfSwKICAgICAgICAgICAgIm1p
+bkl0ZW1zIjogMSwKICAgICAgICAgICAgInVuaXF1ZUl0ZW1zIjogdHJ1ZQogICAgICAgIH0KICAgIH0s
+CiAgICAidHlwZSI6ICJvYmplY3QiLAogICAgInByb3BlcnRpZXMiOiB7CiAgICAgICAgImlkIjogewog
+ICAgICAgICAgICAidHlwZSI6ICJzdHJpbmciLAogICAgICAgICAgICAiZm9ybWF0IjogInVyaSIKICAg
+ICAgICB9LAogICAgICAgICIkc2NoZW1hIjogewogICAgICAgICAgICAidHlwZSI6ICJzdHJpbmciLAog
+ICAgICAgICAgICAiZm9ybWF0IjogInVyaSIKICAgICAgICB9LAogICAgICAgICJ0aXRsZSI6IHsKICAg
+ICAgICAgICAgInR5cGUiOiAic3RyaW5nIgogICAgICAgIH0sCiAgICAgICAgImRlc2NyaXB0aW9uIjog
+ewogICAgICAgICAgICAidHlwZSI6ICJzdHJpbmciCiAgICAgICAgfSwKICAgICAgICAiZGVmYXVsdCI6
+IHt9LAogICAgICAgICJtdWx0aXBsZU9mIjogewogICAgICAgICAgICAidHlwZSI6ICJudW1iZXIiLAog
+ICAgICAgICAgICAibWluaW11bSI6IDAsCiAgICAgICAgICAgICJleGNsdXNpdmVNaW5pbXVtIjogdHJ1
+ZQogICAgICAgIH0sCiAgICAgICAgIm1heGltdW0iOiB7CiAgICAgICAgICAgICJ0eXBlIjogIm51bWJl
+ciIKICAgICAgICB9LAogICAgICAgICJleGNsdXNpdmVNYXhpbXVtIjogewogICAgICAgICAgICAidHlw
+ZSI6ICJib29sZWFuIiwKICAgICAgICAgICAgImRlZmF1bHQiOiBmYWxzZQogICAgICAgIH0sCiAgICAg
+ICAgIm1pbmltdW0iOiB7CiAgICAgICAgICAgICJ0eXBlIjogIm51bWJlciIKICAgICAgICB9LAogICAg
+ICAgICJleGNsdXNpdmVNaW5pbXVtIjogewogICAgICAgICAgICAidHlwZSI6ICJib29sZWFuIiwKICAg
+ICAgICAgICAgImRlZmF1bHQiOiBmYWxzZQogICAgICAgIH0sCiAgICAgICAgIm1heExlbmd0aCI6IHsg
+IiRyZWYiOiAiIy9kZWZpbml0aW9ucy9wb3NpdGl2ZUludGVnZXIiIH0sCiAgICAgICAgIm1pbkxlbmd0
+aCI6IHsgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy9wb3NpdGl2ZUludGVnZXJEZWZhdWx0MCIgfSwKICAg
+ICAgICAicGF0dGVybiI6IHsKICAgICAgICAgICAgInR5cGUiOiAic3RyaW5nIiwKICAgICAgICAgICAg
+ImZvcm1hdCI6ICJyZWdleCIKICAgICAgICB9LAogICAgICAgICJhZGRpdGlvbmFsSXRlbXMiOiB7CiAg
+ICAgICAgICAgICJhbnlPZiI6IFsKICAgICAgICAgICAgICAgIHsgInR5cGUiOiAiYm9vbGVhbiIgfSwK
+ICAgICAgICAgICAgICAgIHsgIiRyZWYiOiAiIyIgfQogICAgICAgICAgICBdLAogICAgICAgICAgICAi
+ZGVmYXVsdCI6IHt9CiAgICAgICAgfSwKICAgICAgICAiaXRlbXMiOiB7CiAgICAgICAgICAgICJhbnlP
+ZiI6IFsKICAgICAgICAgICAgICAgIHsgIiRyZWYiOiAiIyIgfSwKICAgICAgICAgICAgICAgIHsgIiRy
+ZWYiOiAiIy9kZWZpbml0aW9ucy9zY2hlbWFBcnJheSIgfQogICAgICAgICAgICBdLAogICAgICAgICAg
+ICAiZGVmYXVsdCI6IHt9CiAgICAgICAgfSwKICAgICAgICAibWF4SXRlbXMiOiB7ICIkcmVmIjogIiMv
+ZGVmaW5pdGlvbnMvcG9zaXRpdmVJbnRlZ2VyIiB9LAogICAgICAgICJtaW5JdGVtcyI6IHsgIiRyZWYi
+OiAiIy9kZWZpbml0aW9ucy9wb3NpdGl2ZUludGVnZXJEZWZhdWx0MCIgfSwKICAgICAgICAidW5pcXVl
+SXRlbXMiOiB7CiAgICAgICAgICAgICJ0eXBlIjogImJvb2xlYW4iLAogICAgICAgICAgICAiZGVmYXVs
+dCI6IGZhbHNlCiAgICAgICAgfSwKICAgICAgICAibWF4UHJvcGVydGllcyI6IHsgIiRyZWYiOiAiIy9k
+ZWZpbml0aW9ucy9wb3NpdGl2ZUludGVnZXIiIH0sCiAgICAgICAgIm1pblByb3BlcnRpZXMiOiB7ICIk
+cmVmIjogIiMvZGVmaW5pdGlvbnMvcG9zaXRpdmVJbnRlZ2VyRGVmYXVsdDAiIH0sCiAgICAgICAgInJl
+cXVpcmVkIjogeyAiJHJlZiI6ICIjL2RlZmluaXRpb25zL3N0cmluZ0FycmF5IiB9LAogICAgICAgICJh
+ZGRpdGlvbmFsUHJvcGVydGllcyI6IHsKICAgICAgICAgICAgImFueU9mIjogWwogICAgICAgICAgICAg
+ICAgeyAidHlwZSI6ICJib29sZWFuIiB9LAogICAgICAgICAgICAgICAgeyAiJHJlZiI6ICIjIiB9CiAg
+ICAgICAgICAgIF0sCiAgICAgICAgICAgICJkZWZhdWx0Ijoge30KICAgICAgICB9LAogICAgICAgICJk
+ZWZpbml0aW9ucyI6IHsKICAgICAgICAgICAgInR5cGUiOiAib2JqZWN0IiwKICAgICAgICAgICAgImFk
+ZGl0aW9uYWxQcm9wZXJ0aWVzIjogeyAiJHJlZiI6ICIjIiB9LAogICAgICAgICAgICAiZGVmYXVsdCI6
+IHt9CiAgICAgICAgfSwKICAgICAgICAicHJvcGVydGllcyI6IHsKICAgICAgICAgICAgInR5cGUiOiAi
+b2JqZWN0IiwKICAgICAgICAgICAgImFkZGl0aW9uYWxQcm9wZXJ0aWVzIjogeyAiJHJlZiI6ICIjIiB9
+LAogICAgICAgICAgICAiZGVmYXVsdCI6IHt9CiAgICAgICAgfSwKICAgICAgICAicGF0dGVyblByb3Bl
+cnRpZXMiOiB7CiAgICAgICAgICAgICJ0eXBlIjogIm9iamVjdCIsCiAgICAgICAgICAgICJhZGRpdGlv
+bmFsUHJvcGVydGllcyI6IHsgIiRyZWYiOiAiIyIgfSwKICAgICAgICAgICAgImRlZmF1bHQiOiB7fQog
+ICAgICAgIH0sCiAgICAgICAgImRlcGVuZGVuY2llcyI6IHsKICAgICAgICAgICAgInR5cGUiOiAib2Jq
+ZWN0IiwKICAgICAgICAgICAgImFkZGl0aW9uYWxQcm9wZXJ0aWVzIjogewogICAgICAgICAgICAgICAg
+ImFueU9mIjogWwogICAgICAgICAgICAgICAgICAgIHsgIiRyZWYiOiAiIyIgfSwKICAgICAgICAgICAg
+ICAgICAgICB7ICIkcmVmIjogIiMvZGVmaW5pdGlvbnMvc3RyaW5nQXJyYXkiIH0KICAgICAgICAgICAg
+ICAgIF0KICAgICAgICAgICAgfQogICAgICAgIH0sCiAgICAgICAgImVudW0iOiB7CiAgICAgICAgICAg
+ICJ0eXBlIjogImFycmF5IiwKICAgICAgICAgICAgIm1pbkl0ZW1zIjogMSwKICAgICAgICAgICAgInVu
+aXF1ZUl0ZW1zIjogdHJ1ZQogICAgICAgIH0sCiAgICAgICAgInR5cGUiOiB7CiAgICAgICAgICAgICJh
+bnlPZiI6IFsKICAgICAgICAgICAgICAgIHsgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy9zaW1wbGVUeXBl
+cyIgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAidHlwZSI6ICJhcnJheSIs
+CiAgICAgICAgICAgICAgICAgICAgIml0ZW1zIjogeyAiJHJlZiI6ICIjL2RlZmluaXRpb25zL3NpbXBs
+ZVR5cGVzIiB9LAogICAgICAgICAgICAgICAgICAgICJtaW5JdGVtcyI6IDEsCiAgICAgICAgICAgICAg
+ICAgICAgInVuaXF1ZUl0ZW1zIjogdHJ1ZQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICBdCiAg
+ICAgICAgfSwKICAgICAgICAiYWxsT2YiOiB7ICIkcmVmIjogIiMvZGVmaW5pdGlvbnMvc2NoZW1hQXJy
+YXkiIH0sCiAgICAgICAgImFueU9mIjogeyAiJHJlZiI6ICIjL2RlZmluaXRpb25zL3NjaGVtYUFycmF5
+IiB9LAogICAgICAgICJvbmVPZiI6IHsgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy9zY2hlbWFBcnJheSIg
+fSwKICAgICAgICAibm90IjogeyAiJHJlZiI6ICIjIiB9CiAgICB9LAogICAgImRlcGVuZGVuY2llcyI6
+IHsKICAgICAgICAiZXhjbHVzaXZlTWF4aW11bSI6IFsgIm1heGltdW0iIF0sCiAgICAgICAgImV4Y2x1
+c2l2ZU1pbmltdW0iOiBbICJtaW5pbXVtIiBdCiAgICB9LAogICAgImRlZmF1bHQiOiB7fQp9Cg==`)}
diff --git a/vendor/github.com/google/gnostic-models/jsonschema/display.go b/vendor/github.com/google/gnostic-models/jsonschema/display.go
new file mode 100644
index 000000000..028a760a9
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/jsonschema/display.go
@@ -0,0 +1,229 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package jsonschema
+
+import (
+ "fmt"
+ "strings"
+)
+
+//
+// DISPLAY
+// The following methods display Schemas.
+//
+
+// Description returns a string representation of a string or string array.
+func (s *StringOrStringArray) Description() string {
+ if s.String != nil {
+ return *s.String
+ }
+ if s.StringArray != nil {
+ return strings.Join(*s.StringArray, ", ")
+ }
+ return ""
+}
+
+// Returns a string representation of a Schema.
+func (schema *Schema) String() string {
+ return schema.describeSchema("")
+}
+
+// Helper: Returns a string representation of a Schema indented by a specified string.
+func (schema *Schema) describeSchema(indent string) string {
+ result := ""
+ if schema.Schema != nil {
+ result += indent + "$schema: " + *(schema.Schema) + "\n"
+ }
+ if schema.ID != nil {
+ result += indent + "id: " + *(schema.ID) + "\n"
+ }
+ if schema.MultipleOf != nil {
+ result += indent + fmt.Sprintf("multipleOf: %+v\n", *(schema.MultipleOf))
+ }
+ if schema.Maximum != nil {
+ result += indent + fmt.Sprintf("maximum: %+v\n", *(schema.Maximum))
+ }
+ if schema.ExclusiveMaximum != nil {
+ result += indent + fmt.Sprintf("exclusiveMaximum: %+v\n", *(schema.ExclusiveMaximum))
+ }
+ if schema.Minimum != nil {
+ result += indent + fmt.Sprintf("minimum: %+v\n", *(schema.Minimum))
+ }
+ if schema.ExclusiveMinimum != nil {
+ result += indent + fmt.Sprintf("exclusiveMinimum: %+v\n", *(schema.ExclusiveMinimum))
+ }
+ if schema.MaxLength != nil {
+ result += indent + fmt.Sprintf("maxLength: %+v\n", *(schema.MaxLength))
+ }
+ if schema.MinLength != nil {
+ result += indent + fmt.Sprintf("minLength: %+v\n", *(schema.MinLength))
+ }
+ if schema.Pattern != nil {
+ result += indent + fmt.Sprintf("pattern: %+v\n", *(schema.Pattern))
+ }
+ if schema.AdditionalItems != nil {
+ s := schema.AdditionalItems.Schema
+ if s != nil {
+ result += indent + "additionalItems:\n"
+ result += s.describeSchema(indent + " ")
+ } else {
+ b := *(schema.AdditionalItems.Boolean)
+ result += indent + fmt.Sprintf("additionalItems: %+v\n", b)
+ }
+ }
+ if schema.Items != nil {
+ result += indent + "items:\n"
+ items := schema.Items
+ if items.SchemaArray != nil {
+ for i, s := range *(items.SchemaArray) {
+ result += indent + " " + fmt.Sprintf("%d", i) + ":\n"
+ result += s.describeSchema(indent + " " + " ")
+ }
+ } else if items.Schema != nil {
+ result += items.Schema.describeSchema(indent + " " + " ")
+ }
+ }
+ if schema.MaxItems != nil {
+ result += indent + fmt.Sprintf("maxItems: %+v\n", *(schema.MaxItems))
+ }
+ if schema.MinItems != nil {
+ result += indent + fmt.Sprintf("minItems: %+v\n", *(schema.MinItems))
+ }
+ if schema.UniqueItems != nil {
+ result += indent + fmt.Sprintf("uniqueItems: %+v\n", *(schema.UniqueItems))
+ }
+ if schema.MaxProperties != nil {
+ result += indent + fmt.Sprintf("maxProperties: %+v\n", *(schema.MaxProperties))
+ }
+ if schema.MinProperties != nil {
+ result += indent + fmt.Sprintf("minProperties: %+v\n", *(schema.MinProperties))
+ }
+ if schema.Required != nil {
+ result += indent + fmt.Sprintf("required: %+v\n", *(schema.Required))
+ }
+ if schema.AdditionalProperties != nil {
+ s := schema.AdditionalProperties.Schema
+ if s != nil {
+ result += indent + "additionalProperties:\n"
+ result += s.describeSchema(indent + " ")
+ } else {
+ b := *(schema.AdditionalProperties.Boolean)
+ result += indent + fmt.Sprintf("additionalProperties: %+v\n", b)
+ }
+ }
+ if schema.Properties != nil {
+ result += indent + "properties:\n"
+ for _, pair := range *(schema.Properties) {
+ name := pair.Name
+ s := pair.Value
+ result += indent + " " + name + ":\n"
+ result += s.describeSchema(indent + " " + " ")
+ }
+ }
+ if schema.PatternProperties != nil {
+ result += indent + "patternProperties:\n"
+ for _, pair := range *(schema.PatternProperties) {
+ name := pair.Name
+ s := pair.Value
+ result += indent + " " + name + ":\n"
+ result += s.describeSchema(indent + " " + " ")
+ }
+ }
+ if schema.Dependencies != nil {
+ result += indent + "dependencies:\n"
+ for _, pair := range *(schema.Dependencies) {
+ name := pair.Name
+ schemaOrStringArray := pair.Value
+ s := schemaOrStringArray.Schema
+ if s != nil {
+ result += indent + " " + name + ":\n"
+ result += s.describeSchema(indent + " " + " ")
+ } else {
+ a := schemaOrStringArray.StringArray
+ if a != nil {
+ result += indent + " " + name + ":\n"
+ for _, s2 := range *a {
+ result += indent + " " + " " + s2 + "\n"
+ }
+ }
+ }
+
+ }
+ }
+ if schema.Enumeration != nil {
+ result += indent + "enumeration:\n"
+ for _, value := range *(schema.Enumeration) {
+ if value.String != nil {
+ result += indent + " " + fmt.Sprintf("%+v\n", *value.String)
+ } else {
+ result += indent + " " + fmt.Sprintf("%+v\n", *value.Bool)
+ }
+ }
+ }
+ if schema.Type != nil {
+ result += indent + fmt.Sprintf("type: %+v\n", schema.Type.Description())
+ }
+ if schema.AllOf != nil {
+ result += indent + "allOf:\n"
+ for _, s := range *(schema.AllOf) {
+ result += s.describeSchema(indent + " ")
+ result += indent + "-\n"
+ }
+ }
+ if schema.AnyOf != nil {
+ result += indent + "anyOf:\n"
+ for _, s := range *(schema.AnyOf) {
+ result += s.describeSchema(indent + " ")
+ result += indent + "-\n"
+ }
+ }
+ if schema.OneOf != nil {
+ result += indent + "oneOf:\n"
+ for _, s := range *(schema.OneOf) {
+ result += s.describeSchema(indent + " ")
+ result += indent + "-\n"
+ }
+ }
+ if schema.Not != nil {
+ result += indent + "not:\n"
+ result += schema.Not.describeSchema(indent + " ")
+ }
+ if schema.Definitions != nil {
+ result += indent + "definitions:\n"
+ for _, pair := range *(schema.Definitions) {
+ name := pair.Name
+ s := pair.Value
+ result += indent + " " + name + ":\n"
+ result += s.describeSchema(indent + " " + " ")
+ }
+ }
+ if schema.Title != nil {
+ result += indent + "title: " + *(schema.Title) + "\n"
+ }
+ if schema.Description != nil {
+ result += indent + "description: " + *(schema.Description) + "\n"
+ }
+ if schema.Default != nil {
+ result += indent + "default:\n"
+ result += indent + fmt.Sprintf(" %+v\n", *(schema.Default))
+ }
+ if schema.Format != nil {
+ result += indent + "format: " + *(schema.Format) + "\n"
+ }
+ if schema.Ref != nil {
+ result += indent + "$ref: " + *(schema.Ref) + "\n"
+ }
+ return result
+}
diff --git a/vendor/github.com/google/gnostic-models/jsonschema/models.go b/vendor/github.com/google/gnostic-models/jsonschema/models.go
new file mode 100644
index 000000000..4781bdc5f
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/jsonschema/models.go
@@ -0,0 +1,228 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package jsonschema supports the reading, writing, and manipulation
+// of JSON Schemas.
+package jsonschema
+
+import "gopkg.in/yaml.v3"
+
+// The Schema struct models a JSON Schema and, because schemas are
+// defined hierarchically, contains many references to itself.
+// All fields are pointers and are nil if the associated values
+// are not specified.
+type Schema struct {
+ Schema *string // $schema
+ ID *string // id keyword used for $ref resolution scope
+ Ref *string // $ref, i.e. JSON Pointers
+
+ // http://json-schema.org/latest/json-schema-validation.html
+ // 5.1. Validation keywords for numeric instances (number and integer)
+ MultipleOf *SchemaNumber
+ Maximum *SchemaNumber
+ ExclusiveMaximum *bool
+ Minimum *SchemaNumber
+ ExclusiveMinimum *bool
+
+ // 5.2. Validation keywords for strings
+ MaxLength *int64
+ MinLength *int64
+ Pattern *string
+
+ // 5.3. Validation keywords for arrays
+ AdditionalItems *SchemaOrBoolean
+ Items *SchemaOrSchemaArray
+ MaxItems *int64
+ MinItems *int64
+ UniqueItems *bool
+
+ // 5.4. Validation keywords for objects
+ MaxProperties *int64
+ MinProperties *int64
+ Required *[]string
+ AdditionalProperties *SchemaOrBoolean
+ Properties *[]*NamedSchema
+ PatternProperties *[]*NamedSchema
+ Dependencies *[]*NamedSchemaOrStringArray
+
+ // 5.5. Validation keywords for any instance type
+ Enumeration *[]SchemaEnumValue
+ Type *StringOrStringArray
+ AllOf *[]*Schema
+ AnyOf *[]*Schema
+ OneOf *[]*Schema
+ Not *Schema
+ Definitions *[]*NamedSchema
+
+ // 6. Metadata keywords
+ Title *string
+ Description *string
+ Default *yaml.Node
+
+ // 7. Semantic validation with "format"
+ Format *string
+}
+
+// These helper structs represent "combination" types that generally can
+// have values of one type or another. All are used to represent parts
+// of Schemas.
+
+// SchemaNumber represents a value that can be either an Integer or a Float.
+type SchemaNumber struct {
+ Integer *int64
+ Float *float64
+}
+
+// NewSchemaNumberWithInteger creates and returns a new object
+func NewSchemaNumberWithInteger(i int64) *SchemaNumber {
+ result := &SchemaNumber{}
+ result.Integer = &i
+ return result
+}
+
+// NewSchemaNumberWithFloat creates and returns a new object
+func NewSchemaNumberWithFloat(f float64) *SchemaNumber {
+ result := &SchemaNumber{}
+ result.Float = &f
+ return result
+}
+
+// SchemaOrBoolean represents a value that can be either a Schema or a Boolean.
+type SchemaOrBoolean struct {
+ Schema *Schema
+ Boolean *bool
+}
+
+// NewSchemaOrBooleanWithSchema creates and returns a new object
+func NewSchemaOrBooleanWithSchema(s *Schema) *SchemaOrBoolean {
+ result := &SchemaOrBoolean{}
+ result.Schema = s
+ return result
+}
+
+// NewSchemaOrBooleanWithBoolean creates and returns a new object
+func NewSchemaOrBooleanWithBoolean(b bool) *SchemaOrBoolean {
+ result := &SchemaOrBoolean{}
+ result.Boolean = &b
+ return result
+}
+
+// StringOrStringArray represents a value that can be either
+// a String or an Array of Strings.
+type StringOrStringArray struct {
+ String *string
+ StringArray *[]string
+}
+
+// NewStringOrStringArrayWithString creates and returns a new object
+func NewStringOrStringArrayWithString(s string) *StringOrStringArray {
+ result := &StringOrStringArray{}
+ result.String = &s
+ return result
+}
+
+// NewStringOrStringArrayWithStringArray creates and returns a new object
+func NewStringOrStringArrayWithStringArray(a []string) *StringOrStringArray {
+ result := &StringOrStringArray{}
+ result.StringArray = &a
+ return result
+}
+
+// SchemaOrStringArray represents a value that can be either
+// a Schema or an Array of Strings.
+type SchemaOrStringArray struct {
+ Schema *Schema
+ StringArray *[]string
+}
+
+// SchemaOrSchemaArray represents a value that can be either
+// a Schema or an Array of Schemas.
+type SchemaOrSchemaArray struct {
+ Schema *Schema
+ SchemaArray *[]*Schema
+}
+
+// NewSchemaOrSchemaArrayWithSchema creates and returns a new object
+func NewSchemaOrSchemaArrayWithSchema(s *Schema) *SchemaOrSchemaArray {
+ result := &SchemaOrSchemaArray{}
+ result.Schema = s
+ return result
+}
+
+// NewSchemaOrSchemaArrayWithSchemaArray creates and returns a new object
+func NewSchemaOrSchemaArrayWithSchemaArray(a []*Schema) *SchemaOrSchemaArray {
+ result := &SchemaOrSchemaArray{}
+ result.SchemaArray = &a
+ return result
+}
+
+// SchemaEnumValue represents a value that can be part of an
+// enumeration in a Schema.
+type SchemaEnumValue struct {
+ String *string
+ Bool *bool
+}
+
+// NamedSchema is a name-value pair that is used to emulate maps
+// with ordered keys.
+type NamedSchema struct {
+ Name string
+ Value *Schema
+}
+
+// NewNamedSchema creates and returns a new object
+func NewNamedSchema(name string, value *Schema) *NamedSchema {
+ return &NamedSchema{Name: name, Value: value}
+}
+
+// NamedSchemaOrStringArray is a name-value pair that is used
+// to emulate maps with ordered keys.
+type NamedSchemaOrStringArray struct {
+ Name string
+ Value *SchemaOrStringArray
+}
+
+// Access named subschemas by name
+
+func namedSchemaArrayElementWithName(array *[]*NamedSchema, name string) *Schema {
+ if array == nil {
+ return nil
+ }
+ for _, pair := range *array {
+ if pair.Name == name {
+ return pair.Value
+ }
+ }
+ return nil
+}
+
+// PropertyWithName returns the selected element.
+func (s *Schema) PropertyWithName(name string) *Schema {
+ return namedSchemaArrayElementWithName(s.Properties, name)
+}
+
+// PatternPropertyWithName returns the selected element.
+func (s *Schema) PatternPropertyWithName(name string) *Schema {
+ return namedSchemaArrayElementWithName(s.PatternProperties, name)
+}
+
+// DefinitionWithName returns the selected element.
+func (s *Schema) DefinitionWithName(name string) *Schema {
+ return namedSchemaArrayElementWithName(s.Definitions, name)
+}
+
+// AddProperty adds a named property.
+func (s *Schema) AddProperty(name string, property *Schema) {
+ *s.Properties = append(*s.Properties, NewNamedSchema(name, property))
+}
diff --git a/vendor/github.com/google/gnostic-models/jsonschema/operations.go b/vendor/github.com/google/gnostic-models/jsonschema/operations.go
new file mode 100644
index 000000000..ba8dd4a91
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/jsonschema/operations.go
@@ -0,0 +1,394 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package jsonschema
+
+import (
+ "fmt"
+ "log"
+ "strings"
+)
+
+//
+// OPERATIONS
+// The following methods perform operations on Schemas.
+//
+
+// IsEmpty returns true if no members of the Schema are specified.
+func (schema *Schema) IsEmpty() bool {
+ return (schema.Schema == nil) &&
+ (schema.ID == nil) &&
+ (schema.MultipleOf == nil) &&
+ (schema.Maximum == nil) &&
+ (schema.ExclusiveMaximum == nil) &&
+ (schema.Minimum == nil) &&
+ (schema.ExclusiveMinimum == nil) &&
+ (schema.MaxLength == nil) &&
+ (schema.MinLength == nil) &&
+ (schema.Pattern == nil) &&
+ (schema.AdditionalItems == nil) &&
+ (schema.Items == nil) &&
+ (schema.MaxItems == nil) &&
+ (schema.MinItems == nil) &&
+ (schema.UniqueItems == nil) &&
+ (schema.MaxProperties == nil) &&
+ (schema.MinProperties == nil) &&
+ (schema.Required == nil) &&
+ (schema.AdditionalProperties == nil) &&
+ (schema.Properties == nil) &&
+ (schema.PatternProperties == nil) &&
+ (schema.Dependencies == nil) &&
+ (schema.Enumeration == nil) &&
+ (schema.Type == nil) &&
+ (schema.AllOf == nil) &&
+ (schema.AnyOf == nil) &&
+ (schema.OneOf == nil) &&
+ (schema.Not == nil) &&
+ (schema.Definitions == nil) &&
+ (schema.Title == nil) &&
+ (schema.Description == nil) &&
+ (schema.Default == nil) &&
+ (schema.Format == nil) &&
+ (schema.Ref == nil)
+}
+
+// IsEqual returns true if two schemas are equal.
+func (schema *Schema) IsEqual(schema2 *Schema) bool {
+ return schema.String() == schema2.String()
+}
+
+// SchemaOperation represents a function that can be applied to a Schema.
+type SchemaOperation func(schema *Schema, context string)
+
+// Applies a specified function to a Schema and all of the Schemas that it contains.
+func (schema *Schema) applyToSchemas(operation SchemaOperation, context string) {
+
+ if schema.AdditionalItems != nil {
+ s := schema.AdditionalItems.Schema
+ if s != nil {
+ s.applyToSchemas(operation, "AdditionalItems")
+ }
+ }
+
+ if schema.Items != nil {
+ if schema.Items.SchemaArray != nil {
+ for _, s := range *(schema.Items.SchemaArray) {
+ s.applyToSchemas(operation, "Items.SchemaArray")
+ }
+ } else if schema.Items.Schema != nil {
+ schema.Items.Schema.applyToSchemas(operation, "Items.Schema")
+ }
+ }
+
+ if schema.AdditionalProperties != nil {
+ s := schema.AdditionalProperties.Schema
+ if s != nil {
+ s.applyToSchemas(operation, "AdditionalProperties")
+ }
+ }
+
+ if schema.Properties != nil {
+ for _, pair := range *(schema.Properties) {
+ s := pair.Value
+ s.applyToSchemas(operation, "Properties")
+ }
+ }
+ if schema.PatternProperties != nil {
+ for _, pair := range *(schema.PatternProperties) {
+ s := pair.Value
+ s.applyToSchemas(operation, "PatternProperties")
+ }
+ }
+
+ if schema.Dependencies != nil {
+ for _, pair := range *(schema.Dependencies) {
+ schemaOrStringArray := pair.Value
+ s := schemaOrStringArray.Schema
+ if s != nil {
+ s.applyToSchemas(operation, "Dependencies")
+ }
+ }
+ }
+
+ if schema.AllOf != nil {
+ for _, s := range *(schema.AllOf) {
+ s.applyToSchemas(operation, "AllOf")
+ }
+ }
+ if schema.AnyOf != nil {
+ for _, s := range *(schema.AnyOf) {
+ s.applyToSchemas(operation, "AnyOf")
+ }
+ }
+ if schema.OneOf != nil {
+ for _, s := range *(schema.OneOf) {
+ s.applyToSchemas(operation, "OneOf")
+ }
+ }
+ if schema.Not != nil {
+ schema.Not.applyToSchemas(operation, "Not")
+ }
+
+ if schema.Definitions != nil {
+ for _, pair := range *(schema.Definitions) {
+ s := pair.Value
+ s.applyToSchemas(operation, "Definitions")
+ }
+ }
+
+ operation(schema, context)
+}
+
+// CopyProperties copies all non-nil properties from the source Schema to the schema Schema.
+func (schema *Schema) CopyProperties(source *Schema) {
+ if source.Schema != nil {
+ schema.Schema = source.Schema
+ }
+ if source.ID != nil {
+ schema.ID = source.ID
+ }
+ if source.MultipleOf != nil {
+ schema.MultipleOf = source.MultipleOf
+ }
+ if source.Maximum != nil {
+ schema.Maximum = source.Maximum
+ }
+ if source.ExclusiveMaximum != nil {
+ schema.ExclusiveMaximum = source.ExclusiveMaximum
+ }
+ if source.Minimum != nil {
+ schema.Minimum = source.Minimum
+ }
+ if source.ExclusiveMinimum != nil {
+ schema.ExclusiveMinimum = source.ExclusiveMinimum
+ }
+ if source.MaxLength != nil {
+ schema.MaxLength = source.MaxLength
+ }
+ if source.MinLength != nil {
+ schema.MinLength = source.MinLength
+ }
+ if source.Pattern != nil {
+ schema.Pattern = source.Pattern
+ }
+ if source.AdditionalItems != nil {
+ schema.AdditionalItems = source.AdditionalItems
+ }
+ if source.Items != nil {
+ schema.Items = source.Items
+ }
+ if source.MaxItems != nil {
+ schema.MaxItems = source.MaxItems
+ }
+ if source.MinItems != nil {
+ schema.MinItems = source.MinItems
+ }
+ if source.UniqueItems != nil {
+ schema.UniqueItems = source.UniqueItems
+ }
+ if source.MaxProperties != nil {
+ schema.MaxProperties = source.MaxProperties
+ }
+ if source.MinProperties != nil {
+ schema.MinProperties = source.MinProperties
+ }
+ if source.Required != nil {
+ schema.Required = source.Required
+ }
+ if source.AdditionalProperties != nil {
+ schema.AdditionalProperties = source.AdditionalProperties
+ }
+ if source.Properties != nil {
+ schema.Properties = source.Properties
+ }
+ if source.PatternProperties != nil {
+ schema.PatternProperties = source.PatternProperties
+ }
+ if source.Dependencies != nil {
+ schema.Dependencies = source.Dependencies
+ }
+ if source.Enumeration != nil {
+ schema.Enumeration = source.Enumeration
+ }
+ if source.Type != nil {
+ schema.Type = source.Type
+ }
+ if source.AllOf != nil {
+ schema.AllOf = source.AllOf
+ }
+ if source.AnyOf != nil {
+ schema.AnyOf = source.AnyOf
+ }
+ if source.OneOf != nil {
+ schema.OneOf = source.OneOf
+ }
+ if source.Not != nil {
+ schema.Not = source.Not
+ }
+ if source.Definitions != nil {
+ schema.Definitions = source.Definitions
+ }
+ if source.Title != nil {
+ schema.Title = source.Title
+ }
+ if source.Description != nil {
+ schema.Description = source.Description
+ }
+ if source.Default != nil {
+ schema.Default = source.Default
+ }
+ if source.Format != nil {
+ schema.Format = source.Format
+ }
+ if source.Ref != nil {
+ schema.Ref = source.Ref
+ }
+}
+
+// TypeIs returns true if the Type of a Schema includes the specified type
+func (schema *Schema) TypeIs(typeName string) bool {
+ if schema.Type != nil {
+ // the schema Type is either a string or an array of strings
+ if schema.Type.String != nil {
+ return (*(schema.Type.String) == typeName)
+ } else if schema.Type.StringArray != nil {
+ for _, n := range *(schema.Type.StringArray) {
+ if n == typeName {
+ return true
+ }
+ }
+ }
+ }
+ return false
+}
+
+// ResolveRefs resolves "$ref" elements in a Schema and its children.
+// But if a reference refers to an object type, is inside a oneOf, or contains a oneOf,
+// the reference is kept and we expect downstream tools to separately model these
+// referenced schemas.
+func (schema *Schema) ResolveRefs() {
+ rootSchema := schema
+ count := 1
+ for count > 0 {
+ count = 0
+ schema.applyToSchemas(
+ func(schema *Schema, context string) {
+ if schema.Ref != nil {
+ resolvedRef, err := rootSchema.resolveJSONPointer(*(schema.Ref))
+ if err != nil {
+ log.Printf("%+v", err)
+ } else if resolvedRef.TypeIs("object") {
+ // don't substitute for objects, we'll model the referenced schema with a class
+ } else if context == "OneOf" {
+ // don't substitute for references inside oneOf declarations
+ } else if resolvedRef.OneOf != nil {
+ // don't substitute for references that contain oneOf declarations
+ } else if resolvedRef.AdditionalProperties != nil {
+ // don't substitute for references that look like objects
+ } else {
+ schema.Ref = nil
+ schema.CopyProperties(resolvedRef)
+ count++
+ }
+ }
+ }, "")
+ }
+}
+
+// resolveJSONPointer resolves JSON pointers.
+// This current implementation is very crude and custom for OpenAPI 2.0 schemas.
+// It panics for any pointer that it is unable to resolve.
+func (schema *Schema) resolveJSONPointer(ref string) (result *Schema, err error) {
+ parts := strings.Split(ref, "#")
+ if len(parts) == 2 {
+ documentName := parts[0] + "#"
+ if documentName == "#" && schema.ID != nil {
+ documentName = *(schema.ID)
+ }
+ path := parts[1]
+ document := schemas[documentName]
+ pathParts := strings.Split(path, "/")
+
+ // we currently do a very limited (hard-coded) resolution of certain paths and log errors for missed cases
+ if len(pathParts) == 1 {
+ return document, nil
+ } else if len(pathParts) == 3 {
+ switch pathParts[1] {
+ case "definitions":
+ dictionary := document.Definitions
+ for _, pair := range *dictionary {
+ if pair.Name == pathParts[2] {
+ result = pair.Value
+ }
+ }
+ case "properties":
+ dictionary := document.Properties
+ for _, pair := range *dictionary {
+ if pair.Name == pathParts[2] {
+ result = pair.Value
+ }
+ }
+ default:
+ break
+ }
+ }
+ }
+ if result == nil {
+ return nil, fmt.Errorf("unresolved pointer: %+v", ref)
+ }
+ return result, nil
+}
+
+// ResolveAllOfs replaces "allOf" elements by merging their properties into the parent Schema.
+func (schema *Schema) ResolveAllOfs() {
+ schema.applyToSchemas(
+ func(schema *Schema, context string) {
+ if schema.AllOf != nil {
+ for _, allOf := range *(schema.AllOf) {
+ schema.CopyProperties(allOf)
+ }
+ schema.AllOf = nil
+ }
+ }, "resolveAllOfs")
+}
+
+// ResolveAnyOfs replaces all "anyOf" elements with "oneOf".
+func (schema *Schema) ResolveAnyOfs() {
+ schema.applyToSchemas(
+ func(schema *Schema, context string) {
+ if schema.AnyOf != nil {
+ schema.OneOf = schema.AnyOf
+ schema.AnyOf = nil
+ }
+ }, "resolveAnyOfs")
+}
+
+// return a pointer to a copy of a passed-in string
+func stringptr(input string) (output *string) {
+ return &input
+}
+
+// CopyOfficialSchemaProperty copies a named property from the official JSON Schema definition
+func (schema *Schema) CopyOfficialSchemaProperty(name string) {
+ *schema.Properties = append(*schema.Properties,
+ NewNamedSchema(name,
+ &Schema{Ref: stringptr("http://json-schema.org/draft-04/schema#/properties/" + name)}))
+}
+
+// CopyOfficialSchemaProperties copies named properties from the official JSON Schema definition
+func (schema *Schema) CopyOfficialSchemaProperties(names []string) {
+ for _, name := range names {
+ schema.CopyOfficialSchemaProperty(name)
+ }
+}
diff --git a/vendor/github.com/google/gnostic-models/jsonschema/reader.go b/vendor/github.com/google/gnostic-models/jsonschema/reader.go
new file mode 100644
index 000000000..b8583d466
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/jsonschema/reader.go
@@ -0,0 +1,442 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+//go:generate go run generate-base.go
+
+package jsonschema
+
+import (
+ "fmt"
+ "io/ioutil"
+ "strconv"
+
+ "gopkg.in/yaml.v3"
+)
+
+// This is a global map of all known Schemas.
+// It is initialized when the first Schema is created and inserted.
+var schemas map[string]*Schema
+
+// NewBaseSchema builds a schema object from an embedded json representation.
+func NewBaseSchema() (schema *Schema, err error) {
+ b, err := baseSchemaBytes()
+ if err != nil {
+ return nil, err
+ }
+ var node yaml.Node
+ err = yaml.Unmarshal(b, &node)
+ if err != nil {
+ return nil, err
+ }
+ return NewSchemaFromObject(&node), nil
+}
+
+// NewSchemaFromFile reads a schema from a file.
+// Currently this assumes that schemas are stored in the source distribution of this project.
+func NewSchemaFromFile(filename string) (schema *Schema, err error) {
+ file, err := ioutil.ReadFile(filename)
+ if err != nil {
+ return nil, err
+ }
+ var node yaml.Node
+ err = yaml.Unmarshal(file, &node)
+ if err != nil {
+ return nil, err
+ }
+ return NewSchemaFromObject(&node), nil
+}
+
+// NewSchemaFromObject constructs a schema from a parsed JSON object.
+// Due to the complexity of the schema representation, this is a
+// custom reader and not the standard Go JSON reader (encoding/json).
+func NewSchemaFromObject(jsonData *yaml.Node) *Schema {
+ switch jsonData.Kind {
+ case yaml.DocumentNode:
+ return NewSchemaFromObject(jsonData.Content[0])
+ case yaml.MappingNode:
+ schema := &Schema{}
+
+ for i := 0; i < len(jsonData.Content); i += 2 {
+ k := jsonData.Content[i].Value
+ v := jsonData.Content[i+1]
+
+ switch k {
+ case "$schema":
+ schema.Schema = schema.stringValue(v)
+ case "id":
+ schema.ID = schema.stringValue(v)
+
+ case "multipleOf":
+ schema.MultipleOf = schema.numberValue(v)
+ case "maximum":
+ schema.Maximum = schema.numberValue(v)
+ case "exclusiveMaximum":
+ schema.ExclusiveMaximum = schema.boolValue(v)
+ case "minimum":
+ schema.Minimum = schema.numberValue(v)
+ case "exclusiveMinimum":
+ schema.ExclusiveMinimum = schema.boolValue(v)
+
+ case "maxLength":
+ schema.MaxLength = schema.intValue(v)
+ case "minLength":
+ schema.MinLength = schema.intValue(v)
+ case "pattern":
+ schema.Pattern = schema.stringValue(v)
+
+ case "additionalItems":
+ schema.AdditionalItems = schema.schemaOrBooleanValue(v)
+ case "items":
+ schema.Items = schema.schemaOrSchemaArrayValue(v)
+ case "maxItems":
+ schema.MaxItems = schema.intValue(v)
+ case "minItems":
+ schema.MinItems = schema.intValue(v)
+ case "uniqueItems":
+ schema.UniqueItems = schema.boolValue(v)
+
+ case "maxProperties":
+ schema.MaxProperties = schema.intValue(v)
+ case "minProperties":
+ schema.MinProperties = schema.intValue(v)
+ case "required":
+ schema.Required = schema.arrayOfStringsValue(v)
+ case "additionalProperties":
+ schema.AdditionalProperties = schema.schemaOrBooleanValue(v)
+ case "properties":
+ schema.Properties = schema.mapOfSchemasValue(v)
+ case "patternProperties":
+ schema.PatternProperties = schema.mapOfSchemasValue(v)
+ case "dependencies":
+ schema.Dependencies = schema.mapOfSchemasOrStringArraysValue(v)
+
+ case "enum":
+ schema.Enumeration = schema.arrayOfEnumValuesValue(v)
+
+ case "type":
+ schema.Type = schema.stringOrStringArrayValue(v)
+ case "allOf":
+ schema.AllOf = schema.arrayOfSchemasValue(v)
+ case "anyOf":
+ schema.AnyOf = schema.arrayOfSchemasValue(v)
+ case "oneOf":
+ schema.OneOf = schema.arrayOfSchemasValue(v)
+ case "not":
+ schema.Not = NewSchemaFromObject(v)
+ case "definitions":
+ schema.Definitions = schema.mapOfSchemasValue(v)
+
+ case "title":
+ schema.Title = schema.stringValue(v)
+ case "description":
+ schema.Description = schema.stringValue(v)
+
+ case "default":
+ schema.Default = v
+
+ case "format":
+ schema.Format = schema.stringValue(v)
+ case "$ref":
+ schema.Ref = schema.stringValue(v)
+ default:
+ fmt.Printf("UNSUPPORTED (%s)\n", k)
+ }
+ }
+
+ // insert schema in global map
+ if schema.ID != nil {
+ if schemas == nil {
+ schemas = make(map[string]*Schema, 0)
+ }
+ schemas[*(schema.ID)] = schema
+ }
+ return schema
+
+ default:
+ fmt.Printf("schemaValue: unexpected node %+v\n", jsonData)
+ return nil
+ }
+
+ return nil
+}
+
+//
+// BUILDERS
+// The following methods build elements of Schemas from interface{} values.
+// Each returns nil if it is unable to build the desired element.
+//
+
+// Gets the string value of an interface{} value if possible.
+func (schema *Schema) stringValue(v *yaml.Node) *string {
+ switch v.Kind {
+ case yaml.ScalarNode:
+ return &v.Value
+ default:
+ fmt.Printf("stringValue: unexpected node %+v\n", v)
+ }
+ return nil
+}
+
+// Gets the numeric value of an interface{} value if possible.
+func (schema *Schema) numberValue(v *yaml.Node) *SchemaNumber {
+ number := &SchemaNumber{}
+ switch v.Kind {
+ case yaml.ScalarNode:
+ switch v.Tag {
+ case "!!float":
+ v2, _ := strconv.ParseFloat(v.Value, 64)
+ number.Float = &v2
+ return number
+ case "!!int":
+ v2, _ := strconv.ParseInt(v.Value, 10, 64)
+ number.Integer = &v2
+ return number
+ default:
+ fmt.Printf("stringValue: unexpected node %+v\n", v)
+ }
+ default:
+ fmt.Printf("stringValue: unexpected node %+v\n", v)
+ }
+ return nil
+}
+
+// Gets the integer value of an interface{} value if possible.
+func (schema *Schema) intValue(v *yaml.Node) *int64 {
+ switch v.Kind {
+ case yaml.ScalarNode:
+ switch v.Tag {
+ case "!!float":
+ v2, _ := strconv.ParseFloat(v.Value, 64)
+ v3 := int64(v2)
+ return &v3
+ case "!!int":
+ v2, _ := strconv.ParseInt(v.Value, 10, 64)
+ return &v2
+ default:
+ fmt.Printf("intValue: unexpected node %+v\n", v)
+ }
+ default:
+ fmt.Printf("intValue: unexpected node %+v\n", v)
+ }
+ return nil
+}
+
+// Gets the bool value of an interface{} value if possible.
+func (schema *Schema) boolValue(v *yaml.Node) *bool {
+ switch v.Kind {
+ case yaml.ScalarNode:
+ switch v.Tag {
+ case "!!bool":
+ v2, _ := strconv.ParseBool(v.Value)
+ return &v2
+ default:
+ fmt.Printf("boolValue: unexpected node %+v\n", v)
+ }
+ default:
+ fmt.Printf("boolValue: unexpected node %+v\n", v)
+ }
+ return nil
+}
+
+// Gets a map of Schemas from an interface{} value if possible.
+func (schema *Schema) mapOfSchemasValue(v *yaml.Node) *[]*NamedSchema {
+ switch v.Kind {
+ case yaml.MappingNode:
+ m := make([]*NamedSchema, 0)
+ for i := 0; i < len(v.Content); i += 2 {
+ k2 := v.Content[i].Value
+ v2 := v.Content[i+1]
+ pair := &NamedSchema{Name: k2, Value: NewSchemaFromObject(v2)}
+ m = append(m, pair)
+ }
+ return &m
+ default:
+ fmt.Printf("mapOfSchemasValue: unexpected node %+v\n", v)
+ }
+ return nil
+}
+
+// Gets an array of Schemas from an interface{} value if possible.
+func (schema *Schema) arrayOfSchemasValue(v *yaml.Node) *[]*Schema {
+ switch v.Kind {
+ case yaml.SequenceNode:
+ m := make([]*Schema, 0)
+ for _, v2 := range v.Content {
+ switch v2.Kind {
+ case yaml.MappingNode:
+ s := NewSchemaFromObject(v2)
+ m = append(m, s)
+ default:
+ fmt.Printf("arrayOfSchemasValue: unexpected node %+v\n", v2)
+ }
+ }
+ return &m
+ case yaml.MappingNode:
+ m := make([]*Schema, 0)
+ s := NewSchemaFromObject(v)
+ m = append(m, s)
+ return &m
+ default:
+ fmt.Printf("arrayOfSchemasValue: unexpected node %+v\n", v)
+ }
+ return nil
+}
+
+// Gets a Schema or an array of Schemas from an interface{} value if possible.
+func (schema *Schema) schemaOrSchemaArrayValue(v *yaml.Node) *SchemaOrSchemaArray {
+ switch v.Kind {
+ case yaml.SequenceNode:
+ m := make([]*Schema, 0)
+ for _, v2 := range v.Content {
+ switch v2.Kind {
+ case yaml.MappingNode:
+ s := NewSchemaFromObject(v2)
+ m = append(m, s)
+ default:
+ fmt.Printf("schemaOrSchemaArrayValue: unexpected node %+v\n", v2)
+ }
+ }
+ return &SchemaOrSchemaArray{SchemaArray: &m}
+ case yaml.MappingNode:
+ s := NewSchemaFromObject(v)
+ return &SchemaOrSchemaArray{Schema: s}
+ default:
+ fmt.Printf("schemaOrSchemaArrayValue: unexpected node %+v\n", v)
+ }
+ return nil
+}
+
+// Gets an array of strings from an interface{} value if possible.
+func (schema *Schema) arrayOfStringsValue(v *yaml.Node) *[]string {
+ switch v.Kind {
+ case yaml.ScalarNode:
+ a := []string{v.Value}
+ return &a
+ case yaml.SequenceNode:
+ a := make([]string, 0)
+ for _, v2 := range v.Content {
+ switch v2.Kind {
+ case yaml.ScalarNode:
+ a = append(a, v2.Value)
+ default:
+ fmt.Printf("arrayOfStringsValue: unexpected node %+v\n", v2)
+ }
+ }
+ return &a
+ default:
+ fmt.Printf("arrayOfStringsValue: unexpected node %+v\n", v)
+ }
+ return nil
+}
+
+// Gets a string or an array of strings from an interface{} value if possible.
+func (schema *Schema) stringOrStringArrayValue(v *yaml.Node) *StringOrStringArray {
+ switch v.Kind {
+ case yaml.ScalarNode:
+ s := &StringOrStringArray{}
+ s.String = &v.Value
+ return s
+ case yaml.SequenceNode:
+ a := make([]string, 0)
+ for _, v2 := range v.Content {
+ switch v2.Kind {
+ case yaml.ScalarNode:
+ a = append(a, v2.Value)
+ default:
+ fmt.Printf("arrayOfStringsValue: unexpected node %+v\n", v2)
+ }
+ }
+ s := &StringOrStringArray{}
+ s.StringArray = &a
+ return s
+ default:
+ fmt.Printf("arrayOfStringsValue: unexpected node %+v\n", v)
+ }
+ return nil
+}
+
+// Gets an array of enum values from an interface{} value if possible.
+func (schema *Schema) arrayOfEnumValuesValue(v *yaml.Node) *[]SchemaEnumValue {
+ a := make([]SchemaEnumValue, 0)
+ switch v.Kind {
+ case yaml.SequenceNode:
+ for _, v2 := range v.Content {
+ switch v2.Kind {
+ case yaml.ScalarNode:
+ switch v2.Tag {
+ case "!!str":
+ a = append(a, SchemaEnumValue{String: &v2.Value})
+ case "!!bool":
+ v3, _ := strconv.ParseBool(v2.Value)
+ a = append(a, SchemaEnumValue{Bool: &v3})
+ default:
+ fmt.Printf("arrayOfEnumValuesValue: unexpected type %s\n", v2.Tag)
+ }
+ default:
+ fmt.Printf("arrayOfEnumValuesValue: unexpected node %+v\n", v2)
+ }
+ }
+ default:
+ fmt.Printf("arrayOfEnumValuesValue: unexpected node %+v\n", v)
+ }
+ return &a
+}
+
+// Gets a map of schemas or string arrays from an interface{} value if possible.
+func (schema *Schema) mapOfSchemasOrStringArraysValue(v *yaml.Node) *[]*NamedSchemaOrStringArray {
+ m := make([]*NamedSchemaOrStringArray, 0)
+ switch v.Kind {
+ case yaml.MappingNode:
+ for i := 0; i < len(v.Content); i += 2 {
+ k2 := v.Content[i].Value
+ v2 := v.Content[i+1]
+ switch v2.Kind {
+ case yaml.SequenceNode:
+ a := make([]string, 0)
+ for _, v3 := range v2.Content {
+ switch v3.Kind {
+ case yaml.ScalarNode:
+ a = append(a, v3.Value)
+ default:
+ fmt.Printf("mapOfSchemasOrStringArraysValue: unexpected node %+v\n", v3)
+ }
+ }
+ s := &SchemaOrStringArray{}
+ s.StringArray = &a
+ pair := &NamedSchemaOrStringArray{Name: k2, Value: s}
+ m = append(m, pair)
+ default:
+ fmt.Printf("mapOfSchemasOrStringArraysValue: unexpected node %+v\n", v2)
+ }
+ }
+ default:
+ fmt.Printf("mapOfSchemasOrStringArraysValue: unexpected node %+v\n", v)
+ }
+ return &m
+}
+
+// Gets a schema or a boolean value from an interface{} value if possible.
+func (schema *Schema) schemaOrBooleanValue(v *yaml.Node) *SchemaOrBoolean {
+ schemaOrBoolean := &SchemaOrBoolean{}
+ switch v.Kind {
+ case yaml.ScalarNode:
+ v2, _ := strconv.ParseBool(v.Value)
+ schemaOrBoolean.Boolean = &v2
+ case yaml.MappingNode:
+ schemaOrBoolean.Schema = NewSchemaFromObject(v)
+ default:
+ fmt.Printf("schemaOrBooleanValue: unexpected node %+v\n", v)
+ }
+ return schemaOrBoolean
+}
diff --git a/vendor/github.com/google/gnostic-models/jsonschema/schema.json b/vendor/github.com/google/gnostic-models/jsonschema/schema.json
new file mode 100644
index 000000000..85eb502a6
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/jsonschema/schema.json
@@ -0,0 +1,150 @@
+{
+ "id": "http://json-schema.org/draft-04/schema#",
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "description": "Core schema meta-schema",
+ "definitions": {
+ "schemaArray": {
+ "type": "array",
+ "minItems": 1,
+ "items": { "$ref": "#" }
+ },
+ "positiveInteger": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "positiveIntegerDefault0": {
+ "allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ]
+ },
+ "simpleTypes": {
+ "enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ]
+ },
+ "stringArray": {
+ "type": "array",
+ "items": { "type": "string" },
+ "minItems": 1,
+ "uniqueItems": true
+ }
+ },
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string",
+ "format": "uri"
+ },
+ "$schema": {
+ "type": "string",
+ "format": "uri"
+ },
+ "title": {
+ "type": "string"
+ },
+ "description": {
+ "type": "string"
+ },
+ "default": {},
+ "multipleOf": {
+ "type": "number",
+ "minimum": 0,
+ "exclusiveMinimum": true
+ },
+ "maximum": {
+ "type": "number"
+ },
+ "exclusiveMaximum": {
+ "type": "boolean",
+ "default": false
+ },
+ "minimum": {
+ "type": "number"
+ },
+ "exclusiveMinimum": {
+ "type": "boolean",
+ "default": false
+ },
+ "maxLength": { "$ref": "#/definitions/positiveInteger" },
+ "minLength": { "$ref": "#/definitions/positiveIntegerDefault0" },
+ "pattern": {
+ "type": "string",
+ "format": "regex"
+ },
+ "additionalItems": {
+ "anyOf": [
+ { "type": "boolean" },
+ { "$ref": "#" }
+ ],
+ "default": {}
+ },
+ "items": {
+ "anyOf": [
+ { "$ref": "#" },
+ { "$ref": "#/definitions/schemaArray" }
+ ],
+ "default": {}
+ },
+ "maxItems": { "$ref": "#/definitions/positiveInteger" },
+ "minItems": { "$ref": "#/definitions/positiveIntegerDefault0" },
+ "uniqueItems": {
+ "type": "boolean",
+ "default": false
+ },
+ "maxProperties": { "$ref": "#/definitions/positiveInteger" },
+ "minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" },
+ "required": { "$ref": "#/definitions/stringArray" },
+ "additionalProperties": {
+ "anyOf": [
+ { "type": "boolean" },
+ { "$ref": "#" }
+ ],
+ "default": {}
+ },
+ "definitions": {
+ "type": "object",
+ "additionalProperties": { "$ref": "#" },
+ "default": {}
+ },
+ "properties": {
+ "type": "object",
+ "additionalProperties": { "$ref": "#" },
+ "default": {}
+ },
+ "patternProperties": {
+ "type": "object",
+ "additionalProperties": { "$ref": "#" },
+ "default": {}
+ },
+ "dependencies": {
+ "type": "object",
+ "additionalProperties": {
+ "anyOf": [
+ { "$ref": "#" },
+ { "$ref": "#/definitions/stringArray" }
+ ]
+ }
+ },
+ "enum": {
+ "type": "array",
+ "minItems": 1,
+ "uniqueItems": true
+ },
+ "type": {
+ "anyOf": [
+ { "$ref": "#/definitions/simpleTypes" },
+ {
+ "type": "array",
+ "items": { "$ref": "#/definitions/simpleTypes" },
+ "minItems": 1,
+ "uniqueItems": true
+ }
+ ]
+ },
+ "allOf": { "$ref": "#/definitions/schemaArray" },
+ "anyOf": { "$ref": "#/definitions/schemaArray" },
+ "oneOf": { "$ref": "#/definitions/schemaArray" },
+ "not": { "$ref": "#" }
+ },
+ "dependencies": {
+ "exclusiveMaximum": [ "maximum" ],
+ "exclusiveMinimum": [ "minimum" ]
+ },
+ "default": {}
+}
diff --git a/vendor/github.com/google/gnostic-models/jsonschema/writer.go b/vendor/github.com/google/gnostic-models/jsonschema/writer.go
new file mode 100644
index 000000000..340dc5f93
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/jsonschema/writer.go
@@ -0,0 +1,369 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package jsonschema
+
+import (
+ "fmt"
+
+ "gopkg.in/yaml.v3"
+)
+
+const indentation = " "
+
+func renderMappingNode(node *yaml.Node, indent string) (result string) {
+ result = "{\n"
+ innerIndent := indent + indentation
+ for i := 0; i < len(node.Content); i += 2 {
+ // first print the key
+ key := node.Content[i].Value
+ result += fmt.Sprintf("%s\"%+v\": ", innerIndent, key)
+ // then the value
+ value := node.Content[i+1]
+ switch value.Kind {
+ case yaml.ScalarNode:
+ result += "\"" + value.Value + "\""
+ case yaml.MappingNode:
+ result += renderMappingNode(value, innerIndent)
+ case yaml.SequenceNode:
+ result += renderSequenceNode(value, innerIndent)
+ default:
+ result += fmt.Sprintf("???MapItem(Key:%+v, Value:%T)", value, value)
+ }
+ if i < len(node.Content)-2 {
+ result += ","
+ }
+ result += "\n"
+ }
+
+ result += indent + "}"
+ return result
+}
+
+func renderSequenceNode(node *yaml.Node, indent string) (result string) {
+ result = "[\n"
+ innerIndent := indent + indentation
+ for i := 0; i < len(node.Content); i++ {
+ item := node.Content[i]
+ switch item.Kind {
+ case yaml.ScalarNode:
+ result += innerIndent + "\"" + item.Value + "\""
+ case yaml.MappingNode:
+ result += innerIndent + renderMappingNode(item, innerIndent) + ""
+ default:
+ result += innerIndent + fmt.Sprintf("???ArrayItem(%+v)", item)
+ }
+ if i < len(node.Content)-1 {
+ result += ","
+ }
+ result += "\n"
+ }
+ result += indent + "]"
+ return result
+}
+
+func renderStringArray(array []string, indent string) (result string) {
+ result = "[\n"
+ innerIndent := indent + indentation
+ for i, item := range array {
+ result += innerIndent + "\"" + item + "\""
+ if i < len(array)-1 {
+ result += ","
+ }
+ result += "\n"
+ }
+ result += indent + "]"
+ return result
+}
+
+// Render renders a yaml.Node as JSON
+func Render(node *yaml.Node) string {
+ if node.Kind == yaml.DocumentNode {
+ if len(node.Content) == 1 {
+ return Render(node.Content[0])
+ }
+ } else if node.Kind == yaml.MappingNode {
+ return renderMappingNode(node, "") + "\n"
+ } else if node.Kind == yaml.SequenceNode {
+ return renderSequenceNode(node, "") + "\n"
+ }
+ return ""
+}
+
+func (object *SchemaNumber) nodeValue() *yaml.Node {
+ if object.Integer != nil {
+ return nodeForInt64(*object.Integer)
+ } else if object.Float != nil {
+ return nodeForFloat64(*object.Float)
+ } else {
+ return nil
+ }
+}
+
+func (object *SchemaOrBoolean) nodeValue() *yaml.Node {
+ if object.Schema != nil {
+ return object.Schema.nodeValue()
+ } else if object.Boolean != nil {
+ return nodeForBoolean(*object.Boolean)
+ } else {
+ return nil
+ }
+}
+
+func nodeForStringArray(array []string) *yaml.Node {
+ content := make([]*yaml.Node, 0)
+ for _, item := range array {
+ content = append(content, nodeForString(item))
+ }
+ return nodeForSequence(content)
+}
+
+func nodeForSchemaArray(array []*Schema) *yaml.Node {
+ content := make([]*yaml.Node, 0)
+ for _, item := range array {
+ content = append(content, item.nodeValue())
+ }
+ return nodeForSequence(content)
+}
+
+func (object *StringOrStringArray) nodeValue() *yaml.Node {
+ if object.String != nil {
+ return nodeForString(*object.String)
+ } else if object.StringArray != nil {
+ return nodeForStringArray(*(object.StringArray))
+ } else {
+ return nil
+ }
+}
+
+func (object *SchemaOrStringArray) nodeValue() *yaml.Node {
+ if object.Schema != nil {
+ return object.Schema.nodeValue()
+ } else if object.StringArray != nil {
+ return nodeForStringArray(*(object.StringArray))
+ } else {
+ return nil
+ }
+}
+
+func (object *SchemaOrSchemaArray) nodeValue() *yaml.Node {
+ if object.Schema != nil {
+ return object.Schema.nodeValue()
+ } else if object.SchemaArray != nil {
+ return nodeForSchemaArray(*(object.SchemaArray))
+ } else {
+ return nil
+ }
+}
+
+func (object *SchemaEnumValue) nodeValue() *yaml.Node {
+ if object.String != nil {
+ return nodeForString(*object.String)
+ } else if object.Bool != nil {
+ return nodeForBoolean(*object.Bool)
+ } else {
+ return nil
+ }
+}
+
+func nodeForNamedSchemaArray(array *[]*NamedSchema) *yaml.Node {
+ content := make([]*yaml.Node, 0)
+ for _, pair := range *(array) {
+ content = appendPair(content, pair.Name, pair.Value.nodeValue())
+ }
+ return nodeForMapping(content)
+}
+
+func nodeForNamedSchemaOrStringArray(array *[]*NamedSchemaOrStringArray) *yaml.Node {
+ content := make([]*yaml.Node, 0)
+ for _, pair := range *(array) {
+ content = appendPair(content, pair.Name, pair.Value.nodeValue())
+ }
+ return nodeForMapping(content)
+}
+
+func nodeForSchemaEnumArray(array *[]SchemaEnumValue) *yaml.Node {
+ content := make([]*yaml.Node, 0)
+ for _, item := range *array {
+ content = append(content, item.nodeValue())
+ }
+ return nodeForSequence(content)
+}
+
+func nodeForMapping(content []*yaml.Node) *yaml.Node {
+ return &yaml.Node{
+ Kind: yaml.MappingNode,
+ Content: content,
+ }
+}
+
+func nodeForSequence(content []*yaml.Node) *yaml.Node {
+ return &yaml.Node{
+ Kind: yaml.SequenceNode,
+ Content: content,
+ }
+}
+
+func nodeForString(value string) *yaml.Node {
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: "!!str",
+ Value: value,
+ }
+}
+
+func nodeForBoolean(value bool) *yaml.Node {
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: "!!bool",
+ Value: fmt.Sprintf("%t", value),
+ }
+}
+
+func nodeForInt64(value int64) *yaml.Node {
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: "!!int",
+ Value: fmt.Sprintf("%d", value),
+ }
+}
+
+func nodeForFloat64(value float64) *yaml.Node {
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: "!!float",
+ Value: fmt.Sprintf("%f", value),
+ }
+}
+
+func appendPair(nodes []*yaml.Node, name string, value *yaml.Node) []*yaml.Node {
+ nodes = append(nodes, nodeForString(name))
+ nodes = append(nodes, value)
+ return nodes
+}
+
+func (schema *Schema) nodeValue() *yaml.Node {
+ n := &yaml.Node{Kind: yaml.MappingNode}
+ content := make([]*yaml.Node, 0)
+ if schema.Title != nil {
+ content = appendPair(content, "title", nodeForString(*schema.Title))
+ }
+ if schema.ID != nil {
+ content = appendPair(content, "id", nodeForString(*schema.ID))
+ }
+ if schema.Schema != nil {
+ content = appendPair(content, "$schema", nodeForString(*schema.Schema))
+ }
+ if schema.Type != nil {
+ content = appendPair(content, "type", schema.Type.nodeValue())
+ }
+ if schema.Items != nil {
+ content = appendPair(content, "items", schema.Items.nodeValue())
+ }
+ if schema.Description != nil {
+ content = appendPair(content, "description", nodeForString(*schema.Description))
+ }
+ if schema.Required != nil {
+ content = appendPair(content, "required", nodeForStringArray(*schema.Required))
+ }
+ if schema.AdditionalProperties != nil {
+ content = appendPair(content, "additionalProperties", schema.AdditionalProperties.nodeValue())
+ }
+ if schema.PatternProperties != nil {
+ content = appendPair(content, "patternProperties", nodeForNamedSchemaArray(schema.PatternProperties))
+ }
+ if schema.Properties != nil {
+ content = appendPair(content, "properties", nodeForNamedSchemaArray(schema.Properties))
+ }
+ if schema.Dependencies != nil {
+ content = appendPair(content, "dependencies", nodeForNamedSchemaOrStringArray(schema.Dependencies))
+ }
+ if schema.Ref != nil {
+ content = appendPair(content, "$ref", nodeForString(*schema.Ref))
+ }
+ if schema.MultipleOf != nil {
+ content = appendPair(content, "multipleOf", schema.MultipleOf.nodeValue())
+ }
+ if schema.Maximum != nil {
+ content = appendPair(content, "maximum", schema.Maximum.nodeValue())
+ }
+ if schema.ExclusiveMaximum != nil {
+ content = appendPair(content, "exclusiveMaximum", nodeForBoolean(*schema.ExclusiveMaximum))
+ }
+ if schema.Minimum != nil {
+ content = appendPair(content, "minimum", schema.Minimum.nodeValue())
+ }
+ if schema.ExclusiveMinimum != nil {
+ content = appendPair(content, "exclusiveMinimum", nodeForBoolean(*schema.ExclusiveMinimum))
+ }
+ if schema.MaxLength != nil {
+ content = appendPair(content, "maxLength", nodeForInt64(*schema.MaxLength))
+ }
+ if schema.MinLength != nil {
+ content = appendPair(content, "minLength", nodeForInt64(*schema.MinLength))
+ }
+ if schema.Pattern != nil {
+ content = appendPair(content, "pattern", nodeForString(*schema.Pattern))
+ }
+ if schema.AdditionalItems != nil {
+ content = appendPair(content, "additionalItems", schema.AdditionalItems.nodeValue())
+ }
+ if schema.MaxItems != nil {
+ content = appendPair(content, "maxItems", nodeForInt64(*schema.MaxItems))
+ }
+ if schema.MinItems != nil {
+ content = appendPair(content, "minItems", nodeForInt64(*schema.MinItems))
+ }
+ if schema.UniqueItems != nil {
+ content = appendPair(content, "uniqueItems", nodeForBoolean(*schema.UniqueItems))
+ }
+ if schema.MaxProperties != nil {
+ content = appendPair(content, "maxProperties", nodeForInt64(*schema.MaxProperties))
+ }
+ if schema.MinProperties != nil {
+ content = appendPair(content, "minProperties", nodeForInt64(*schema.MinProperties))
+ }
+ if schema.Enumeration != nil {
+ content = appendPair(content, "enum", nodeForSchemaEnumArray(schema.Enumeration))
+ }
+ if schema.AllOf != nil {
+ content = appendPair(content, "allOf", nodeForSchemaArray(*schema.AllOf))
+ }
+ if schema.AnyOf != nil {
+ content = appendPair(content, "anyOf", nodeForSchemaArray(*schema.AnyOf))
+ }
+ if schema.OneOf != nil {
+ content = appendPair(content, "oneOf", nodeForSchemaArray(*schema.OneOf))
+ }
+ if schema.Not != nil {
+ content = appendPair(content, "not", schema.Not.nodeValue())
+ }
+ if schema.Definitions != nil {
+ content = appendPair(content, "definitions", nodeForNamedSchemaArray(schema.Definitions))
+ }
+ if schema.Default != nil {
+ // m = append(m, yaml.MapItem{Key: "default", Value: *schema.Default})
+ }
+ if schema.Format != nil {
+ content = appendPair(content, "format", nodeForString(*schema.Format))
+ }
+ n.Content = content
+ return n
+}
+
+// JSONString returns a json representation of a schema.
+func (schema *Schema) JSONString() string {
+ node := schema.nodeValue()
+ return Render(node)
+}
diff --git a/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.go b/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.go
new file mode 100644
index 000000000..d71fe6d54
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.go
@@ -0,0 +1,8820 @@
+// Copyright 2020 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// THIS FILE IS AUTOMATICALLY GENERATED.
+
+package openapi_v2
+
+import (
+ "fmt"
+ "regexp"
+ "strings"
+
+ "gopkg.in/yaml.v3"
+
+ "github.com/google/gnostic-models/compiler"
+)
+
+// Version returns the package name (and OpenAPI version).
+func Version() string {
+ return "openapi_v2"
+}
+
+// NewAdditionalPropertiesItem creates an object of type AdditionalPropertiesItem if possible, returning an error if not.
+func NewAdditionalPropertiesItem(in *yaml.Node, context *compiler.Context) (*AdditionalPropertiesItem, error) {
+ errors := make([]error, 0)
+ x := &AdditionalPropertiesItem{}
+ matched := false
+ // Schema schema = 1;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewSchema(m, compiler.NewContext("schema", m, context))
+ if matchingError == nil {
+ x.Oneof = &AdditionalPropertiesItem_Schema{Schema: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // bool boolean = 2;
+ boolValue, ok := compiler.BoolForScalarNode(in)
+ if ok {
+ x.Oneof = &AdditionalPropertiesItem_Boolean{Boolean: boolValue}
+ matched = true
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ } else {
+ message := fmt.Sprintf("contains an invalid AdditionalPropertiesItem")
+ err := compiler.NewError(context, message)
+ errors = []error{err}
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewAny creates an object of type Any if possible, returning an error if not.
+func NewAny(in *yaml.Node, context *compiler.Context) (*Any, error) {
+ errors := make([]error, 0)
+ x := &Any{}
+ bytes := compiler.Marshal(in)
+ x.Yaml = string(bytes)
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewApiKeySecurity creates an object of type ApiKeySecurity if possible, returning an error if not.
+func NewApiKeySecurity(in *yaml.Node, context *compiler.Context) (*ApiKeySecurity, error) {
+ errors := make([]error, 0)
+ x := &ApiKeySecurity{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"in", "name", "type"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"description", "in", "name", "type"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string type = 1;
+ v1 := compiler.MapValueForKey(m, "type")
+ if v1 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [apiKey]
+ if ok && !compiler.StringArrayContainsValue([]string{"apiKey"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string name = 2;
+ v2 := compiler.MapValueForKey(m, "name")
+ if v2 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string in = 3;
+ v3 := compiler.MapValueForKey(m, "in")
+ if v3 != nil {
+ x.In, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [header query]
+ if ok && !compiler.StringArrayContainsValue([]string{"header", "query"}, x.In) {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 4;
+ v4 := compiler.MapValueForKey(m, "description")
+ if v4 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 5;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewBasicAuthenticationSecurity creates an object of type BasicAuthenticationSecurity if possible, returning an error if not.
+func NewBasicAuthenticationSecurity(in *yaml.Node, context *compiler.Context) (*BasicAuthenticationSecurity, error) {
+ errors := make([]error, 0)
+ x := &BasicAuthenticationSecurity{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"type"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"description", "type"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string type = 1;
+ v1 := compiler.MapValueForKey(m, "type")
+ if v1 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [basic]
+ if ok && !compiler.StringArrayContainsValue([]string{"basic"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 2;
+ v2 := compiler.MapValueForKey(m, "description")
+ if v2 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 3;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewBodyParameter creates an object of type BodyParameter if possible, returning an error if not.
+func NewBodyParameter(in *yaml.Node, context *compiler.Context) (*BodyParameter, error) {
+ errors := make([]error, 0)
+ x := &BodyParameter{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"in", "name", "schema"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"description", "in", "name", "required", "schema"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string description = 1;
+ v1 := compiler.MapValueForKey(m, "description")
+ if v1 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string name = 2;
+ v2 := compiler.MapValueForKey(m, "name")
+ if v2 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string in = 3;
+ v3 := compiler.MapValueForKey(m, "in")
+ if v3 != nil {
+ x.In, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [body]
+ if ok && !compiler.StringArrayContainsValue([]string{"body"}, x.In) {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool required = 4;
+ v4 := compiler.MapValueForKey(m, "required")
+ if v4 != nil {
+ x.Required, ok = compiler.BoolForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Schema schema = 5;
+ v5 := compiler.MapValueForKey(m, "schema")
+ if v5 != nil {
+ var err error
+ x.Schema, err = NewSchema(v5, compiler.NewContext("schema", v5, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny vendor_extension = 6;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewContact creates an object of type Contact if possible, returning an error if not.
+func NewContact(in *yaml.Node, context *compiler.Context) (*Contact, error) {
+ errors := make([]error, 0)
+ x := &Contact{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"email", "name", "url"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string url = 2;
+ v2 := compiler.MapValueForKey(m, "url")
+ if v2 != nil {
+ x.Url, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string email = 3;
+ v3 := compiler.MapValueForKey(m, "email")
+ if v3 != nil {
+ x.Email, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for email: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 4;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewDefault creates an object of type Default if possible, returning an error if not.
+func NewDefault(in *yaml.Node, context *compiler.Context) (*Default, error) {
+ errors := make([]error, 0)
+ x := &Default{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedAny additional_properties = 1;
+ // MAP: Any
+ x.AdditionalProperties = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewDefinitions creates an object of type Definitions if possible, returning an error if not.
+func NewDefinitions(in *yaml.Node, context *compiler.Context) (*Definitions, error) {
+ errors := make([]error, 0)
+ x := &Definitions{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedSchema additional_properties = 1;
+ // MAP: Schema
+ x.AdditionalProperties = make([]*NamedSchema, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedSchema{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewSchema(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewDocument creates an object of type Document if possible, returning an error if not.
+func NewDocument(in *yaml.Node, context *compiler.Context) (*Document, error) {
+ errors := make([]error, 0)
+ x := &Document{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"info", "paths", "swagger"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"basePath", "consumes", "definitions", "externalDocs", "host", "info", "parameters", "paths", "produces", "responses", "schemes", "security", "securityDefinitions", "swagger", "tags"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string swagger = 1;
+ v1 := compiler.MapValueForKey(m, "swagger")
+ if v1 != nil {
+ x.Swagger, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for swagger: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [2.0]
+ if ok && !compiler.StringArrayContainsValue([]string{"2.0"}, x.Swagger) {
+ message := fmt.Sprintf("has unexpected value for swagger: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Info info = 2;
+ v2 := compiler.MapValueForKey(m, "info")
+ if v2 != nil {
+ var err error
+ x.Info, err = NewInfo(v2, compiler.NewContext("info", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string host = 3;
+ v3 := compiler.MapValueForKey(m, "host")
+ if v3 != nil {
+ x.Host, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for host: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string base_path = 4;
+ v4 := compiler.MapValueForKey(m, "basePath")
+ if v4 != nil {
+ x.BasePath, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for basePath: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated string schemes = 5;
+ v5 := compiler.MapValueForKey(m, "schemes")
+ if v5 != nil {
+ v, ok := compiler.SequenceNodeForNode(v5)
+ if ok {
+ x.Schemes = compiler.StringArrayForSequenceNode(v)
+ } else {
+ message := fmt.Sprintf("has unexpected value for schemes: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [http https ws wss]
+ if ok && !compiler.StringArrayContainsValues([]string{"http", "https", "ws", "wss"}, x.Schemes) {
+ message := fmt.Sprintf("has unexpected value for schemes: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated string consumes = 6;
+ v6 := compiler.MapValueForKey(m, "consumes")
+ if v6 != nil {
+ v, ok := compiler.SequenceNodeForNode(v6)
+ if ok {
+ x.Consumes = compiler.StringArrayForSequenceNode(v)
+ } else {
+ message := fmt.Sprintf("has unexpected value for consumes: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated string produces = 7;
+ v7 := compiler.MapValueForKey(m, "produces")
+ if v7 != nil {
+ v, ok := compiler.SequenceNodeForNode(v7)
+ if ok {
+ x.Produces = compiler.StringArrayForSequenceNode(v)
+ } else {
+ message := fmt.Sprintf("has unexpected value for produces: %s", compiler.Display(v7))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Paths paths = 8;
+ v8 := compiler.MapValueForKey(m, "paths")
+ if v8 != nil {
+ var err error
+ x.Paths, err = NewPaths(v8, compiler.NewContext("paths", v8, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Definitions definitions = 9;
+ v9 := compiler.MapValueForKey(m, "definitions")
+ if v9 != nil {
+ var err error
+ x.Definitions, err = NewDefinitions(v9, compiler.NewContext("definitions", v9, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // ParameterDefinitions parameters = 10;
+ v10 := compiler.MapValueForKey(m, "parameters")
+ if v10 != nil {
+ var err error
+ x.Parameters, err = NewParameterDefinitions(v10, compiler.NewContext("parameters", v10, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // ResponseDefinitions responses = 11;
+ v11 := compiler.MapValueForKey(m, "responses")
+ if v11 != nil {
+ var err error
+ x.Responses, err = NewResponseDefinitions(v11, compiler.NewContext("responses", v11, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated SecurityRequirement security = 12;
+ v12 := compiler.MapValueForKey(m, "security")
+ if v12 != nil {
+ // repeated SecurityRequirement
+ x.Security = make([]*SecurityRequirement, 0)
+ a, ok := compiler.SequenceNodeForNode(v12)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewSecurityRequirement(item, compiler.NewContext("security", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Security = append(x.Security, y)
+ }
+ }
+ }
+ // SecurityDefinitions security_definitions = 13;
+ v13 := compiler.MapValueForKey(m, "securityDefinitions")
+ if v13 != nil {
+ var err error
+ x.SecurityDefinitions, err = NewSecurityDefinitions(v13, compiler.NewContext("securityDefinitions", v13, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated Tag tags = 14;
+ v14 := compiler.MapValueForKey(m, "tags")
+ if v14 != nil {
+ // repeated Tag
+ x.Tags = make([]*Tag, 0)
+ a, ok := compiler.SequenceNodeForNode(v14)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewTag(item, compiler.NewContext("tags", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Tags = append(x.Tags, y)
+ }
+ }
+ }
+ // ExternalDocs external_docs = 15;
+ v15 := compiler.MapValueForKey(m, "externalDocs")
+ if v15 != nil {
+ var err error
+ x.ExternalDocs, err = NewExternalDocs(v15, compiler.NewContext("externalDocs", v15, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny vendor_extension = 16;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewExamples creates an object of type Examples if possible, returning an error if not.
+func NewExamples(in *yaml.Node, context *compiler.Context) (*Examples, error) {
+ errors := make([]error, 0)
+ x := &Examples{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedAny additional_properties = 1;
+ // MAP: Any
+ x.AdditionalProperties = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewExternalDocs creates an object of type ExternalDocs if possible, returning an error if not.
+func NewExternalDocs(in *yaml.Node, context *compiler.Context) (*ExternalDocs, error) {
+ errors := make([]error, 0)
+ x := &ExternalDocs{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"url"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"description", "url"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string description = 1;
+ v1 := compiler.MapValueForKey(m, "description")
+ if v1 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string url = 2;
+ v2 := compiler.MapValueForKey(m, "url")
+ if v2 != nil {
+ x.Url, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 3;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewFileSchema creates an object of type FileSchema if possible, returning an error if not.
+func NewFileSchema(in *yaml.Node, context *compiler.Context) (*FileSchema, error) {
+ errors := make([]error, 0)
+ x := &FileSchema{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"type"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"default", "description", "example", "externalDocs", "format", "readOnly", "required", "title", "type"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string format = 1;
+ v1 := compiler.MapValueForKey(m, "format")
+ if v1 != nil {
+ x.Format, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string title = 2;
+ v2 := compiler.MapValueForKey(m, "title")
+ if v2 != nil {
+ x.Title, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for title: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 3;
+ v3 := compiler.MapValueForKey(m, "description")
+ if v3 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Any default = 4;
+ v4 := compiler.MapValueForKey(m, "default")
+ if v4 != nil {
+ var err error
+ x.Default, err = NewAny(v4, compiler.NewContext("default", v4, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated string required = 5;
+ v5 := compiler.MapValueForKey(m, "required")
+ if v5 != nil {
+ v, ok := compiler.SequenceNodeForNode(v5)
+ if ok {
+ x.Required = compiler.StringArrayForSequenceNode(v)
+ } else {
+ message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string type = 6;
+ v6 := compiler.MapValueForKey(m, "type")
+ if v6 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v6)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [file]
+ if ok && !compiler.StringArrayContainsValue([]string{"file"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool read_only = 7;
+ v7 := compiler.MapValueForKey(m, "readOnly")
+ if v7 != nil {
+ x.ReadOnly, ok = compiler.BoolForScalarNode(v7)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for readOnly: %s", compiler.Display(v7))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // ExternalDocs external_docs = 8;
+ v8 := compiler.MapValueForKey(m, "externalDocs")
+ if v8 != nil {
+ var err error
+ x.ExternalDocs, err = NewExternalDocs(v8, compiler.NewContext("externalDocs", v8, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Any example = 9;
+ v9 := compiler.MapValueForKey(m, "example")
+ if v9 != nil {
+ var err error
+ x.Example, err = NewAny(v9, compiler.NewContext("example", v9, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny vendor_extension = 10;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewFormDataParameterSubSchema creates an object of type FormDataParameterSubSchema if possible, returning an error if not.
+func NewFormDataParameterSubSchema(in *yaml.Node, context *compiler.Context) (*FormDataParameterSubSchema, error) {
+ errors := make([]error, 0)
+ x := &FormDataParameterSubSchema{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"allowEmptyValue", "collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // bool required = 1;
+ v1 := compiler.MapValueForKey(m, "required")
+ if v1 != nil {
+ x.Required, ok = compiler.BoolForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string in = 2;
+ v2 := compiler.MapValueForKey(m, "in")
+ if v2 != nil {
+ x.In, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [formData]
+ if ok && !compiler.StringArrayContainsValue([]string{"formData"}, x.In) {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 3;
+ v3 := compiler.MapValueForKey(m, "description")
+ if v3 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string name = 4;
+ v4 := compiler.MapValueForKey(m, "name")
+ if v4 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool allow_empty_value = 5;
+ v5 := compiler.MapValueForKey(m, "allowEmptyValue")
+ if v5 != nil {
+ x.AllowEmptyValue, ok = compiler.BoolForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for allowEmptyValue: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string type = 6;
+ v6 := compiler.MapValueForKey(m, "type")
+ if v6 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v6)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [string number boolean integer array file]
+ if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "boolean", "integer", "array", "file"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string format = 7;
+ v7 := compiler.MapValueForKey(m, "format")
+ if v7 != nil {
+ x.Format, ok = compiler.StringForScalarNode(v7)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v7))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // PrimitivesItems items = 8;
+ v8 := compiler.MapValueForKey(m, "items")
+ if v8 != nil {
+ var err error
+ x.Items, err = NewPrimitivesItems(v8, compiler.NewContext("items", v8, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string collection_format = 9;
+ v9 := compiler.MapValueForKey(m, "collectionFormat")
+ if v9 != nil {
+ x.CollectionFormat, ok = compiler.StringForScalarNode(v9)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v9))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [csv ssv tsv pipes multi]
+ if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes", "multi"}, x.CollectionFormat) {
+ message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v9))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Any default = 10;
+ v10 := compiler.MapValueForKey(m, "default")
+ if v10 != nil {
+ var err error
+ x.Default, err = NewAny(v10, compiler.NewContext("default", v10, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // float maximum = 11;
+ v11 := compiler.MapValueForKey(m, "maximum")
+ if v11 != nil {
+ v, ok := compiler.FloatForScalarNode(v11)
+ if ok {
+ x.Maximum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v11))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_maximum = 12;
+ v12 := compiler.MapValueForKey(m, "exclusiveMaximum")
+ if v12 != nil {
+ x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v12)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v12))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // float minimum = 13;
+ v13 := compiler.MapValueForKey(m, "minimum")
+ if v13 != nil {
+ v, ok := compiler.FloatForScalarNode(v13)
+ if ok {
+ x.Minimum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v13))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_minimum = 14;
+ v14 := compiler.MapValueForKey(m, "exclusiveMinimum")
+ if v14 != nil {
+ x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v14)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v14))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_length = 15;
+ v15 := compiler.MapValueForKey(m, "maxLength")
+ if v15 != nil {
+ t, ok := compiler.IntForScalarNode(v15)
+ if ok {
+ x.MaxLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v15))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_length = 16;
+ v16 := compiler.MapValueForKey(m, "minLength")
+ if v16 != nil {
+ t, ok := compiler.IntForScalarNode(v16)
+ if ok {
+ x.MinLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v16))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string pattern = 17;
+ v17 := compiler.MapValueForKey(m, "pattern")
+ if v17 != nil {
+ x.Pattern, ok = compiler.StringForScalarNode(v17)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v17))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_items = 18;
+ v18 := compiler.MapValueForKey(m, "maxItems")
+ if v18 != nil {
+ t, ok := compiler.IntForScalarNode(v18)
+ if ok {
+ x.MaxItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v18))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_items = 19;
+ v19 := compiler.MapValueForKey(m, "minItems")
+ if v19 != nil {
+ t, ok := compiler.IntForScalarNode(v19)
+ if ok {
+ x.MinItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v19))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool unique_items = 20;
+ v20 := compiler.MapValueForKey(m, "uniqueItems")
+ if v20 != nil {
+ x.UniqueItems, ok = compiler.BoolForScalarNode(v20)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v20))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated Any enum = 21;
+ v21 := compiler.MapValueForKey(m, "enum")
+ if v21 != nil {
+ // repeated Any
+ x.Enum = make([]*Any, 0)
+ a, ok := compiler.SequenceNodeForNode(v21)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewAny(item, compiler.NewContext("enum", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Enum = append(x.Enum, y)
+ }
+ }
+ }
+ // float multiple_of = 22;
+ v22 := compiler.MapValueForKey(m, "multipleOf")
+ if v22 != nil {
+ v, ok := compiler.FloatForScalarNode(v22)
+ if ok {
+ x.MultipleOf = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v22))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 23;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewHeader creates an object of type Header if possible, returning an error if not.
+func NewHeader(in *yaml.Node, context *compiler.Context) (*Header, error) {
+ errors := make([]error, 0)
+ x := &Header{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"type"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "pattern", "type", "uniqueItems"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string type = 1;
+ v1 := compiler.MapValueForKey(m, "type")
+ if v1 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [string number integer boolean array]
+ if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "integer", "boolean", "array"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string format = 2;
+ v2 := compiler.MapValueForKey(m, "format")
+ if v2 != nil {
+ x.Format, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // PrimitivesItems items = 3;
+ v3 := compiler.MapValueForKey(m, "items")
+ if v3 != nil {
+ var err error
+ x.Items, err = NewPrimitivesItems(v3, compiler.NewContext("items", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string collection_format = 4;
+ v4 := compiler.MapValueForKey(m, "collectionFormat")
+ if v4 != nil {
+ x.CollectionFormat, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [csv ssv tsv pipes]
+ if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes"}, x.CollectionFormat) {
+ message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Any default = 5;
+ v5 := compiler.MapValueForKey(m, "default")
+ if v5 != nil {
+ var err error
+ x.Default, err = NewAny(v5, compiler.NewContext("default", v5, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // float maximum = 6;
+ v6 := compiler.MapValueForKey(m, "maximum")
+ if v6 != nil {
+ v, ok := compiler.FloatForScalarNode(v6)
+ if ok {
+ x.Maximum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_maximum = 7;
+ v7 := compiler.MapValueForKey(m, "exclusiveMaximum")
+ if v7 != nil {
+ x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v7)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v7))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // float minimum = 8;
+ v8 := compiler.MapValueForKey(m, "minimum")
+ if v8 != nil {
+ v, ok := compiler.FloatForScalarNode(v8)
+ if ok {
+ x.Minimum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v8))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_minimum = 9;
+ v9 := compiler.MapValueForKey(m, "exclusiveMinimum")
+ if v9 != nil {
+ x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v9)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v9))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_length = 10;
+ v10 := compiler.MapValueForKey(m, "maxLength")
+ if v10 != nil {
+ t, ok := compiler.IntForScalarNode(v10)
+ if ok {
+ x.MaxLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v10))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_length = 11;
+ v11 := compiler.MapValueForKey(m, "minLength")
+ if v11 != nil {
+ t, ok := compiler.IntForScalarNode(v11)
+ if ok {
+ x.MinLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v11))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string pattern = 12;
+ v12 := compiler.MapValueForKey(m, "pattern")
+ if v12 != nil {
+ x.Pattern, ok = compiler.StringForScalarNode(v12)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v12))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_items = 13;
+ v13 := compiler.MapValueForKey(m, "maxItems")
+ if v13 != nil {
+ t, ok := compiler.IntForScalarNode(v13)
+ if ok {
+ x.MaxItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v13))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_items = 14;
+ v14 := compiler.MapValueForKey(m, "minItems")
+ if v14 != nil {
+ t, ok := compiler.IntForScalarNode(v14)
+ if ok {
+ x.MinItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v14))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool unique_items = 15;
+ v15 := compiler.MapValueForKey(m, "uniqueItems")
+ if v15 != nil {
+ x.UniqueItems, ok = compiler.BoolForScalarNode(v15)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v15))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated Any enum = 16;
+ v16 := compiler.MapValueForKey(m, "enum")
+ if v16 != nil {
+ // repeated Any
+ x.Enum = make([]*Any, 0)
+ a, ok := compiler.SequenceNodeForNode(v16)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewAny(item, compiler.NewContext("enum", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Enum = append(x.Enum, y)
+ }
+ }
+ }
+ // float multiple_of = 17;
+ v17 := compiler.MapValueForKey(m, "multipleOf")
+ if v17 != nil {
+ v, ok := compiler.FloatForScalarNode(v17)
+ if ok {
+ x.MultipleOf = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v17))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 18;
+ v18 := compiler.MapValueForKey(m, "description")
+ if v18 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v18)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v18))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 19;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewHeaderParameterSubSchema creates an object of type HeaderParameterSubSchema if possible, returning an error if not.
+func NewHeaderParameterSubSchema(in *yaml.Node, context *compiler.Context) (*HeaderParameterSubSchema, error) {
+ errors := make([]error, 0)
+ x := &HeaderParameterSubSchema{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // bool required = 1;
+ v1 := compiler.MapValueForKey(m, "required")
+ if v1 != nil {
+ x.Required, ok = compiler.BoolForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string in = 2;
+ v2 := compiler.MapValueForKey(m, "in")
+ if v2 != nil {
+ x.In, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [header]
+ if ok && !compiler.StringArrayContainsValue([]string{"header"}, x.In) {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 3;
+ v3 := compiler.MapValueForKey(m, "description")
+ if v3 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string name = 4;
+ v4 := compiler.MapValueForKey(m, "name")
+ if v4 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string type = 5;
+ v5 := compiler.MapValueForKey(m, "type")
+ if v5 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [string number boolean integer array]
+ if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "boolean", "integer", "array"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string format = 6;
+ v6 := compiler.MapValueForKey(m, "format")
+ if v6 != nil {
+ x.Format, ok = compiler.StringForScalarNode(v6)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // PrimitivesItems items = 7;
+ v7 := compiler.MapValueForKey(m, "items")
+ if v7 != nil {
+ var err error
+ x.Items, err = NewPrimitivesItems(v7, compiler.NewContext("items", v7, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string collection_format = 8;
+ v8 := compiler.MapValueForKey(m, "collectionFormat")
+ if v8 != nil {
+ x.CollectionFormat, ok = compiler.StringForScalarNode(v8)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v8))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [csv ssv tsv pipes]
+ if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes"}, x.CollectionFormat) {
+ message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v8))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Any default = 9;
+ v9 := compiler.MapValueForKey(m, "default")
+ if v9 != nil {
+ var err error
+ x.Default, err = NewAny(v9, compiler.NewContext("default", v9, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // float maximum = 10;
+ v10 := compiler.MapValueForKey(m, "maximum")
+ if v10 != nil {
+ v, ok := compiler.FloatForScalarNode(v10)
+ if ok {
+ x.Maximum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v10))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_maximum = 11;
+ v11 := compiler.MapValueForKey(m, "exclusiveMaximum")
+ if v11 != nil {
+ x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v11)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v11))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // float minimum = 12;
+ v12 := compiler.MapValueForKey(m, "minimum")
+ if v12 != nil {
+ v, ok := compiler.FloatForScalarNode(v12)
+ if ok {
+ x.Minimum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v12))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_minimum = 13;
+ v13 := compiler.MapValueForKey(m, "exclusiveMinimum")
+ if v13 != nil {
+ x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v13)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v13))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_length = 14;
+ v14 := compiler.MapValueForKey(m, "maxLength")
+ if v14 != nil {
+ t, ok := compiler.IntForScalarNode(v14)
+ if ok {
+ x.MaxLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v14))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_length = 15;
+ v15 := compiler.MapValueForKey(m, "minLength")
+ if v15 != nil {
+ t, ok := compiler.IntForScalarNode(v15)
+ if ok {
+ x.MinLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v15))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string pattern = 16;
+ v16 := compiler.MapValueForKey(m, "pattern")
+ if v16 != nil {
+ x.Pattern, ok = compiler.StringForScalarNode(v16)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v16))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_items = 17;
+ v17 := compiler.MapValueForKey(m, "maxItems")
+ if v17 != nil {
+ t, ok := compiler.IntForScalarNode(v17)
+ if ok {
+ x.MaxItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v17))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_items = 18;
+ v18 := compiler.MapValueForKey(m, "minItems")
+ if v18 != nil {
+ t, ok := compiler.IntForScalarNode(v18)
+ if ok {
+ x.MinItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v18))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool unique_items = 19;
+ v19 := compiler.MapValueForKey(m, "uniqueItems")
+ if v19 != nil {
+ x.UniqueItems, ok = compiler.BoolForScalarNode(v19)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v19))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated Any enum = 20;
+ v20 := compiler.MapValueForKey(m, "enum")
+ if v20 != nil {
+ // repeated Any
+ x.Enum = make([]*Any, 0)
+ a, ok := compiler.SequenceNodeForNode(v20)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewAny(item, compiler.NewContext("enum", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Enum = append(x.Enum, y)
+ }
+ }
+ }
+ // float multiple_of = 21;
+ v21 := compiler.MapValueForKey(m, "multipleOf")
+ if v21 != nil {
+ v, ok := compiler.FloatForScalarNode(v21)
+ if ok {
+ x.MultipleOf = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v21))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 22;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewHeaders creates an object of type Headers if possible, returning an error if not.
+func NewHeaders(in *yaml.Node, context *compiler.Context) (*Headers, error) {
+ errors := make([]error, 0)
+ x := &Headers{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedHeader additional_properties = 1;
+ // MAP: Header
+ x.AdditionalProperties = make([]*NamedHeader, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedHeader{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewHeader(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewInfo creates an object of type Info if possible, returning an error if not.
+func NewInfo(in *yaml.Node, context *compiler.Context) (*Info, error) {
+ errors := make([]error, 0)
+ x := &Info{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"title", "version"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"contact", "description", "license", "termsOfService", "title", "version"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string title = 1;
+ v1 := compiler.MapValueForKey(m, "title")
+ if v1 != nil {
+ x.Title, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for title: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string version = 2;
+ v2 := compiler.MapValueForKey(m, "version")
+ if v2 != nil {
+ x.Version, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for version: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 3;
+ v3 := compiler.MapValueForKey(m, "description")
+ if v3 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string terms_of_service = 4;
+ v4 := compiler.MapValueForKey(m, "termsOfService")
+ if v4 != nil {
+ x.TermsOfService, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for termsOfService: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Contact contact = 5;
+ v5 := compiler.MapValueForKey(m, "contact")
+ if v5 != nil {
+ var err error
+ x.Contact, err = NewContact(v5, compiler.NewContext("contact", v5, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // License license = 6;
+ v6 := compiler.MapValueForKey(m, "license")
+ if v6 != nil {
+ var err error
+ x.License, err = NewLicense(v6, compiler.NewContext("license", v6, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny vendor_extension = 7;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewItemsItem creates an object of type ItemsItem if possible, returning an error if not.
+func NewItemsItem(in *yaml.Node, context *compiler.Context) (*ItemsItem, error) {
+ errors := make([]error, 0)
+ x := &ItemsItem{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for item array: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ x.Schema = make([]*Schema, 0)
+ y, err := NewSchema(m, compiler.NewContext("", m, context))
+ if err != nil {
+ return nil, err
+ }
+ x.Schema = append(x.Schema, y)
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewJsonReference creates an object of type JsonReference if possible, returning an error if not.
+func NewJsonReference(in *yaml.Node, context *compiler.Context) (*JsonReference, error) {
+ errors := make([]error, 0)
+ x := &JsonReference{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"$ref"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string _ref = 1;
+ v1 := compiler.MapValueForKey(m, "$ref")
+ if v1 != nil {
+ x.XRef, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for $ref: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 2;
+ v2 := compiler.MapValueForKey(m, "description")
+ if v2 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewLicense creates an object of type License if possible, returning an error if not.
+func NewLicense(in *yaml.Node, context *compiler.Context) (*License, error) {
+ errors := make([]error, 0)
+ x := &License{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"name"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"name", "url"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string url = 2;
+ v2 := compiler.MapValueForKey(m, "url")
+ if v2 != nil {
+ x.Url, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 3;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedAny creates an object of type NamedAny if possible, returning an error if not.
+func NewNamedAny(in *yaml.Node, context *compiler.Context) (*NamedAny, error) {
+ errors := make([]error, 0)
+ x := &NamedAny{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Any value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewAny(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedHeader creates an object of type NamedHeader if possible, returning an error if not.
+func NewNamedHeader(in *yaml.Node, context *compiler.Context) (*NamedHeader, error) {
+ errors := make([]error, 0)
+ x := &NamedHeader{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Header value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewHeader(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedParameter creates an object of type NamedParameter if possible, returning an error if not.
+func NewNamedParameter(in *yaml.Node, context *compiler.Context) (*NamedParameter, error) {
+ errors := make([]error, 0)
+ x := &NamedParameter{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Parameter value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewParameter(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedPathItem creates an object of type NamedPathItem if possible, returning an error if not.
+func NewNamedPathItem(in *yaml.Node, context *compiler.Context) (*NamedPathItem, error) {
+ errors := make([]error, 0)
+ x := &NamedPathItem{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // PathItem value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewPathItem(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedResponse creates an object of type NamedResponse if possible, returning an error if not.
+func NewNamedResponse(in *yaml.Node, context *compiler.Context) (*NamedResponse, error) {
+ errors := make([]error, 0)
+ x := &NamedResponse{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Response value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewResponse(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedResponseValue creates an object of type NamedResponseValue if possible, returning an error if not.
+func NewNamedResponseValue(in *yaml.Node, context *compiler.Context) (*NamedResponseValue, error) {
+ errors := make([]error, 0)
+ x := &NamedResponseValue{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // ResponseValue value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewResponseValue(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedSchema creates an object of type NamedSchema if possible, returning an error if not.
+func NewNamedSchema(in *yaml.Node, context *compiler.Context) (*NamedSchema, error) {
+ errors := make([]error, 0)
+ x := &NamedSchema{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Schema value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewSchema(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedSecurityDefinitionsItem creates an object of type NamedSecurityDefinitionsItem if possible, returning an error if not.
+func NewNamedSecurityDefinitionsItem(in *yaml.Node, context *compiler.Context) (*NamedSecurityDefinitionsItem, error) {
+ errors := make([]error, 0)
+ x := &NamedSecurityDefinitionsItem{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // SecurityDefinitionsItem value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewSecurityDefinitionsItem(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedString creates an object of type NamedString if possible, returning an error if not.
+func NewNamedString(in *yaml.Node, context *compiler.Context) (*NamedString, error) {
+ errors := make([]error, 0)
+ x := &NamedString{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ x.Value, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for value: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedStringArray creates an object of type NamedStringArray if possible, returning an error if not.
+func NewNamedStringArray(in *yaml.Node, context *compiler.Context) (*NamedStringArray, error) {
+ errors := make([]error, 0)
+ x := &NamedStringArray{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // StringArray value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewStringArray(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNonBodyParameter creates an object of type NonBodyParameter if possible, returning an error if not.
+func NewNonBodyParameter(in *yaml.Node, context *compiler.Context) (*NonBodyParameter, error) {
+ errors := make([]error, 0)
+ x := &NonBodyParameter{}
+ matched := false
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"in", "name", "type"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // HeaderParameterSubSchema header_parameter_sub_schema = 1;
+ {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewHeaderParameterSubSchema(m, compiler.NewContext("headerParameterSubSchema", m, context))
+ if matchingError == nil {
+ x.Oneof = &NonBodyParameter_HeaderParameterSubSchema{HeaderParameterSubSchema: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ // FormDataParameterSubSchema form_data_parameter_sub_schema = 2;
+ {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewFormDataParameterSubSchema(m, compiler.NewContext("formDataParameterSubSchema", m, context))
+ if matchingError == nil {
+ x.Oneof = &NonBodyParameter_FormDataParameterSubSchema{FormDataParameterSubSchema: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ // QueryParameterSubSchema query_parameter_sub_schema = 3;
+ {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewQueryParameterSubSchema(m, compiler.NewContext("queryParameterSubSchema", m, context))
+ if matchingError == nil {
+ x.Oneof = &NonBodyParameter_QueryParameterSubSchema{QueryParameterSubSchema: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ // PathParameterSubSchema path_parameter_sub_schema = 4;
+ {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewPathParameterSubSchema(m, compiler.NewContext("pathParameterSubSchema", m, context))
+ if matchingError == nil {
+ x.Oneof = &NonBodyParameter_PathParameterSubSchema{PathParameterSubSchema: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ } else {
+ message := fmt.Sprintf("contains an invalid NonBodyParameter")
+ err := compiler.NewError(context, message)
+ errors = []error{err}
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewOauth2AccessCodeSecurity creates an object of type Oauth2AccessCodeSecurity if possible, returning an error if not.
+func NewOauth2AccessCodeSecurity(in *yaml.Node, context *compiler.Context) (*Oauth2AccessCodeSecurity, error) {
+ errors := make([]error, 0)
+ x := &Oauth2AccessCodeSecurity{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"authorizationUrl", "flow", "tokenUrl", "type"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"authorizationUrl", "description", "flow", "scopes", "tokenUrl", "type"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string type = 1;
+ v1 := compiler.MapValueForKey(m, "type")
+ if v1 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [oauth2]
+ if ok && !compiler.StringArrayContainsValue([]string{"oauth2"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string flow = 2;
+ v2 := compiler.MapValueForKey(m, "flow")
+ if v2 != nil {
+ x.Flow, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [accessCode]
+ if ok && !compiler.StringArrayContainsValue([]string{"accessCode"}, x.Flow) {
+ message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Oauth2Scopes scopes = 3;
+ v3 := compiler.MapValueForKey(m, "scopes")
+ if v3 != nil {
+ var err error
+ x.Scopes, err = NewOauth2Scopes(v3, compiler.NewContext("scopes", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string authorization_url = 4;
+ v4 := compiler.MapValueForKey(m, "authorizationUrl")
+ if v4 != nil {
+ x.AuthorizationUrl, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for authorizationUrl: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string token_url = 5;
+ v5 := compiler.MapValueForKey(m, "tokenUrl")
+ if v5 != nil {
+ x.TokenUrl, ok = compiler.StringForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for tokenUrl: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 6;
+ v6 := compiler.MapValueForKey(m, "description")
+ if v6 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v6)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 7;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewOauth2ApplicationSecurity creates an object of type Oauth2ApplicationSecurity if possible, returning an error if not.
+func NewOauth2ApplicationSecurity(in *yaml.Node, context *compiler.Context) (*Oauth2ApplicationSecurity, error) {
+ errors := make([]error, 0)
+ x := &Oauth2ApplicationSecurity{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"flow", "tokenUrl", "type"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"description", "flow", "scopes", "tokenUrl", "type"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string type = 1;
+ v1 := compiler.MapValueForKey(m, "type")
+ if v1 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [oauth2]
+ if ok && !compiler.StringArrayContainsValue([]string{"oauth2"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string flow = 2;
+ v2 := compiler.MapValueForKey(m, "flow")
+ if v2 != nil {
+ x.Flow, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [application]
+ if ok && !compiler.StringArrayContainsValue([]string{"application"}, x.Flow) {
+ message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Oauth2Scopes scopes = 3;
+ v3 := compiler.MapValueForKey(m, "scopes")
+ if v3 != nil {
+ var err error
+ x.Scopes, err = NewOauth2Scopes(v3, compiler.NewContext("scopes", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string token_url = 4;
+ v4 := compiler.MapValueForKey(m, "tokenUrl")
+ if v4 != nil {
+ x.TokenUrl, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for tokenUrl: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 5;
+ v5 := compiler.MapValueForKey(m, "description")
+ if v5 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 6;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewOauth2ImplicitSecurity creates an object of type Oauth2ImplicitSecurity if possible, returning an error if not.
+func NewOauth2ImplicitSecurity(in *yaml.Node, context *compiler.Context) (*Oauth2ImplicitSecurity, error) {
+ errors := make([]error, 0)
+ x := &Oauth2ImplicitSecurity{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"authorizationUrl", "flow", "type"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"authorizationUrl", "description", "flow", "scopes", "type"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string type = 1;
+ v1 := compiler.MapValueForKey(m, "type")
+ if v1 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [oauth2]
+ if ok && !compiler.StringArrayContainsValue([]string{"oauth2"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string flow = 2;
+ v2 := compiler.MapValueForKey(m, "flow")
+ if v2 != nil {
+ x.Flow, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [implicit]
+ if ok && !compiler.StringArrayContainsValue([]string{"implicit"}, x.Flow) {
+ message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Oauth2Scopes scopes = 3;
+ v3 := compiler.MapValueForKey(m, "scopes")
+ if v3 != nil {
+ var err error
+ x.Scopes, err = NewOauth2Scopes(v3, compiler.NewContext("scopes", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string authorization_url = 4;
+ v4 := compiler.MapValueForKey(m, "authorizationUrl")
+ if v4 != nil {
+ x.AuthorizationUrl, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for authorizationUrl: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 5;
+ v5 := compiler.MapValueForKey(m, "description")
+ if v5 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 6;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewOauth2PasswordSecurity creates an object of type Oauth2PasswordSecurity if possible, returning an error if not.
+func NewOauth2PasswordSecurity(in *yaml.Node, context *compiler.Context) (*Oauth2PasswordSecurity, error) {
+ errors := make([]error, 0)
+ x := &Oauth2PasswordSecurity{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"flow", "tokenUrl", "type"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"description", "flow", "scopes", "tokenUrl", "type"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string type = 1;
+ v1 := compiler.MapValueForKey(m, "type")
+ if v1 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [oauth2]
+ if ok && !compiler.StringArrayContainsValue([]string{"oauth2"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string flow = 2;
+ v2 := compiler.MapValueForKey(m, "flow")
+ if v2 != nil {
+ x.Flow, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [password]
+ if ok && !compiler.StringArrayContainsValue([]string{"password"}, x.Flow) {
+ message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Oauth2Scopes scopes = 3;
+ v3 := compiler.MapValueForKey(m, "scopes")
+ if v3 != nil {
+ var err error
+ x.Scopes, err = NewOauth2Scopes(v3, compiler.NewContext("scopes", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string token_url = 4;
+ v4 := compiler.MapValueForKey(m, "tokenUrl")
+ if v4 != nil {
+ x.TokenUrl, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for tokenUrl: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 5;
+ v5 := compiler.MapValueForKey(m, "description")
+ if v5 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 6;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewOauth2Scopes creates an object of type Oauth2Scopes if possible, returning an error if not.
+func NewOauth2Scopes(in *yaml.Node, context *compiler.Context) (*Oauth2Scopes, error) {
+ errors := make([]error, 0)
+ x := &Oauth2Scopes{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedString additional_properties = 1;
+ // MAP: string
+ x.AdditionalProperties = make([]*NamedString, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedString{}
+ pair.Name = k
+ pair.Value, _ = compiler.StringForScalarNode(v)
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewOperation creates an object of type Operation if possible, returning an error if not.
+func NewOperation(in *yaml.Node, context *compiler.Context) (*Operation, error) {
+ errors := make([]error, 0)
+ x := &Operation{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"responses"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"consumes", "deprecated", "description", "externalDocs", "operationId", "parameters", "produces", "responses", "schemes", "security", "summary", "tags"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // repeated string tags = 1;
+ v1 := compiler.MapValueForKey(m, "tags")
+ if v1 != nil {
+ v, ok := compiler.SequenceNodeForNode(v1)
+ if ok {
+ x.Tags = compiler.StringArrayForSequenceNode(v)
+ } else {
+ message := fmt.Sprintf("has unexpected value for tags: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string summary = 2;
+ v2 := compiler.MapValueForKey(m, "summary")
+ if v2 != nil {
+ x.Summary, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for summary: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 3;
+ v3 := compiler.MapValueForKey(m, "description")
+ if v3 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // ExternalDocs external_docs = 4;
+ v4 := compiler.MapValueForKey(m, "externalDocs")
+ if v4 != nil {
+ var err error
+ x.ExternalDocs, err = NewExternalDocs(v4, compiler.NewContext("externalDocs", v4, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string operation_id = 5;
+ v5 := compiler.MapValueForKey(m, "operationId")
+ if v5 != nil {
+ x.OperationId, ok = compiler.StringForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for operationId: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated string produces = 6;
+ v6 := compiler.MapValueForKey(m, "produces")
+ if v6 != nil {
+ v, ok := compiler.SequenceNodeForNode(v6)
+ if ok {
+ x.Produces = compiler.StringArrayForSequenceNode(v)
+ } else {
+ message := fmt.Sprintf("has unexpected value for produces: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated string consumes = 7;
+ v7 := compiler.MapValueForKey(m, "consumes")
+ if v7 != nil {
+ v, ok := compiler.SequenceNodeForNode(v7)
+ if ok {
+ x.Consumes = compiler.StringArrayForSequenceNode(v)
+ } else {
+ message := fmt.Sprintf("has unexpected value for consumes: %s", compiler.Display(v7))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated ParametersItem parameters = 8;
+ v8 := compiler.MapValueForKey(m, "parameters")
+ if v8 != nil {
+ // repeated ParametersItem
+ x.Parameters = make([]*ParametersItem, 0)
+ a, ok := compiler.SequenceNodeForNode(v8)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewParametersItem(item, compiler.NewContext("parameters", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Parameters = append(x.Parameters, y)
+ }
+ }
+ }
+ // Responses responses = 9;
+ v9 := compiler.MapValueForKey(m, "responses")
+ if v9 != nil {
+ var err error
+ x.Responses, err = NewResponses(v9, compiler.NewContext("responses", v9, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated string schemes = 10;
+ v10 := compiler.MapValueForKey(m, "schemes")
+ if v10 != nil {
+ v, ok := compiler.SequenceNodeForNode(v10)
+ if ok {
+ x.Schemes = compiler.StringArrayForSequenceNode(v)
+ } else {
+ message := fmt.Sprintf("has unexpected value for schemes: %s", compiler.Display(v10))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [http https ws wss]
+ if ok && !compiler.StringArrayContainsValues([]string{"http", "https", "ws", "wss"}, x.Schemes) {
+ message := fmt.Sprintf("has unexpected value for schemes: %s", compiler.Display(v10))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool deprecated = 11;
+ v11 := compiler.MapValueForKey(m, "deprecated")
+ if v11 != nil {
+ x.Deprecated, ok = compiler.BoolForScalarNode(v11)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for deprecated: %s", compiler.Display(v11))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated SecurityRequirement security = 12;
+ v12 := compiler.MapValueForKey(m, "security")
+ if v12 != nil {
+ // repeated SecurityRequirement
+ x.Security = make([]*SecurityRequirement, 0)
+ a, ok := compiler.SequenceNodeForNode(v12)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewSecurityRequirement(item, compiler.NewContext("security", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Security = append(x.Security, y)
+ }
+ }
+ }
+ // repeated NamedAny vendor_extension = 13;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewParameter creates an object of type Parameter if possible, returning an error if not.
+func NewParameter(in *yaml.Node, context *compiler.Context) (*Parameter, error) {
+ errors := make([]error, 0)
+ x := &Parameter{}
+ matched := false
+ // BodyParameter body_parameter = 1;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewBodyParameter(m, compiler.NewContext("bodyParameter", m, context))
+ if matchingError == nil {
+ x.Oneof = &Parameter_BodyParameter{BodyParameter: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // NonBodyParameter non_body_parameter = 2;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewNonBodyParameter(m, compiler.NewContext("nonBodyParameter", m, context))
+ if matchingError == nil {
+ x.Oneof = &Parameter_NonBodyParameter{NonBodyParameter: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ } else {
+ message := fmt.Sprintf("contains an invalid Parameter")
+ err := compiler.NewError(context, message)
+ errors = []error{err}
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewParameterDefinitions creates an object of type ParameterDefinitions if possible, returning an error if not.
+func NewParameterDefinitions(in *yaml.Node, context *compiler.Context) (*ParameterDefinitions, error) {
+ errors := make([]error, 0)
+ x := &ParameterDefinitions{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedParameter additional_properties = 1;
+ // MAP: Parameter
+ x.AdditionalProperties = make([]*NamedParameter, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedParameter{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewParameter(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewParametersItem creates an object of type ParametersItem if possible, returning an error if not.
+func NewParametersItem(in *yaml.Node, context *compiler.Context) (*ParametersItem, error) {
+ errors := make([]error, 0)
+ x := &ParametersItem{}
+ matched := false
+ // Parameter parameter = 1;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewParameter(m, compiler.NewContext("parameter", m, context))
+ if matchingError == nil {
+ x.Oneof = &ParametersItem_Parameter{Parameter: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // JsonReference json_reference = 2;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewJsonReference(m, compiler.NewContext("jsonReference", m, context))
+ if matchingError == nil {
+ x.Oneof = &ParametersItem_JsonReference{JsonReference: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ } else {
+ message := fmt.Sprintf("contains an invalid ParametersItem")
+ err := compiler.NewError(context, message)
+ errors = []error{err}
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewPathItem creates an object of type PathItem if possible, returning an error if not.
+func NewPathItem(in *yaml.Node, context *compiler.Context) (*PathItem, error) {
+ errors := make([]error, 0)
+ x := &PathItem{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"$ref", "delete", "get", "head", "options", "parameters", "patch", "post", "put"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string _ref = 1;
+ v1 := compiler.MapValueForKey(m, "$ref")
+ if v1 != nil {
+ x.XRef, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for $ref: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Operation get = 2;
+ v2 := compiler.MapValueForKey(m, "get")
+ if v2 != nil {
+ var err error
+ x.Get, err = NewOperation(v2, compiler.NewContext("get", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Operation put = 3;
+ v3 := compiler.MapValueForKey(m, "put")
+ if v3 != nil {
+ var err error
+ x.Put, err = NewOperation(v3, compiler.NewContext("put", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Operation post = 4;
+ v4 := compiler.MapValueForKey(m, "post")
+ if v4 != nil {
+ var err error
+ x.Post, err = NewOperation(v4, compiler.NewContext("post", v4, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Operation delete = 5;
+ v5 := compiler.MapValueForKey(m, "delete")
+ if v5 != nil {
+ var err error
+ x.Delete, err = NewOperation(v5, compiler.NewContext("delete", v5, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Operation options = 6;
+ v6 := compiler.MapValueForKey(m, "options")
+ if v6 != nil {
+ var err error
+ x.Options, err = NewOperation(v6, compiler.NewContext("options", v6, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Operation head = 7;
+ v7 := compiler.MapValueForKey(m, "head")
+ if v7 != nil {
+ var err error
+ x.Head, err = NewOperation(v7, compiler.NewContext("head", v7, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Operation patch = 8;
+ v8 := compiler.MapValueForKey(m, "patch")
+ if v8 != nil {
+ var err error
+ x.Patch, err = NewOperation(v8, compiler.NewContext("patch", v8, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated ParametersItem parameters = 9;
+ v9 := compiler.MapValueForKey(m, "parameters")
+ if v9 != nil {
+ // repeated ParametersItem
+ x.Parameters = make([]*ParametersItem, 0)
+ a, ok := compiler.SequenceNodeForNode(v9)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewParametersItem(item, compiler.NewContext("parameters", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Parameters = append(x.Parameters, y)
+ }
+ }
+ }
+ // repeated NamedAny vendor_extension = 10;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewPathParameterSubSchema creates an object of type PathParameterSubSchema if possible, returning an error if not.
+func NewPathParameterSubSchema(in *yaml.Node, context *compiler.Context) (*PathParameterSubSchema, error) {
+ errors := make([]error, 0)
+ x := &PathParameterSubSchema{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"required"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // bool required = 1;
+ v1 := compiler.MapValueForKey(m, "required")
+ if v1 != nil {
+ x.Required, ok = compiler.BoolForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string in = 2;
+ v2 := compiler.MapValueForKey(m, "in")
+ if v2 != nil {
+ x.In, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [path]
+ if ok && !compiler.StringArrayContainsValue([]string{"path"}, x.In) {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 3;
+ v3 := compiler.MapValueForKey(m, "description")
+ if v3 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string name = 4;
+ v4 := compiler.MapValueForKey(m, "name")
+ if v4 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string type = 5;
+ v5 := compiler.MapValueForKey(m, "type")
+ if v5 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [string number boolean integer array]
+ if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "boolean", "integer", "array"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string format = 6;
+ v6 := compiler.MapValueForKey(m, "format")
+ if v6 != nil {
+ x.Format, ok = compiler.StringForScalarNode(v6)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // PrimitivesItems items = 7;
+ v7 := compiler.MapValueForKey(m, "items")
+ if v7 != nil {
+ var err error
+ x.Items, err = NewPrimitivesItems(v7, compiler.NewContext("items", v7, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string collection_format = 8;
+ v8 := compiler.MapValueForKey(m, "collectionFormat")
+ if v8 != nil {
+ x.CollectionFormat, ok = compiler.StringForScalarNode(v8)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v8))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [csv ssv tsv pipes]
+ if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes"}, x.CollectionFormat) {
+ message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v8))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Any default = 9;
+ v9 := compiler.MapValueForKey(m, "default")
+ if v9 != nil {
+ var err error
+ x.Default, err = NewAny(v9, compiler.NewContext("default", v9, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // float maximum = 10;
+ v10 := compiler.MapValueForKey(m, "maximum")
+ if v10 != nil {
+ v, ok := compiler.FloatForScalarNode(v10)
+ if ok {
+ x.Maximum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v10))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_maximum = 11;
+ v11 := compiler.MapValueForKey(m, "exclusiveMaximum")
+ if v11 != nil {
+ x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v11)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v11))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // float minimum = 12;
+ v12 := compiler.MapValueForKey(m, "minimum")
+ if v12 != nil {
+ v, ok := compiler.FloatForScalarNode(v12)
+ if ok {
+ x.Minimum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v12))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_minimum = 13;
+ v13 := compiler.MapValueForKey(m, "exclusiveMinimum")
+ if v13 != nil {
+ x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v13)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v13))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_length = 14;
+ v14 := compiler.MapValueForKey(m, "maxLength")
+ if v14 != nil {
+ t, ok := compiler.IntForScalarNode(v14)
+ if ok {
+ x.MaxLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v14))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_length = 15;
+ v15 := compiler.MapValueForKey(m, "minLength")
+ if v15 != nil {
+ t, ok := compiler.IntForScalarNode(v15)
+ if ok {
+ x.MinLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v15))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string pattern = 16;
+ v16 := compiler.MapValueForKey(m, "pattern")
+ if v16 != nil {
+ x.Pattern, ok = compiler.StringForScalarNode(v16)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v16))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_items = 17;
+ v17 := compiler.MapValueForKey(m, "maxItems")
+ if v17 != nil {
+ t, ok := compiler.IntForScalarNode(v17)
+ if ok {
+ x.MaxItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v17))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_items = 18;
+ v18 := compiler.MapValueForKey(m, "minItems")
+ if v18 != nil {
+ t, ok := compiler.IntForScalarNode(v18)
+ if ok {
+ x.MinItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v18))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool unique_items = 19;
+ v19 := compiler.MapValueForKey(m, "uniqueItems")
+ if v19 != nil {
+ x.UniqueItems, ok = compiler.BoolForScalarNode(v19)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v19))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated Any enum = 20;
+ v20 := compiler.MapValueForKey(m, "enum")
+ if v20 != nil {
+ // repeated Any
+ x.Enum = make([]*Any, 0)
+ a, ok := compiler.SequenceNodeForNode(v20)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewAny(item, compiler.NewContext("enum", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Enum = append(x.Enum, y)
+ }
+ }
+ }
+ // float multiple_of = 21;
+ v21 := compiler.MapValueForKey(m, "multipleOf")
+ if v21 != nil {
+ v, ok := compiler.FloatForScalarNode(v21)
+ if ok {
+ x.MultipleOf = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v21))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 22;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewPaths creates an object of type Paths if possible, returning an error if not.
+func NewPaths(in *yaml.Node, context *compiler.Context) (*Paths, error) {
+ errors := make([]error, 0)
+ x := &Paths{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{}
+ allowedPatterns := []*regexp.Regexp{pattern0, pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // repeated NamedAny vendor_extension = 1;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ // repeated NamedPathItem path = 2;
+ // MAP: PathItem ^/
+ x.Path = make([]*NamedPathItem, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "/") {
+ pair := &NamedPathItem{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewPathItem(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Path = append(x.Path, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewPrimitivesItems creates an object of type PrimitivesItems if possible, returning an error if not.
+func NewPrimitivesItems(in *yaml.Node, context *compiler.Context) (*PrimitivesItems, error) {
+ errors := make([]error, 0)
+ x := &PrimitivesItems{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"collectionFormat", "default", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "pattern", "type", "uniqueItems"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string type = 1;
+ v1 := compiler.MapValueForKey(m, "type")
+ if v1 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [string number integer boolean array]
+ if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "integer", "boolean", "array"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string format = 2;
+ v2 := compiler.MapValueForKey(m, "format")
+ if v2 != nil {
+ x.Format, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // PrimitivesItems items = 3;
+ v3 := compiler.MapValueForKey(m, "items")
+ if v3 != nil {
+ var err error
+ x.Items, err = NewPrimitivesItems(v3, compiler.NewContext("items", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string collection_format = 4;
+ v4 := compiler.MapValueForKey(m, "collectionFormat")
+ if v4 != nil {
+ x.CollectionFormat, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [csv ssv tsv pipes]
+ if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes"}, x.CollectionFormat) {
+ message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Any default = 5;
+ v5 := compiler.MapValueForKey(m, "default")
+ if v5 != nil {
+ var err error
+ x.Default, err = NewAny(v5, compiler.NewContext("default", v5, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // float maximum = 6;
+ v6 := compiler.MapValueForKey(m, "maximum")
+ if v6 != nil {
+ v, ok := compiler.FloatForScalarNode(v6)
+ if ok {
+ x.Maximum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_maximum = 7;
+ v7 := compiler.MapValueForKey(m, "exclusiveMaximum")
+ if v7 != nil {
+ x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v7)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v7))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // float minimum = 8;
+ v8 := compiler.MapValueForKey(m, "minimum")
+ if v8 != nil {
+ v, ok := compiler.FloatForScalarNode(v8)
+ if ok {
+ x.Minimum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v8))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_minimum = 9;
+ v9 := compiler.MapValueForKey(m, "exclusiveMinimum")
+ if v9 != nil {
+ x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v9)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v9))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_length = 10;
+ v10 := compiler.MapValueForKey(m, "maxLength")
+ if v10 != nil {
+ t, ok := compiler.IntForScalarNode(v10)
+ if ok {
+ x.MaxLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v10))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_length = 11;
+ v11 := compiler.MapValueForKey(m, "minLength")
+ if v11 != nil {
+ t, ok := compiler.IntForScalarNode(v11)
+ if ok {
+ x.MinLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v11))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string pattern = 12;
+ v12 := compiler.MapValueForKey(m, "pattern")
+ if v12 != nil {
+ x.Pattern, ok = compiler.StringForScalarNode(v12)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v12))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_items = 13;
+ v13 := compiler.MapValueForKey(m, "maxItems")
+ if v13 != nil {
+ t, ok := compiler.IntForScalarNode(v13)
+ if ok {
+ x.MaxItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v13))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_items = 14;
+ v14 := compiler.MapValueForKey(m, "minItems")
+ if v14 != nil {
+ t, ok := compiler.IntForScalarNode(v14)
+ if ok {
+ x.MinItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v14))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool unique_items = 15;
+ v15 := compiler.MapValueForKey(m, "uniqueItems")
+ if v15 != nil {
+ x.UniqueItems, ok = compiler.BoolForScalarNode(v15)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v15))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated Any enum = 16;
+ v16 := compiler.MapValueForKey(m, "enum")
+ if v16 != nil {
+ // repeated Any
+ x.Enum = make([]*Any, 0)
+ a, ok := compiler.SequenceNodeForNode(v16)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewAny(item, compiler.NewContext("enum", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Enum = append(x.Enum, y)
+ }
+ }
+ }
+ // float multiple_of = 17;
+ v17 := compiler.MapValueForKey(m, "multipleOf")
+ if v17 != nil {
+ v, ok := compiler.FloatForScalarNode(v17)
+ if ok {
+ x.MultipleOf = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v17))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 18;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewProperties creates an object of type Properties if possible, returning an error if not.
+func NewProperties(in *yaml.Node, context *compiler.Context) (*Properties, error) {
+ errors := make([]error, 0)
+ x := &Properties{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedSchema additional_properties = 1;
+ // MAP: Schema
+ x.AdditionalProperties = make([]*NamedSchema, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedSchema{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewSchema(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewQueryParameterSubSchema creates an object of type QueryParameterSubSchema if possible, returning an error if not.
+func NewQueryParameterSubSchema(in *yaml.Node, context *compiler.Context) (*QueryParameterSubSchema, error) {
+ errors := make([]error, 0)
+ x := &QueryParameterSubSchema{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"allowEmptyValue", "collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // bool required = 1;
+ v1 := compiler.MapValueForKey(m, "required")
+ if v1 != nil {
+ x.Required, ok = compiler.BoolForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string in = 2;
+ v2 := compiler.MapValueForKey(m, "in")
+ if v2 != nil {
+ x.In, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [query]
+ if ok && !compiler.StringArrayContainsValue([]string{"query"}, x.In) {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 3;
+ v3 := compiler.MapValueForKey(m, "description")
+ if v3 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string name = 4;
+ v4 := compiler.MapValueForKey(m, "name")
+ if v4 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool allow_empty_value = 5;
+ v5 := compiler.MapValueForKey(m, "allowEmptyValue")
+ if v5 != nil {
+ x.AllowEmptyValue, ok = compiler.BoolForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for allowEmptyValue: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string type = 6;
+ v6 := compiler.MapValueForKey(m, "type")
+ if v6 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v6)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [string number boolean integer array]
+ if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "boolean", "integer", "array"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string format = 7;
+ v7 := compiler.MapValueForKey(m, "format")
+ if v7 != nil {
+ x.Format, ok = compiler.StringForScalarNode(v7)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v7))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // PrimitivesItems items = 8;
+ v8 := compiler.MapValueForKey(m, "items")
+ if v8 != nil {
+ var err error
+ x.Items, err = NewPrimitivesItems(v8, compiler.NewContext("items", v8, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string collection_format = 9;
+ v9 := compiler.MapValueForKey(m, "collectionFormat")
+ if v9 != nil {
+ x.CollectionFormat, ok = compiler.StringForScalarNode(v9)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v9))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [csv ssv tsv pipes multi]
+ if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes", "multi"}, x.CollectionFormat) {
+ message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v9))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Any default = 10;
+ v10 := compiler.MapValueForKey(m, "default")
+ if v10 != nil {
+ var err error
+ x.Default, err = NewAny(v10, compiler.NewContext("default", v10, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // float maximum = 11;
+ v11 := compiler.MapValueForKey(m, "maximum")
+ if v11 != nil {
+ v, ok := compiler.FloatForScalarNode(v11)
+ if ok {
+ x.Maximum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v11))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_maximum = 12;
+ v12 := compiler.MapValueForKey(m, "exclusiveMaximum")
+ if v12 != nil {
+ x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v12)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v12))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // float minimum = 13;
+ v13 := compiler.MapValueForKey(m, "minimum")
+ if v13 != nil {
+ v, ok := compiler.FloatForScalarNode(v13)
+ if ok {
+ x.Minimum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v13))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_minimum = 14;
+ v14 := compiler.MapValueForKey(m, "exclusiveMinimum")
+ if v14 != nil {
+ x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v14)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v14))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_length = 15;
+ v15 := compiler.MapValueForKey(m, "maxLength")
+ if v15 != nil {
+ t, ok := compiler.IntForScalarNode(v15)
+ if ok {
+ x.MaxLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v15))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_length = 16;
+ v16 := compiler.MapValueForKey(m, "minLength")
+ if v16 != nil {
+ t, ok := compiler.IntForScalarNode(v16)
+ if ok {
+ x.MinLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v16))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string pattern = 17;
+ v17 := compiler.MapValueForKey(m, "pattern")
+ if v17 != nil {
+ x.Pattern, ok = compiler.StringForScalarNode(v17)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v17))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_items = 18;
+ v18 := compiler.MapValueForKey(m, "maxItems")
+ if v18 != nil {
+ t, ok := compiler.IntForScalarNode(v18)
+ if ok {
+ x.MaxItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v18))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_items = 19;
+ v19 := compiler.MapValueForKey(m, "minItems")
+ if v19 != nil {
+ t, ok := compiler.IntForScalarNode(v19)
+ if ok {
+ x.MinItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v19))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool unique_items = 20;
+ v20 := compiler.MapValueForKey(m, "uniqueItems")
+ if v20 != nil {
+ x.UniqueItems, ok = compiler.BoolForScalarNode(v20)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v20))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated Any enum = 21;
+ v21 := compiler.MapValueForKey(m, "enum")
+ if v21 != nil {
+ // repeated Any
+ x.Enum = make([]*Any, 0)
+ a, ok := compiler.SequenceNodeForNode(v21)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewAny(item, compiler.NewContext("enum", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Enum = append(x.Enum, y)
+ }
+ }
+ }
+ // float multiple_of = 22;
+ v22 := compiler.MapValueForKey(m, "multipleOf")
+ if v22 != nil {
+ v, ok := compiler.FloatForScalarNode(v22)
+ if ok {
+ x.MultipleOf = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v22))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 23;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewResponse creates an object of type Response if possible, returning an error if not.
+func NewResponse(in *yaml.Node, context *compiler.Context) (*Response, error) {
+ errors := make([]error, 0)
+ x := &Response{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"description"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"description", "examples", "headers", "schema"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string description = 1;
+ v1 := compiler.MapValueForKey(m, "description")
+ if v1 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // SchemaItem schema = 2;
+ v2 := compiler.MapValueForKey(m, "schema")
+ if v2 != nil {
+ var err error
+ x.Schema, err = NewSchemaItem(v2, compiler.NewContext("schema", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Headers headers = 3;
+ v3 := compiler.MapValueForKey(m, "headers")
+ if v3 != nil {
+ var err error
+ x.Headers, err = NewHeaders(v3, compiler.NewContext("headers", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Examples examples = 4;
+ v4 := compiler.MapValueForKey(m, "examples")
+ if v4 != nil {
+ var err error
+ x.Examples, err = NewExamples(v4, compiler.NewContext("examples", v4, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny vendor_extension = 5;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewResponseDefinitions creates an object of type ResponseDefinitions if possible, returning an error if not.
+func NewResponseDefinitions(in *yaml.Node, context *compiler.Context) (*ResponseDefinitions, error) {
+ errors := make([]error, 0)
+ x := &ResponseDefinitions{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedResponse additional_properties = 1;
+ // MAP: Response
+ x.AdditionalProperties = make([]*NamedResponse, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedResponse{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewResponse(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewResponseValue creates an object of type ResponseValue if possible, returning an error if not.
+func NewResponseValue(in *yaml.Node, context *compiler.Context) (*ResponseValue, error) {
+ errors := make([]error, 0)
+ x := &ResponseValue{}
+ matched := false
+ // Response response = 1;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewResponse(m, compiler.NewContext("response", m, context))
+ if matchingError == nil {
+ x.Oneof = &ResponseValue_Response{Response: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // JsonReference json_reference = 2;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewJsonReference(m, compiler.NewContext("jsonReference", m, context))
+ if matchingError == nil {
+ x.Oneof = &ResponseValue_JsonReference{JsonReference: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ } else {
+ message := fmt.Sprintf("contains an invalid ResponseValue")
+ err := compiler.NewError(context, message)
+ errors = []error{err}
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewResponses creates an object of type Responses if possible, returning an error if not.
+func NewResponses(in *yaml.Node, context *compiler.Context) (*Responses, error) {
+ errors := make([]error, 0)
+ x := &Responses{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{}
+ allowedPatterns := []*regexp.Regexp{pattern2, pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // repeated NamedResponseValue response_code = 1;
+ // MAP: ResponseValue ^([0-9]{3})$|^(default)$
+ x.ResponseCode = make([]*NamedResponseValue, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if pattern2.MatchString(k) {
+ pair := &NamedResponseValue{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewResponseValue(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.ResponseCode = append(x.ResponseCode, pair)
+ }
+ }
+ }
+ // repeated NamedAny vendor_extension = 2;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewSchema creates an object of type Schema if possible, returning an error if not.
+func NewSchema(in *yaml.Node, context *compiler.Context) (*Schema, error) {
+ errors := make([]error, 0)
+ x := &Schema{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"$ref", "additionalProperties", "allOf", "default", "description", "discriminator", "enum", "example", "exclusiveMaximum", "exclusiveMinimum", "externalDocs", "format", "items", "maxItems", "maxLength", "maxProperties", "maximum", "minItems", "minLength", "minProperties", "minimum", "multipleOf", "pattern", "properties", "readOnly", "required", "title", "type", "uniqueItems", "xml"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string _ref = 1;
+ v1 := compiler.MapValueForKey(m, "$ref")
+ if v1 != nil {
+ x.XRef, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for $ref: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string format = 2;
+ v2 := compiler.MapValueForKey(m, "format")
+ if v2 != nil {
+ x.Format, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string title = 3;
+ v3 := compiler.MapValueForKey(m, "title")
+ if v3 != nil {
+ x.Title, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for title: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 4;
+ v4 := compiler.MapValueForKey(m, "description")
+ if v4 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Any default = 5;
+ v5 := compiler.MapValueForKey(m, "default")
+ if v5 != nil {
+ var err error
+ x.Default, err = NewAny(v5, compiler.NewContext("default", v5, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // float multiple_of = 6;
+ v6 := compiler.MapValueForKey(m, "multipleOf")
+ if v6 != nil {
+ v, ok := compiler.FloatForScalarNode(v6)
+ if ok {
+ x.MultipleOf = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // float maximum = 7;
+ v7 := compiler.MapValueForKey(m, "maximum")
+ if v7 != nil {
+ v, ok := compiler.FloatForScalarNode(v7)
+ if ok {
+ x.Maximum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v7))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_maximum = 8;
+ v8 := compiler.MapValueForKey(m, "exclusiveMaximum")
+ if v8 != nil {
+ x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v8)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v8))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // float minimum = 9;
+ v9 := compiler.MapValueForKey(m, "minimum")
+ if v9 != nil {
+ v, ok := compiler.FloatForScalarNode(v9)
+ if ok {
+ x.Minimum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v9))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_minimum = 10;
+ v10 := compiler.MapValueForKey(m, "exclusiveMinimum")
+ if v10 != nil {
+ x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v10)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v10))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_length = 11;
+ v11 := compiler.MapValueForKey(m, "maxLength")
+ if v11 != nil {
+ t, ok := compiler.IntForScalarNode(v11)
+ if ok {
+ x.MaxLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v11))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_length = 12;
+ v12 := compiler.MapValueForKey(m, "minLength")
+ if v12 != nil {
+ t, ok := compiler.IntForScalarNode(v12)
+ if ok {
+ x.MinLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v12))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string pattern = 13;
+ v13 := compiler.MapValueForKey(m, "pattern")
+ if v13 != nil {
+ x.Pattern, ok = compiler.StringForScalarNode(v13)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v13))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_items = 14;
+ v14 := compiler.MapValueForKey(m, "maxItems")
+ if v14 != nil {
+ t, ok := compiler.IntForScalarNode(v14)
+ if ok {
+ x.MaxItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v14))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_items = 15;
+ v15 := compiler.MapValueForKey(m, "minItems")
+ if v15 != nil {
+ t, ok := compiler.IntForScalarNode(v15)
+ if ok {
+ x.MinItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v15))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool unique_items = 16;
+ v16 := compiler.MapValueForKey(m, "uniqueItems")
+ if v16 != nil {
+ x.UniqueItems, ok = compiler.BoolForScalarNode(v16)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v16))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_properties = 17;
+ v17 := compiler.MapValueForKey(m, "maxProperties")
+ if v17 != nil {
+ t, ok := compiler.IntForScalarNode(v17)
+ if ok {
+ x.MaxProperties = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxProperties: %s", compiler.Display(v17))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_properties = 18;
+ v18 := compiler.MapValueForKey(m, "minProperties")
+ if v18 != nil {
+ t, ok := compiler.IntForScalarNode(v18)
+ if ok {
+ x.MinProperties = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minProperties: %s", compiler.Display(v18))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated string required = 19;
+ v19 := compiler.MapValueForKey(m, "required")
+ if v19 != nil {
+ v, ok := compiler.SequenceNodeForNode(v19)
+ if ok {
+ x.Required = compiler.StringArrayForSequenceNode(v)
+ } else {
+ message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v19))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated Any enum = 20;
+ v20 := compiler.MapValueForKey(m, "enum")
+ if v20 != nil {
+ // repeated Any
+ x.Enum = make([]*Any, 0)
+ a, ok := compiler.SequenceNodeForNode(v20)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewAny(item, compiler.NewContext("enum", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Enum = append(x.Enum, y)
+ }
+ }
+ }
+ // AdditionalPropertiesItem additional_properties = 21;
+ v21 := compiler.MapValueForKey(m, "additionalProperties")
+ if v21 != nil {
+ var err error
+ x.AdditionalProperties, err = NewAdditionalPropertiesItem(v21, compiler.NewContext("additionalProperties", v21, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // TypeItem type = 22;
+ v22 := compiler.MapValueForKey(m, "type")
+ if v22 != nil {
+ var err error
+ x.Type, err = NewTypeItem(v22, compiler.NewContext("type", v22, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // ItemsItem items = 23;
+ v23 := compiler.MapValueForKey(m, "items")
+ if v23 != nil {
+ var err error
+ x.Items, err = NewItemsItem(v23, compiler.NewContext("items", v23, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated Schema all_of = 24;
+ v24 := compiler.MapValueForKey(m, "allOf")
+ if v24 != nil {
+ // repeated Schema
+ x.AllOf = make([]*Schema, 0)
+ a, ok := compiler.SequenceNodeForNode(v24)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewSchema(item, compiler.NewContext("allOf", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AllOf = append(x.AllOf, y)
+ }
+ }
+ }
+ // Properties properties = 25;
+ v25 := compiler.MapValueForKey(m, "properties")
+ if v25 != nil {
+ var err error
+ x.Properties, err = NewProperties(v25, compiler.NewContext("properties", v25, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string discriminator = 26;
+ v26 := compiler.MapValueForKey(m, "discriminator")
+ if v26 != nil {
+ x.Discriminator, ok = compiler.StringForScalarNode(v26)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for discriminator: %s", compiler.Display(v26))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool read_only = 27;
+ v27 := compiler.MapValueForKey(m, "readOnly")
+ if v27 != nil {
+ x.ReadOnly, ok = compiler.BoolForScalarNode(v27)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for readOnly: %s", compiler.Display(v27))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Xml xml = 28;
+ v28 := compiler.MapValueForKey(m, "xml")
+ if v28 != nil {
+ var err error
+ x.Xml, err = NewXml(v28, compiler.NewContext("xml", v28, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // ExternalDocs external_docs = 29;
+ v29 := compiler.MapValueForKey(m, "externalDocs")
+ if v29 != nil {
+ var err error
+ x.ExternalDocs, err = NewExternalDocs(v29, compiler.NewContext("externalDocs", v29, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Any example = 30;
+ v30 := compiler.MapValueForKey(m, "example")
+ if v30 != nil {
+ var err error
+ x.Example, err = NewAny(v30, compiler.NewContext("example", v30, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny vendor_extension = 31;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewSchemaItem creates an object of type SchemaItem if possible, returning an error if not.
+func NewSchemaItem(in *yaml.Node, context *compiler.Context) (*SchemaItem, error) {
+ errors := make([]error, 0)
+ x := &SchemaItem{}
+ matched := false
+ // Schema schema = 1;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewSchema(m, compiler.NewContext("schema", m, context))
+ if matchingError == nil {
+ x.Oneof = &SchemaItem_Schema{Schema: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // FileSchema file_schema = 2;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewFileSchema(m, compiler.NewContext("fileSchema", m, context))
+ if matchingError == nil {
+ x.Oneof = &SchemaItem_FileSchema{FileSchema: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ } else {
+ message := fmt.Sprintf("contains an invalid SchemaItem")
+ err := compiler.NewError(context, message)
+ errors = []error{err}
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewSecurityDefinitions creates an object of type SecurityDefinitions if possible, returning an error if not.
+func NewSecurityDefinitions(in *yaml.Node, context *compiler.Context) (*SecurityDefinitions, error) {
+ errors := make([]error, 0)
+ x := &SecurityDefinitions{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedSecurityDefinitionsItem additional_properties = 1;
+ // MAP: SecurityDefinitionsItem
+ x.AdditionalProperties = make([]*NamedSecurityDefinitionsItem, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedSecurityDefinitionsItem{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewSecurityDefinitionsItem(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewSecurityDefinitionsItem creates an object of type SecurityDefinitionsItem if possible, returning an error if not.
+func NewSecurityDefinitionsItem(in *yaml.Node, context *compiler.Context) (*SecurityDefinitionsItem, error) {
+ errors := make([]error, 0)
+ x := &SecurityDefinitionsItem{}
+ matched := false
+ // BasicAuthenticationSecurity basic_authentication_security = 1;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewBasicAuthenticationSecurity(m, compiler.NewContext("basicAuthenticationSecurity", m, context))
+ if matchingError == nil {
+ x.Oneof = &SecurityDefinitionsItem_BasicAuthenticationSecurity{BasicAuthenticationSecurity: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // ApiKeySecurity api_key_security = 2;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewApiKeySecurity(m, compiler.NewContext("apiKeySecurity", m, context))
+ if matchingError == nil {
+ x.Oneof = &SecurityDefinitionsItem_ApiKeySecurity{ApiKeySecurity: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // Oauth2ImplicitSecurity oauth2_implicit_security = 3;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewOauth2ImplicitSecurity(m, compiler.NewContext("oauth2ImplicitSecurity", m, context))
+ if matchingError == nil {
+ x.Oneof = &SecurityDefinitionsItem_Oauth2ImplicitSecurity{Oauth2ImplicitSecurity: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // Oauth2PasswordSecurity oauth2_password_security = 4;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewOauth2PasswordSecurity(m, compiler.NewContext("oauth2PasswordSecurity", m, context))
+ if matchingError == nil {
+ x.Oneof = &SecurityDefinitionsItem_Oauth2PasswordSecurity{Oauth2PasswordSecurity: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // Oauth2ApplicationSecurity oauth2_application_security = 5;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewOauth2ApplicationSecurity(m, compiler.NewContext("oauth2ApplicationSecurity", m, context))
+ if matchingError == nil {
+ x.Oneof = &SecurityDefinitionsItem_Oauth2ApplicationSecurity{Oauth2ApplicationSecurity: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // Oauth2AccessCodeSecurity oauth2_access_code_security = 6;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewOauth2AccessCodeSecurity(m, compiler.NewContext("oauth2AccessCodeSecurity", m, context))
+ if matchingError == nil {
+ x.Oneof = &SecurityDefinitionsItem_Oauth2AccessCodeSecurity{Oauth2AccessCodeSecurity: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ } else {
+ message := fmt.Sprintf("contains an invalid SecurityDefinitionsItem")
+ err := compiler.NewError(context, message)
+ errors = []error{err}
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewSecurityRequirement creates an object of type SecurityRequirement if possible, returning an error if not.
+func NewSecurityRequirement(in *yaml.Node, context *compiler.Context) (*SecurityRequirement, error) {
+ errors := make([]error, 0)
+ x := &SecurityRequirement{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedStringArray additional_properties = 1;
+ // MAP: StringArray
+ x.AdditionalProperties = make([]*NamedStringArray, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedStringArray{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewStringArray(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewStringArray creates an object of type StringArray if possible, returning an error if not.
+func NewStringArray(in *yaml.Node, context *compiler.Context) (*StringArray, error) {
+ errors := make([]error, 0)
+ x := &StringArray{}
+ x.Value = make([]string, 0)
+ for _, node := range in.Content {
+ s, _ := compiler.StringForScalarNode(node)
+ x.Value = append(x.Value, s)
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewTag creates an object of type Tag if possible, returning an error if not.
+func NewTag(in *yaml.Node, context *compiler.Context) (*Tag, error) {
+ errors := make([]error, 0)
+ x := &Tag{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"name"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"description", "externalDocs", "name"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 2;
+ v2 := compiler.MapValueForKey(m, "description")
+ if v2 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // ExternalDocs external_docs = 3;
+ v3 := compiler.MapValueForKey(m, "externalDocs")
+ if v3 != nil {
+ var err error
+ x.ExternalDocs, err = NewExternalDocs(v3, compiler.NewContext("externalDocs", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny vendor_extension = 4;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewTypeItem creates an object of type TypeItem if possible, returning an error if not.
+func NewTypeItem(in *yaml.Node, context *compiler.Context) (*TypeItem, error) {
+ errors := make([]error, 0)
+ x := &TypeItem{}
+ v1 := in
+ switch v1.Kind {
+ case yaml.ScalarNode:
+ x.Value = make([]string, 0)
+ x.Value = append(x.Value, v1.Value)
+ case yaml.SequenceNode:
+ x.Value = make([]string, 0)
+ for _, v := range v1.Content {
+ value := v.Value
+ ok := v.Kind == yaml.ScalarNode
+ if ok {
+ x.Value = append(x.Value, value)
+ } else {
+ message := fmt.Sprintf("has unexpected value for string array element: %+v (%T)", value, value)
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ default:
+ message := fmt.Sprintf("has unexpected value for string array: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewVendorExtension creates an object of type VendorExtension if possible, returning an error if not.
+func NewVendorExtension(in *yaml.Node, context *compiler.Context) (*VendorExtension, error) {
+ errors := make([]error, 0)
+ x := &VendorExtension{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedAny additional_properties = 1;
+ // MAP: Any
+ x.AdditionalProperties = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewXml creates an object of type Xml if possible, returning an error if not.
+func NewXml(in *yaml.Node, context *compiler.Context) (*Xml, error) {
+ errors := make([]error, 0)
+ x := &Xml{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"attribute", "name", "namespace", "prefix", "wrapped"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string namespace = 2;
+ v2 := compiler.MapValueForKey(m, "namespace")
+ if v2 != nil {
+ x.Namespace, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for namespace: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string prefix = 3;
+ v3 := compiler.MapValueForKey(m, "prefix")
+ if v3 != nil {
+ x.Prefix, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for prefix: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool attribute = 4;
+ v4 := compiler.MapValueForKey(m, "attribute")
+ if v4 != nil {
+ x.Attribute, ok = compiler.BoolForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for attribute: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool wrapped = 5;
+ v5 := compiler.MapValueForKey(m, "wrapped")
+ if v5 != nil {
+ x.Wrapped, ok = compiler.BoolForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for wrapped: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 6;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside AdditionalPropertiesItem objects.
+func (m *AdditionalPropertiesItem) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ {
+ p, ok := m.Oneof.(*AdditionalPropertiesItem_Schema)
+ if ok {
+ _, err := p.Schema.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Any objects.
+func (m *Any) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside ApiKeySecurity objects.
+func (m *ApiKeySecurity) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside BasicAuthenticationSecurity objects.
+func (m *BasicAuthenticationSecurity) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside BodyParameter objects.
+func (m *BodyParameter) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Schema != nil {
+ _, err := m.Schema.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Contact objects.
+func (m *Contact) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Default objects.
+func (m *Default) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Definitions objects.
+func (m *Definitions) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Document objects.
+func (m *Document) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Info != nil {
+ _, err := m.Info.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Paths != nil {
+ _, err := m.Paths.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Definitions != nil {
+ _, err := m.Definitions.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Parameters != nil {
+ _, err := m.Parameters.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Responses != nil {
+ _, err := m.Responses.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Security {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ if m.SecurityDefinitions != nil {
+ _, err := m.SecurityDefinitions.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Tags {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ if m.ExternalDocs != nil {
+ _, err := m.ExternalDocs.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Examples objects.
+func (m *Examples) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside ExternalDocs objects.
+func (m *ExternalDocs) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside FileSchema objects.
+func (m *FileSchema) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Default != nil {
+ _, err := m.Default.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.ExternalDocs != nil {
+ _, err := m.ExternalDocs.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Example != nil {
+ _, err := m.Example.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside FormDataParameterSubSchema objects.
+func (m *FormDataParameterSubSchema) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Items != nil {
+ _, err := m.Items.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Default != nil {
+ _, err := m.Default.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Enum {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Header objects.
+func (m *Header) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Items != nil {
+ _, err := m.Items.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Default != nil {
+ _, err := m.Default.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Enum {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside HeaderParameterSubSchema objects.
+func (m *HeaderParameterSubSchema) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Items != nil {
+ _, err := m.Items.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Default != nil {
+ _, err := m.Default.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Enum {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Headers objects.
+func (m *Headers) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Info objects.
+func (m *Info) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Contact != nil {
+ _, err := m.Contact.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.License != nil {
+ _, err := m.License.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside ItemsItem objects.
+func (m *ItemsItem) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.Schema {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside JsonReference objects.
+func (m *JsonReference) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.XRef != "" {
+ info, err := compiler.ReadInfoForRef(root, m.XRef)
+ if err != nil {
+ return nil, err
+ }
+ if info != nil {
+ replacement, err := NewJsonReference(info, nil)
+ if err == nil {
+ *m = *replacement
+ return m.ResolveReferences(root)
+ }
+ }
+ return info, nil
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside License objects.
+func (m *License) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedAny objects.
+func (m *NamedAny) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedHeader objects.
+func (m *NamedHeader) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedParameter objects.
+func (m *NamedParameter) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedPathItem objects.
+func (m *NamedPathItem) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedResponse objects.
+func (m *NamedResponse) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedResponseValue objects.
+func (m *NamedResponseValue) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedSchema objects.
+func (m *NamedSchema) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedSecurityDefinitionsItem objects.
+func (m *NamedSecurityDefinitionsItem) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedString objects.
+func (m *NamedString) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedStringArray objects.
+func (m *NamedStringArray) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NonBodyParameter objects.
+func (m *NonBodyParameter) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ {
+ p, ok := m.Oneof.(*NonBodyParameter_HeaderParameterSubSchema)
+ if ok {
+ _, err := p.HeaderParameterSubSchema.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*NonBodyParameter_FormDataParameterSubSchema)
+ if ok {
+ _, err := p.FormDataParameterSubSchema.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*NonBodyParameter_QueryParameterSubSchema)
+ if ok {
+ _, err := p.QueryParameterSubSchema.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*NonBodyParameter_PathParameterSubSchema)
+ if ok {
+ _, err := p.PathParameterSubSchema.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Oauth2AccessCodeSecurity objects.
+func (m *Oauth2AccessCodeSecurity) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Scopes != nil {
+ _, err := m.Scopes.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Oauth2ApplicationSecurity objects.
+func (m *Oauth2ApplicationSecurity) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Scopes != nil {
+ _, err := m.Scopes.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Oauth2ImplicitSecurity objects.
+func (m *Oauth2ImplicitSecurity) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Scopes != nil {
+ _, err := m.Scopes.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Oauth2PasswordSecurity objects.
+func (m *Oauth2PasswordSecurity) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Scopes != nil {
+ _, err := m.Scopes.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Oauth2Scopes objects.
+func (m *Oauth2Scopes) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Operation objects.
+func (m *Operation) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.ExternalDocs != nil {
+ _, err := m.ExternalDocs.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Parameters {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ if m.Responses != nil {
+ _, err := m.Responses.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Security {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Parameter objects.
+func (m *Parameter) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ {
+ p, ok := m.Oneof.(*Parameter_BodyParameter)
+ if ok {
+ _, err := p.BodyParameter.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*Parameter_NonBodyParameter)
+ if ok {
+ _, err := p.NonBodyParameter.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside ParameterDefinitions objects.
+func (m *ParameterDefinitions) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside ParametersItem objects.
+func (m *ParametersItem) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ {
+ p, ok := m.Oneof.(*ParametersItem_Parameter)
+ if ok {
+ _, err := p.Parameter.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*ParametersItem_JsonReference)
+ if ok {
+ info, err := p.JsonReference.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ } else if info != nil {
+ n, err := NewParametersItem(info, nil)
+ if err != nil {
+ return nil, err
+ } else if n != nil {
+ *m = *n
+ return nil, nil
+ }
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside PathItem objects.
+func (m *PathItem) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.XRef != "" {
+ info, err := compiler.ReadInfoForRef(root, m.XRef)
+ if err != nil {
+ return nil, err
+ }
+ if info != nil {
+ replacement, err := NewPathItem(info, nil)
+ if err == nil {
+ *m = *replacement
+ return m.ResolveReferences(root)
+ }
+ }
+ return info, nil
+ }
+ if m.Get != nil {
+ _, err := m.Get.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Put != nil {
+ _, err := m.Put.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Post != nil {
+ _, err := m.Post.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Delete != nil {
+ _, err := m.Delete.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Options != nil {
+ _, err := m.Options.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Head != nil {
+ _, err := m.Head.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Patch != nil {
+ _, err := m.Patch.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Parameters {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside PathParameterSubSchema objects.
+func (m *PathParameterSubSchema) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Items != nil {
+ _, err := m.Items.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Default != nil {
+ _, err := m.Default.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Enum {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Paths objects.
+func (m *Paths) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.Path {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside PrimitivesItems objects.
+func (m *PrimitivesItems) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Items != nil {
+ _, err := m.Items.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Default != nil {
+ _, err := m.Default.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Enum {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Properties objects.
+func (m *Properties) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside QueryParameterSubSchema objects.
+func (m *QueryParameterSubSchema) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Items != nil {
+ _, err := m.Items.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Default != nil {
+ _, err := m.Default.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Enum {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Response objects.
+func (m *Response) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Schema != nil {
+ _, err := m.Schema.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Headers != nil {
+ _, err := m.Headers.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Examples != nil {
+ _, err := m.Examples.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside ResponseDefinitions objects.
+func (m *ResponseDefinitions) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside ResponseValue objects.
+func (m *ResponseValue) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ {
+ p, ok := m.Oneof.(*ResponseValue_Response)
+ if ok {
+ _, err := p.Response.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*ResponseValue_JsonReference)
+ if ok {
+ info, err := p.JsonReference.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ } else if info != nil {
+ n, err := NewResponseValue(info, nil)
+ if err != nil {
+ return nil, err
+ } else if n != nil {
+ *m = *n
+ return nil, nil
+ }
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Responses objects.
+func (m *Responses) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.ResponseCode {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Schema objects.
+func (m *Schema) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.XRef != "" {
+ info, err := compiler.ReadInfoForRef(root, m.XRef)
+ if err != nil {
+ return nil, err
+ }
+ if info != nil {
+ replacement, err := NewSchema(info, nil)
+ if err == nil {
+ *m = *replacement
+ return m.ResolveReferences(root)
+ }
+ }
+ return info, nil
+ }
+ if m.Default != nil {
+ _, err := m.Default.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Enum {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ if m.AdditionalProperties != nil {
+ _, err := m.AdditionalProperties.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Type != nil {
+ _, err := m.Type.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Items != nil {
+ _, err := m.Items.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.AllOf {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ if m.Properties != nil {
+ _, err := m.Properties.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Xml != nil {
+ _, err := m.Xml.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.ExternalDocs != nil {
+ _, err := m.ExternalDocs.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Example != nil {
+ _, err := m.Example.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside SchemaItem objects.
+func (m *SchemaItem) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ {
+ p, ok := m.Oneof.(*SchemaItem_Schema)
+ if ok {
+ _, err := p.Schema.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*SchemaItem_FileSchema)
+ if ok {
+ _, err := p.FileSchema.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside SecurityDefinitions objects.
+func (m *SecurityDefinitions) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside SecurityDefinitionsItem objects.
+func (m *SecurityDefinitionsItem) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ {
+ p, ok := m.Oneof.(*SecurityDefinitionsItem_BasicAuthenticationSecurity)
+ if ok {
+ _, err := p.BasicAuthenticationSecurity.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*SecurityDefinitionsItem_ApiKeySecurity)
+ if ok {
+ _, err := p.ApiKeySecurity.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2ImplicitSecurity)
+ if ok {
+ _, err := p.Oauth2ImplicitSecurity.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2PasswordSecurity)
+ if ok {
+ _, err := p.Oauth2PasswordSecurity.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2ApplicationSecurity)
+ if ok {
+ _, err := p.Oauth2ApplicationSecurity.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2AccessCodeSecurity)
+ if ok {
+ _, err := p.Oauth2AccessCodeSecurity.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside SecurityRequirement objects.
+func (m *SecurityRequirement) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside StringArray objects.
+func (m *StringArray) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Tag objects.
+func (m *Tag) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.ExternalDocs != nil {
+ _, err := m.ExternalDocs.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside TypeItem objects.
+func (m *TypeItem) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside VendorExtension objects.
+func (m *VendorExtension) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Xml objects.
+func (m *Xml) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ToRawInfo returns a description of AdditionalPropertiesItem suitable for JSON or YAML export.
+func (m *AdditionalPropertiesItem) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // AdditionalPropertiesItem
+ // {Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v0 := m.GetSchema()
+ if v0 != nil {
+ return v0.ToRawInfo()
+ }
+ // {Name:boolean Type:bool StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ if v1, ok := m.GetOneof().(*AdditionalPropertiesItem_Boolean); ok {
+ return compiler.NewScalarNodeForBool(v1.Boolean)
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of Any suitable for JSON or YAML export.
+func (m *Any) ToRawInfo() *yaml.Node {
+ var err error
+ var node yaml.Node
+ err = yaml.Unmarshal([]byte(m.Yaml), &node)
+ if err == nil {
+ if node.Kind == yaml.DocumentNode {
+ return node.Content[0]
+ }
+ return &node
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of ApiKeySecurity suitable for JSON or YAML export.
+func (m *ApiKeySecurity) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("in"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In))
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of BasicAuthenticationSecurity suitable for JSON or YAML export.
+func (m *BasicAuthenticationSecurity) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of BodyParameter suitable for JSON or YAML export.
+func (m *BodyParameter) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("in"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In))
+ if m.Required != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("required"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required))
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("schema"))
+ info.Content = append(info.Content, m.Schema.ToRawInfo())
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Contact suitable for JSON or YAML export.
+func (m *Contact) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ if m.Url != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("url"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url))
+ }
+ if m.Email != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("email"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Email))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Default suitable for JSON or YAML export.
+func (m *Default) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Definitions suitable for JSON or YAML export.
+func (m *Definitions) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Document suitable for JSON or YAML export.
+func (m *Document) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("swagger"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Swagger))
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("info"))
+ info.Content = append(info.Content, m.Info.ToRawInfo())
+ if m.Host != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("host"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Host))
+ }
+ if m.BasePath != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("basePath"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.BasePath))
+ }
+ if len(m.Schemes) != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("schemes"))
+ info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Schemes))
+ }
+ if len(m.Consumes) != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("consumes"))
+ info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Consumes))
+ }
+ if len(m.Produces) != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("produces"))
+ info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Produces))
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("paths"))
+ info.Content = append(info.Content, m.Paths.ToRawInfo())
+ if m.Definitions != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("definitions"))
+ info.Content = append(info.Content, m.Definitions.ToRawInfo())
+ }
+ if m.Parameters != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters"))
+ info.Content = append(info.Content, m.Parameters.ToRawInfo())
+ }
+ if m.Responses != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("responses"))
+ info.Content = append(info.Content, m.Responses.ToRawInfo())
+ }
+ if len(m.Security) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Security {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("security"))
+ info.Content = append(info.Content, items)
+ }
+ if m.SecurityDefinitions != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("securityDefinitions"))
+ info.Content = append(info.Content, m.SecurityDefinitions.ToRawInfo())
+ }
+ if len(m.Tags) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Tags {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("tags"))
+ info.Content = append(info.Content, items)
+ }
+ if m.ExternalDocs != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs"))
+ info.Content = append(info.Content, m.ExternalDocs.ToRawInfo())
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Examples suitable for JSON or YAML export.
+func (m *Examples) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of ExternalDocs suitable for JSON or YAML export.
+func (m *ExternalDocs) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("url"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url))
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of FileSchema suitable for JSON or YAML export.
+func (m *FileSchema) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Format != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("format"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format))
+ }
+ if m.Title != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("title"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Title))
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.Default != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("default"))
+ info.Content = append(info.Content, m.Default.ToRawInfo())
+ }
+ if len(m.Required) != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("required"))
+ info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Required))
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ if m.ReadOnly != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("readOnly"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ReadOnly))
+ }
+ if m.ExternalDocs != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs"))
+ info.Content = append(info.Content, m.ExternalDocs.ToRawInfo())
+ }
+ if m.Example != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("example"))
+ info.Content = append(info.Content, m.Example.ToRawInfo())
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of FormDataParameterSubSchema suitable for JSON or YAML export.
+func (m *FormDataParameterSubSchema) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Required != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("required"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required))
+ }
+ if m.In != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("in"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In))
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ if m.AllowEmptyValue != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("allowEmptyValue"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.AllowEmptyValue))
+ }
+ if m.Type != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ }
+ if m.Format != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("format"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format))
+ }
+ if m.Items != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("items"))
+ info.Content = append(info.Content, m.Items.ToRawInfo())
+ }
+ if m.CollectionFormat != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat))
+ }
+ if m.Default != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("default"))
+ info.Content = append(info.Content, m.Default.ToRawInfo())
+ }
+ if m.Maximum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum))
+ }
+ if m.ExclusiveMaximum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum))
+ }
+ if m.Minimum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum))
+ }
+ if m.ExclusiveMinimum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum))
+ }
+ if m.MaxLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength))
+ }
+ if m.MinLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength))
+ }
+ if m.Pattern != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern))
+ }
+ if m.MaxItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems))
+ }
+ if m.MinItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems))
+ }
+ if m.UniqueItems != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems))
+ }
+ if len(m.Enum) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Enum {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("enum"))
+ info.Content = append(info.Content, items)
+ }
+ if m.MultipleOf != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Header suitable for JSON or YAML export.
+func (m *Header) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ if m.Format != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("format"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format))
+ }
+ if m.Items != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("items"))
+ info.Content = append(info.Content, m.Items.ToRawInfo())
+ }
+ if m.CollectionFormat != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat))
+ }
+ if m.Default != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("default"))
+ info.Content = append(info.Content, m.Default.ToRawInfo())
+ }
+ if m.Maximum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum))
+ }
+ if m.ExclusiveMaximum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum))
+ }
+ if m.Minimum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum))
+ }
+ if m.ExclusiveMinimum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum))
+ }
+ if m.MaxLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength))
+ }
+ if m.MinLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength))
+ }
+ if m.Pattern != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern))
+ }
+ if m.MaxItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems))
+ }
+ if m.MinItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems))
+ }
+ if m.UniqueItems != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems))
+ }
+ if len(m.Enum) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Enum {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("enum"))
+ info.Content = append(info.Content, items)
+ }
+ if m.MultipleOf != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf))
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of HeaderParameterSubSchema suitable for JSON or YAML export.
+func (m *HeaderParameterSubSchema) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Required != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("required"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required))
+ }
+ if m.In != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("in"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In))
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ if m.Type != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ }
+ if m.Format != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("format"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format))
+ }
+ if m.Items != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("items"))
+ info.Content = append(info.Content, m.Items.ToRawInfo())
+ }
+ if m.CollectionFormat != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat))
+ }
+ if m.Default != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("default"))
+ info.Content = append(info.Content, m.Default.ToRawInfo())
+ }
+ if m.Maximum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum))
+ }
+ if m.ExclusiveMaximum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum))
+ }
+ if m.Minimum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum))
+ }
+ if m.ExclusiveMinimum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum))
+ }
+ if m.MaxLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength))
+ }
+ if m.MinLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength))
+ }
+ if m.Pattern != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern))
+ }
+ if m.MaxItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems))
+ }
+ if m.MinItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems))
+ }
+ if m.UniqueItems != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems))
+ }
+ if len(m.Enum) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Enum {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("enum"))
+ info.Content = append(info.Content, items)
+ }
+ if m.MultipleOf != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Headers suitable for JSON or YAML export.
+func (m *Headers) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Info suitable for JSON or YAML export.
+func (m *Info) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("title"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Title))
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("version"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Version))
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.TermsOfService != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("termsOfService"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TermsOfService))
+ }
+ if m.Contact != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("contact"))
+ info.Content = append(info.Content, m.Contact.ToRawInfo())
+ }
+ if m.License != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("license"))
+ info.Content = append(info.Content, m.License.ToRawInfo())
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of ItemsItem suitable for JSON or YAML export.
+func (m *ItemsItem) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if len(m.Schema) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Schema {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("schema"))
+ info.Content = append(info.Content, items)
+ }
+ return info
+}
+
+// ToRawInfo returns a description of JsonReference suitable for JSON or YAML export.
+func (m *JsonReference) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("$ref"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.XRef))
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ return info
+}
+
+// ToRawInfo returns a description of License suitable for JSON or YAML export.
+func (m *License) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ if m.Url != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("url"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of NamedAny suitable for JSON or YAML export.
+func (m *NamedAny) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ if m.Value != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("value"))
+ info.Content = append(info.Content, m.Value.ToRawInfo())
+ }
+ return info
+}
+
+// ToRawInfo returns a description of NamedHeader suitable for JSON or YAML export.
+func (m *NamedHeader) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:Header StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedParameter suitable for JSON or YAML export.
+func (m *NamedParameter) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:Parameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedPathItem suitable for JSON or YAML export.
+func (m *NamedPathItem) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:PathItem StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedResponse suitable for JSON or YAML export.
+func (m *NamedResponse) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:Response StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedResponseValue suitable for JSON or YAML export.
+func (m *NamedResponseValue) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:ResponseValue StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedSchema suitable for JSON or YAML export.
+func (m *NamedSchema) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedSecurityDefinitionsItem suitable for JSON or YAML export.
+func (m *NamedSecurityDefinitionsItem) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:SecurityDefinitionsItem StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedString suitable for JSON or YAML export.
+func (m *NamedString) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ if m.Value != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("value"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Value))
+ }
+ return info
+}
+
+// ToRawInfo returns a description of NamedStringArray suitable for JSON or YAML export.
+func (m *NamedStringArray) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:StringArray StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NonBodyParameter suitable for JSON or YAML export.
+func (m *NonBodyParameter) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // NonBodyParameter
+ // {Name:headerParameterSubSchema Type:HeaderParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v0 := m.GetHeaderParameterSubSchema()
+ if v0 != nil {
+ return v0.ToRawInfo()
+ }
+ // {Name:formDataParameterSubSchema Type:FormDataParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v1 := m.GetFormDataParameterSubSchema()
+ if v1 != nil {
+ return v1.ToRawInfo()
+ }
+ // {Name:queryParameterSubSchema Type:QueryParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v2 := m.GetQueryParameterSubSchema()
+ if v2 != nil {
+ return v2.ToRawInfo()
+ }
+ // {Name:pathParameterSubSchema Type:PathParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v3 := m.GetPathParameterSubSchema()
+ if v3 != nil {
+ return v3.ToRawInfo()
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of Oauth2AccessCodeSecurity suitable for JSON or YAML export.
+func (m *Oauth2AccessCodeSecurity) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("flow"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Flow))
+ if m.Scopes != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("scopes"))
+ info.Content = append(info.Content, m.Scopes.ToRawInfo())
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("authorizationUrl"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.AuthorizationUrl))
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("tokenUrl"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TokenUrl))
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Oauth2ApplicationSecurity suitable for JSON or YAML export.
+func (m *Oauth2ApplicationSecurity) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("flow"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Flow))
+ if m.Scopes != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("scopes"))
+ info.Content = append(info.Content, m.Scopes.ToRawInfo())
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("tokenUrl"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TokenUrl))
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Oauth2ImplicitSecurity suitable for JSON or YAML export.
+func (m *Oauth2ImplicitSecurity) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("flow"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Flow))
+ if m.Scopes != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("scopes"))
+ info.Content = append(info.Content, m.Scopes.ToRawInfo())
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("authorizationUrl"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.AuthorizationUrl))
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Oauth2PasswordSecurity suitable for JSON or YAML export.
+func (m *Oauth2PasswordSecurity) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("flow"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Flow))
+ if m.Scopes != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("scopes"))
+ info.Content = append(info.Content, m.Scopes.ToRawInfo())
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("tokenUrl"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TokenUrl))
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Oauth2Scopes suitable for JSON or YAML export.
+func (m *Oauth2Scopes) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // &{Name:additionalProperties Type:NamedString StringEnumValues:[] MapType:string Repeated:true Pattern: Implicit:true Description:}
+ return info
+}
+
+// ToRawInfo returns a description of Operation suitable for JSON or YAML export.
+func (m *Operation) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if len(m.Tags) != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("tags"))
+ info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Tags))
+ }
+ if m.Summary != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("summary"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Summary))
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.ExternalDocs != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs"))
+ info.Content = append(info.Content, m.ExternalDocs.ToRawInfo())
+ }
+ if m.OperationId != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("operationId"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.OperationId))
+ }
+ if len(m.Produces) != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("produces"))
+ info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Produces))
+ }
+ if len(m.Consumes) != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("consumes"))
+ info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Consumes))
+ }
+ if len(m.Parameters) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Parameters {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters"))
+ info.Content = append(info.Content, items)
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("responses"))
+ info.Content = append(info.Content, m.Responses.ToRawInfo())
+ if len(m.Schemes) != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("schemes"))
+ info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Schemes))
+ }
+ if m.Deprecated != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("deprecated"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Deprecated))
+ }
+ if len(m.Security) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Security {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("security"))
+ info.Content = append(info.Content, items)
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Parameter suitable for JSON or YAML export.
+func (m *Parameter) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // Parameter
+ // {Name:bodyParameter Type:BodyParameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v0 := m.GetBodyParameter()
+ if v0 != nil {
+ return v0.ToRawInfo()
+ }
+ // {Name:nonBodyParameter Type:NonBodyParameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v1 := m.GetNonBodyParameter()
+ if v1 != nil {
+ return v1.ToRawInfo()
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of ParameterDefinitions suitable for JSON or YAML export.
+func (m *ParameterDefinitions) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of ParametersItem suitable for JSON or YAML export.
+func (m *ParametersItem) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // ParametersItem
+ // {Name:parameter Type:Parameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v0 := m.GetParameter()
+ if v0 != nil {
+ return v0.ToRawInfo()
+ }
+ // {Name:jsonReference Type:JsonReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v1 := m.GetJsonReference()
+ if v1 != nil {
+ return v1.ToRawInfo()
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of PathItem suitable for JSON or YAML export.
+func (m *PathItem) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.XRef != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("$ref"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.XRef))
+ }
+ if m.Get != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("get"))
+ info.Content = append(info.Content, m.Get.ToRawInfo())
+ }
+ if m.Put != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("put"))
+ info.Content = append(info.Content, m.Put.ToRawInfo())
+ }
+ if m.Post != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("post"))
+ info.Content = append(info.Content, m.Post.ToRawInfo())
+ }
+ if m.Delete != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("delete"))
+ info.Content = append(info.Content, m.Delete.ToRawInfo())
+ }
+ if m.Options != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("options"))
+ info.Content = append(info.Content, m.Options.ToRawInfo())
+ }
+ if m.Head != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("head"))
+ info.Content = append(info.Content, m.Head.ToRawInfo())
+ }
+ if m.Patch != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("patch"))
+ info.Content = append(info.Content, m.Patch.ToRawInfo())
+ }
+ if len(m.Parameters) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Parameters {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters"))
+ info.Content = append(info.Content, items)
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of PathParameterSubSchema suitable for JSON or YAML export.
+func (m *PathParameterSubSchema) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("required"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required))
+ if m.In != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("in"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In))
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ if m.Type != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ }
+ if m.Format != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("format"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format))
+ }
+ if m.Items != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("items"))
+ info.Content = append(info.Content, m.Items.ToRawInfo())
+ }
+ if m.CollectionFormat != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat))
+ }
+ if m.Default != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("default"))
+ info.Content = append(info.Content, m.Default.ToRawInfo())
+ }
+ if m.Maximum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum))
+ }
+ if m.ExclusiveMaximum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum))
+ }
+ if m.Minimum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum))
+ }
+ if m.ExclusiveMinimum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum))
+ }
+ if m.MaxLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength))
+ }
+ if m.MinLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength))
+ }
+ if m.Pattern != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern))
+ }
+ if m.MaxItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems))
+ }
+ if m.MinItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems))
+ }
+ if m.UniqueItems != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems))
+ }
+ if len(m.Enum) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Enum {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("enum"))
+ info.Content = append(info.Content, items)
+ }
+ if m.MultipleOf != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Paths suitable for JSON or YAML export.
+func (m *Paths) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ if m.Path != nil {
+ for _, item := range m.Path {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of PrimitivesItems suitable for JSON or YAML export.
+func (m *PrimitivesItems) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Type != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ }
+ if m.Format != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("format"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format))
+ }
+ if m.Items != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("items"))
+ info.Content = append(info.Content, m.Items.ToRawInfo())
+ }
+ if m.CollectionFormat != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat))
+ }
+ if m.Default != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("default"))
+ info.Content = append(info.Content, m.Default.ToRawInfo())
+ }
+ if m.Maximum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum))
+ }
+ if m.ExclusiveMaximum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum))
+ }
+ if m.Minimum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum))
+ }
+ if m.ExclusiveMinimum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum))
+ }
+ if m.MaxLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength))
+ }
+ if m.MinLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength))
+ }
+ if m.Pattern != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern))
+ }
+ if m.MaxItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems))
+ }
+ if m.MinItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems))
+ }
+ if m.UniqueItems != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems))
+ }
+ if len(m.Enum) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Enum {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("enum"))
+ info.Content = append(info.Content, items)
+ }
+ if m.MultipleOf != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Properties suitable for JSON or YAML export.
+func (m *Properties) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of QueryParameterSubSchema suitable for JSON or YAML export.
+func (m *QueryParameterSubSchema) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Required != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("required"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required))
+ }
+ if m.In != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("in"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In))
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ if m.AllowEmptyValue != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("allowEmptyValue"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.AllowEmptyValue))
+ }
+ if m.Type != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ }
+ if m.Format != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("format"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format))
+ }
+ if m.Items != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("items"))
+ info.Content = append(info.Content, m.Items.ToRawInfo())
+ }
+ if m.CollectionFormat != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat))
+ }
+ if m.Default != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("default"))
+ info.Content = append(info.Content, m.Default.ToRawInfo())
+ }
+ if m.Maximum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum))
+ }
+ if m.ExclusiveMaximum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum))
+ }
+ if m.Minimum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum))
+ }
+ if m.ExclusiveMinimum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum))
+ }
+ if m.MaxLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength))
+ }
+ if m.MinLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength))
+ }
+ if m.Pattern != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern))
+ }
+ if m.MaxItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems))
+ }
+ if m.MinItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems))
+ }
+ if m.UniqueItems != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems))
+ }
+ if len(m.Enum) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Enum {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("enum"))
+ info.Content = append(info.Content, items)
+ }
+ if m.MultipleOf != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Response suitable for JSON or YAML export.
+func (m *Response) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ if m.Schema != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("schema"))
+ info.Content = append(info.Content, m.Schema.ToRawInfo())
+ }
+ if m.Headers != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("headers"))
+ info.Content = append(info.Content, m.Headers.ToRawInfo())
+ }
+ if m.Examples != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("examples"))
+ info.Content = append(info.Content, m.Examples.ToRawInfo())
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of ResponseDefinitions suitable for JSON or YAML export.
+func (m *ResponseDefinitions) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of ResponseValue suitable for JSON or YAML export.
+func (m *ResponseValue) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // ResponseValue
+ // {Name:response Type:Response StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v0 := m.GetResponse()
+ if v0 != nil {
+ return v0.ToRawInfo()
+ }
+ // {Name:jsonReference Type:JsonReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v1 := m.GetJsonReference()
+ if v1 != nil {
+ return v1.ToRawInfo()
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of Responses suitable for JSON or YAML export.
+func (m *Responses) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.ResponseCode != nil {
+ for _, item := range m.ResponseCode {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Schema suitable for JSON or YAML export.
+func (m *Schema) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.XRef != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("$ref"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.XRef))
+ }
+ if m.Format != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("format"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format))
+ }
+ if m.Title != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("title"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Title))
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.Default != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("default"))
+ info.Content = append(info.Content, m.Default.ToRawInfo())
+ }
+ if m.MultipleOf != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf))
+ }
+ if m.Maximum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum))
+ }
+ if m.ExclusiveMaximum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum))
+ }
+ if m.Minimum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum))
+ }
+ if m.ExclusiveMinimum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum))
+ }
+ if m.MaxLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength))
+ }
+ if m.MinLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength))
+ }
+ if m.Pattern != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern))
+ }
+ if m.MaxItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems))
+ }
+ if m.MinItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems))
+ }
+ if m.UniqueItems != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems))
+ }
+ if m.MaxProperties != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxProperties"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxProperties))
+ }
+ if m.MinProperties != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minProperties"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinProperties))
+ }
+ if len(m.Required) != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("required"))
+ info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Required))
+ }
+ if len(m.Enum) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Enum {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("enum"))
+ info.Content = append(info.Content, items)
+ }
+ if m.AdditionalProperties != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("additionalProperties"))
+ info.Content = append(info.Content, m.AdditionalProperties.ToRawInfo())
+ }
+ if m.Type != nil {
+ if len(m.Type.Value) == 1 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type.Value[0]))
+ } else {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Type.Value))
+ }
+ }
+ if m.Items != nil {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Items.Schema {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ if len(items.Content) == 1 {
+ items = items.Content[0]
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("items"))
+ info.Content = append(info.Content, items)
+ }
+ if len(m.AllOf) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.AllOf {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("allOf"))
+ info.Content = append(info.Content, items)
+ }
+ if m.Properties != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("properties"))
+ info.Content = append(info.Content, m.Properties.ToRawInfo())
+ }
+ if m.Discriminator != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("discriminator"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Discriminator))
+ }
+ if m.ReadOnly != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("readOnly"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ReadOnly))
+ }
+ if m.Xml != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("xml"))
+ info.Content = append(info.Content, m.Xml.ToRawInfo())
+ }
+ if m.ExternalDocs != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs"))
+ info.Content = append(info.Content, m.ExternalDocs.ToRawInfo())
+ }
+ if m.Example != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("example"))
+ info.Content = append(info.Content, m.Example.ToRawInfo())
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of SchemaItem suitable for JSON or YAML export.
+func (m *SchemaItem) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // SchemaItem
+ // {Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v0 := m.GetSchema()
+ if v0 != nil {
+ return v0.ToRawInfo()
+ }
+ // {Name:fileSchema Type:FileSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v1 := m.GetFileSchema()
+ if v1 != nil {
+ return v1.ToRawInfo()
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of SecurityDefinitions suitable for JSON or YAML export.
+func (m *SecurityDefinitions) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of SecurityDefinitionsItem suitable for JSON or YAML export.
+func (m *SecurityDefinitionsItem) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // SecurityDefinitionsItem
+ // {Name:basicAuthenticationSecurity Type:BasicAuthenticationSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v0 := m.GetBasicAuthenticationSecurity()
+ if v0 != nil {
+ return v0.ToRawInfo()
+ }
+ // {Name:apiKeySecurity Type:ApiKeySecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v1 := m.GetApiKeySecurity()
+ if v1 != nil {
+ return v1.ToRawInfo()
+ }
+ // {Name:oauth2ImplicitSecurity Type:Oauth2ImplicitSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v2 := m.GetOauth2ImplicitSecurity()
+ if v2 != nil {
+ return v2.ToRawInfo()
+ }
+ // {Name:oauth2PasswordSecurity Type:Oauth2PasswordSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v3 := m.GetOauth2PasswordSecurity()
+ if v3 != nil {
+ return v3.ToRawInfo()
+ }
+ // {Name:oauth2ApplicationSecurity Type:Oauth2ApplicationSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v4 := m.GetOauth2ApplicationSecurity()
+ if v4 != nil {
+ return v4.ToRawInfo()
+ }
+ // {Name:oauth2AccessCodeSecurity Type:Oauth2AccessCodeSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v5 := m.GetOauth2AccessCodeSecurity()
+ if v5 != nil {
+ return v5.ToRawInfo()
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of SecurityRequirement suitable for JSON or YAML export.
+func (m *SecurityRequirement) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of StringArray suitable for JSON or YAML export.
+func (m *StringArray) ToRawInfo() *yaml.Node {
+ return compiler.NewSequenceNodeForStringArray(m.Value)
+}
+
+// ToRawInfo returns a description of Tag suitable for JSON or YAML export.
+func (m *Tag) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.ExternalDocs != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs"))
+ info.Content = append(info.Content, m.ExternalDocs.ToRawInfo())
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of TypeItem suitable for JSON or YAML export.
+func (m *TypeItem) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if len(m.Value) != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("value"))
+ info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Value))
+ }
+ return info
+}
+
+// ToRawInfo returns a description of VendorExtension suitable for JSON or YAML export.
+func (m *VendorExtension) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Xml suitable for JSON or YAML export.
+func (m *Xml) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ if m.Namespace != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("namespace"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Namespace))
+ }
+ if m.Prefix != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("prefix"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Prefix))
+ }
+ if m.Attribute != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("attribute"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Attribute))
+ }
+ if m.Wrapped != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("wrapped"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Wrapped))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+var (
+ pattern0 = regexp.MustCompile("^x-")
+ pattern1 = regexp.MustCompile("^/")
+ pattern2 = regexp.MustCompile("^([0-9]{3})$|^(default)$")
+)
diff --git a/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.pb.go b/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.pb.go
new file mode 100644
index 000000000..65c4c913c
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.pb.go
@@ -0,0 +1,7342 @@
+// Copyright 2020 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// THIS FILE IS AUTOMATICALLY GENERATED.
+
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.27.1
+// protoc v3.19.3
+// source: openapiv2/OpenAPIv2.proto
+
+package openapi_v2
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ anypb "google.golang.org/protobuf/types/known/anypb"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type AdditionalPropertiesItem struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *AdditionalPropertiesItem_Schema
+ // *AdditionalPropertiesItem_Boolean
+ Oneof isAdditionalPropertiesItem_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *AdditionalPropertiesItem) Reset() {
+ *x = AdditionalPropertiesItem{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *AdditionalPropertiesItem) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*AdditionalPropertiesItem) ProtoMessage() {}
+
+func (x *AdditionalPropertiesItem) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use AdditionalPropertiesItem.ProtoReflect.Descriptor instead.
+func (*AdditionalPropertiesItem) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{0}
+}
+
+func (m *AdditionalPropertiesItem) GetOneof() isAdditionalPropertiesItem_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *AdditionalPropertiesItem) GetSchema() *Schema {
+ if x, ok := x.GetOneof().(*AdditionalPropertiesItem_Schema); ok {
+ return x.Schema
+ }
+ return nil
+}
+
+func (x *AdditionalPropertiesItem) GetBoolean() bool {
+ if x, ok := x.GetOneof().(*AdditionalPropertiesItem_Boolean); ok {
+ return x.Boolean
+ }
+ return false
+}
+
+type isAdditionalPropertiesItem_Oneof interface {
+ isAdditionalPropertiesItem_Oneof()
+}
+
+type AdditionalPropertiesItem_Schema struct {
+ Schema *Schema `protobuf:"bytes,1,opt,name=schema,proto3,oneof"`
+}
+
+type AdditionalPropertiesItem_Boolean struct {
+ Boolean bool `protobuf:"varint,2,opt,name=boolean,proto3,oneof"`
+}
+
+func (*AdditionalPropertiesItem_Schema) isAdditionalPropertiesItem_Oneof() {}
+
+func (*AdditionalPropertiesItem_Boolean) isAdditionalPropertiesItem_Oneof() {}
+
+type Any struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Value *anypb.Any `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
+ Yaml string `protobuf:"bytes,2,opt,name=yaml,proto3" json:"yaml,omitempty"`
+}
+
+func (x *Any) Reset() {
+ *x = Any{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Any) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Any) ProtoMessage() {}
+
+func (x *Any) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Any.ProtoReflect.Descriptor instead.
+func (*Any) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *Any) GetValue() *anypb.Any {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+func (x *Any) GetYaml() string {
+ if x != nil {
+ return x.Yaml
+ }
+ return ""
+}
+
+type ApiKeySecurity struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
+ Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
+ In string `protobuf:"bytes,3,opt,name=in,proto3" json:"in,omitempty"`
+ Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,5,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *ApiKeySecurity) Reset() {
+ *x = ApiKeySecurity{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ApiKeySecurity) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ApiKeySecurity) ProtoMessage() {}
+
+func (x *ApiKeySecurity) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ApiKeySecurity.ProtoReflect.Descriptor instead.
+func (*ApiKeySecurity) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *ApiKeySecurity) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *ApiKeySecurity) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *ApiKeySecurity) GetIn() string {
+ if x != nil {
+ return x.In
+ }
+ return ""
+}
+
+func (x *ApiKeySecurity) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *ApiKeySecurity) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type BasicAuthenticationSecurity struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
+ Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,3,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *BasicAuthenticationSecurity) Reset() {
+ *x = BasicAuthenticationSecurity{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *BasicAuthenticationSecurity) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*BasicAuthenticationSecurity) ProtoMessage() {}
+
+func (x *BasicAuthenticationSecurity) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use BasicAuthenticationSecurity.ProtoReflect.Descriptor instead.
+func (*BasicAuthenticationSecurity) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *BasicAuthenticationSecurity) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *BasicAuthenticationSecurity) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *BasicAuthenticationSecurity) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type BodyParameter struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
+ Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"`
+ // The name of the parameter.
+ Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
+ // Determines the location of the parameter.
+ In string `protobuf:"bytes,3,opt,name=in,proto3" json:"in,omitempty"`
+ // Determines whether or not this parameter is required or optional.
+ Required bool `protobuf:"varint,4,opt,name=required,proto3" json:"required,omitempty"`
+ Schema *Schema `protobuf:"bytes,5,opt,name=schema,proto3" json:"schema,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *BodyParameter) Reset() {
+ *x = BodyParameter{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *BodyParameter) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*BodyParameter) ProtoMessage() {}
+
+func (x *BodyParameter) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[4]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use BodyParameter.ProtoReflect.Descriptor instead.
+func (*BodyParameter) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{4}
+}
+
+func (x *BodyParameter) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *BodyParameter) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *BodyParameter) GetIn() string {
+ if x != nil {
+ return x.In
+ }
+ return ""
+}
+
+func (x *BodyParameter) GetRequired() bool {
+ if x != nil {
+ return x.Required
+ }
+ return false
+}
+
+func (x *BodyParameter) GetSchema() *Schema {
+ if x != nil {
+ return x.Schema
+ }
+ return nil
+}
+
+func (x *BodyParameter) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+// Contact information for the owners of the API.
+type Contact struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The identifying name of the contact person/organization.
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // The URL pointing to the contact information.
+ Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
+ // The email address of the contact person/organization.
+ Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,4,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Contact) Reset() {
+ *x = Contact{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[5]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Contact) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Contact) ProtoMessage() {}
+
+func (x *Contact) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[5]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Contact.ProtoReflect.Descriptor instead.
+func (*Contact) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{5}
+}
+
+func (x *Contact) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *Contact) GetUrl() string {
+ if x != nil {
+ return x.Url
+ }
+ return ""
+}
+
+func (x *Contact) GetEmail() string {
+ if x != nil {
+ return x.Email
+ }
+ return ""
+}
+
+func (x *Contact) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type Default struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedAny `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *Default) Reset() {
+ *x = Default{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[6]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Default) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Default) ProtoMessage() {}
+
+func (x *Default) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[6]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Default.ProtoReflect.Descriptor instead.
+func (*Default) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{6}
+}
+
+func (x *Default) GetAdditionalProperties() []*NamedAny {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+// One or more JSON objects describing the schemas being consumed and produced by the API.
+type Definitions struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedSchema `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *Definitions) Reset() {
+ *x = Definitions{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[7]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Definitions) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Definitions) ProtoMessage() {}
+
+func (x *Definitions) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[7]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Definitions.ProtoReflect.Descriptor instead.
+func (*Definitions) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{7}
+}
+
+func (x *Definitions) GetAdditionalProperties() []*NamedSchema {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+type Document struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The Swagger version of this document.
+ Swagger string `protobuf:"bytes,1,opt,name=swagger,proto3" json:"swagger,omitempty"`
+ Info *Info `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"`
+ // The host (name or ip) of the API. Example: 'swagger.io'
+ Host string `protobuf:"bytes,3,opt,name=host,proto3" json:"host,omitempty"`
+ // The base path to the API. Example: '/api'.
+ BasePath string `protobuf:"bytes,4,opt,name=base_path,json=basePath,proto3" json:"base_path,omitempty"`
+ // The transfer protocol of the API.
+ Schemes []string `protobuf:"bytes,5,rep,name=schemes,proto3" json:"schemes,omitempty"`
+ // A list of MIME types accepted by the API.
+ Consumes []string `protobuf:"bytes,6,rep,name=consumes,proto3" json:"consumes,omitempty"`
+ // A list of MIME types the API can produce.
+ Produces []string `protobuf:"bytes,7,rep,name=produces,proto3" json:"produces,omitempty"`
+ Paths *Paths `protobuf:"bytes,8,opt,name=paths,proto3" json:"paths,omitempty"`
+ Definitions *Definitions `protobuf:"bytes,9,opt,name=definitions,proto3" json:"definitions,omitempty"`
+ Parameters *ParameterDefinitions `protobuf:"bytes,10,opt,name=parameters,proto3" json:"parameters,omitempty"`
+ Responses *ResponseDefinitions `protobuf:"bytes,11,opt,name=responses,proto3" json:"responses,omitempty"`
+ Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security,proto3" json:"security,omitempty"`
+ SecurityDefinitions *SecurityDefinitions `protobuf:"bytes,13,opt,name=security_definitions,json=securityDefinitions,proto3" json:"security_definitions,omitempty"`
+ Tags []*Tag `protobuf:"bytes,14,rep,name=tags,proto3" json:"tags,omitempty"`
+ ExternalDocs *ExternalDocs `protobuf:"bytes,15,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,16,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Document) Reset() {
+ *x = Document{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[8]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Document) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Document) ProtoMessage() {}
+
+func (x *Document) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[8]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Document.ProtoReflect.Descriptor instead.
+func (*Document) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{8}
+}
+
+func (x *Document) GetSwagger() string {
+ if x != nil {
+ return x.Swagger
+ }
+ return ""
+}
+
+func (x *Document) GetInfo() *Info {
+ if x != nil {
+ return x.Info
+ }
+ return nil
+}
+
+func (x *Document) GetHost() string {
+ if x != nil {
+ return x.Host
+ }
+ return ""
+}
+
+func (x *Document) GetBasePath() string {
+ if x != nil {
+ return x.BasePath
+ }
+ return ""
+}
+
+func (x *Document) GetSchemes() []string {
+ if x != nil {
+ return x.Schemes
+ }
+ return nil
+}
+
+func (x *Document) GetConsumes() []string {
+ if x != nil {
+ return x.Consumes
+ }
+ return nil
+}
+
+func (x *Document) GetProduces() []string {
+ if x != nil {
+ return x.Produces
+ }
+ return nil
+}
+
+func (x *Document) GetPaths() *Paths {
+ if x != nil {
+ return x.Paths
+ }
+ return nil
+}
+
+func (x *Document) GetDefinitions() *Definitions {
+ if x != nil {
+ return x.Definitions
+ }
+ return nil
+}
+
+func (x *Document) GetParameters() *ParameterDefinitions {
+ if x != nil {
+ return x.Parameters
+ }
+ return nil
+}
+
+func (x *Document) GetResponses() *ResponseDefinitions {
+ if x != nil {
+ return x.Responses
+ }
+ return nil
+}
+
+func (x *Document) GetSecurity() []*SecurityRequirement {
+ if x != nil {
+ return x.Security
+ }
+ return nil
+}
+
+func (x *Document) GetSecurityDefinitions() *SecurityDefinitions {
+ if x != nil {
+ return x.SecurityDefinitions
+ }
+ return nil
+}
+
+func (x *Document) GetTags() []*Tag {
+ if x != nil {
+ return x.Tags
+ }
+ return nil
+}
+
+func (x *Document) GetExternalDocs() *ExternalDocs {
+ if x != nil {
+ return x.ExternalDocs
+ }
+ return nil
+}
+
+func (x *Document) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type Examples struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedAny `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *Examples) Reset() {
+ *x = Examples{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[9]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Examples) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Examples) ProtoMessage() {}
+
+func (x *Examples) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[9]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Examples.ProtoReflect.Descriptor instead.
+func (*Examples) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{9}
+}
+
+func (x *Examples) GetAdditionalProperties() []*NamedAny {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+// information about external documentation
+type ExternalDocs struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"`
+ Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,3,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *ExternalDocs) Reset() {
+ *x = ExternalDocs{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[10]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ExternalDocs) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ExternalDocs) ProtoMessage() {}
+
+func (x *ExternalDocs) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[10]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ExternalDocs.ProtoReflect.Descriptor instead.
+func (*ExternalDocs) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{10}
+}
+
+func (x *ExternalDocs) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *ExternalDocs) GetUrl() string {
+ if x != nil {
+ return x.Url
+ }
+ return ""
+}
+
+func (x *ExternalDocs) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+// A deterministic version of a JSON Schema object.
+type FileSchema struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Format string `protobuf:"bytes,1,opt,name=format,proto3" json:"format,omitempty"`
+ Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
+ Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
+ Default *Any `protobuf:"bytes,4,opt,name=default,proto3" json:"default,omitempty"`
+ Required []string `protobuf:"bytes,5,rep,name=required,proto3" json:"required,omitempty"`
+ Type string `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty"`
+ ReadOnly bool `protobuf:"varint,7,opt,name=read_only,json=readOnly,proto3" json:"read_only,omitempty"`
+ ExternalDocs *ExternalDocs `protobuf:"bytes,8,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"`
+ Example *Any `protobuf:"bytes,9,opt,name=example,proto3" json:"example,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,10,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *FileSchema) Reset() {
+ *x = FileSchema{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[11]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *FileSchema) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*FileSchema) ProtoMessage() {}
+
+func (x *FileSchema) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[11]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use FileSchema.ProtoReflect.Descriptor instead.
+func (*FileSchema) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{11}
+}
+
+func (x *FileSchema) GetFormat() string {
+ if x != nil {
+ return x.Format
+ }
+ return ""
+}
+
+func (x *FileSchema) GetTitle() string {
+ if x != nil {
+ return x.Title
+ }
+ return ""
+}
+
+func (x *FileSchema) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *FileSchema) GetDefault() *Any {
+ if x != nil {
+ return x.Default
+ }
+ return nil
+}
+
+func (x *FileSchema) GetRequired() []string {
+ if x != nil {
+ return x.Required
+ }
+ return nil
+}
+
+func (x *FileSchema) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *FileSchema) GetReadOnly() bool {
+ if x != nil {
+ return x.ReadOnly
+ }
+ return false
+}
+
+func (x *FileSchema) GetExternalDocs() *ExternalDocs {
+ if x != nil {
+ return x.ExternalDocs
+ }
+ return nil
+}
+
+func (x *FileSchema) GetExample() *Any {
+ if x != nil {
+ return x.Example
+ }
+ return nil
+}
+
+func (x *FileSchema) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type FormDataParameterSubSchema struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Determines whether or not this parameter is required or optional.
+ Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"`
+ // Determines the location of the parameter.
+ In string `protobuf:"bytes,2,opt,name=in,proto3" json:"in,omitempty"`
+ // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
+ Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
+ // The name of the parameter.
+ Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
+ // allows sending a parameter by name only or with an empty value.
+ AllowEmptyValue bool `protobuf:"varint,5,opt,name=allow_empty_value,json=allowEmptyValue,proto3" json:"allow_empty_value,omitempty"`
+ Type string `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty"`
+ Format string `protobuf:"bytes,7,opt,name=format,proto3" json:"format,omitempty"`
+ Items *PrimitivesItems `protobuf:"bytes,8,opt,name=items,proto3" json:"items,omitempty"`
+ CollectionFormat string `protobuf:"bytes,9,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"`
+ Default *Any `protobuf:"bytes,10,opt,name=default,proto3" json:"default,omitempty"`
+ Maximum float64 `protobuf:"fixed64,11,opt,name=maximum,proto3" json:"maximum,omitempty"`
+ ExclusiveMaximum bool `protobuf:"varint,12,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"`
+ Minimum float64 `protobuf:"fixed64,13,opt,name=minimum,proto3" json:"minimum,omitempty"`
+ ExclusiveMinimum bool `protobuf:"varint,14,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"`
+ MaxLength int64 `protobuf:"varint,15,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"`
+ MinLength int64 `protobuf:"varint,16,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"`
+ Pattern string `protobuf:"bytes,17,opt,name=pattern,proto3" json:"pattern,omitempty"`
+ MaxItems int64 `protobuf:"varint,18,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"`
+ MinItems int64 `protobuf:"varint,19,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"`
+ UniqueItems bool `protobuf:"varint,20,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"`
+ Enum []*Any `protobuf:"bytes,21,rep,name=enum,proto3" json:"enum,omitempty"`
+ MultipleOf float64 `protobuf:"fixed64,22,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,23,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *FormDataParameterSubSchema) Reset() {
+ *x = FormDataParameterSubSchema{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[12]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *FormDataParameterSubSchema) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*FormDataParameterSubSchema) ProtoMessage() {}
+
+func (x *FormDataParameterSubSchema) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[12]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use FormDataParameterSubSchema.ProtoReflect.Descriptor instead.
+func (*FormDataParameterSubSchema) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{12}
+}
+
+func (x *FormDataParameterSubSchema) GetRequired() bool {
+ if x != nil {
+ return x.Required
+ }
+ return false
+}
+
+func (x *FormDataParameterSubSchema) GetIn() string {
+ if x != nil {
+ return x.In
+ }
+ return ""
+}
+
+func (x *FormDataParameterSubSchema) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *FormDataParameterSubSchema) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *FormDataParameterSubSchema) GetAllowEmptyValue() bool {
+ if x != nil {
+ return x.AllowEmptyValue
+ }
+ return false
+}
+
+func (x *FormDataParameterSubSchema) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *FormDataParameterSubSchema) GetFormat() string {
+ if x != nil {
+ return x.Format
+ }
+ return ""
+}
+
+func (x *FormDataParameterSubSchema) GetItems() *PrimitivesItems {
+ if x != nil {
+ return x.Items
+ }
+ return nil
+}
+
+func (x *FormDataParameterSubSchema) GetCollectionFormat() string {
+ if x != nil {
+ return x.CollectionFormat
+ }
+ return ""
+}
+
+func (x *FormDataParameterSubSchema) GetDefault() *Any {
+ if x != nil {
+ return x.Default
+ }
+ return nil
+}
+
+func (x *FormDataParameterSubSchema) GetMaximum() float64 {
+ if x != nil {
+ return x.Maximum
+ }
+ return 0
+}
+
+func (x *FormDataParameterSubSchema) GetExclusiveMaximum() bool {
+ if x != nil {
+ return x.ExclusiveMaximum
+ }
+ return false
+}
+
+func (x *FormDataParameterSubSchema) GetMinimum() float64 {
+ if x != nil {
+ return x.Minimum
+ }
+ return 0
+}
+
+func (x *FormDataParameterSubSchema) GetExclusiveMinimum() bool {
+ if x != nil {
+ return x.ExclusiveMinimum
+ }
+ return false
+}
+
+func (x *FormDataParameterSubSchema) GetMaxLength() int64 {
+ if x != nil {
+ return x.MaxLength
+ }
+ return 0
+}
+
+func (x *FormDataParameterSubSchema) GetMinLength() int64 {
+ if x != nil {
+ return x.MinLength
+ }
+ return 0
+}
+
+func (x *FormDataParameterSubSchema) GetPattern() string {
+ if x != nil {
+ return x.Pattern
+ }
+ return ""
+}
+
+func (x *FormDataParameterSubSchema) GetMaxItems() int64 {
+ if x != nil {
+ return x.MaxItems
+ }
+ return 0
+}
+
+func (x *FormDataParameterSubSchema) GetMinItems() int64 {
+ if x != nil {
+ return x.MinItems
+ }
+ return 0
+}
+
+func (x *FormDataParameterSubSchema) GetUniqueItems() bool {
+ if x != nil {
+ return x.UniqueItems
+ }
+ return false
+}
+
+func (x *FormDataParameterSubSchema) GetEnum() []*Any {
+ if x != nil {
+ return x.Enum
+ }
+ return nil
+}
+
+func (x *FormDataParameterSubSchema) GetMultipleOf() float64 {
+ if x != nil {
+ return x.MultipleOf
+ }
+ return 0
+}
+
+func (x *FormDataParameterSubSchema) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type Header struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
+ Format string `protobuf:"bytes,2,opt,name=format,proto3" json:"format,omitempty"`
+ Items *PrimitivesItems `protobuf:"bytes,3,opt,name=items,proto3" json:"items,omitempty"`
+ CollectionFormat string `protobuf:"bytes,4,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"`
+ Default *Any `protobuf:"bytes,5,opt,name=default,proto3" json:"default,omitempty"`
+ Maximum float64 `protobuf:"fixed64,6,opt,name=maximum,proto3" json:"maximum,omitempty"`
+ ExclusiveMaximum bool `protobuf:"varint,7,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"`
+ Minimum float64 `protobuf:"fixed64,8,opt,name=minimum,proto3" json:"minimum,omitempty"`
+ ExclusiveMinimum bool `protobuf:"varint,9,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"`
+ MaxLength int64 `protobuf:"varint,10,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"`
+ MinLength int64 `protobuf:"varint,11,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"`
+ Pattern string `protobuf:"bytes,12,opt,name=pattern,proto3" json:"pattern,omitempty"`
+ MaxItems int64 `protobuf:"varint,13,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"`
+ MinItems int64 `protobuf:"varint,14,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"`
+ UniqueItems bool `protobuf:"varint,15,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"`
+ Enum []*Any `protobuf:"bytes,16,rep,name=enum,proto3" json:"enum,omitempty"`
+ MultipleOf float64 `protobuf:"fixed64,17,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"`
+ Description string `protobuf:"bytes,18,opt,name=description,proto3" json:"description,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,19,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Header) Reset() {
+ *x = Header{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[13]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Header) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Header) ProtoMessage() {}
+
+func (x *Header) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[13]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Header.ProtoReflect.Descriptor instead.
+func (*Header) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{13}
+}
+
+func (x *Header) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *Header) GetFormat() string {
+ if x != nil {
+ return x.Format
+ }
+ return ""
+}
+
+func (x *Header) GetItems() *PrimitivesItems {
+ if x != nil {
+ return x.Items
+ }
+ return nil
+}
+
+func (x *Header) GetCollectionFormat() string {
+ if x != nil {
+ return x.CollectionFormat
+ }
+ return ""
+}
+
+func (x *Header) GetDefault() *Any {
+ if x != nil {
+ return x.Default
+ }
+ return nil
+}
+
+func (x *Header) GetMaximum() float64 {
+ if x != nil {
+ return x.Maximum
+ }
+ return 0
+}
+
+func (x *Header) GetExclusiveMaximum() bool {
+ if x != nil {
+ return x.ExclusiveMaximum
+ }
+ return false
+}
+
+func (x *Header) GetMinimum() float64 {
+ if x != nil {
+ return x.Minimum
+ }
+ return 0
+}
+
+func (x *Header) GetExclusiveMinimum() bool {
+ if x != nil {
+ return x.ExclusiveMinimum
+ }
+ return false
+}
+
+func (x *Header) GetMaxLength() int64 {
+ if x != nil {
+ return x.MaxLength
+ }
+ return 0
+}
+
+func (x *Header) GetMinLength() int64 {
+ if x != nil {
+ return x.MinLength
+ }
+ return 0
+}
+
+func (x *Header) GetPattern() string {
+ if x != nil {
+ return x.Pattern
+ }
+ return ""
+}
+
+func (x *Header) GetMaxItems() int64 {
+ if x != nil {
+ return x.MaxItems
+ }
+ return 0
+}
+
+func (x *Header) GetMinItems() int64 {
+ if x != nil {
+ return x.MinItems
+ }
+ return 0
+}
+
+func (x *Header) GetUniqueItems() bool {
+ if x != nil {
+ return x.UniqueItems
+ }
+ return false
+}
+
+func (x *Header) GetEnum() []*Any {
+ if x != nil {
+ return x.Enum
+ }
+ return nil
+}
+
+func (x *Header) GetMultipleOf() float64 {
+ if x != nil {
+ return x.MultipleOf
+ }
+ return 0
+}
+
+func (x *Header) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Header) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type HeaderParameterSubSchema struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Determines whether or not this parameter is required or optional.
+ Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"`
+ // Determines the location of the parameter.
+ In string `protobuf:"bytes,2,opt,name=in,proto3" json:"in,omitempty"`
+ // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
+ Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
+ // The name of the parameter.
+ Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
+ Type string `protobuf:"bytes,5,opt,name=type,proto3" json:"type,omitempty"`
+ Format string `protobuf:"bytes,6,opt,name=format,proto3" json:"format,omitempty"`
+ Items *PrimitivesItems `protobuf:"bytes,7,opt,name=items,proto3" json:"items,omitempty"`
+ CollectionFormat string `protobuf:"bytes,8,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"`
+ Default *Any `protobuf:"bytes,9,opt,name=default,proto3" json:"default,omitempty"`
+ Maximum float64 `protobuf:"fixed64,10,opt,name=maximum,proto3" json:"maximum,omitempty"`
+ ExclusiveMaximum bool `protobuf:"varint,11,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"`
+ Minimum float64 `protobuf:"fixed64,12,opt,name=minimum,proto3" json:"minimum,omitempty"`
+ ExclusiveMinimum bool `protobuf:"varint,13,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"`
+ MaxLength int64 `protobuf:"varint,14,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"`
+ MinLength int64 `protobuf:"varint,15,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"`
+ Pattern string `protobuf:"bytes,16,opt,name=pattern,proto3" json:"pattern,omitempty"`
+ MaxItems int64 `protobuf:"varint,17,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"`
+ MinItems int64 `protobuf:"varint,18,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"`
+ UniqueItems bool `protobuf:"varint,19,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"`
+ Enum []*Any `protobuf:"bytes,20,rep,name=enum,proto3" json:"enum,omitempty"`
+ MultipleOf float64 `protobuf:"fixed64,21,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,22,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *HeaderParameterSubSchema) Reset() {
+ *x = HeaderParameterSubSchema{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[14]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *HeaderParameterSubSchema) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*HeaderParameterSubSchema) ProtoMessage() {}
+
+func (x *HeaderParameterSubSchema) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[14]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use HeaderParameterSubSchema.ProtoReflect.Descriptor instead.
+func (*HeaderParameterSubSchema) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{14}
+}
+
+func (x *HeaderParameterSubSchema) GetRequired() bool {
+ if x != nil {
+ return x.Required
+ }
+ return false
+}
+
+func (x *HeaderParameterSubSchema) GetIn() string {
+ if x != nil {
+ return x.In
+ }
+ return ""
+}
+
+func (x *HeaderParameterSubSchema) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *HeaderParameterSubSchema) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *HeaderParameterSubSchema) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *HeaderParameterSubSchema) GetFormat() string {
+ if x != nil {
+ return x.Format
+ }
+ return ""
+}
+
+func (x *HeaderParameterSubSchema) GetItems() *PrimitivesItems {
+ if x != nil {
+ return x.Items
+ }
+ return nil
+}
+
+func (x *HeaderParameterSubSchema) GetCollectionFormat() string {
+ if x != nil {
+ return x.CollectionFormat
+ }
+ return ""
+}
+
+func (x *HeaderParameterSubSchema) GetDefault() *Any {
+ if x != nil {
+ return x.Default
+ }
+ return nil
+}
+
+func (x *HeaderParameterSubSchema) GetMaximum() float64 {
+ if x != nil {
+ return x.Maximum
+ }
+ return 0
+}
+
+func (x *HeaderParameterSubSchema) GetExclusiveMaximum() bool {
+ if x != nil {
+ return x.ExclusiveMaximum
+ }
+ return false
+}
+
+func (x *HeaderParameterSubSchema) GetMinimum() float64 {
+ if x != nil {
+ return x.Minimum
+ }
+ return 0
+}
+
+func (x *HeaderParameterSubSchema) GetExclusiveMinimum() bool {
+ if x != nil {
+ return x.ExclusiveMinimum
+ }
+ return false
+}
+
+func (x *HeaderParameterSubSchema) GetMaxLength() int64 {
+ if x != nil {
+ return x.MaxLength
+ }
+ return 0
+}
+
+func (x *HeaderParameterSubSchema) GetMinLength() int64 {
+ if x != nil {
+ return x.MinLength
+ }
+ return 0
+}
+
+func (x *HeaderParameterSubSchema) GetPattern() string {
+ if x != nil {
+ return x.Pattern
+ }
+ return ""
+}
+
+func (x *HeaderParameterSubSchema) GetMaxItems() int64 {
+ if x != nil {
+ return x.MaxItems
+ }
+ return 0
+}
+
+func (x *HeaderParameterSubSchema) GetMinItems() int64 {
+ if x != nil {
+ return x.MinItems
+ }
+ return 0
+}
+
+func (x *HeaderParameterSubSchema) GetUniqueItems() bool {
+ if x != nil {
+ return x.UniqueItems
+ }
+ return false
+}
+
+func (x *HeaderParameterSubSchema) GetEnum() []*Any {
+ if x != nil {
+ return x.Enum
+ }
+ return nil
+}
+
+func (x *HeaderParameterSubSchema) GetMultipleOf() float64 {
+ if x != nil {
+ return x.MultipleOf
+ }
+ return 0
+}
+
+func (x *HeaderParameterSubSchema) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type Headers struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedHeader `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *Headers) Reset() {
+ *x = Headers{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[15]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Headers) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Headers) ProtoMessage() {}
+
+func (x *Headers) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[15]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Headers.ProtoReflect.Descriptor instead.
+func (*Headers) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{15}
+}
+
+func (x *Headers) GetAdditionalProperties() []*NamedHeader {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+// General information about the API.
+type Info struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // A unique and precise title of the API.
+ Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
+ // A semantic version number of the API.
+ Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
+ // A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed.
+ Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
+ // The terms of service for the API.
+ TermsOfService string `protobuf:"bytes,4,opt,name=terms_of_service,json=termsOfService,proto3" json:"terms_of_service,omitempty"`
+ Contact *Contact `protobuf:"bytes,5,opt,name=contact,proto3" json:"contact,omitempty"`
+ License *License `protobuf:"bytes,6,opt,name=license,proto3" json:"license,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,7,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Info) Reset() {
+ *x = Info{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[16]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Info) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Info) ProtoMessage() {}
+
+func (x *Info) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[16]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Info.ProtoReflect.Descriptor instead.
+func (*Info) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{16}
+}
+
+func (x *Info) GetTitle() string {
+ if x != nil {
+ return x.Title
+ }
+ return ""
+}
+
+func (x *Info) GetVersion() string {
+ if x != nil {
+ return x.Version
+ }
+ return ""
+}
+
+func (x *Info) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Info) GetTermsOfService() string {
+ if x != nil {
+ return x.TermsOfService
+ }
+ return ""
+}
+
+func (x *Info) GetContact() *Contact {
+ if x != nil {
+ return x.Contact
+ }
+ return nil
+}
+
+func (x *Info) GetLicense() *License {
+ if x != nil {
+ return x.License
+ }
+ return nil
+}
+
+func (x *Info) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type ItemsItem struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Schema []*Schema `protobuf:"bytes,1,rep,name=schema,proto3" json:"schema,omitempty"`
+}
+
+func (x *ItemsItem) Reset() {
+ *x = ItemsItem{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[17]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ItemsItem) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ItemsItem) ProtoMessage() {}
+
+func (x *ItemsItem) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[17]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ItemsItem.ProtoReflect.Descriptor instead.
+func (*ItemsItem) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{17}
+}
+
+func (x *ItemsItem) GetSchema() []*Schema {
+ if x != nil {
+ return x.Schema
+ }
+ return nil
+}
+
+type JsonReference struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ XRef string `protobuf:"bytes,1,opt,name=_ref,json=Ref,proto3" json:"_ref,omitempty"`
+ Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
+}
+
+func (x *JsonReference) Reset() {
+ *x = JsonReference{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[18]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *JsonReference) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*JsonReference) ProtoMessage() {}
+
+func (x *JsonReference) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[18]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use JsonReference.ProtoReflect.Descriptor instead.
+func (*JsonReference) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{18}
+}
+
+func (x *JsonReference) GetXRef() string {
+ if x != nil {
+ return x.XRef
+ }
+ return ""
+}
+
+func (x *JsonReference) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+type License struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The name of the license type. It's encouraged to use an OSI compatible license.
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // The URL pointing to the license.
+ Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,3,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *License) Reset() {
+ *x = License{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[19]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *License) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*License) ProtoMessage() {}
+
+func (x *License) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[19]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use License.ProtoReflect.Descriptor instead.
+func (*License) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{19}
+}
+
+func (x *License) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *License) GetUrl() string {
+ if x != nil {
+ return x.Url
+ }
+ return ""
+}
+
+func (x *License) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of Any as ordered (name,value) pairs.
+type NamedAny struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *Any `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedAny) Reset() {
+ *x = NamedAny{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[20]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedAny) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedAny) ProtoMessage() {}
+
+func (x *NamedAny) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[20]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedAny.ProtoReflect.Descriptor instead.
+func (*NamedAny) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{20}
+}
+
+func (x *NamedAny) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedAny) GetValue() *Any {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of Header as ordered (name,value) pairs.
+type NamedHeader struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *Header `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedHeader) Reset() {
+ *x = NamedHeader{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[21]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedHeader) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedHeader) ProtoMessage() {}
+
+func (x *NamedHeader) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[21]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedHeader.ProtoReflect.Descriptor instead.
+func (*NamedHeader) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{21}
+}
+
+func (x *NamedHeader) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedHeader) GetValue() *Header {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of Parameter as ordered (name,value) pairs.
+type NamedParameter struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *Parameter `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedParameter) Reset() {
+ *x = NamedParameter{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[22]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedParameter) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedParameter) ProtoMessage() {}
+
+func (x *NamedParameter) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[22]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedParameter.ProtoReflect.Descriptor instead.
+func (*NamedParameter) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{22}
+}
+
+func (x *NamedParameter) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedParameter) GetValue() *Parameter {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of PathItem as ordered (name,value) pairs.
+type NamedPathItem struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *PathItem `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedPathItem) Reset() {
+ *x = NamedPathItem{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[23]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedPathItem) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedPathItem) ProtoMessage() {}
+
+func (x *NamedPathItem) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[23]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedPathItem.ProtoReflect.Descriptor instead.
+func (*NamedPathItem) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{23}
+}
+
+func (x *NamedPathItem) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedPathItem) GetValue() *PathItem {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of Response as ordered (name,value) pairs.
+type NamedResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *Response `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedResponse) Reset() {
+ *x = NamedResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[24]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedResponse) ProtoMessage() {}
+
+func (x *NamedResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[24]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedResponse.ProtoReflect.Descriptor instead.
+func (*NamedResponse) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{24}
+}
+
+func (x *NamedResponse) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedResponse) GetValue() *Response {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of ResponseValue as ordered (name,value) pairs.
+type NamedResponseValue struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *ResponseValue `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedResponseValue) Reset() {
+ *x = NamedResponseValue{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[25]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedResponseValue) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedResponseValue) ProtoMessage() {}
+
+func (x *NamedResponseValue) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[25]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedResponseValue.ProtoReflect.Descriptor instead.
+func (*NamedResponseValue) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{25}
+}
+
+func (x *NamedResponseValue) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedResponseValue) GetValue() *ResponseValue {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of Schema as ordered (name,value) pairs.
+type NamedSchema struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *Schema `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedSchema) Reset() {
+ *x = NamedSchema{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[26]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedSchema) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedSchema) ProtoMessage() {}
+
+func (x *NamedSchema) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[26]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedSchema.ProtoReflect.Descriptor instead.
+func (*NamedSchema) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{26}
+}
+
+func (x *NamedSchema) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedSchema) GetValue() *Schema {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of SecurityDefinitionsItem as ordered (name,value) pairs.
+type NamedSecurityDefinitionsItem struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *SecurityDefinitionsItem `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedSecurityDefinitionsItem) Reset() {
+ *x = NamedSecurityDefinitionsItem{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[27]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedSecurityDefinitionsItem) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedSecurityDefinitionsItem) ProtoMessage() {}
+
+func (x *NamedSecurityDefinitionsItem) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[27]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedSecurityDefinitionsItem.ProtoReflect.Descriptor instead.
+func (*NamedSecurityDefinitionsItem) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{27}
+}
+
+func (x *NamedSecurityDefinitionsItem) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedSecurityDefinitionsItem) GetValue() *SecurityDefinitionsItem {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of string as ordered (name,value) pairs.
+type NamedString struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedString) Reset() {
+ *x = NamedString{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[28]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedString) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedString) ProtoMessage() {}
+
+func (x *NamedString) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[28]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedString.ProtoReflect.Descriptor instead.
+func (*NamedString) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{28}
+}
+
+func (x *NamedString) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedString) GetValue() string {
+ if x != nil {
+ return x.Value
+ }
+ return ""
+}
+
+// Automatically-generated message used to represent maps of StringArray as ordered (name,value) pairs.
+type NamedStringArray struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *StringArray `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedStringArray) Reset() {
+ *x = NamedStringArray{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[29]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedStringArray) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedStringArray) ProtoMessage() {}
+
+func (x *NamedStringArray) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[29]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedStringArray.ProtoReflect.Descriptor instead.
+func (*NamedStringArray) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{29}
+}
+
+func (x *NamedStringArray) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedStringArray) GetValue() *StringArray {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+type NonBodyParameter struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *NonBodyParameter_HeaderParameterSubSchema
+ // *NonBodyParameter_FormDataParameterSubSchema
+ // *NonBodyParameter_QueryParameterSubSchema
+ // *NonBodyParameter_PathParameterSubSchema
+ Oneof isNonBodyParameter_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *NonBodyParameter) Reset() {
+ *x = NonBodyParameter{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[30]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NonBodyParameter) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NonBodyParameter) ProtoMessage() {}
+
+func (x *NonBodyParameter) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[30]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NonBodyParameter.ProtoReflect.Descriptor instead.
+func (*NonBodyParameter) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{30}
+}
+
+func (m *NonBodyParameter) GetOneof() isNonBodyParameter_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *NonBodyParameter) GetHeaderParameterSubSchema() *HeaderParameterSubSchema {
+ if x, ok := x.GetOneof().(*NonBodyParameter_HeaderParameterSubSchema); ok {
+ return x.HeaderParameterSubSchema
+ }
+ return nil
+}
+
+func (x *NonBodyParameter) GetFormDataParameterSubSchema() *FormDataParameterSubSchema {
+ if x, ok := x.GetOneof().(*NonBodyParameter_FormDataParameterSubSchema); ok {
+ return x.FormDataParameterSubSchema
+ }
+ return nil
+}
+
+func (x *NonBodyParameter) GetQueryParameterSubSchema() *QueryParameterSubSchema {
+ if x, ok := x.GetOneof().(*NonBodyParameter_QueryParameterSubSchema); ok {
+ return x.QueryParameterSubSchema
+ }
+ return nil
+}
+
+func (x *NonBodyParameter) GetPathParameterSubSchema() *PathParameterSubSchema {
+ if x, ok := x.GetOneof().(*NonBodyParameter_PathParameterSubSchema); ok {
+ return x.PathParameterSubSchema
+ }
+ return nil
+}
+
+type isNonBodyParameter_Oneof interface {
+ isNonBodyParameter_Oneof()
+}
+
+type NonBodyParameter_HeaderParameterSubSchema struct {
+ HeaderParameterSubSchema *HeaderParameterSubSchema `protobuf:"bytes,1,opt,name=header_parameter_sub_schema,json=headerParameterSubSchema,proto3,oneof"`
+}
+
+type NonBodyParameter_FormDataParameterSubSchema struct {
+ FormDataParameterSubSchema *FormDataParameterSubSchema `protobuf:"bytes,2,opt,name=form_data_parameter_sub_schema,json=formDataParameterSubSchema,proto3,oneof"`
+}
+
+type NonBodyParameter_QueryParameterSubSchema struct {
+ QueryParameterSubSchema *QueryParameterSubSchema `protobuf:"bytes,3,opt,name=query_parameter_sub_schema,json=queryParameterSubSchema,proto3,oneof"`
+}
+
+type NonBodyParameter_PathParameterSubSchema struct {
+ PathParameterSubSchema *PathParameterSubSchema `protobuf:"bytes,4,opt,name=path_parameter_sub_schema,json=pathParameterSubSchema,proto3,oneof"`
+}
+
+func (*NonBodyParameter_HeaderParameterSubSchema) isNonBodyParameter_Oneof() {}
+
+func (*NonBodyParameter_FormDataParameterSubSchema) isNonBodyParameter_Oneof() {}
+
+func (*NonBodyParameter_QueryParameterSubSchema) isNonBodyParameter_Oneof() {}
+
+func (*NonBodyParameter_PathParameterSubSchema) isNonBodyParameter_Oneof() {}
+
+type Oauth2AccessCodeSecurity struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
+ Flow string `protobuf:"bytes,2,opt,name=flow,proto3" json:"flow,omitempty"`
+ Scopes *Oauth2Scopes `protobuf:"bytes,3,opt,name=scopes,proto3" json:"scopes,omitempty"`
+ AuthorizationUrl string `protobuf:"bytes,4,opt,name=authorization_url,json=authorizationUrl,proto3" json:"authorization_url,omitempty"`
+ TokenUrl string `protobuf:"bytes,5,opt,name=token_url,json=tokenUrl,proto3" json:"token_url,omitempty"`
+ Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,7,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Oauth2AccessCodeSecurity) Reset() {
+ *x = Oauth2AccessCodeSecurity{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[31]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Oauth2AccessCodeSecurity) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Oauth2AccessCodeSecurity) ProtoMessage() {}
+
+func (x *Oauth2AccessCodeSecurity) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[31]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Oauth2AccessCodeSecurity.ProtoReflect.Descriptor instead.
+func (*Oauth2AccessCodeSecurity) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{31}
+}
+
+func (x *Oauth2AccessCodeSecurity) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *Oauth2AccessCodeSecurity) GetFlow() string {
+ if x != nil {
+ return x.Flow
+ }
+ return ""
+}
+
+func (x *Oauth2AccessCodeSecurity) GetScopes() *Oauth2Scopes {
+ if x != nil {
+ return x.Scopes
+ }
+ return nil
+}
+
+func (x *Oauth2AccessCodeSecurity) GetAuthorizationUrl() string {
+ if x != nil {
+ return x.AuthorizationUrl
+ }
+ return ""
+}
+
+func (x *Oauth2AccessCodeSecurity) GetTokenUrl() string {
+ if x != nil {
+ return x.TokenUrl
+ }
+ return ""
+}
+
+func (x *Oauth2AccessCodeSecurity) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Oauth2AccessCodeSecurity) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type Oauth2ApplicationSecurity struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
+ Flow string `protobuf:"bytes,2,opt,name=flow,proto3" json:"flow,omitempty"`
+ Scopes *Oauth2Scopes `protobuf:"bytes,3,opt,name=scopes,proto3" json:"scopes,omitempty"`
+ TokenUrl string `protobuf:"bytes,4,opt,name=token_url,json=tokenUrl,proto3" json:"token_url,omitempty"`
+ Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Oauth2ApplicationSecurity) Reset() {
+ *x = Oauth2ApplicationSecurity{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[32]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Oauth2ApplicationSecurity) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Oauth2ApplicationSecurity) ProtoMessage() {}
+
+func (x *Oauth2ApplicationSecurity) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[32]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Oauth2ApplicationSecurity.ProtoReflect.Descriptor instead.
+func (*Oauth2ApplicationSecurity) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{32}
+}
+
+func (x *Oauth2ApplicationSecurity) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *Oauth2ApplicationSecurity) GetFlow() string {
+ if x != nil {
+ return x.Flow
+ }
+ return ""
+}
+
+func (x *Oauth2ApplicationSecurity) GetScopes() *Oauth2Scopes {
+ if x != nil {
+ return x.Scopes
+ }
+ return nil
+}
+
+func (x *Oauth2ApplicationSecurity) GetTokenUrl() string {
+ if x != nil {
+ return x.TokenUrl
+ }
+ return ""
+}
+
+func (x *Oauth2ApplicationSecurity) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Oauth2ApplicationSecurity) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type Oauth2ImplicitSecurity struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
+ Flow string `protobuf:"bytes,2,opt,name=flow,proto3" json:"flow,omitempty"`
+ Scopes *Oauth2Scopes `protobuf:"bytes,3,opt,name=scopes,proto3" json:"scopes,omitempty"`
+ AuthorizationUrl string `protobuf:"bytes,4,opt,name=authorization_url,json=authorizationUrl,proto3" json:"authorization_url,omitempty"`
+ Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Oauth2ImplicitSecurity) Reset() {
+ *x = Oauth2ImplicitSecurity{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[33]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Oauth2ImplicitSecurity) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Oauth2ImplicitSecurity) ProtoMessage() {}
+
+func (x *Oauth2ImplicitSecurity) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[33]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Oauth2ImplicitSecurity.ProtoReflect.Descriptor instead.
+func (*Oauth2ImplicitSecurity) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{33}
+}
+
+func (x *Oauth2ImplicitSecurity) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *Oauth2ImplicitSecurity) GetFlow() string {
+ if x != nil {
+ return x.Flow
+ }
+ return ""
+}
+
+func (x *Oauth2ImplicitSecurity) GetScopes() *Oauth2Scopes {
+ if x != nil {
+ return x.Scopes
+ }
+ return nil
+}
+
+func (x *Oauth2ImplicitSecurity) GetAuthorizationUrl() string {
+ if x != nil {
+ return x.AuthorizationUrl
+ }
+ return ""
+}
+
+func (x *Oauth2ImplicitSecurity) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Oauth2ImplicitSecurity) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type Oauth2PasswordSecurity struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
+ Flow string `protobuf:"bytes,2,opt,name=flow,proto3" json:"flow,omitempty"`
+ Scopes *Oauth2Scopes `protobuf:"bytes,3,opt,name=scopes,proto3" json:"scopes,omitempty"`
+ TokenUrl string `protobuf:"bytes,4,opt,name=token_url,json=tokenUrl,proto3" json:"token_url,omitempty"`
+ Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Oauth2PasswordSecurity) Reset() {
+ *x = Oauth2PasswordSecurity{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[34]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Oauth2PasswordSecurity) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Oauth2PasswordSecurity) ProtoMessage() {}
+
+func (x *Oauth2PasswordSecurity) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[34]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Oauth2PasswordSecurity.ProtoReflect.Descriptor instead.
+func (*Oauth2PasswordSecurity) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{34}
+}
+
+func (x *Oauth2PasswordSecurity) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *Oauth2PasswordSecurity) GetFlow() string {
+ if x != nil {
+ return x.Flow
+ }
+ return ""
+}
+
+func (x *Oauth2PasswordSecurity) GetScopes() *Oauth2Scopes {
+ if x != nil {
+ return x.Scopes
+ }
+ return nil
+}
+
+func (x *Oauth2PasswordSecurity) GetTokenUrl() string {
+ if x != nil {
+ return x.TokenUrl
+ }
+ return ""
+}
+
+func (x *Oauth2PasswordSecurity) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Oauth2PasswordSecurity) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type Oauth2Scopes struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedString `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *Oauth2Scopes) Reset() {
+ *x = Oauth2Scopes{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[35]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Oauth2Scopes) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Oauth2Scopes) ProtoMessage() {}
+
+func (x *Oauth2Scopes) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[35]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Oauth2Scopes.ProtoReflect.Descriptor instead.
+func (*Oauth2Scopes) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{35}
+}
+
+func (x *Oauth2Scopes) GetAdditionalProperties() []*NamedString {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+type Operation struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Tags []string `protobuf:"bytes,1,rep,name=tags,proto3" json:"tags,omitempty"`
+ // A brief summary of the operation.
+ Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"`
+ // A longer description of the operation, GitHub Flavored Markdown is allowed.
+ Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
+ ExternalDocs *ExternalDocs `protobuf:"bytes,4,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"`
+ // A unique identifier of the operation.
+ OperationId string `protobuf:"bytes,5,opt,name=operation_id,json=operationId,proto3" json:"operation_id,omitempty"`
+ // A list of MIME types the API can produce.
+ Produces []string `protobuf:"bytes,6,rep,name=produces,proto3" json:"produces,omitempty"`
+ // A list of MIME types the API can consume.
+ Consumes []string `protobuf:"bytes,7,rep,name=consumes,proto3" json:"consumes,omitempty"`
+ // The parameters needed to send a valid API call.
+ Parameters []*ParametersItem `protobuf:"bytes,8,rep,name=parameters,proto3" json:"parameters,omitempty"`
+ Responses *Responses `protobuf:"bytes,9,opt,name=responses,proto3" json:"responses,omitempty"`
+ // The transfer protocol of the API.
+ Schemes []string `protobuf:"bytes,10,rep,name=schemes,proto3" json:"schemes,omitempty"`
+ Deprecated bool `protobuf:"varint,11,opt,name=deprecated,proto3" json:"deprecated,omitempty"`
+ Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security,proto3" json:"security,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,13,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Operation) Reset() {
+ *x = Operation{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[36]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Operation) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Operation) ProtoMessage() {}
+
+func (x *Operation) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[36]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Operation.ProtoReflect.Descriptor instead.
+func (*Operation) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{36}
+}
+
+func (x *Operation) GetTags() []string {
+ if x != nil {
+ return x.Tags
+ }
+ return nil
+}
+
+func (x *Operation) GetSummary() string {
+ if x != nil {
+ return x.Summary
+ }
+ return ""
+}
+
+func (x *Operation) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Operation) GetExternalDocs() *ExternalDocs {
+ if x != nil {
+ return x.ExternalDocs
+ }
+ return nil
+}
+
+func (x *Operation) GetOperationId() string {
+ if x != nil {
+ return x.OperationId
+ }
+ return ""
+}
+
+func (x *Operation) GetProduces() []string {
+ if x != nil {
+ return x.Produces
+ }
+ return nil
+}
+
+func (x *Operation) GetConsumes() []string {
+ if x != nil {
+ return x.Consumes
+ }
+ return nil
+}
+
+func (x *Operation) GetParameters() []*ParametersItem {
+ if x != nil {
+ return x.Parameters
+ }
+ return nil
+}
+
+func (x *Operation) GetResponses() *Responses {
+ if x != nil {
+ return x.Responses
+ }
+ return nil
+}
+
+func (x *Operation) GetSchemes() []string {
+ if x != nil {
+ return x.Schemes
+ }
+ return nil
+}
+
+func (x *Operation) GetDeprecated() bool {
+ if x != nil {
+ return x.Deprecated
+ }
+ return false
+}
+
+func (x *Operation) GetSecurity() []*SecurityRequirement {
+ if x != nil {
+ return x.Security
+ }
+ return nil
+}
+
+func (x *Operation) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type Parameter struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *Parameter_BodyParameter
+ // *Parameter_NonBodyParameter
+ Oneof isParameter_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *Parameter) Reset() {
+ *x = Parameter{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[37]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Parameter) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Parameter) ProtoMessage() {}
+
+func (x *Parameter) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[37]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Parameter.ProtoReflect.Descriptor instead.
+func (*Parameter) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{37}
+}
+
+func (m *Parameter) GetOneof() isParameter_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *Parameter) GetBodyParameter() *BodyParameter {
+ if x, ok := x.GetOneof().(*Parameter_BodyParameter); ok {
+ return x.BodyParameter
+ }
+ return nil
+}
+
+func (x *Parameter) GetNonBodyParameter() *NonBodyParameter {
+ if x, ok := x.GetOneof().(*Parameter_NonBodyParameter); ok {
+ return x.NonBodyParameter
+ }
+ return nil
+}
+
+type isParameter_Oneof interface {
+ isParameter_Oneof()
+}
+
+type Parameter_BodyParameter struct {
+ BodyParameter *BodyParameter `protobuf:"bytes,1,opt,name=body_parameter,json=bodyParameter,proto3,oneof"`
+}
+
+type Parameter_NonBodyParameter struct {
+ NonBodyParameter *NonBodyParameter `protobuf:"bytes,2,opt,name=non_body_parameter,json=nonBodyParameter,proto3,oneof"`
+}
+
+func (*Parameter_BodyParameter) isParameter_Oneof() {}
+
+func (*Parameter_NonBodyParameter) isParameter_Oneof() {}
+
+// One or more JSON representations for parameters
+type ParameterDefinitions struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedParameter `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *ParameterDefinitions) Reset() {
+ *x = ParameterDefinitions{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[38]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ParameterDefinitions) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ParameterDefinitions) ProtoMessage() {}
+
+func (x *ParameterDefinitions) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[38]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ParameterDefinitions.ProtoReflect.Descriptor instead.
+func (*ParameterDefinitions) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{38}
+}
+
+func (x *ParameterDefinitions) GetAdditionalProperties() []*NamedParameter {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+type ParametersItem struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *ParametersItem_Parameter
+ // *ParametersItem_JsonReference
+ Oneof isParametersItem_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *ParametersItem) Reset() {
+ *x = ParametersItem{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[39]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ParametersItem) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ParametersItem) ProtoMessage() {}
+
+func (x *ParametersItem) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[39]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ParametersItem.ProtoReflect.Descriptor instead.
+func (*ParametersItem) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{39}
+}
+
+func (m *ParametersItem) GetOneof() isParametersItem_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *ParametersItem) GetParameter() *Parameter {
+ if x, ok := x.GetOneof().(*ParametersItem_Parameter); ok {
+ return x.Parameter
+ }
+ return nil
+}
+
+func (x *ParametersItem) GetJsonReference() *JsonReference {
+ if x, ok := x.GetOneof().(*ParametersItem_JsonReference); ok {
+ return x.JsonReference
+ }
+ return nil
+}
+
+type isParametersItem_Oneof interface {
+ isParametersItem_Oneof()
+}
+
+type ParametersItem_Parameter struct {
+ Parameter *Parameter `protobuf:"bytes,1,opt,name=parameter,proto3,oneof"`
+}
+
+type ParametersItem_JsonReference struct {
+ JsonReference *JsonReference `protobuf:"bytes,2,opt,name=json_reference,json=jsonReference,proto3,oneof"`
+}
+
+func (*ParametersItem_Parameter) isParametersItem_Oneof() {}
+
+func (*ParametersItem_JsonReference) isParametersItem_Oneof() {}
+
+type PathItem struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ XRef string `protobuf:"bytes,1,opt,name=_ref,json=Ref,proto3" json:"_ref,omitempty"`
+ Get *Operation `protobuf:"bytes,2,opt,name=get,proto3" json:"get,omitempty"`
+ Put *Operation `protobuf:"bytes,3,opt,name=put,proto3" json:"put,omitempty"`
+ Post *Operation `protobuf:"bytes,4,opt,name=post,proto3" json:"post,omitempty"`
+ Delete *Operation `protobuf:"bytes,5,opt,name=delete,proto3" json:"delete,omitempty"`
+ Options *Operation `protobuf:"bytes,6,opt,name=options,proto3" json:"options,omitempty"`
+ Head *Operation `protobuf:"bytes,7,opt,name=head,proto3" json:"head,omitempty"`
+ Patch *Operation `protobuf:"bytes,8,opt,name=patch,proto3" json:"patch,omitempty"`
+ // The parameters needed to send a valid API call.
+ Parameters []*ParametersItem `protobuf:"bytes,9,rep,name=parameters,proto3" json:"parameters,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,10,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *PathItem) Reset() {
+ *x = PathItem{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[40]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *PathItem) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*PathItem) ProtoMessage() {}
+
+func (x *PathItem) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[40]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use PathItem.ProtoReflect.Descriptor instead.
+func (*PathItem) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{40}
+}
+
+func (x *PathItem) GetXRef() string {
+ if x != nil {
+ return x.XRef
+ }
+ return ""
+}
+
+func (x *PathItem) GetGet() *Operation {
+ if x != nil {
+ return x.Get
+ }
+ return nil
+}
+
+func (x *PathItem) GetPut() *Operation {
+ if x != nil {
+ return x.Put
+ }
+ return nil
+}
+
+func (x *PathItem) GetPost() *Operation {
+ if x != nil {
+ return x.Post
+ }
+ return nil
+}
+
+func (x *PathItem) GetDelete() *Operation {
+ if x != nil {
+ return x.Delete
+ }
+ return nil
+}
+
+func (x *PathItem) GetOptions() *Operation {
+ if x != nil {
+ return x.Options
+ }
+ return nil
+}
+
+func (x *PathItem) GetHead() *Operation {
+ if x != nil {
+ return x.Head
+ }
+ return nil
+}
+
+func (x *PathItem) GetPatch() *Operation {
+ if x != nil {
+ return x.Patch
+ }
+ return nil
+}
+
+func (x *PathItem) GetParameters() []*ParametersItem {
+ if x != nil {
+ return x.Parameters
+ }
+ return nil
+}
+
+func (x *PathItem) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type PathParameterSubSchema struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Determines whether or not this parameter is required or optional.
+ Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"`
+ // Determines the location of the parameter.
+ In string `protobuf:"bytes,2,opt,name=in,proto3" json:"in,omitempty"`
+ // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
+ Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
+ // The name of the parameter.
+ Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
+ Type string `protobuf:"bytes,5,opt,name=type,proto3" json:"type,omitempty"`
+ Format string `protobuf:"bytes,6,opt,name=format,proto3" json:"format,omitempty"`
+ Items *PrimitivesItems `protobuf:"bytes,7,opt,name=items,proto3" json:"items,omitempty"`
+ CollectionFormat string `protobuf:"bytes,8,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"`
+ Default *Any `protobuf:"bytes,9,opt,name=default,proto3" json:"default,omitempty"`
+ Maximum float64 `protobuf:"fixed64,10,opt,name=maximum,proto3" json:"maximum,omitempty"`
+ ExclusiveMaximum bool `protobuf:"varint,11,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"`
+ Minimum float64 `protobuf:"fixed64,12,opt,name=minimum,proto3" json:"minimum,omitempty"`
+ ExclusiveMinimum bool `protobuf:"varint,13,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"`
+ MaxLength int64 `protobuf:"varint,14,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"`
+ MinLength int64 `protobuf:"varint,15,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"`
+ Pattern string `protobuf:"bytes,16,opt,name=pattern,proto3" json:"pattern,omitempty"`
+ MaxItems int64 `protobuf:"varint,17,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"`
+ MinItems int64 `protobuf:"varint,18,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"`
+ UniqueItems bool `protobuf:"varint,19,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"`
+ Enum []*Any `protobuf:"bytes,20,rep,name=enum,proto3" json:"enum,omitempty"`
+ MultipleOf float64 `protobuf:"fixed64,21,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,22,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *PathParameterSubSchema) Reset() {
+ *x = PathParameterSubSchema{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[41]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *PathParameterSubSchema) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*PathParameterSubSchema) ProtoMessage() {}
+
+func (x *PathParameterSubSchema) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[41]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use PathParameterSubSchema.ProtoReflect.Descriptor instead.
+func (*PathParameterSubSchema) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{41}
+}
+
+func (x *PathParameterSubSchema) GetRequired() bool {
+ if x != nil {
+ return x.Required
+ }
+ return false
+}
+
+func (x *PathParameterSubSchema) GetIn() string {
+ if x != nil {
+ return x.In
+ }
+ return ""
+}
+
+func (x *PathParameterSubSchema) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *PathParameterSubSchema) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *PathParameterSubSchema) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *PathParameterSubSchema) GetFormat() string {
+ if x != nil {
+ return x.Format
+ }
+ return ""
+}
+
+func (x *PathParameterSubSchema) GetItems() *PrimitivesItems {
+ if x != nil {
+ return x.Items
+ }
+ return nil
+}
+
+func (x *PathParameterSubSchema) GetCollectionFormat() string {
+ if x != nil {
+ return x.CollectionFormat
+ }
+ return ""
+}
+
+func (x *PathParameterSubSchema) GetDefault() *Any {
+ if x != nil {
+ return x.Default
+ }
+ return nil
+}
+
+func (x *PathParameterSubSchema) GetMaximum() float64 {
+ if x != nil {
+ return x.Maximum
+ }
+ return 0
+}
+
+func (x *PathParameterSubSchema) GetExclusiveMaximum() bool {
+ if x != nil {
+ return x.ExclusiveMaximum
+ }
+ return false
+}
+
+func (x *PathParameterSubSchema) GetMinimum() float64 {
+ if x != nil {
+ return x.Minimum
+ }
+ return 0
+}
+
+func (x *PathParameterSubSchema) GetExclusiveMinimum() bool {
+ if x != nil {
+ return x.ExclusiveMinimum
+ }
+ return false
+}
+
+func (x *PathParameterSubSchema) GetMaxLength() int64 {
+ if x != nil {
+ return x.MaxLength
+ }
+ return 0
+}
+
+func (x *PathParameterSubSchema) GetMinLength() int64 {
+ if x != nil {
+ return x.MinLength
+ }
+ return 0
+}
+
+func (x *PathParameterSubSchema) GetPattern() string {
+ if x != nil {
+ return x.Pattern
+ }
+ return ""
+}
+
+func (x *PathParameterSubSchema) GetMaxItems() int64 {
+ if x != nil {
+ return x.MaxItems
+ }
+ return 0
+}
+
+func (x *PathParameterSubSchema) GetMinItems() int64 {
+ if x != nil {
+ return x.MinItems
+ }
+ return 0
+}
+
+func (x *PathParameterSubSchema) GetUniqueItems() bool {
+ if x != nil {
+ return x.UniqueItems
+ }
+ return false
+}
+
+func (x *PathParameterSubSchema) GetEnum() []*Any {
+ if x != nil {
+ return x.Enum
+ }
+ return nil
+}
+
+func (x *PathParameterSubSchema) GetMultipleOf() float64 {
+ if x != nil {
+ return x.MultipleOf
+ }
+ return 0
+}
+
+func (x *PathParameterSubSchema) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+// Relative paths to the individual endpoints. They must be relative to the 'basePath'.
+type Paths struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ VendorExtension []*NamedAny `protobuf:"bytes,1,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+ Path []*NamedPathItem `protobuf:"bytes,2,rep,name=path,proto3" json:"path,omitempty"`
+}
+
+func (x *Paths) Reset() {
+ *x = Paths{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[42]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Paths) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Paths) ProtoMessage() {}
+
+func (x *Paths) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[42]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Paths.ProtoReflect.Descriptor instead.
+func (*Paths) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{42}
+}
+
+func (x *Paths) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+func (x *Paths) GetPath() []*NamedPathItem {
+ if x != nil {
+ return x.Path
+ }
+ return nil
+}
+
+type PrimitivesItems struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
+ Format string `protobuf:"bytes,2,opt,name=format,proto3" json:"format,omitempty"`
+ Items *PrimitivesItems `protobuf:"bytes,3,opt,name=items,proto3" json:"items,omitempty"`
+ CollectionFormat string `protobuf:"bytes,4,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"`
+ Default *Any `protobuf:"bytes,5,opt,name=default,proto3" json:"default,omitempty"`
+ Maximum float64 `protobuf:"fixed64,6,opt,name=maximum,proto3" json:"maximum,omitempty"`
+ ExclusiveMaximum bool `protobuf:"varint,7,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"`
+ Minimum float64 `protobuf:"fixed64,8,opt,name=minimum,proto3" json:"minimum,omitempty"`
+ ExclusiveMinimum bool `protobuf:"varint,9,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"`
+ MaxLength int64 `protobuf:"varint,10,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"`
+ MinLength int64 `protobuf:"varint,11,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"`
+ Pattern string `protobuf:"bytes,12,opt,name=pattern,proto3" json:"pattern,omitempty"`
+ MaxItems int64 `protobuf:"varint,13,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"`
+ MinItems int64 `protobuf:"varint,14,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"`
+ UniqueItems bool `protobuf:"varint,15,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"`
+ Enum []*Any `protobuf:"bytes,16,rep,name=enum,proto3" json:"enum,omitempty"`
+ MultipleOf float64 `protobuf:"fixed64,17,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,18,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *PrimitivesItems) Reset() {
+ *x = PrimitivesItems{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[43]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *PrimitivesItems) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*PrimitivesItems) ProtoMessage() {}
+
+func (x *PrimitivesItems) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[43]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use PrimitivesItems.ProtoReflect.Descriptor instead.
+func (*PrimitivesItems) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{43}
+}
+
+func (x *PrimitivesItems) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *PrimitivesItems) GetFormat() string {
+ if x != nil {
+ return x.Format
+ }
+ return ""
+}
+
+func (x *PrimitivesItems) GetItems() *PrimitivesItems {
+ if x != nil {
+ return x.Items
+ }
+ return nil
+}
+
+func (x *PrimitivesItems) GetCollectionFormat() string {
+ if x != nil {
+ return x.CollectionFormat
+ }
+ return ""
+}
+
+func (x *PrimitivesItems) GetDefault() *Any {
+ if x != nil {
+ return x.Default
+ }
+ return nil
+}
+
+func (x *PrimitivesItems) GetMaximum() float64 {
+ if x != nil {
+ return x.Maximum
+ }
+ return 0
+}
+
+func (x *PrimitivesItems) GetExclusiveMaximum() bool {
+ if x != nil {
+ return x.ExclusiveMaximum
+ }
+ return false
+}
+
+func (x *PrimitivesItems) GetMinimum() float64 {
+ if x != nil {
+ return x.Minimum
+ }
+ return 0
+}
+
+func (x *PrimitivesItems) GetExclusiveMinimum() bool {
+ if x != nil {
+ return x.ExclusiveMinimum
+ }
+ return false
+}
+
+func (x *PrimitivesItems) GetMaxLength() int64 {
+ if x != nil {
+ return x.MaxLength
+ }
+ return 0
+}
+
+func (x *PrimitivesItems) GetMinLength() int64 {
+ if x != nil {
+ return x.MinLength
+ }
+ return 0
+}
+
+func (x *PrimitivesItems) GetPattern() string {
+ if x != nil {
+ return x.Pattern
+ }
+ return ""
+}
+
+func (x *PrimitivesItems) GetMaxItems() int64 {
+ if x != nil {
+ return x.MaxItems
+ }
+ return 0
+}
+
+func (x *PrimitivesItems) GetMinItems() int64 {
+ if x != nil {
+ return x.MinItems
+ }
+ return 0
+}
+
+func (x *PrimitivesItems) GetUniqueItems() bool {
+ if x != nil {
+ return x.UniqueItems
+ }
+ return false
+}
+
+func (x *PrimitivesItems) GetEnum() []*Any {
+ if x != nil {
+ return x.Enum
+ }
+ return nil
+}
+
+func (x *PrimitivesItems) GetMultipleOf() float64 {
+ if x != nil {
+ return x.MultipleOf
+ }
+ return 0
+}
+
+func (x *PrimitivesItems) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type Properties struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedSchema `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *Properties) Reset() {
+ *x = Properties{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[44]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Properties) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Properties) ProtoMessage() {}
+
+func (x *Properties) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[44]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Properties.ProtoReflect.Descriptor instead.
+func (*Properties) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{44}
+}
+
+func (x *Properties) GetAdditionalProperties() []*NamedSchema {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+type QueryParameterSubSchema struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Determines whether or not this parameter is required or optional.
+ Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"`
+ // Determines the location of the parameter.
+ In string `protobuf:"bytes,2,opt,name=in,proto3" json:"in,omitempty"`
+ // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
+ Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
+ // The name of the parameter.
+ Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
+ // allows sending a parameter by name only or with an empty value.
+ AllowEmptyValue bool `protobuf:"varint,5,opt,name=allow_empty_value,json=allowEmptyValue,proto3" json:"allow_empty_value,omitempty"`
+ Type string `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty"`
+ Format string `protobuf:"bytes,7,opt,name=format,proto3" json:"format,omitempty"`
+ Items *PrimitivesItems `protobuf:"bytes,8,opt,name=items,proto3" json:"items,omitempty"`
+ CollectionFormat string `protobuf:"bytes,9,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"`
+ Default *Any `protobuf:"bytes,10,opt,name=default,proto3" json:"default,omitempty"`
+ Maximum float64 `protobuf:"fixed64,11,opt,name=maximum,proto3" json:"maximum,omitempty"`
+ ExclusiveMaximum bool `protobuf:"varint,12,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"`
+ Minimum float64 `protobuf:"fixed64,13,opt,name=minimum,proto3" json:"minimum,omitempty"`
+ ExclusiveMinimum bool `protobuf:"varint,14,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"`
+ MaxLength int64 `protobuf:"varint,15,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"`
+ MinLength int64 `protobuf:"varint,16,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"`
+ Pattern string `protobuf:"bytes,17,opt,name=pattern,proto3" json:"pattern,omitempty"`
+ MaxItems int64 `protobuf:"varint,18,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"`
+ MinItems int64 `protobuf:"varint,19,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"`
+ UniqueItems bool `protobuf:"varint,20,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"`
+ Enum []*Any `protobuf:"bytes,21,rep,name=enum,proto3" json:"enum,omitempty"`
+ MultipleOf float64 `protobuf:"fixed64,22,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,23,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *QueryParameterSubSchema) Reset() {
+ *x = QueryParameterSubSchema{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[45]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *QueryParameterSubSchema) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*QueryParameterSubSchema) ProtoMessage() {}
+
+func (x *QueryParameterSubSchema) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[45]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use QueryParameterSubSchema.ProtoReflect.Descriptor instead.
+func (*QueryParameterSubSchema) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{45}
+}
+
+func (x *QueryParameterSubSchema) GetRequired() bool {
+ if x != nil {
+ return x.Required
+ }
+ return false
+}
+
+func (x *QueryParameterSubSchema) GetIn() string {
+ if x != nil {
+ return x.In
+ }
+ return ""
+}
+
+func (x *QueryParameterSubSchema) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *QueryParameterSubSchema) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *QueryParameterSubSchema) GetAllowEmptyValue() bool {
+ if x != nil {
+ return x.AllowEmptyValue
+ }
+ return false
+}
+
+func (x *QueryParameterSubSchema) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *QueryParameterSubSchema) GetFormat() string {
+ if x != nil {
+ return x.Format
+ }
+ return ""
+}
+
+func (x *QueryParameterSubSchema) GetItems() *PrimitivesItems {
+ if x != nil {
+ return x.Items
+ }
+ return nil
+}
+
+func (x *QueryParameterSubSchema) GetCollectionFormat() string {
+ if x != nil {
+ return x.CollectionFormat
+ }
+ return ""
+}
+
+func (x *QueryParameterSubSchema) GetDefault() *Any {
+ if x != nil {
+ return x.Default
+ }
+ return nil
+}
+
+func (x *QueryParameterSubSchema) GetMaximum() float64 {
+ if x != nil {
+ return x.Maximum
+ }
+ return 0
+}
+
+func (x *QueryParameterSubSchema) GetExclusiveMaximum() bool {
+ if x != nil {
+ return x.ExclusiveMaximum
+ }
+ return false
+}
+
+func (x *QueryParameterSubSchema) GetMinimum() float64 {
+ if x != nil {
+ return x.Minimum
+ }
+ return 0
+}
+
+func (x *QueryParameterSubSchema) GetExclusiveMinimum() bool {
+ if x != nil {
+ return x.ExclusiveMinimum
+ }
+ return false
+}
+
+func (x *QueryParameterSubSchema) GetMaxLength() int64 {
+ if x != nil {
+ return x.MaxLength
+ }
+ return 0
+}
+
+func (x *QueryParameterSubSchema) GetMinLength() int64 {
+ if x != nil {
+ return x.MinLength
+ }
+ return 0
+}
+
+func (x *QueryParameterSubSchema) GetPattern() string {
+ if x != nil {
+ return x.Pattern
+ }
+ return ""
+}
+
+func (x *QueryParameterSubSchema) GetMaxItems() int64 {
+ if x != nil {
+ return x.MaxItems
+ }
+ return 0
+}
+
+func (x *QueryParameterSubSchema) GetMinItems() int64 {
+ if x != nil {
+ return x.MinItems
+ }
+ return 0
+}
+
+func (x *QueryParameterSubSchema) GetUniqueItems() bool {
+ if x != nil {
+ return x.UniqueItems
+ }
+ return false
+}
+
+func (x *QueryParameterSubSchema) GetEnum() []*Any {
+ if x != nil {
+ return x.Enum
+ }
+ return nil
+}
+
+func (x *QueryParameterSubSchema) GetMultipleOf() float64 {
+ if x != nil {
+ return x.MultipleOf
+ }
+ return 0
+}
+
+func (x *QueryParameterSubSchema) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type Response struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"`
+ Schema *SchemaItem `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"`
+ Headers *Headers `protobuf:"bytes,3,opt,name=headers,proto3" json:"headers,omitempty"`
+ Examples *Examples `protobuf:"bytes,4,opt,name=examples,proto3" json:"examples,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,5,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Response) Reset() {
+ *x = Response{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[46]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Response) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Response) ProtoMessage() {}
+
+func (x *Response) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[46]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Response.ProtoReflect.Descriptor instead.
+func (*Response) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{46}
+}
+
+func (x *Response) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Response) GetSchema() *SchemaItem {
+ if x != nil {
+ return x.Schema
+ }
+ return nil
+}
+
+func (x *Response) GetHeaders() *Headers {
+ if x != nil {
+ return x.Headers
+ }
+ return nil
+}
+
+func (x *Response) GetExamples() *Examples {
+ if x != nil {
+ return x.Examples
+ }
+ return nil
+}
+
+func (x *Response) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+// One or more JSON representations for responses
+type ResponseDefinitions struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedResponse `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *ResponseDefinitions) Reset() {
+ *x = ResponseDefinitions{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[47]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ResponseDefinitions) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ResponseDefinitions) ProtoMessage() {}
+
+func (x *ResponseDefinitions) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[47]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ResponseDefinitions.ProtoReflect.Descriptor instead.
+func (*ResponseDefinitions) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{47}
+}
+
+func (x *ResponseDefinitions) GetAdditionalProperties() []*NamedResponse {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+type ResponseValue struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *ResponseValue_Response
+ // *ResponseValue_JsonReference
+ Oneof isResponseValue_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *ResponseValue) Reset() {
+ *x = ResponseValue{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[48]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ResponseValue) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ResponseValue) ProtoMessage() {}
+
+func (x *ResponseValue) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[48]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ResponseValue.ProtoReflect.Descriptor instead.
+func (*ResponseValue) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{48}
+}
+
+func (m *ResponseValue) GetOneof() isResponseValue_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *ResponseValue) GetResponse() *Response {
+ if x, ok := x.GetOneof().(*ResponseValue_Response); ok {
+ return x.Response
+ }
+ return nil
+}
+
+func (x *ResponseValue) GetJsonReference() *JsonReference {
+ if x, ok := x.GetOneof().(*ResponseValue_JsonReference); ok {
+ return x.JsonReference
+ }
+ return nil
+}
+
+type isResponseValue_Oneof interface {
+ isResponseValue_Oneof()
+}
+
+type ResponseValue_Response struct {
+ Response *Response `protobuf:"bytes,1,opt,name=response,proto3,oneof"`
+}
+
+type ResponseValue_JsonReference struct {
+ JsonReference *JsonReference `protobuf:"bytes,2,opt,name=json_reference,json=jsonReference,proto3,oneof"`
+}
+
+func (*ResponseValue_Response) isResponseValue_Oneof() {}
+
+func (*ResponseValue_JsonReference) isResponseValue_Oneof() {}
+
+// Response objects names can either be any valid HTTP status code or 'default'.
+type Responses struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ ResponseCode []*NamedResponseValue `protobuf:"bytes,1,rep,name=response_code,json=responseCode,proto3" json:"response_code,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,2,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Responses) Reset() {
+ *x = Responses{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[49]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Responses) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Responses) ProtoMessage() {}
+
+func (x *Responses) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[49]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Responses.ProtoReflect.Descriptor instead.
+func (*Responses) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{49}
+}
+
+func (x *Responses) GetResponseCode() []*NamedResponseValue {
+ if x != nil {
+ return x.ResponseCode
+ }
+ return nil
+}
+
+func (x *Responses) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+// A deterministic version of a JSON Schema object.
+type Schema struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ XRef string `protobuf:"bytes,1,opt,name=_ref,json=Ref,proto3" json:"_ref,omitempty"`
+ Format string `protobuf:"bytes,2,opt,name=format,proto3" json:"format,omitempty"`
+ Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"`
+ Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`
+ Default *Any `protobuf:"bytes,5,opt,name=default,proto3" json:"default,omitempty"`
+ MultipleOf float64 `protobuf:"fixed64,6,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"`
+ Maximum float64 `protobuf:"fixed64,7,opt,name=maximum,proto3" json:"maximum,omitempty"`
+ ExclusiveMaximum bool `protobuf:"varint,8,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"`
+ Minimum float64 `protobuf:"fixed64,9,opt,name=minimum,proto3" json:"minimum,omitempty"`
+ ExclusiveMinimum bool `protobuf:"varint,10,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"`
+ MaxLength int64 `protobuf:"varint,11,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"`
+ MinLength int64 `protobuf:"varint,12,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"`
+ Pattern string `protobuf:"bytes,13,opt,name=pattern,proto3" json:"pattern,omitempty"`
+ MaxItems int64 `protobuf:"varint,14,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"`
+ MinItems int64 `protobuf:"varint,15,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"`
+ UniqueItems bool `protobuf:"varint,16,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"`
+ MaxProperties int64 `protobuf:"varint,17,opt,name=max_properties,json=maxProperties,proto3" json:"max_properties,omitempty"`
+ MinProperties int64 `protobuf:"varint,18,opt,name=min_properties,json=minProperties,proto3" json:"min_properties,omitempty"`
+ Required []string `protobuf:"bytes,19,rep,name=required,proto3" json:"required,omitempty"`
+ Enum []*Any `protobuf:"bytes,20,rep,name=enum,proto3" json:"enum,omitempty"`
+ AdditionalProperties *AdditionalPropertiesItem `protobuf:"bytes,21,opt,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+ Type *TypeItem `protobuf:"bytes,22,opt,name=type,proto3" json:"type,omitempty"`
+ Items *ItemsItem `protobuf:"bytes,23,opt,name=items,proto3" json:"items,omitempty"`
+ AllOf []*Schema `protobuf:"bytes,24,rep,name=all_of,json=allOf,proto3" json:"all_of,omitempty"`
+ Properties *Properties `protobuf:"bytes,25,opt,name=properties,proto3" json:"properties,omitempty"`
+ Discriminator string `protobuf:"bytes,26,opt,name=discriminator,proto3" json:"discriminator,omitempty"`
+ ReadOnly bool `protobuf:"varint,27,opt,name=read_only,json=readOnly,proto3" json:"read_only,omitempty"`
+ Xml *Xml `protobuf:"bytes,28,opt,name=xml,proto3" json:"xml,omitempty"`
+ ExternalDocs *ExternalDocs `protobuf:"bytes,29,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"`
+ Example *Any `protobuf:"bytes,30,opt,name=example,proto3" json:"example,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,31,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Schema) Reset() {
+ *x = Schema{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[50]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Schema) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Schema) ProtoMessage() {}
+
+func (x *Schema) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[50]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Schema.ProtoReflect.Descriptor instead.
+func (*Schema) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{50}
+}
+
+func (x *Schema) GetXRef() string {
+ if x != nil {
+ return x.XRef
+ }
+ return ""
+}
+
+func (x *Schema) GetFormat() string {
+ if x != nil {
+ return x.Format
+ }
+ return ""
+}
+
+func (x *Schema) GetTitle() string {
+ if x != nil {
+ return x.Title
+ }
+ return ""
+}
+
+func (x *Schema) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Schema) GetDefault() *Any {
+ if x != nil {
+ return x.Default
+ }
+ return nil
+}
+
+func (x *Schema) GetMultipleOf() float64 {
+ if x != nil {
+ return x.MultipleOf
+ }
+ return 0
+}
+
+func (x *Schema) GetMaximum() float64 {
+ if x != nil {
+ return x.Maximum
+ }
+ return 0
+}
+
+func (x *Schema) GetExclusiveMaximum() bool {
+ if x != nil {
+ return x.ExclusiveMaximum
+ }
+ return false
+}
+
+func (x *Schema) GetMinimum() float64 {
+ if x != nil {
+ return x.Minimum
+ }
+ return 0
+}
+
+func (x *Schema) GetExclusiveMinimum() bool {
+ if x != nil {
+ return x.ExclusiveMinimum
+ }
+ return false
+}
+
+func (x *Schema) GetMaxLength() int64 {
+ if x != nil {
+ return x.MaxLength
+ }
+ return 0
+}
+
+func (x *Schema) GetMinLength() int64 {
+ if x != nil {
+ return x.MinLength
+ }
+ return 0
+}
+
+func (x *Schema) GetPattern() string {
+ if x != nil {
+ return x.Pattern
+ }
+ return ""
+}
+
+func (x *Schema) GetMaxItems() int64 {
+ if x != nil {
+ return x.MaxItems
+ }
+ return 0
+}
+
+func (x *Schema) GetMinItems() int64 {
+ if x != nil {
+ return x.MinItems
+ }
+ return 0
+}
+
+func (x *Schema) GetUniqueItems() bool {
+ if x != nil {
+ return x.UniqueItems
+ }
+ return false
+}
+
+func (x *Schema) GetMaxProperties() int64 {
+ if x != nil {
+ return x.MaxProperties
+ }
+ return 0
+}
+
+func (x *Schema) GetMinProperties() int64 {
+ if x != nil {
+ return x.MinProperties
+ }
+ return 0
+}
+
+func (x *Schema) GetRequired() []string {
+ if x != nil {
+ return x.Required
+ }
+ return nil
+}
+
+func (x *Schema) GetEnum() []*Any {
+ if x != nil {
+ return x.Enum
+ }
+ return nil
+}
+
+func (x *Schema) GetAdditionalProperties() *AdditionalPropertiesItem {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+func (x *Schema) GetType() *TypeItem {
+ if x != nil {
+ return x.Type
+ }
+ return nil
+}
+
+func (x *Schema) GetItems() *ItemsItem {
+ if x != nil {
+ return x.Items
+ }
+ return nil
+}
+
+func (x *Schema) GetAllOf() []*Schema {
+ if x != nil {
+ return x.AllOf
+ }
+ return nil
+}
+
+func (x *Schema) GetProperties() *Properties {
+ if x != nil {
+ return x.Properties
+ }
+ return nil
+}
+
+func (x *Schema) GetDiscriminator() string {
+ if x != nil {
+ return x.Discriminator
+ }
+ return ""
+}
+
+func (x *Schema) GetReadOnly() bool {
+ if x != nil {
+ return x.ReadOnly
+ }
+ return false
+}
+
+func (x *Schema) GetXml() *Xml {
+ if x != nil {
+ return x.Xml
+ }
+ return nil
+}
+
+func (x *Schema) GetExternalDocs() *ExternalDocs {
+ if x != nil {
+ return x.ExternalDocs
+ }
+ return nil
+}
+
+func (x *Schema) GetExample() *Any {
+ if x != nil {
+ return x.Example
+ }
+ return nil
+}
+
+func (x *Schema) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type SchemaItem struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *SchemaItem_Schema
+ // *SchemaItem_FileSchema
+ Oneof isSchemaItem_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *SchemaItem) Reset() {
+ *x = SchemaItem{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[51]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SchemaItem) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SchemaItem) ProtoMessage() {}
+
+func (x *SchemaItem) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[51]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SchemaItem.ProtoReflect.Descriptor instead.
+func (*SchemaItem) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{51}
+}
+
+func (m *SchemaItem) GetOneof() isSchemaItem_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *SchemaItem) GetSchema() *Schema {
+ if x, ok := x.GetOneof().(*SchemaItem_Schema); ok {
+ return x.Schema
+ }
+ return nil
+}
+
+func (x *SchemaItem) GetFileSchema() *FileSchema {
+ if x, ok := x.GetOneof().(*SchemaItem_FileSchema); ok {
+ return x.FileSchema
+ }
+ return nil
+}
+
+type isSchemaItem_Oneof interface {
+ isSchemaItem_Oneof()
+}
+
+type SchemaItem_Schema struct {
+ Schema *Schema `protobuf:"bytes,1,opt,name=schema,proto3,oneof"`
+}
+
+type SchemaItem_FileSchema struct {
+ FileSchema *FileSchema `protobuf:"bytes,2,opt,name=file_schema,json=fileSchema,proto3,oneof"`
+}
+
+func (*SchemaItem_Schema) isSchemaItem_Oneof() {}
+
+func (*SchemaItem_FileSchema) isSchemaItem_Oneof() {}
+
+type SecurityDefinitions struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedSecurityDefinitionsItem `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *SecurityDefinitions) Reset() {
+ *x = SecurityDefinitions{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[52]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SecurityDefinitions) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SecurityDefinitions) ProtoMessage() {}
+
+func (x *SecurityDefinitions) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[52]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SecurityDefinitions.ProtoReflect.Descriptor instead.
+func (*SecurityDefinitions) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{52}
+}
+
+func (x *SecurityDefinitions) GetAdditionalProperties() []*NamedSecurityDefinitionsItem {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+type SecurityDefinitionsItem struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *SecurityDefinitionsItem_BasicAuthenticationSecurity
+ // *SecurityDefinitionsItem_ApiKeySecurity
+ // *SecurityDefinitionsItem_Oauth2ImplicitSecurity
+ // *SecurityDefinitionsItem_Oauth2PasswordSecurity
+ // *SecurityDefinitionsItem_Oauth2ApplicationSecurity
+ // *SecurityDefinitionsItem_Oauth2AccessCodeSecurity
+ Oneof isSecurityDefinitionsItem_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *SecurityDefinitionsItem) Reset() {
+ *x = SecurityDefinitionsItem{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[53]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SecurityDefinitionsItem) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SecurityDefinitionsItem) ProtoMessage() {}
+
+func (x *SecurityDefinitionsItem) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[53]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SecurityDefinitionsItem.ProtoReflect.Descriptor instead.
+func (*SecurityDefinitionsItem) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{53}
+}
+
+func (m *SecurityDefinitionsItem) GetOneof() isSecurityDefinitionsItem_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *SecurityDefinitionsItem) GetBasicAuthenticationSecurity() *BasicAuthenticationSecurity {
+ if x, ok := x.GetOneof().(*SecurityDefinitionsItem_BasicAuthenticationSecurity); ok {
+ return x.BasicAuthenticationSecurity
+ }
+ return nil
+}
+
+func (x *SecurityDefinitionsItem) GetApiKeySecurity() *ApiKeySecurity {
+ if x, ok := x.GetOneof().(*SecurityDefinitionsItem_ApiKeySecurity); ok {
+ return x.ApiKeySecurity
+ }
+ return nil
+}
+
+func (x *SecurityDefinitionsItem) GetOauth2ImplicitSecurity() *Oauth2ImplicitSecurity {
+ if x, ok := x.GetOneof().(*SecurityDefinitionsItem_Oauth2ImplicitSecurity); ok {
+ return x.Oauth2ImplicitSecurity
+ }
+ return nil
+}
+
+func (x *SecurityDefinitionsItem) GetOauth2PasswordSecurity() *Oauth2PasswordSecurity {
+ if x, ok := x.GetOneof().(*SecurityDefinitionsItem_Oauth2PasswordSecurity); ok {
+ return x.Oauth2PasswordSecurity
+ }
+ return nil
+}
+
+func (x *SecurityDefinitionsItem) GetOauth2ApplicationSecurity() *Oauth2ApplicationSecurity {
+ if x, ok := x.GetOneof().(*SecurityDefinitionsItem_Oauth2ApplicationSecurity); ok {
+ return x.Oauth2ApplicationSecurity
+ }
+ return nil
+}
+
+func (x *SecurityDefinitionsItem) GetOauth2AccessCodeSecurity() *Oauth2AccessCodeSecurity {
+ if x, ok := x.GetOneof().(*SecurityDefinitionsItem_Oauth2AccessCodeSecurity); ok {
+ return x.Oauth2AccessCodeSecurity
+ }
+ return nil
+}
+
+type isSecurityDefinitionsItem_Oneof interface {
+ isSecurityDefinitionsItem_Oneof()
+}
+
+type SecurityDefinitionsItem_BasicAuthenticationSecurity struct {
+ BasicAuthenticationSecurity *BasicAuthenticationSecurity `protobuf:"bytes,1,opt,name=basic_authentication_security,json=basicAuthenticationSecurity,proto3,oneof"`
+}
+
+type SecurityDefinitionsItem_ApiKeySecurity struct {
+ ApiKeySecurity *ApiKeySecurity `protobuf:"bytes,2,opt,name=api_key_security,json=apiKeySecurity,proto3,oneof"`
+}
+
+type SecurityDefinitionsItem_Oauth2ImplicitSecurity struct {
+ Oauth2ImplicitSecurity *Oauth2ImplicitSecurity `protobuf:"bytes,3,opt,name=oauth2_implicit_security,json=oauth2ImplicitSecurity,proto3,oneof"`
+}
+
+type SecurityDefinitionsItem_Oauth2PasswordSecurity struct {
+ Oauth2PasswordSecurity *Oauth2PasswordSecurity `protobuf:"bytes,4,opt,name=oauth2_password_security,json=oauth2PasswordSecurity,proto3,oneof"`
+}
+
+type SecurityDefinitionsItem_Oauth2ApplicationSecurity struct {
+ Oauth2ApplicationSecurity *Oauth2ApplicationSecurity `protobuf:"bytes,5,opt,name=oauth2_application_security,json=oauth2ApplicationSecurity,proto3,oneof"`
+}
+
+type SecurityDefinitionsItem_Oauth2AccessCodeSecurity struct {
+ Oauth2AccessCodeSecurity *Oauth2AccessCodeSecurity `protobuf:"bytes,6,opt,name=oauth2_access_code_security,json=oauth2AccessCodeSecurity,proto3,oneof"`
+}
+
+func (*SecurityDefinitionsItem_BasicAuthenticationSecurity) isSecurityDefinitionsItem_Oneof() {}
+
+func (*SecurityDefinitionsItem_ApiKeySecurity) isSecurityDefinitionsItem_Oneof() {}
+
+func (*SecurityDefinitionsItem_Oauth2ImplicitSecurity) isSecurityDefinitionsItem_Oneof() {}
+
+func (*SecurityDefinitionsItem_Oauth2PasswordSecurity) isSecurityDefinitionsItem_Oneof() {}
+
+func (*SecurityDefinitionsItem_Oauth2ApplicationSecurity) isSecurityDefinitionsItem_Oneof() {}
+
+func (*SecurityDefinitionsItem_Oauth2AccessCodeSecurity) isSecurityDefinitionsItem_Oneof() {}
+
+type SecurityRequirement struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedStringArray `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *SecurityRequirement) Reset() {
+ *x = SecurityRequirement{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[54]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SecurityRequirement) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SecurityRequirement) ProtoMessage() {}
+
+func (x *SecurityRequirement) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[54]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SecurityRequirement.ProtoReflect.Descriptor instead.
+func (*SecurityRequirement) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{54}
+}
+
+func (x *SecurityRequirement) GetAdditionalProperties() []*NamedStringArray {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+type StringArray struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Value []string `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *StringArray) Reset() {
+ *x = StringArray{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[55]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *StringArray) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*StringArray) ProtoMessage() {}
+
+func (x *StringArray) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[55]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use StringArray.ProtoReflect.Descriptor instead.
+func (*StringArray) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{55}
+}
+
+func (x *StringArray) GetValue() []string {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+type Tag struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
+ ExternalDocs *ExternalDocs `protobuf:"bytes,3,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,4,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Tag) Reset() {
+ *x = Tag{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[56]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Tag) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Tag) ProtoMessage() {}
+
+func (x *Tag) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[56]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Tag.ProtoReflect.Descriptor instead.
+func (*Tag) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{56}
+}
+
+func (x *Tag) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *Tag) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Tag) GetExternalDocs() *ExternalDocs {
+ if x != nil {
+ return x.ExternalDocs
+ }
+ return nil
+}
+
+func (x *Tag) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type TypeItem struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Value []string `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *TypeItem) Reset() {
+ *x = TypeItem{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[57]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *TypeItem) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*TypeItem) ProtoMessage() {}
+
+func (x *TypeItem) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[57]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use TypeItem.ProtoReflect.Descriptor instead.
+func (*TypeItem) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{57}
+}
+
+func (x *TypeItem) GetValue() []string {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Any property starting with x- is valid.
+type VendorExtension struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedAny `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *VendorExtension) Reset() {
+ *x = VendorExtension{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[58]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *VendorExtension) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*VendorExtension) ProtoMessage() {}
+
+func (x *VendorExtension) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[58]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use VendorExtension.ProtoReflect.Descriptor instead.
+func (*VendorExtension) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{58}
+}
+
+func (x *VendorExtension) GetAdditionalProperties() []*NamedAny {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+type Xml struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"`
+ Prefix string `protobuf:"bytes,3,opt,name=prefix,proto3" json:"prefix,omitempty"`
+ Attribute bool `protobuf:"varint,4,opt,name=attribute,proto3" json:"attribute,omitempty"`
+ Wrapped bool `protobuf:"varint,5,opt,name=wrapped,proto3" json:"wrapped,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Xml) Reset() {
+ *x = Xml{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[59]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Xml) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Xml) ProtoMessage() {}
+
+func (x *Xml) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[59]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Xml.ProtoReflect.Descriptor instead.
+func (*Xml) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{59}
+}
+
+func (x *Xml) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *Xml) GetNamespace() string {
+ if x != nil {
+ return x.Namespace
+ }
+ return ""
+}
+
+func (x *Xml) GetPrefix() string {
+ if x != nil {
+ return x.Prefix
+ }
+ return ""
+}
+
+func (x *Xml) GetAttribute() bool {
+ if x != nil {
+ return x.Attribute
+ }
+ return false
+}
+
+func (x *Xml) GetWrapped() bool {
+ if x != nil {
+ return x.Wrapped
+ }
+ return false
+}
+
+func (x *Xml) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+var File_openapiv2_OpenAPIv2_proto protoreflect.FileDescriptor
+
+var file_openapiv2_OpenAPIv2_proto_rawDesc = []byte{
+ 0x0a, 0x19, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x4f, 0x70, 0x65, 0x6e,
+ 0x41, 0x50, 0x49, 0x76, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f,
+ 0x74, 0x6f, 0x22, 0x6d, 0x0a, 0x18, 0x41, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c,
+ 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x2c,
+ 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65,
+ 0x6d, 0x61, 0x48, 0x00, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x1a, 0x0a, 0x07,
+ 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52,
+ 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f,
+ 0x66, 0x22, 0x45, 0x0a, 0x03, 0x41, 0x6e, 0x79, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,
+ 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
+ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76,
+ 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x22, 0xab, 0x01, 0x0a, 0x0e, 0x41, 0x70, 0x69,
+ 0x4b, 0x65, 0x79, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74,
+ 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12,
+ 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
+ 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x02, 0x69, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69,
+ 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
+ 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f,
+ 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32,
+ 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d,
+ 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74,
+ 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x94, 0x01, 0x0a, 0x1b, 0x42, 0x61, 0x73, 0x69, 0x63,
+ 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65,
+ 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65,
+ 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x10,
+ 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e,
+ 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65,
+ 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xde, 0x01,
+ 0x0a, 0x0d, 0x42, 0x6f, 0x64, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12,
+ 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
+ 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65,
+ 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65,
+ 0x64, 0x12, 0x2a, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53,
+ 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x3f, 0x0a,
+ 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f,
+ 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76,
+ 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x86,
+ 0x01, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
+ 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10,
+ 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c,
+ 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72,
+ 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b,
+ 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61,
+ 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78,
+ 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x54, 0x0a, 0x07, 0x44, 0x65, 0x66, 0x61, 0x75,
+ 0x6c, 0x74, 0x12, 0x49, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c,
+ 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,
+ 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e,
+ 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f,
+ 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x5b, 0x0a,
+ 0x0b, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x4c, 0x0a, 0x15,
+ 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65,
+ 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x63,
+ 0x68, 0x65, 0x6d, 0x61, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c,
+ 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xe8, 0x05, 0x0a, 0x08, 0x44,
+ 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x77, 0x61, 0x67, 0x67,
+ 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x77, 0x61, 0x67, 0x67, 0x65,
+ 0x72, 0x12, 0x24, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x10, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6e, 0x66,
+ 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18,
+ 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x62,
+ 0x61, 0x73, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
+ 0x62, 0x61, 0x73, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x63, 0x68, 0x65,
+ 0x6d, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d,
+ 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x73, 0x18, 0x06,
+ 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x73, 0x12, 0x1a,
+ 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09,
+ 0x52, 0x08, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x73, 0x12, 0x27, 0x0a, 0x05, 0x70, 0x61,
+ 0x74, 0x68, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x73, 0x52, 0x05, 0x70, 0x61,
+ 0x74, 0x68, 0x73, 0x12, 0x39, 0x0a, 0x0b, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f,
+ 0x6e, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e,
+ 0x73, 0x52, 0x0b, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x40,
+ 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x0a, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e,
+ 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74,
+ 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73,
+ 0x12, 0x3d, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x0b, 0x20,
+ 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32,
+ 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74,
+ 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x12,
+ 0x3b, 0x0a, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x0c, 0x20, 0x03, 0x28,
+ 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53,
+ 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65,
+ 0x6e, 0x74, 0x52, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x52, 0x0a, 0x14,
+ 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x5f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74,
+ 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79,
+ 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x13, 0x73, 0x65, 0x63,
+ 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73,
+ 0x12, 0x23, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x61, 0x67, 0x52,
+ 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61,
+ 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f,
+ 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e,
+ 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c,
+ 0x44, 0x6f, 0x63, 0x73, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65,
+ 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65,
+ 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65,
+ 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x55, 0x0a, 0x08, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65,
+ 0x73, 0x12, 0x49, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f,
+ 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
+ 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61,
+ 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e,
+ 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x83, 0x01, 0x0a,
+ 0x0c, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x20, 0x0a,
+ 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12,
+ 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72,
+ 0x6c, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65,
+ 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e,
+ 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69,
+ 0x6f, 0x6e, 0x22, 0xff, 0x02, 0x0a, 0x0a, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d,
+ 0x61, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74,
+ 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12,
+ 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
+ 0x6e, 0x12, 0x29, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x04, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e,
+ 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x1a, 0x0a, 0x08,
+ 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08,
+ 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65,
+ 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09,
+ 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52,
+ 0x08, 0x72, 0x65, 0x61, 0x64, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74,
+ 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b,
+ 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78,
+ 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65,
+ 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x29, 0x0a, 0x07, 0x65, 0x78, 0x61, 0x6d,
+ 0x70, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x65, 0x78, 0x61, 0x6d,
+ 0x70, 0x6c, 0x65, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78,
+ 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e,
+ 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64,
+ 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e,
+ 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xab, 0x06, 0x0a, 0x1a, 0x46, 0x6f, 0x72, 0x6d, 0x44, 0x61, 0x74,
+ 0x61, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68,
+ 0x65, 0x6d, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12,
+ 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12,
+ 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
+ 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x65,
+ 0x6d, 0x70, 0x74, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08,
+ 0x52, 0x0f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x56, 0x61, 0x6c, 0x75,
+ 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18,
+ 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x31, 0x0a,
+ 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f,
+ 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74,
+ 0x69, 0x76, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73,
+ 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66,
+ 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6c,
+ 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a,
+ 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52,
+ 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69,
+ 0x6d, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d,
+ 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f,
+ 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65,
+ 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12,
+ 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x01,
+ 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63,
+ 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0e,
+ 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d,
+ 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65,
+ 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c,
+ 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e,
+ 0x67, 0x74, 0x68, 0x18, 0x10, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65,
+ 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18,
+ 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b,
+ 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28,
+ 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d,
+ 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08,
+ 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71,
+ 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b,
+ 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x65,
+ 0x6e, 0x75, 0x6d, 0x18, 0x15, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d,
+ 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18,
+ 0x16, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f,
+ 0x66, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65,
+ 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x17, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e,
+ 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69,
+ 0x6f, 0x6e, 0x22, 0xab, 0x05, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x12, 0x0a,
+ 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70,
+ 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x31, 0x0a, 0x05, 0x69, 0x74, 0x65,
+ 0x6d, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73,
+ 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x2b, 0x0a, 0x11,
+ 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61,
+ 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74,
+ 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a, 0x07, 0x64, 0x65, 0x66,
+ 0x61, 0x75, 0x6c, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64, 0x65, 0x66,
+ 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18,
+ 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b,
+ 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x69,
+ 0x6d, 0x75, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75,
+ 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d,
+ 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x69,
+ 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69,
+ 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08,
+ 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x69, 0x6e, 0x69, 0x6d,
+ 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68,
+ 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74,
+ 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18,
+ 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68,
+ 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x0c, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61,
+ 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d,
+ 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x69,
+ 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x49,
+ 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x69,
+ 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x6e, 0x69, 0x71,
+ 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18,
+ 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x1f, 0x0a, 0x0b,
+ 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18, 0x11, 0x20, 0x01, 0x28,
+ 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f, 0x66, 0x12, 0x20, 0x0a,
+ 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x12, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12,
+ 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73,
+ 0x69, 0x6f, 0x6e, 0x18, 0x13, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52,
+ 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e,
+ 0x22, 0xfd, 0x05, 0x0a, 0x18, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d,
+ 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x1a, 0x0a,
+ 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52,
+ 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73,
+ 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
+ 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e,
+ 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
+ 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74,
+ 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x06, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x31, 0x0a, 0x05, 0x69,
+ 0x74, 0x65, 0x6d, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76,
+ 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x2b,
+ 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x6f, 0x72,
+ 0x6d, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6c, 0x6c, 0x65,
+ 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a, 0x07, 0x64,
+ 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f,
+ 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64,
+ 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75,
+ 0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d,
+ 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x61,
+ 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63,
+ 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x18, 0x0a,
+ 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07,
+ 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75,
+ 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0d, 0x20, 0x01,
+ 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x69, 0x6e,
+ 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67,
+ 0x74, 0x68, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e,
+ 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74,
+ 0x68, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67,
+ 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x10, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, 0x0a, 0x09,
+ 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x03, 0x52,
+ 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e,
+ 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69,
+ 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65,
+ 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x6e,
+ 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x65, 0x6e, 0x75,
+ 0x6d, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x1f,
+ 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18, 0x15, 0x20,
+ 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f, 0x66, 0x12,
+ 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73,
+ 0x69, 0x6f, 0x6e, 0x18, 0x16, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52,
+ 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e,
+ 0x22, 0x57, 0x0a, 0x07, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x4c, 0x0a, 0x15, 0x61,
+ 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72,
+ 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x48, 0x65, 0x61,
+ 0x64, 0x65, 0x72, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50,
+ 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xa1, 0x02, 0x0a, 0x04, 0x49, 0x6e,
+ 0x66, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73,
+ 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69,
+ 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
+ 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,
+ 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x10, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x5f, 0x6f, 0x66,
+ 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e,
+ 0x74, 0x65, 0x72, 0x6d, 0x73, 0x4f, 0x66, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x2d,
+ 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x13, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x6f, 0x6e,
+ 0x74, 0x61, 0x63, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x2d, 0x0a,
+ 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x63, 0x65,
+ 0x6e, 0x73, 0x65, 0x52, 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x10,
+ 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e,
+ 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65,
+ 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x37, 0x0a,
+ 0x09, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x2a, 0x0a, 0x06, 0x73, 0x63,
+ 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x06,
+ 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22, 0x44, 0x0a, 0x0d, 0x4a, 0x73, 0x6f, 0x6e, 0x52, 0x65,
+ 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x11, 0x0a, 0x04, 0x5f, 0x72, 0x65, 0x66, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x52, 0x65, 0x66, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65,
+ 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x70, 0x0a, 0x07,
+ 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75,
+ 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x3f, 0x0a,
+ 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f,
+ 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76,
+ 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x45,
+ 0x0a, 0x08, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
+ 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x25,
+ 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e,
+ 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05,
+ 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x4b, 0x0a, 0x0b, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x48, 0x65,
+ 0x61, 0x64, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,
+ 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c,
+ 0x75, 0x65, 0x22, 0x51, 0x0a, 0x0e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d,
+ 0x65, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,
+ 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x05,
+ 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x4f, 0x0a, 0x0d, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61,
+ 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61,
+ 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x52,
+ 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x4f, 0x0a, 0x0d, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x52,
+ 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x76,
+ 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+ 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x59, 0x0a, 0x12, 0x4e, 0x61, 0x6d, 0x65, 0x64,
+ 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,
+ 0x65, 0x12, 0x2f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
+ 0x32, 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65,
+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c,
+ 0x75, 0x65, 0x22, 0x4b, 0x0a, 0x0b, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d,
+ 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02,
+ 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76,
+ 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22,
+ 0x6d, 0x0a, 0x1c, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79,
+ 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12,
+ 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
+ 0x61, 0x6d, 0x65, 0x12, 0x39, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e,
+ 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69,
+ 0x6f, 0x6e, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x37,
+ 0x0a, 0x0b, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,
+ 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x55, 0x0a, 0x10, 0x4e, 0x61, 0x6d, 0x65, 0x64,
+ 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e,
+ 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
+ 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x74, 0x72, 0x69,
+ 0x6e, 0x67, 0x41, 0x72, 0x72, 0x61, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xb5,
+ 0x03, 0x0a, 0x10, 0x4e, 0x6f, 0x6e, 0x42, 0x6f, 0x64, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65,
+ 0x74, 0x65, 0x72, 0x12, 0x65, 0x0a, 0x1b, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x70, 0x61,
+ 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x75, 0x62, 0x5f, 0x73, 0x63, 0x68, 0x65,
+ 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61,
+ 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x48, 0x00,
+ 0x52, 0x18, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65,
+ 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x6c, 0x0a, 0x1e, 0x66, 0x6f,
+ 0x72, 0x6d, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65,
+ 0x72, 0x5f, 0x73, 0x75, 0x62, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e,
+ 0x46, 0x6f, 0x72, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65,
+ 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x48, 0x00, 0x52, 0x1a, 0x66, 0x6f,
+ 0x72, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53,
+ 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x62, 0x0a, 0x1a, 0x71, 0x75, 0x65, 0x72,
+ 0x79, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x75, 0x62, 0x5f,
+ 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f,
+ 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50,
+ 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d,
+ 0x61, 0x48, 0x00, 0x52, 0x17, 0x71, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65,
+ 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x5f, 0x0a, 0x19,
+ 0x70, 0x61, 0x74, 0x68, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x73,
+ 0x75, 0x62, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x74,
+ 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68,
+ 0x65, 0x6d, 0x61, 0x48, 0x00, 0x52, 0x16, 0x70, 0x61, 0x74, 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d,
+ 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x42, 0x07, 0x0a,
+ 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0xa1, 0x02, 0x0a, 0x18, 0x4f, 0x61, 0x75, 0x74, 0x68,
+ 0x32, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x63, 0x75, 0x72,
+ 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x30, 0x0a, 0x06, 0x73,
+ 0x63, 0x6f, 0x70, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x53,
+ 0x63, 0x6f, 0x70, 0x65, 0x73, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x2b, 0x0a,
+ 0x11, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x75,
+ 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72,
+ 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x6f,
+ 0x6b, 0x65, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74,
+ 0x6f, 0x6b, 0x65, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72,
+ 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65,
+ 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e,
+ 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20,
+ 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32,
+ 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f,
+ 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xf5, 0x01, 0x0a, 0x19, 0x4f,
+ 0x61, 0x75, 0x74, 0x68, 0x32, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
+ 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04,
+ 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x6c, 0x6f, 0x77,
+ 0x12, 0x30, 0x0a, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
+ 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x61,
+ 0x75, 0x74, 0x68, 0x32, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x70,
+ 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18,
+ 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x55, 0x72, 0x6c, 0x12,
+ 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
+ 0x6e, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65,
+ 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e,
+ 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69,
+ 0x6f, 0x6e, 0x22, 0x82, 0x02, 0x0a, 0x16, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x49, 0x6d, 0x70,
+ 0x6c, 0x69, 0x63, 0x69, 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a,
+ 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70,
+ 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x18,
+ 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x52,
+ 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x75, 0x74, 0x68, 0x6f,
+ 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x10, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f,
+ 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
+ 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72,
+ 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72,
+ 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b,
+ 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61,
+ 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78,
+ 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xf2, 0x01, 0x0a, 0x16, 0x4f, 0x61, 0x75, 0x74,
+ 0x68, 0x32, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69,
+ 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x02,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x63,
+ 0x6f, 0x70, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x53, 0x63,
+ 0x6f, 0x70, 0x65, 0x73, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x09,
+ 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73,
+ 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
+ 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x10, 0x76,
+ 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18,
+ 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e,
+ 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x5c, 0x0a, 0x0c,
+ 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x4c, 0x0a, 0x15,
+ 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65,
+ 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x74,
+ 0x72, 0x69, 0x6e, 0x67, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c,
+ 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x9e, 0x04, 0x0a, 0x09, 0x4f,
+ 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73,
+ 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x18, 0x0a, 0x07,
+ 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73,
+ 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
+ 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73,
+ 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65,
+ 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, 0x74,
+ 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72,
+ 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6f, 0x70, 0x65, 0x72, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f,
+ 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72,
+ 0x6f, 0x64, 0x75, 0x63, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72,
+ 0x6f, 0x64, 0x75, 0x63, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d,
+ 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d,
+ 0x65, 0x73, 0x12, 0x3a, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73,
+ 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x49, 0x74,
+ 0x65, 0x6d, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x33,
+ 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52,
+ 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e,
+ 0x73, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x18, 0x0a,
+ 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x12, 0x1e, 0x0a,
+ 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28,
+ 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x3b, 0x0a,
+ 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32,
+ 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x65, 0x63,
+ 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74,
+ 0x52, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65,
+ 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0d,
+ 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76,
+ 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64,
+ 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xa6, 0x01, 0x0a, 0x09,
+ 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x42, 0x0a, 0x0e, 0x62, 0x6f, 0x64,
+ 0x79, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x42,
+ 0x6f, 0x64, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0d,
+ 0x62, 0x6f, 0x64, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x4c, 0x0a,
+ 0x12, 0x6e, 0x6f, 0x6e, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65,
+ 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x6f, 0x6e, 0x42, 0x6f, 0x64, 0x79, 0x50, 0x61,
+ 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x10, 0x6e, 0x6f, 0x6e, 0x42, 0x6f,
+ 0x64, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x42, 0x07, 0x0a, 0x05, 0x6f,
+ 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x67, 0x0a, 0x14, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65,
+ 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x4f, 0x0a, 0x15,
+ 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65,
+ 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61,
+ 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f,
+ 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x94, 0x01,
+ 0x0a, 0x0e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x49, 0x74, 0x65, 0x6d,
+ 0x12, 0x35, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20,
+ 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32,
+ 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x09, 0x70, 0x61,
+ 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x42, 0x0a, 0x0e, 0x6a, 0x73, 0x6f, 0x6e, 0x5f,
+ 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4a, 0x73, 0x6f,
+ 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x6a, 0x73,
+ 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f,
+ 0x6e, 0x65, 0x6f, 0x66, 0x22, 0xcf, 0x03, 0x0a, 0x08, 0x50, 0x61, 0x74, 0x68, 0x49, 0x74, 0x65,
+ 0x6d, 0x12, 0x11, 0x0a, 0x04, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x03, 0x52, 0x65, 0x66, 0x12, 0x27, 0x0a, 0x03, 0x67, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f,
+ 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x67, 0x65, 0x74, 0x12, 0x27, 0x0a,
+ 0x03, 0x70, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f,
+ 0x6e, 0x52, 0x03, 0x70, 0x75, 0x74, 0x12, 0x29, 0x0a, 0x04, 0x70, 0x6f, 0x73, 0x74, 0x18, 0x04,
+ 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76,
+ 0x32, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x70, 0x6f, 0x73,
+ 0x74, 0x12, 0x2d, 0x0a, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f,
+ 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65,
+ 0x12, 0x2f, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f,
+ 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e,
+ 0x73, 0x12, 0x29, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x70, 0x65,
+ 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x68, 0x65, 0x61, 0x64, 0x12, 0x2b, 0x0a, 0x05,
+ 0x70, 0x61, 0x74, 0x63, 0x68, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69,
+ 0x6f, 0x6e, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x12, 0x3a, 0x0a, 0x0a, 0x70, 0x61, 0x72,
+ 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e,
+ 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d,
+ 0x65, 0x74, 0x65, 0x72, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d,
+ 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f,
+ 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32,
+ 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d,
+ 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74,
+ 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xfb, 0x05, 0x0a, 0x16, 0x50, 0x61, 0x74, 0x68, 0x50,
+ 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d,
+ 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x01, 0x20,
+ 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x0e, 0x0a,
+ 0x02, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x20, 0x0a,
+ 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12,
+ 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
+ 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61,
+ 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12,
+ 0x31, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x69, 0x6d,
+ 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65,
+ 0x6d, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
+ 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63,
+ 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12,
+ 0x29, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b,
+ 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e,
+ 0x79, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61,
+ 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78,
+ 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76,
+ 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52,
+ 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75,
+ 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0c, 0x20, 0x01,
+ 0x28, 0x01, 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65,
+ 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d,
+ 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76,
+ 0x65, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f,
+ 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61,
+ 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c,
+ 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e,
+ 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72,
+ 0x6e, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e,
+ 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x11, 0x20,
+ 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a,
+ 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x03,
+ 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e,
+ 0x69, 0x71, 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x08,
+ 0x52, 0x0b, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a,
+ 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, 0x6e,
+ 0x75, 0x6d, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f,
+ 0x66, 0x18, 0x15, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c,
+ 0x65, 0x4f, 0x66, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78,
+ 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x16, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e,
+ 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64,
+ 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e,
+ 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x77, 0x0a, 0x05, 0x50, 0x61, 0x74, 0x68, 0x73, 0x12, 0x3f, 0x0a,
+ 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f,
+ 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76,
+ 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2d,
+ 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6f,
+ 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50,
+ 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0x92, 0x05,
+ 0x0a, 0x0f, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d,
+ 0x73, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x31, 0x0a,
+ 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f,
+ 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74,
+ 0x69, 0x76, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73,
+ 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66,
+ 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6c,
+ 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a,
+ 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52,
+ 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69,
+ 0x6d, 0x75, 0x6d, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d,
+ 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f,
+ 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65,
+ 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12,
+ 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x01,
+ 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63,
+ 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x09,
+ 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d,
+ 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65,
+ 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c,
+ 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e,
+ 0x67, 0x74, 0x68, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65,
+ 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18,
+ 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b,
+ 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28,
+ 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d,
+ 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08,
+ 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71,
+ 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b,
+ 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x65,
+ 0x6e, 0x75, 0x6d, 0x18, 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d,
+ 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18,
+ 0x11, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f,
+ 0x66, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65,
+ 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x12, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e,
+ 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69,
+ 0x6f, 0x6e, 0x22, 0x5a, 0x0a, 0x0a, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73,
+ 0x12, 0x4c, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70,
+ 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
+ 0x17, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d,
+ 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69,
+ 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xa8,
+ 0x06, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65,
+ 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65,
+ 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65,
+ 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
+ 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73,
+ 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
+ 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x11,
+ 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75,
+ 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x45, 0x6d,
+ 0x70, 0x74, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65,
+ 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06,
+ 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f,
+ 0x72, 0x6d, 0x61, 0x74, 0x12, 0x31, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x08, 0x20,
+ 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32,
+ 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x73,
+ 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65,
+ 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x09, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f,
+ 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18,
+ 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12,
+ 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x01,
+ 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63,
+ 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0c,
+ 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d,
+ 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75,
+ 0x6d, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d,
+ 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69,
+ 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63,
+ 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a,
+ 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0f, 0x20, 0x01, 0x28,
+ 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a,
+ 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x10, 0x20, 0x01, 0x28, 0x03,
+ 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70,
+ 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61,
+ 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65,
+ 0x6d, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65,
+ 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18,
+ 0x13, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12,
+ 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18,
+ 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65,
+ 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x15, 0x20, 0x03, 0x28, 0x0b,
+ 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e,
+ 0x79, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69,
+ 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18, 0x16, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75,
+ 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f, 0x66, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64,
+ 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x17, 0x20, 0x03,
+ 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e,
+ 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72,
+ 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xfe, 0x01, 0x0a, 0x08, 0x52, 0x65,
+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
+ 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73,
+ 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65,
+ 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x49, 0x74, 0x65, 0x6d,
+ 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x2d, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64,
+ 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x52, 0x07,
+ 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x30, 0x0a, 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70,
+ 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x52,
+ 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e,
+ 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20,
+ 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32,
+ 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f,
+ 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x65, 0x0a, 0x13, 0x52, 0x65,
+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e,
+ 0x73, 0x12, 0x4e, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f,
+ 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
+ 0x32, 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61,
+ 0x6d, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64,
+ 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65,
+ 0x73, 0x22, 0x90, 0x01, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x61,
+ 0x6c, 0x75, 0x65, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x32, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x08, 0x72,
+ 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x0e, 0x6a, 0x73, 0x6f, 0x6e, 0x5f,
+ 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4a, 0x73, 0x6f,
+ 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x6a, 0x73,
+ 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f,
+ 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x91, 0x01, 0x0a, 0x09, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
+ 0x65, 0x73, 0x12, 0x43, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x63,
+ 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70,
+ 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x70, 0x6f,
+ 0x6e, 0x73, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f,
+ 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28,
+ 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e,
+ 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45,
+ 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xaf, 0x09, 0x0a, 0x06, 0x53, 0x63, 0x68,
+ 0x65, 0x6d, 0x61, 0x12, 0x11, 0x0a, 0x04, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x03, 0x52, 0x65, 0x66, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74,
+ 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x14,
+ 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74,
+ 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
+ 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72,
+ 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c,
+ 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c,
+ 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66,
+ 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65,
+ 0x4f, 0x66, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x07, 0x20,
+ 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11,
+ 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75,
+ 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69,
+ 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e,
+ 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x09, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69,
+ 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65,
+ 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10,
+ 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d,
+ 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0b,
+ 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12,
+ 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0c, 0x20,
+ 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18,
+ 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f,
+ 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78,
+ 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65,
+ 0x6d, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65,
+ 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65,
+ 0x6d, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65,
+ 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x72, 0x6f,
+ 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6d,
+ 0x61, 0x78, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e,
+ 0x6d, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x12,
+ 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6d, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74,
+ 0x69, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18,
+ 0x13, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12,
+ 0x23, 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e,
+ 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04,
+ 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x59, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e,
+ 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x15, 0x20,
+ 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32,
+ 0x2e, 0x41, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65,
+ 0x72, 0x74, 0x69, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74,
+ 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12,
+ 0x28, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e,
+ 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x49,
+ 0x74, 0x65, 0x6d, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x69, 0x74, 0x65,
+ 0x6d, 0x73, 0x18, 0x17, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52,
+ 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x29, 0x0a, 0x06, 0x61, 0x6c, 0x6c, 0x5f, 0x6f, 0x66,
+ 0x18, 0x18, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x05, 0x61, 0x6c, 0x6c, 0x4f,
+ 0x66, 0x12, 0x36, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18,
+ 0x19, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x32, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x52, 0x0a, 0x70,
+ 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x64, 0x69, 0x73,
+ 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x0d, 0x64, 0x69, 0x73, 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x12,
+ 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x1b, 0x20, 0x01,
+ 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x61, 0x64, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x21, 0x0a, 0x03,
+ 0x78, 0x6d, 0x6c, 0x18, 0x1c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x58, 0x6d, 0x6c, 0x52, 0x03, 0x78, 0x6d, 0x6c, 0x12,
+ 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73,
+ 0x18, 0x1d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73,
+ 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x29,
+ 0x0a, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79,
+ 0x52, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e,
+ 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x1f, 0x20,
+ 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32,
+ 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f,
+ 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x7e, 0x0a, 0x0a, 0x53, 0x63,
+ 0x68, 0x65, 0x6d, 0x61, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x2c, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65,
+ 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x48, 0x00, 0x52, 0x06,
+ 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x39, 0x0a, 0x0b, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x73,
+ 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x63, 0x68,
+ 0x65, 0x6d, 0x61, 0x48, 0x00, 0x52, 0x0a, 0x66, 0x69, 0x6c, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d,
+ 0x61, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x74, 0x0a, 0x13, 0x53, 0x65,
+ 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e,
+ 0x73, 0x12, 0x5d, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f,
+ 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
+ 0x32, 0x28, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61,
+ 0x6d, 0x65, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e,
+ 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69,
+ 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73,
+ 0x22, 0xe9, 0x04, 0x0a, 0x17, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66,
+ 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x6d, 0x0a, 0x1d,
+ 0x62, 0x61, 0x73, 0x69, 0x63, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20,
+ 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32,
+ 0x2e, 0x42, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, 0x1b,
+ 0x62, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74,
+ 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x46, 0x0a, 0x10, 0x61,
+ 0x70, 0x69, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x32, 0x2e, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74,
+ 0x79, 0x48, 0x00, 0x52, 0x0e, 0x61, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x53, 0x65, 0x63, 0x75, 0x72,
+ 0x69, 0x74, 0x79, 0x12, 0x5e, 0x0a, 0x18, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x5f, 0x69, 0x6d,
+ 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18,
+ 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x49, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69,
+ 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, 0x16, 0x6f, 0x61, 0x75,
+ 0x74, 0x68, 0x32, 0x49, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x53, 0x65, 0x63, 0x75, 0x72,
+ 0x69, 0x74, 0x79, 0x12, 0x5e, 0x0a, 0x18, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x5f, 0x70, 0x61,
+ 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18,
+ 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72,
+ 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, 0x16, 0x6f, 0x61, 0x75,
+ 0x74, 0x68, 0x32, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72,
+ 0x69, 0x74, 0x79, 0x12, 0x67, 0x0a, 0x1b, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x5f, 0x61, 0x70,
+ 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69,
+ 0x74, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x41, 0x70, 0x70, 0x6c,
+ 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x48,
+ 0x00, 0x52, 0x19, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x65, 0x0a, 0x1b,
+ 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x6f,
+ 0x64, 0x65, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f,
+ 0x61, 0x75, 0x74, 0x68, 0x32, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x53,
+ 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, 0x18, 0x6f, 0x61, 0x75, 0x74, 0x68,
+ 0x32, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x63, 0x75, 0x72,
+ 0x69, 0x74, 0x79, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x68, 0x0a, 0x13,
+ 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d,
+ 0x65, 0x6e, 0x74, 0x12, 0x51, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61,
+ 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03,
+ 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e,
+ 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x41, 0x72, 0x72, 0x61, 0x79,
+ 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70,
+ 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x23, 0x0a, 0x0b, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67,
+ 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01,
+ 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xbb, 0x01, 0x0a, 0x03,
+ 0x54, 0x61, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72,
+ 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65,
+ 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74,
+ 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
+ 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78,
+ 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65,
+ 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64,
+ 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x03,
+ 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e,
+ 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72,
+ 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x20, 0x0a, 0x08, 0x54, 0x79, 0x70,
+ 0x65, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01,
+ 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x5c, 0x0a, 0x0f, 0x56,
+ 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x49,
+ 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f,
+ 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e,
+ 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64,
+ 0x41, 0x6e, 0x79, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50,
+ 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xc8, 0x01, 0x0a, 0x03, 0x58, 0x6d,
+ 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61,
+ 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70,
+ 0x61, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x03, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x1c, 0x0a, 0x09, 0x61,
+ 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09,
+ 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x77, 0x72, 0x61,
+ 0x70, 0x70, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x77, 0x72, 0x61, 0x70,
+ 0x70, 0x65, 0x64, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78,
+ 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e,
+ 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64,
+ 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e,
+ 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x3e, 0x0a, 0x0e, 0x6f, 0x72, 0x67, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x5f, 0x76, 0x32, 0x42, 0x0c, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x50, 0x49, 0x50,
+ 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x16, 0x2e, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x76, 0x32, 0x3b, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x32, 0xa2, 0x02,
+ 0x03, 0x4f, 0x41, 0x53, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_openapiv2_OpenAPIv2_proto_rawDescOnce sync.Once
+ file_openapiv2_OpenAPIv2_proto_rawDescData = file_openapiv2_OpenAPIv2_proto_rawDesc
+)
+
+func file_openapiv2_OpenAPIv2_proto_rawDescGZIP() []byte {
+ file_openapiv2_OpenAPIv2_proto_rawDescOnce.Do(func() {
+ file_openapiv2_OpenAPIv2_proto_rawDescData = protoimpl.X.CompressGZIP(file_openapiv2_OpenAPIv2_proto_rawDescData)
+ })
+ return file_openapiv2_OpenAPIv2_proto_rawDescData
+}
+
+var file_openapiv2_OpenAPIv2_proto_msgTypes = make([]protoimpl.MessageInfo, 60)
+var file_openapiv2_OpenAPIv2_proto_goTypes = []interface{}{
+ (*AdditionalPropertiesItem)(nil), // 0: openapi.v2.AdditionalPropertiesItem
+ (*Any)(nil), // 1: openapi.v2.Any
+ (*ApiKeySecurity)(nil), // 2: openapi.v2.ApiKeySecurity
+ (*BasicAuthenticationSecurity)(nil), // 3: openapi.v2.BasicAuthenticationSecurity
+ (*BodyParameter)(nil), // 4: openapi.v2.BodyParameter
+ (*Contact)(nil), // 5: openapi.v2.Contact
+ (*Default)(nil), // 6: openapi.v2.Default
+ (*Definitions)(nil), // 7: openapi.v2.Definitions
+ (*Document)(nil), // 8: openapi.v2.Document
+ (*Examples)(nil), // 9: openapi.v2.Examples
+ (*ExternalDocs)(nil), // 10: openapi.v2.ExternalDocs
+ (*FileSchema)(nil), // 11: openapi.v2.FileSchema
+ (*FormDataParameterSubSchema)(nil), // 12: openapi.v2.FormDataParameterSubSchema
+ (*Header)(nil), // 13: openapi.v2.Header
+ (*HeaderParameterSubSchema)(nil), // 14: openapi.v2.HeaderParameterSubSchema
+ (*Headers)(nil), // 15: openapi.v2.Headers
+ (*Info)(nil), // 16: openapi.v2.Info
+ (*ItemsItem)(nil), // 17: openapi.v2.ItemsItem
+ (*JsonReference)(nil), // 18: openapi.v2.JsonReference
+ (*License)(nil), // 19: openapi.v2.License
+ (*NamedAny)(nil), // 20: openapi.v2.NamedAny
+ (*NamedHeader)(nil), // 21: openapi.v2.NamedHeader
+ (*NamedParameter)(nil), // 22: openapi.v2.NamedParameter
+ (*NamedPathItem)(nil), // 23: openapi.v2.NamedPathItem
+ (*NamedResponse)(nil), // 24: openapi.v2.NamedResponse
+ (*NamedResponseValue)(nil), // 25: openapi.v2.NamedResponseValue
+ (*NamedSchema)(nil), // 26: openapi.v2.NamedSchema
+ (*NamedSecurityDefinitionsItem)(nil), // 27: openapi.v2.NamedSecurityDefinitionsItem
+ (*NamedString)(nil), // 28: openapi.v2.NamedString
+ (*NamedStringArray)(nil), // 29: openapi.v2.NamedStringArray
+ (*NonBodyParameter)(nil), // 30: openapi.v2.NonBodyParameter
+ (*Oauth2AccessCodeSecurity)(nil), // 31: openapi.v2.Oauth2AccessCodeSecurity
+ (*Oauth2ApplicationSecurity)(nil), // 32: openapi.v2.Oauth2ApplicationSecurity
+ (*Oauth2ImplicitSecurity)(nil), // 33: openapi.v2.Oauth2ImplicitSecurity
+ (*Oauth2PasswordSecurity)(nil), // 34: openapi.v2.Oauth2PasswordSecurity
+ (*Oauth2Scopes)(nil), // 35: openapi.v2.Oauth2Scopes
+ (*Operation)(nil), // 36: openapi.v2.Operation
+ (*Parameter)(nil), // 37: openapi.v2.Parameter
+ (*ParameterDefinitions)(nil), // 38: openapi.v2.ParameterDefinitions
+ (*ParametersItem)(nil), // 39: openapi.v2.ParametersItem
+ (*PathItem)(nil), // 40: openapi.v2.PathItem
+ (*PathParameterSubSchema)(nil), // 41: openapi.v2.PathParameterSubSchema
+ (*Paths)(nil), // 42: openapi.v2.Paths
+ (*PrimitivesItems)(nil), // 43: openapi.v2.PrimitivesItems
+ (*Properties)(nil), // 44: openapi.v2.Properties
+ (*QueryParameterSubSchema)(nil), // 45: openapi.v2.QueryParameterSubSchema
+ (*Response)(nil), // 46: openapi.v2.Response
+ (*ResponseDefinitions)(nil), // 47: openapi.v2.ResponseDefinitions
+ (*ResponseValue)(nil), // 48: openapi.v2.ResponseValue
+ (*Responses)(nil), // 49: openapi.v2.Responses
+ (*Schema)(nil), // 50: openapi.v2.Schema
+ (*SchemaItem)(nil), // 51: openapi.v2.SchemaItem
+ (*SecurityDefinitions)(nil), // 52: openapi.v2.SecurityDefinitions
+ (*SecurityDefinitionsItem)(nil), // 53: openapi.v2.SecurityDefinitionsItem
+ (*SecurityRequirement)(nil), // 54: openapi.v2.SecurityRequirement
+ (*StringArray)(nil), // 55: openapi.v2.StringArray
+ (*Tag)(nil), // 56: openapi.v2.Tag
+ (*TypeItem)(nil), // 57: openapi.v2.TypeItem
+ (*VendorExtension)(nil), // 58: openapi.v2.VendorExtension
+ (*Xml)(nil), // 59: openapi.v2.Xml
+ (*anypb.Any)(nil), // 60: google.protobuf.Any
+}
+var file_openapiv2_OpenAPIv2_proto_depIdxs = []int32{
+ 50, // 0: openapi.v2.AdditionalPropertiesItem.schema:type_name -> openapi.v2.Schema
+ 60, // 1: openapi.v2.Any.value:type_name -> google.protobuf.Any
+ 20, // 2: openapi.v2.ApiKeySecurity.vendor_extension:type_name -> openapi.v2.NamedAny
+ 20, // 3: openapi.v2.BasicAuthenticationSecurity.vendor_extension:type_name -> openapi.v2.NamedAny
+ 50, // 4: openapi.v2.BodyParameter.schema:type_name -> openapi.v2.Schema
+ 20, // 5: openapi.v2.BodyParameter.vendor_extension:type_name -> openapi.v2.NamedAny
+ 20, // 6: openapi.v2.Contact.vendor_extension:type_name -> openapi.v2.NamedAny
+ 20, // 7: openapi.v2.Default.additional_properties:type_name -> openapi.v2.NamedAny
+ 26, // 8: openapi.v2.Definitions.additional_properties:type_name -> openapi.v2.NamedSchema
+ 16, // 9: openapi.v2.Document.info:type_name -> openapi.v2.Info
+ 42, // 10: openapi.v2.Document.paths:type_name -> openapi.v2.Paths
+ 7, // 11: openapi.v2.Document.definitions:type_name -> openapi.v2.Definitions
+ 38, // 12: openapi.v2.Document.parameters:type_name -> openapi.v2.ParameterDefinitions
+ 47, // 13: openapi.v2.Document.responses:type_name -> openapi.v2.ResponseDefinitions
+ 54, // 14: openapi.v2.Document.security:type_name -> openapi.v2.SecurityRequirement
+ 52, // 15: openapi.v2.Document.security_definitions:type_name -> openapi.v2.SecurityDefinitions
+ 56, // 16: openapi.v2.Document.tags:type_name -> openapi.v2.Tag
+ 10, // 17: openapi.v2.Document.external_docs:type_name -> openapi.v2.ExternalDocs
+ 20, // 18: openapi.v2.Document.vendor_extension:type_name -> openapi.v2.NamedAny
+ 20, // 19: openapi.v2.Examples.additional_properties:type_name -> openapi.v2.NamedAny
+ 20, // 20: openapi.v2.ExternalDocs.vendor_extension:type_name -> openapi.v2.NamedAny
+ 1, // 21: openapi.v2.FileSchema.default:type_name -> openapi.v2.Any
+ 10, // 22: openapi.v2.FileSchema.external_docs:type_name -> openapi.v2.ExternalDocs
+ 1, // 23: openapi.v2.FileSchema.example:type_name -> openapi.v2.Any
+ 20, // 24: openapi.v2.FileSchema.vendor_extension:type_name -> openapi.v2.NamedAny
+ 43, // 25: openapi.v2.FormDataParameterSubSchema.items:type_name -> openapi.v2.PrimitivesItems
+ 1, // 26: openapi.v2.FormDataParameterSubSchema.default:type_name -> openapi.v2.Any
+ 1, // 27: openapi.v2.FormDataParameterSubSchema.enum:type_name -> openapi.v2.Any
+ 20, // 28: openapi.v2.FormDataParameterSubSchema.vendor_extension:type_name -> openapi.v2.NamedAny
+ 43, // 29: openapi.v2.Header.items:type_name -> openapi.v2.PrimitivesItems
+ 1, // 30: openapi.v2.Header.default:type_name -> openapi.v2.Any
+ 1, // 31: openapi.v2.Header.enum:type_name -> openapi.v2.Any
+ 20, // 32: openapi.v2.Header.vendor_extension:type_name -> openapi.v2.NamedAny
+ 43, // 33: openapi.v2.HeaderParameterSubSchema.items:type_name -> openapi.v2.PrimitivesItems
+ 1, // 34: openapi.v2.HeaderParameterSubSchema.default:type_name -> openapi.v2.Any
+ 1, // 35: openapi.v2.HeaderParameterSubSchema.enum:type_name -> openapi.v2.Any
+ 20, // 36: openapi.v2.HeaderParameterSubSchema.vendor_extension:type_name -> openapi.v2.NamedAny
+ 21, // 37: openapi.v2.Headers.additional_properties:type_name -> openapi.v2.NamedHeader
+ 5, // 38: openapi.v2.Info.contact:type_name -> openapi.v2.Contact
+ 19, // 39: openapi.v2.Info.license:type_name -> openapi.v2.License
+ 20, // 40: openapi.v2.Info.vendor_extension:type_name -> openapi.v2.NamedAny
+ 50, // 41: openapi.v2.ItemsItem.schema:type_name -> openapi.v2.Schema
+ 20, // 42: openapi.v2.License.vendor_extension:type_name -> openapi.v2.NamedAny
+ 1, // 43: openapi.v2.NamedAny.value:type_name -> openapi.v2.Any
+ 13, // 44: openapi.v2.NamedHeader.value:type_name -> openapi.v2.Header
+ 37, // 45: openapi.v2.NamedParameter.value:type_name -> openapi.v2.Parameter
+ 40, // 46: openapi.v2.NamedPathItem.value:type_name -> openapi.v2.PathItem
+ 46, // 47: openapi.v2.NamedResponse.value:type_name -> openapi.v2.Response
+ 48, // 48: openapi.v2.NamedResponseValue.value:type_name -> openapi.v2.ResponseValue
+ 50, // 49: openapi.v2.NamedSchema.value:type_name -> openapi.v2.Schema
+ 53, // 50: openapi.v2.NamedSecurityDefinitionsItem.value:type_name -> openapi.v2.SecurityDefinitionsItem
+ 55, // 51: openapi.v2.NamedStringArray.value:type_name -> openapi.v2.StringArray
+ 14, // 52: openapi.v2.NonBodyParameter.header_parameter_sub_schema:type_name -> openapi.v2.HeaderParameterSubSchema
+ 12, // 53: openapi.v2.NonBodyParameter.form_data_parameter_sub_schema:type_name -> openapi.v2.FormDataParameterSubSchema
+ 45, // 54: openapi.v2.NonBodyParameter.query_parameter_sub_schema:type_name -> openapi.v2.QueryParameterSubSchema
+ 41, // 55: openapi.v2.NonBodyParameter.path_parameter_sub_schema:type_name -> openapi.v2.PathParameterSubSchema
+ 35, // 56: openapi.v2.Oauth2AccessCodeSecurity.scopes:type_name -> openapi.v2.Oauth2Scopes
+ 20, // 57: openapi.v2.Oauth2AccessCodeSecurity.vendor_extension:type_name -> openapi.v2.NamedAny
+ 35, // 58: openapi.v2.Oauth2ApplicationSecurity.scopes:type_name -> openapi.v2.Oauth2Scopes
+ 20, // 59: openapi.v2.Oauth2ApplicationSecurity.vendor_extension:type_name -> openapi.v2.NamedAny
+ 35, // 60: openapi.v2.Oauth2ImplicitSecurity.scopes:type_name -> openapi.v2.Oauth2Scopes
+ 20, // 61: openapi.v2.Oauth2ImplicitSecurity.vendor_extension:type_name -> openapi.v2.NamedAny
+ 35, // 62: openapi.v2.Oauth2PasswordSecurity.scopes:type_name -> openapi.v2.Oauth2Scopes
+ 20, // 63: openapi.v2.Oauth2PasswordSecurity.vendor_extension:type_name -> openapi.v2.NamedAny
+ 28, // 64: openapi.v2.Oauth2Scopes.additional_properties:type_name -> openapi.v2.NamedString
+ 10, // 65: openapi.v2.Operation.external_docs:type_name -> openapi.v2.ExternalDocs
+ 39, // 66: openapi.v2.Operation.parameters:type_name -> openapi.v2.ParametersItem
+ 49, // 67: openapi.v2.Operation.responses:type_name -> openapi.v2.Responses
+ 54, // 68: openapi.v2.Operation.security:type_name -> openapi.v2.SecurityRequirement
+ 20, // 69: openapi.v2.Operation.vendor_extension:type_name -> openapi.v2.NamedAny
+ 4, // 70: openapi.v2.Parameter.body_parameter:type_name -> openapi.v2.BodyParameter
+ 30, // 71: openapi.v2.Parameter.non_body_parameter:type_name -> openapi.v2.NonBodyParameter
+ 22, // 72: openapi.v2.ParameterDefinitions.additional_properties:type_name -> openapi.v2.NamedParameter
+ 37, // 73: openapi.v2.ParametersItem.parameter:type_name -> openapi.v2.Parameter
+ 18, // 74: openapi.v2.ParametersItem.json_reference:type_name -> openapi.v2.JsonReference
+ 36, // 75: openapi.v2.PathItem.get:type_name -> openapi.v2.Operation
+ 36, // 76: openapi.v2.PathItem.put:type_name -> openapi.v2.Operation
+ 36, // 77: openapi.v2.PathItem.post:type_name -> openapi.v2.Operation
+ 36, // 78: openapi.v2.PathItem.delete:type_name -> openapi.v2.Operation
+ 36, // 79: openapi.v2.PathItem.options:type_name -> openapi.v2.Operation
+ 36, // 80: openapi.v2.PathItem.head:type_name -> openapi.v2.Operation
+ 36, // 81: openapi.v2.PathItem.patch:type_name -> openapi.v2.Operation
+ 39, // 82: openapi.v2.PathItem.parameters:type_name -> openapi.v2.ParametersItem
+ 20, // 83: openapi.v2.PathItem.vendor_extension:type_name -> openapi.v2.NamedAny
+ 43, // 84: openapi.v2.PathParameterSubSchema.items:type_name -> openapi.v2.PrimitivesItems
+ 1, // 85: openapi.v2.PathParameterSubSchema.default:type_name -> openapi.v2.Any
+ 1, // 86: openapi.v2.PathParameterSubSchema.enum:type_name -> openapi.v2.Any
+ 20, // 87: openapi.v2.PathParameterSubSchema.vendor_extension:type_name -> openapi.v2.NamedAny
+ 20, // 88: openapi.v2.Paths.vendor_extension:type_name -> openapi.v2.NamedAny
+ 23, // 89: openapi.v2.Paths.path:type_name -> openapi.v2.NamedPathItem
+ 43, // 90: openapi.v2.PrimitivesItems.items:type_name -> openapi.v2.PrimitivesItems
+ 1, // 91: openapi.v2.PrimitivesItems.default:type_name -> openapi.v2.Any
+ 1, // 92: openapi.v2.PrimitivesItems.enum:type_name -> openapi.v2.Any
+ 20, // 93: openapi.v2.PrimitivesItems.vendor_extension:type_name -> openapi.v2.NamedAny
+ 26, // 94: openapi.v2.Properties.additional_properties:type_name -> openapi.v2.NamedSchema
+ 43, // 95: openapi.v2.QueryParameterSubSchema.items:type_name -> openapi.v2.PrimitivesItems
+ 1, // 96: openapi.v2.QueryParameterSubSchema.default:type_name -> openapi.v2.Any
+ 1, // 97: openapi.v2.QueryParameterSubSchema.enum:type_name -> openapi.v2.Any
+ 20, // 98: openapi.v2.QueryParameterSubSchema.vendor_extension:type_name -> openapi.v2.NamedAny
+ 51, // 99: openapi.v2.Response.schema:type_name -> openapi.v2.SchemaItem
+ 15, // 100: openapi.v2.Response.headers:type_name -> openapi.v2.Headers
+ 9, // 101: openapi.v2.Response.examples:type_name -> openapi.v2.Examples
+ 20, // 102: openapi.v2.Response.vendor_extension:type_name -> openapi.v2.NamedAny
+ 24, // 103: openapi.v2.ResponseDefinitions.additional_properties:type_name -> openapi.v2.NamedResponse
+ 46, // 104: openapi.v2.ResponseValue.response:type_name -> openapi.v2.Response
+ 18, // 105: openapi.v2.ResponseValue.json_reference:type_name -> openapi.v2.JsonReference
+ 25, // 106: openapi.v2.Responses.response_code:type_name -> openapi.v2.NamedResponseValue
+ 20, // 107: openapi.v2.Responses.vendor_extension:type_name -> openapi.v2.NamedAny
+ 1, // 108: openapi.v2.Schema.default:type_name -> openapi.v2.Any
+ 1, // 109: openapi.v2.Schema.enum:type_name -> openapi.v2.Any
+ 0, // 110: openapi.v2.Schema.additional_properties:type_name -> openapi.v2.AdditionalPropertiesItem
+ 57, // 111: openapi.v2.Schema.type:type_name -> openapi.v2.TypeItem
+ 17, // 112: openapi.v2.Schema.items:type_name -> openapi.v2.ItemsItem
+ 50, // 113: openapi.v2.Schema.all_of:type_name -> openapi.v2.Schema
+ 44, // 114: openapi.v2.Schema.properties:type_name -> openapi.v2.Properties
+ 59, // 115: openapi.v2.Schema.xml:type_name -> openapi.v2.Xml
+ 10, // 116: openapi.v2.Schema.external_docs:type_name -> openapi.v2.ExternalDocs
+ 1, // 117: openapi.v2.Schema.example:type_name -> openapi.v2.Any
+ 20, // 118: openapi.v2.Schema.vendor_extension:type_name -> openapi.v2.NamedAny
+ 50, // 119: openapi.v2.SchemaItem.schema:type_name -> openapi.v2.Schema
+ 11, // 120: openapi.v2.SchemaItem.file_schema:type_name -> openapi.v2.FileSchema
+ 27, // 121: openapi.v2.SecurityDefinitions.additional_properties:type_name -> openapi.v2.NamedSecurityDefinitionsItem
+ 3, // 122: openapi.v2.SecurityDefinitionsItem.basic_authentication_security:type_name -> openapi.v2.BasicAuthenticationSecurity
+ 2, // 123: openapi.v2.SecurityDefinitionsItem.api_key_security:type_name -> openapi.v2.ApiKeySecurity
+ 33, // 124: openapi.v2.SecurityDefinitionsItem.oauth2_implicit_security:type_name -> openapi.v2.Oauth2ImplicitSecurity
+ 34, // 125: openapi.v2.SecurityDefinitionsItem.oauth2_password_security:type_name -> openapi.v2.Oauth2PasswordSecurity
+ 32, // 126: openapi.v2.SecurityDefinitionsItem.oauth2_application_security:type_name -> openapi.v2.Oauth2ApplicationSecurity
+ 31, // 127: openapi.v2.SecurityDefinitionsItem.oauth2_access_code_security:type_name -> openapi.v2.Oauth2AccessCodeSecurity
+ 29, // 128: openapi.v2.SecurityRequirement.additional_properties:type_name -> openapi.v2.NamedStringArray
+ 10, // 129: openapi.v2.Tag.external_docs:type_name -> openapi.v2.ExternalDocs
+ 20, // 130: openapi.v2.Tag.vendor_extension:type_name -> openapi.v2.NamedAny
+ 20, // 131: openapi.v2.VendorExtension.additional_properties:type_name -> openapi.v2.NamedAny
+ 20, // 132: openapi.v2.Xml.vendor_extension:type_name -> openapi.v2.NamedAny
+ 133, // [133:133] is the sub-list for method output_type
+ 133, // [133:133] is the sub-list for method input_type
+ 133, // [133:133] is the sub-list for extension type_name
+ 133, // [133:133] is the sub-list for extension extendee
+ 0, // [0:133] is the sub-list for field type_name
+}
+
+func init() { file_openapiv2_OpenAPIv2_proto_init() }
+func file_openapiv2_OpenAPIv2_proto_init() {
+ if File_openapiv2_OpenAPIv2_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_openapiv2_OpenAPIv2_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*AdditionalPropertiesItem); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Any); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ApiKeySecurity); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*BasicAuthenticationSecurity); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*BodyParameter); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Contact); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Default); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Definitions); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Document); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Examples); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ExternalDocs); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*FileSchema); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*FormDataParameterSubSchema); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Header); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*HeaderParameterSubSchema); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Headers); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Info); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ItemsItem); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*JsonReference); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*License); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedAny); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedHeader); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedParameter); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedPathItem); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedResponseValue); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedSchema); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedSecurityDefinitionsItem); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedString); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedStringArray); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NonBodyParameter); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Oauth2AccessCodeSecurity); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Oauth2ApplicationSecurity); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Oauth2ImplicitSecurity); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Oauth2PasswordSecurity); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Oauth2Scopes); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Operation); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Parameter); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ParameterDefinitions); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ParametersItem); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*PathItem); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*PathParameterSubSchema); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Paths); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*PrimitivesItems); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Properties); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*QueryParameterSubSchema); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Response); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ResponseDefinitions); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ResponseValue); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[49].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Responses); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[50].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Schema); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[51].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SchemaItem); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[52].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SecurityDefinitions); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[53].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SecurityDefinitionsItem); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[54].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SecurityRequirement); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[55].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*StringArray); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[56].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Tag); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[57].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*TypeItem); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[58].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*VendorExtension); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[59].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Xml); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[0].OneofWrappers = []interface{}{
+ (*AdditionalPropertiesItem_Schema)(nil),
+ (*AdditionalPropertiesItem_Boolean)(nil),
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[30].OneofWrappers = []interface{}{
+ (*NonBodyParameter_HeaderParameterSubSchema)(nil),
+ (*NonBodyParameter_FormDataParameterSubSchema)(nil),
+ (*NonBodyParameter_QueryParameterSubSchema)(nil),
+ (*NonBodyParameter_PathParameterSubSchema)(nil),
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[37].OneofWrappers = []interface{}{
+ (*Parameter_BodyParameter)(nil),
+ (*Parameter_NonBodyParameter)(nil),
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[39].OneofWrappers = []interface{}{
+ (*ParametersItem_Parameter)(nil),
+ (*ParametersItem_JsonReference)(nil),
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[48].OneofWrappers = []interface{}{
+ (*ResponseValue_Response)(nil),
+ (*ResponseValue_JsonReference)(nil),
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[51].OneofWrappers = []interface{}{
+ (*SchemaItem_Schema)(nil),
+ (*SchemaItem_FileSchema)(nil),
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[53].OneofWrappers = []interface{}{
+ (*SecurityDefinitionsItem_BasicAuthenticationSecurity)(nil),
+ (*SecurityDefinitionsItem_ApiKeySecurity)(nil),
+ (*SecurityDefinitionsItem_Oauth2ImplicitSecurity)(nil),
+ (*SecurityDefinitionsItem_Oauth2PasswordSecurity)(nil),
+ (*SecurityDefinitionsItem_Oauth2ApplicationSecurity)(nil),
+ (*SecurityDefinitionsItem_Oauth2AccessCodeSecurity)(nil),
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_openapiv2_OpenAPIv2_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 60,
+ NumExtensions: 0,
+ NumServices: 0,
+ },
+ GoTypes: file_openapiv2_OpenAPIv2_proto_goTypes,
+ DependencyIndexes: file_openapiv2_OpenAPIv2_proto_depIdxs,
+ MessageInfos: file_openapiv2_OpenAPIv2_proto_msgTypes,
+ }.Build()
+ File_openapiv2_OpenAPIv2_proto = out.File
+ file_openapiv2_OpenAPIv2_proto_rawDesc = nil
+ file_openapiv2_OpenAPIv2_proto_goTypes = nil
+ file_openapiv2_OpenAPIv2_proto_depIdxs = nil
+}
diff --git a/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.proto b/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.proto
new file mode 100644
index 000000000..1c59b2f4a
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.proto
@@ -0,0 +1,666 @@
+// Copyright 2020 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// THIS FILE IS AUTOMATICALLY GENERATED.
+
+syntax = "proto3";
+
+package openapi.v2;
+
+import "google/protobuf/any.proto";
+
+// This option lets the proto compiler generate Java code inside the package
+// name (see below) instead of inside an outer class. It creates a simpler
+// developer experience by reducing one-level of name nesting and be
+// consistent with most programming languages that don't support outer classes.
+option java_multiple_files = true;
+
+// The Java outer classname should be the filename in UpperCamelCase. This
+// class is only used to hold proto descriptor, so developers don't need to
+// work with it directly.
+option java_outer_classname = "OpenAPIProto";
+
+// The Java package name must be proto package name with proper prefix.
+option java_package = "org.openapi_v2";
+
+// A reasonable prefix for the Objective-C symbols generated from the package.
+// It should at a minimum be 3 characters long, all uppercase, and convention
+// is to use an abbreviation of the package name. Something short, but
+// hopefully unique enough to not conflict with things that may come along in
+// the future. 'GPB' is reserved for the protocol buffer implementation itself.
+option objc_class_prefix = "OAS";
+
+// The Go package name.
+option go_package = "./openapiv2;openapi_v2";
+
+message AdditionalPropertiesItem {
+ oneof oneof {
+ Schema schema = 1;
+ bool boolean = 2;
+ }
+}
+
+message Any {
+ google.protobuf.Any value = 1;
+ string yaml = 2;
+}
+
+message ApiKeySecurity {
+ string type = 1;
+ string name = 2;
+ string in = 3;
+ string description = 4;
+ repeated NamedAny vendor_extension = 5;
+}
+
+message BasicAuthenticationSecurity {
+ string type = 1;
+ string description = 2;
+ repeated NamedAny vendor_extension = 3;
+}
+
+message BodyParameter {
+ // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
+ string description = 1;
+ // The name of the parameter.
+ string name = 2;
+ // Determines the location of the parameter.
+ string in = 3;
+ // Determines whether or not this parameter is required or optional.
+ bool required = 4;
+ Schema schema = 5;
+ repeated NamedAny vendor_extension = 6;
+}
+
+// Contact information for the owners of the API.
+message Contact {
+ // The identifying name of the contact person/organization.
+ string name = 1;
+ // The URL pointing to the contact information.
+ string url = 2;
+ // The email address of the contact person/organization.
+ string email = 3;
+ repeated NamedAny vendor_extension = 4;
+}
+
+message Default {
+ repeated NamedAny additional_properties = 1;
+}
+
+// One or more JSON objects describing the schemas being consumed and produced by the API.
+message Definitions {
+ repeated NamedSchema additional_properties = 1;
+}
+
+message Document {
+ // The Swagger version of this document.
+ string swagger = 1;
+ Info info = 2;
+ // The host (name or ip) of the API. Example: 'swagger.io'
+ string host = 3;
+ // The base path to the API. Example: '/api'.
+ string base_path = 4;
+ // The transfer protocol of the API.
+ repeated string schemes = 5;
+ // A list of MIME types accepted by the API.
+ repeated string consumes = 6;
+ // A list of MIME types the API can produce.
+ repeated string produces = 7;
+ Paths paths = 8;
+ Definitions definitions = 9;
+ ParameterDefinitions parameters = 10;
+ ResponseDefinitions responses = 11;
+ repeated SecurityRequirement security = 12;
+ SecurityDefinitions security_definitions = 13;
+ repeated Tag tags = 14;
+ ExternalDocs external_docs = 15;
+ repeated NamedAny vendor_extension = 16;
+}
+
+message Examples {
+ repeated NamedAny additional_properties = 1;
+}
+
+// information about external documentation
+message ExternalDocs {
+ string description = 1;
+ string url = 2;
+ repeated NamedAny vendor_extension = 3;
+}
+
+// A deterministic version of a JSON Schema object.
+message FileSchema {
+ string format = 1;
+ string title = 2;
+ string description = 3;
+ Any default = 4;
+ repeated string required = 5;
+ string type = 6;
+ bool read_only = 7;
+ ExternalDocs external_docs = 8;
+ Any example = 9;
+ repeated NamedAny vendor_extension = 10;
+}
+
+message FormDataParameterSubSchema {
+ // Determines whether or not this parameter is required or optional.
+ bool required = 1;
+ // Determines the location of the parameter.
+ string in = 2;
+ // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
+ string description = 3;
+ // The name of the parameter.
+ string name = 4;
+ // allows sending a parameter by name only or with an empty value.
+ bool allow_empty_value = 5;
+ string type = 6;
+ string format = 7;
+ PrimitivesItems items = 8;
+ string collection_format = 9;
+ Any default = 10;
+ double maximum = 11;
+ bool exclusive_maximum = 12;
+ double minimum = 13;
+ bool exclusive_minimum = 14;
+ int64 max_length = 15;
+ int64 min_length = 16;
+ string pattern = 17;
+ int64 max_items = 18;
+ int64 min_items = 19;
+ bool unique_items = 20;
+ repeated Any enum = 21;
+ double multiple_of = 22;
+ repeated NamedAny vendor_extension = 23;
+}
+
+message Header {
+ string type = 1;
+ string format = 2;
+ PrimitivesItems items = 3;
+ string collection_format = 4;
+ Any default = 5;
+ double maximum = 6;
+ bool exclusive_maximum = 7;
+ double minimum = 8;
+ bool exclusive_minimum = 9;
+ int64 max_length = 10;
+ int64 min_length = 11;
+ string pattern = 12;
+ int64 max_items = 13;
+ int64 min_items = 14;
+ bool unique_items = 15;
+ repeated Any enum = 16;
+ double multiple_of = 17;
+ string description = 18;
+ repeated NamedAny vendor_extension = 19;
+}
+
+message HeaderParameterSubSchema {
+ // Determines whether or not this parameter is required or optional.
+ bool required = 1;
+ // Determines the location of the parameter.
+ string in = 2;
+ // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
+ string description = 3;
+ // The name of the parameter.
+ string name = 4;
+ string type = 5;
+ string format = 6;
+ PrimitivesItems items = 7;
+ string collection_format = 8;
+ Any default = 9;
+ double maximum = 10;
+ bool exclusive_maximum = 11;
+ double minimum = 12;
+ bool exclusive_minimum = 13;
+ int64 max_length = 14;
+ int64 min_length = 15;
+ string pattern = 16;
+ int64 max_items = 17;
+ int64 min_items = 18;
+ bool unique_items = 19;
+ repeated Any enum = 20;
+ double multiple_of = 21;
+ repeated NamedAny vendor_extension = 22;
+}
+
+message Headers {
+ repeated NamedHeader additional_properties = 1;
+}
+
+// General information about the API.
+message Info {
+ // A unique and precise title of the API.
+ string title = 1;
+ // A semantic version number of the API.
+ string version = 2;
+ // A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed.
+ string description = 3;
+ // The terms of service for the API.
+ string terms_of_service = 4;
+ Contact contact = 5;
+ License license = 6;
+ repeated NamedAny vendor_extension = 7;
+}
+
+message ItemsItem {
+ repeated Schema schema = 1;
+}
+
+message JsonReference {
+ string _ref = 1;
+ string description = 2;
+}
+
+message License {
+ // The name of the license type. It's encouraged to use an OSI compatible license.
+ string name = 1;
+ // The URL pointing to the license.
+ string url = 2;
+ repeated NamedAny vendor_extension = 3;
+}
+
+// Automatically-generated message used to represent maps of Any as ordered (name,value) pairs.
+message NamedAny {
+ // Map key
+ string name = 1;
+ // Mapped value
+ Any value = 2;
+}
+
+// Automatically-generated message used to represent maps of Header as ordered (name,value) pairs.
+message NamedHeader {
+ // Map key
+ string name = 1;
+ // Mapped value
+ Header value = 2;
+}
+
+// Automatically-generated message used to represent maps of Parameter as ordered (name,value) pairs.
+message NamedParameter {
+ // Map key
+ string name = 1;
+ // Mapped value
+ Parameter value = 2;
+}
+
+// Automatically-generated message used to represent maps of PathItem as ordered (name,value) pairs.
+message NamedPathItem {
+ // Map key
+ string name = 1;
+ // Mapped value
+ PathItem value = 2;
+}
+
+// Automatically-generated message used to represent maps of Response as ordered (name,value) pairs.
+message NamedResponse {
+ // Map key
+ string name = 1;
+ // Mapped value
+ Response value = 2;
+}
+
+// Automatically-generated message used to represent maps of ResponseValue as ordered (name,value) pairs.
+message NamedResponseValue {
+ // Map key
+ string name = 1;
+ // Mapped value
+ ResponseValue value = 2;
+}
+
+// Automatically-generated message used to represent maps of Schema as ordered (name,value) pairs.
+message NamedSchema {
+ // Map key
+ string name = 1;
+ // Mapped value
+ Schema value = 2;
+}
+
+// Automatically-generated message used to represent maps of SecurityDefinitionsItem as ordered (name,value) pairs.
+message NamedSecurityDefinitionsItem {
+ // Map key
+ string name = 1;
+ // Mapped value
+ SecurityDefinitionsItem value = 2;
+}
+
+// Automatically-generated message used to represent maps of string as ordered (name,value) pairs.
+message NamedString {
+ // Map key
+ string name = 1;
+ // Mapped value
+ string value = 2;
+}
+
+// Automatically-generated message used to represent maps of StringArray as ordered (name,value) pairs.
+message NamedStringArray {
+ // Map key
+ string name = 1;
+ // Mapped value
+ StringArray value = 2;
+}
+
+message NonBodyParameter {
+ oneof oneof {
+ HeaderParameterSubSchema header_parameter_sub_schema = 1;
+ FormDataParameterSubSchema form_data_parameter_sub_schema = 2;
+ QueryParameterSubSchema query_parameter_sub_schema = 3;
+ PathParameterSubSchema path_parameter_sub_schema = 4;
+ }
+}
+
+message Oauth2AccessCodeSecurity {
+ string type = 1;
+ string flow = 2;
+ Oauth2Scopes scopes = 3;
+ string authorization_url = 4;
+ string token_url = 5;
+ string description = 6;
+ repeated NamedAny vendor_extension = 7;
+}
+
+message Oauth2ApplicationSecurity {
+ string type = 1;
+ string flow = 2;
+ Oauth2Scopes scopes = 3;
+ string token_url = 4;
+ string description = 5;
+ repeated NamedAny vendor_extension = 6;
+}
+
+message Oauth2ImplicitSecurity {
+ string type = 1;
+ string flow = 2;
+ Oauth2Scopes scopes = 3;
+ string authorization_url = 4;
+ string description = 5;
+ repeated NamedAny vendor_extension = 6;
+}
+
+message Oauth2PasswordSecurity {
+ string type = 1;
+ string flow = 2;
+ Oauth2Scopes scopes = 3;
+ string token_url = 4;
+ string description = 5;
+ repeated NamedAny vendor_extension = 6;
+}
+
+message Oauth2Scopes {
+ repeated NamedString additional_properties = 1;
+}
+
+message Operation {
+ repeated string tags = 1;
+ // A brief summary of the operation.
+ string summary = 2;
+ // A longer description of the operation, GitHub Flavored Markdown is allowed.
+ string description = 3;
+ ExternalDocs external_docs = 4;
+ // A unique identifier of the operation.
+ string operation_id = 5;
+ // A list of MIME types the API can produce.
+ repeated string produces = 6;
+ // A list of MIME types the API can consume.
+ repeated string consumes = 7;
+ // The parameters needed to send a valid API call.
+ repeated ParametersItem parameters = 8;
+ Responses responses = 9;
+ // The transfer protocol of the API.
+ repeated string schemes = 10;
+ bool deprecated = 11;
+ repeated SecurityRequirement security = 12;
+ repeated NamedAny vendor_extension = 13;
+}
+
+message Parameter {
+ oneof oneof {
+ BodyParameter body_parameter = 1;
+ NonBodyParameter non_body_parameter = 2;
+ }
+}
+
+// One or more JSON representations for parameters
+message ParameterDefinitions {
+ repeated NamedParameter additional_properties = 1;
+}
+
+message ParametersItem {
+ oneof oneof {
+ Parameter parameter = 1;
+ JsonReference json_reference = 2;
+ }
+}
+
+message PathItem {
+ string _ref = 1;
+ Operation get = 2;
+ Operation put = 3;
+ Operation post = 4;
+ Operation delete = 5;
+ Operation options = 6;
+ Operation head = 7;
+ Operation patch = 8;
+ // The parameters needed to send a valid API call.
+ repeated ParametersItem parameters = 9;
+ repeated NamedAny vendor_extension = 10;
+}
+
+message PathParameterSubSchema {
+ // Determines whether or not this parameter is required or optional.
+ bool required = 1;
+ // Determines the location of the parameter.
+ string in = 2;
+ // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
+ string description = 3;
+ // The name of the parameter.
+ string name = 4;
+ string type = 5;
+ string format = 6;
+ PrimitivesItems items = 7;
+ string collection_format = 8;
+ Any default = 9;
+ double maximum = 10;
+ bool exclusive_maximum = 11;
+ double minimum = 12;
+ bool exclusive_minimum = 13;
+ int64 max_length = 14;
+ int64 min_length = 15;
+ string pattern = 16;
+ int64 max_items = 17;
+ int64 min_items = 18;
+ bool unique_items = 19;
+ repeated Any enum = 20;
+ double multiple_of = 21;
+ repeated NamedAny vendor_extension = 22;
+}
+
+// Relative paths to the individual endpoints. They must be relative to the 'basePath'.
+message Paths {
+ repeated NamedAny vendor_extension = 1;
+ repeated NamedPathItem path = 2;
+}
+
+message PrimitivesItems {
+ string type = 1;
+ string format = 2;
+ PrimitivesItems items = 3;
+ string collection_format = 4;
+ Any default = 5;
+ double maximum = 6;
+ bool exclusive_maximum = 7;
+ double minimum = 8;
+ bool exclusive_minimum = 9;
+ int64 max_length = 10;
+ int64 min_length = 11;
+ string pattern = 12;
+ int64 max_items = 13;
+ int64 min_items = 14;
+ bool unique_items = 15;
+ repeated Any enum = 16;
+ double multiple_of = 17;
+ repeated NamedAny vendor_extension = 18;
+}
+
+message Properties {
+ repeated NamedSchema additional_properties = 1;
+}
+
+message QueryParameterSubSchema {
+ // Determines whether or not this parameter is required or optional.
+ bool required = 1;
+ // Determines the location of the parameter.
+ string in = 2;
+ // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
+ string description = 3;
+ // The name of the parameter.
+ string name = 4;
+ // allows sending a parameter by name only or with an empty value.
+ bool allow_empty_value = 5;
+ string type = 6;
+ string format = 7;
+ PrimitivesItems items = 8;
+ string collection_format = 9;
+ Any default = 10;
+ double maximum = 11;
+ bool exclusive_maximum = 12;
+ double minimum = 13;
+ bool exclusive_minimum = 14;
+ int64 max_length = 15;
+ int64 min_length = 16;
+ string pattern = 17;
+ int64 max_items = 18;
+ int64 min_items = 19;
+ bool unique_items = 20;
+ repeated Any enum = 21;
+ double multiple_of = 22;
+ repeated NamedAny vendor_extension = 23;
+}
+
+message Response {
+ string description = 1;
+ SchemaItem schema = 2;
+ Headers headers = 3;
+ Examples examples = 4;
+ repeated NamedAny vendor_extension = 5;
+}
+
+// One or more JSON representations for responses
+message ResponseDefinitions {
+ repeated NamedResponse additional_properties = 1;
+}
+
+message ResponseValue {
+ oneof oneof {
+ Response response = 1;
+ JsonReference json_reference = 2;
+ }
+}
+
+// Response objects names can either be any valid HTTP status code or 'default'.
+message Responses {
+ repeated NamedResponseValue response_code = 1;
+ repeated NamedAny vendor_extension = 2;
+}
+
+// A deterministic version of a JSON Schema object.
+message Schema {
+ string _ref = 1;
+ string format = 2;
+ string title = 3;
+ string description = 4;
+ Any default = 5;
+ double multiple_of = 6;
+ double maximum = 7;
+ bool exclusive_maximum = 8;
+ double minimum = 9;
+ bool exclusive_minimum = 10;
+ int64 max_length = 11;
+ int64 min_length = 12;
+ string pattern = 13;
+ int64 max_items = 14;
+ int64 min_items = 15;
+ bool unique_items = 16;
+ int64 max_properties = 17;
+ int64 min_properties = 18;
+ repeated string required = 19;
+ repeated Any enum = 20;
+ AdditionalPropertiesItem additional_properties = 21;
+ TypeItem type = 22;
+ ItemsItem items = 23;
+ repeated Schema all_of = 24;
+ Properties properties = 25;
+ string discriminator = 26;
+ bool read_only = 27;
+ Xml xml = 28;
+ ExternalDocs external_docs = 29;
+ Any example = 30;
+ repeated NamedAny vendor_extension = 31;
+}
+
+message SchemaItem {
+ oneof oneof {
+ Schema schema = 1;
+ FileSchema file_schema = 2;
+ }
+}
+
+message SecurityDefinitions {
+ repeated NamedSecurityDefinitionsItem additional_properties = 1;
+}
+
+message SecurityDefinitionsItem {
+ oneof oneof {
+ BasicAuthenticationSecurity basic_authentication_security = 1;
+ ApiKeySecurity api_key_security = 2;
+ Oauth2ImplicitSecurity oauth2_implicit_security = 3;
+ Oauth2PasswordSecurity oauth2_password_security = 4;
+ Oauth2ApplicationSecurity oauth2_application_security = 5;
+ Oauth2AccessCodeSecurity oauth2_access_code_security = 6;
+ }
+}
+
+message SecurityRequirement {
+ repeated NamedStringArray additional_properties = 1;
+}
+
+message StringArray {
+ repeated string value = 1;
+}
+
+message Tag {
+ string name = 1;
+ string description = 2;
+ ExternalDocs external_docs = 3;
+ repeated NamedAny vendor_extension = 4;
+}
+
+message TypeItem {
+ repeated string value = 1;
+}
+
+// Any property starting with x- is valid.
+message VendorExtension {
+ repeated NamedAny additional_properties = 1;
+}
+
+message Xml {
+ string name = 1;
+ string namespace = 2;
+ string prefix = 3;
+ bool attribute = 4;
+ bool wrapped = 5;
+ repeated NamedAny vendor_extension = 6;
+}
+
diff --git a/vendor/github.com/google/gnostic-models/openapiv2/README.md b/vendor/github.com/google/gnostic-models/openapiv2/README.md
new file mode 100644
index 000000000..5276128d3
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/openapiv2/README.md
@@ -0,0 +1,14 @@
+# OpenAPI v2 Protocol Buffer Models
+
+This directory contains a Protocol Buffer-language model and related code for
+supporting OpenAPI v2.
+
+Gnostic applications and plugins can use OpenAPIv2.proto to generate Protocol
+Buffer support code for their preferred languages.
+
+OpenAPIv2.go is used by Gnostic to read JSON and YAML OpenAPI descriptions into
+the Protocol Buffer-based datastructures generated from OpenAPIv2.proto.
+
+OpenAPIv2.proto and OpenAPIv2.go are generated by the Gnostic compiler
+generator, and OpenAPIv2.pb.go is generated by protoc, the Protocol Buffer
+compiler, and protoc-gen-go, the Protocol Buffer Go code generation plugin.
diff --git a/vendor/github.com/google/gnostic-models/openapiv2/document.go b/vendor/github.com/google/gnostic-models/openapiv2/document.go
new file mode 100644
index 000000000..e96ac0d6d
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/openapiv2/document.go
@@ -0,0 +1,42 @@
+// Copyright 2020 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package openapi_v2
+
+import (
+ "gopkg.in/yaml.v3"
+
+ "github.com/google/gnostic-models/compiler"
+)
+
+// ParseDocument reads an OpenAPI v2 description from a YAML/JSON representation.
+func ParseDocument(b []byte) (*Document, error) {
+ info, err := compiler.ReadInfoFromBytes("", b)
+ if err != nil {
+ return nil, err
+ }
+ root := info.Content[0]
+ return NewDocument(root, compiler.NewContextWithExtensions("$root", root, nil, nil))
+}
+
+// YAMLValue produces a serialized YAML representation of the document.
+func (d *Document) YAMLValue(comment string) ([]byte, error) {
+ rawInfo := d.ToRawInfo()
+ rawInfo = &yaml.Node{
+ Kind: yaml.DocumentNode,
+ Content: []*yaml.Node{rawInfo},
+ HeadComment: comment,
+ }
+ return yaml.Marshal(rawInfo)
+}
diff --git a/vendor/github.com/google/gnostic-models/openapiv2/openapi-2.0.json b/vendor/github.com/google/gnostic-models/openapiv2/openapi-2.0.json
new file mode 100644
index 000000000..afa12b79b
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/openapiv2/openapi-2.0.json
@@ -0,0 +1,1610 @@
+{
+ "title": "A JSON Schema for Swagger 2.0 API.",
+ "id": "http://swagger.io/v2/schema.json#",
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "required": [
+ "swagger",
+ "info",
+ "paths"
+ ],
+ "additionalProperties": false,
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ },
+ "properties": {
+ "swagger": {
+ "type": "string",
+ "enum": [
+ "2.0"
+ ],
+ "description": "The Swagger version of this document."
+ },
+ "info": {
+ "$ref": "#/definitions/info"
+ },
+ "host": {
+ "type": "string",
+ "pattern": "^[^{}/ :\\\\]+(?::\\d+)?$",
+ "description": "The host (name or ip) of the API. Example: 'swagger.io'"
+ },
+ "basePath": {
+ "type": "string",
+ "pattern": "^/",
+ "description": "The base path to the API. Example: '/api'."
+ },
+ "schemes": {
+ "$ref": "#/definitions/schemesList"
+ },
+ "consumes": {
+ "description": "A list of MIME types accepted by the API.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/mediaTypeList"
+ }
+ ]
+ },
+ "produces": {
+ "description": "A list of MIME types the API can produce.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/mediaTypeList"
+ }
+ ]
+ },
+ "paths": {
+ "$ref": "#/definitions/paths"
+ },
+ "definitions": {
+ "$ref": "#/definitions/definitions"
+ },
+ "parameters": {
+ "$ref": "#/definitions/parameterDefinitions"
+ },
+ "responses": {
+ "$ref": "#/definitions/responseDefinitions"
+ },
+ "security": {
+ "$ref": "#/definitions/security"
+ },
+ "securityDefinitions": {
+ "$ref": "#/definitions/securityDefinitions"
+ },
+ "tags": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/tag"
+ },
+ "uniqueItems": true
+ },
+ "externalDocs": {
+ "$ref": "#/definitions/externalDocs"
+ }
+ },
+ "definitions": {
+ "info": {
+ "type": "object",
+ "description": "General information about the API.",
+ "required": [
+ "version",
+ "title"
+ ],
+ "additionalProperties": false,
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ },
+ "properties": {
+ "title": {
+ "type": "string",
+ "description": "A unique and precise title of the API."
+ },
+ "version": {
+ "type": "string",
+ "description": "A semantic version number of the API."
+ },
+ "description": {
+ "type": "string",
+ "description": "A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed."
+ },
+ "termsOfService": {
+ "type": "string",
+ "description": "The terms of service for the API."
+ },
+ "contact": {
+ "$ref": "#/definitions/contact"
+ },
+ "license": {
+ "$ref": "#/definitions/license"
+ }
+ }
+ },
+ "contact": {
+ "type": "object",
+ "description": "Contact information for the owners of the API.",
+ "additionalProperties": false,
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "The identifying name of the contact person/organization."
+ },
+ "url": {
+ "type": "string",
+ "description": "The URL pointing to the contact information.",
+ "format": "uri"
+ },
+ "email": {
+ "type": "string",
+ "description": "The email address of the contact person/organization.",
+ "format": "email"
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "license": {
+ "type": "object",
+ "required": [
+ "name"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "The name of the license type. It's encouraged to use an OSI compatible license."
+ },
+ "url": {
+ "type": "string",
+ "description": "The URL pointing to the license.",
+ "format": "uri"
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "paths": {
+ "type": "object",
+ "description": "Relative paths to the individual endpoints. They must be relative to the 'basePath'.",
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ },
+ "^/": {
+ "$ref": "#/definitions/pathItem"
+ }
+ },
+ "additionalProperties": false
+ },
+ "definitions": {
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/definitions/schema"
+ },
+ "description": "One or more JSON objects describing the schemas being consumed and produced by the API."
+ },
+ "parameterDefinitions": {
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/definitions/parameter"
+ },
+ "description": "One or more JSON representations for parameters"
+ },
+ "responseDefinitions": {
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/definitions/response"
+ },
+ "description": "One or more JSON representations for responses"
+ },
+ "externalDocs": {
+ "type": "object",
+ "additionalProperties": false,
+ "description": "information about external documentation",
+ "required": [
+ "url"
+ ],
+ "properties": {
+ "description": {
+ "type": "string"
+ },
+ "url": {
+ "type": "string",
+ "format": "uri"
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "examples": {
+ "type": "object",
+ "additionalProperties": true
+ },
+ "mimeType": {
+ "type": "string",
+ "description": "The MIME type of the HTTP message."
+ },
+ "operation": {
+ "type": "object",
+ "required": [
+ "responses"
+ ],
+ "additionalProperties": false,
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ },
+ "properties": {
+ "tags": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "uniqueItems": true
+ },
+ "summary": {
+ "type": "string",
+ "description": "A brief summary of the operation."
+ },
+ "description": {
+ "type": "string",
+ "description": "A longer description of the operation, GitHub Flavored Markdown is allowed."
+ },
+ "externalDocs": {
+ "$ref": "#/definitions/externalDocs"
+ },
+ "operationId": {
+ "type": "string",
+ "description": "A unique identifier of the operation."
+ },
+ "produces": {
+ "description": "A list of MIME types the API can produce.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/mediaTypeList"
+ }
+ ]
+ },
+ "consumes": {
+ "description": "A list of MIME types the API can consume.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/mediaTypeList"
+ }
+ ]
+ },
+ "parameters": {
+ "$ref": "#/definitions/parametersList"
+ },
+ "responses": {
+ "$ref": "#/definitions/responses"
+ },
+ "schemes": {
+ "$ref": "#/definitions/schemesList"
+ },
+ "deprecated": {
+ "type": "boolean",
+ "default": false
+ },
+ "security": {
+ "$ref": "#/definitions/security"
+ }
+ }
+ },
+ "pathItem": {
+ "type": "object",
+ "additionalProperties": false,
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ },
+ "properties": {
+ "$ref": {
+ "type": "string"
+ },
+ "get": {
+ "$ref": "#/definitions/operation"
+ },
+ "put": {
+ "$ref": "#/definitions/operation"
+ },
+ "post": {
+ "$ref": "#/definitions/operation"
+ },
+ "delete": {
+ "$ref": "#/definitions/operation"
+ },
+ "options": {
+ "$ref": "#/definitions/operation"
+ },
+ "head": {
+ "$ref": "#/definitions/operation"
+ },
+ "patch": {
+ "$ref": "#/definitions/operation"
+ },
+ "parameters": {
+ "$ref": "#/definitions/parametersList"
+ }
+ }
+ },
+ "responses": {
+ "type": "object",
+ "description": "Response objects names can either be any valid HTTP status code or 'default'.",
+ "minProperties": 1,
+ "additionalProperties": false,
+ "patternProperties": {
+ "^([0-9]{3})$|^(default)$": {
+ "$ref": "#/definitions/responseValue"
+ },
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ },
+ "not": {
+ "type": "object",
+ "additionalProperties": false,
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ }
+ },
+ "responseValue": {
+ "oneOf": [
+ {
+ "$ref": "#/definitions/response"
+ },
+ {
+ "$ref": "#/definitions/jsonReference"
+ }
+ ]
+ },
+ "response": {
+ "type": "object",
+ "required": [
+ "description"
+ ],
+ "properties": {
+ "description": {
+ "type": "string"
+ },
+ "schema": {
+ "oneOf": [
+ {
+ "$ref": "#/definitions/schema"
+ },
+ {
+ "$ref": "#/definitions/fileSchema"
+ }
+ ]
+ },
+ "headers": {
+ "$ref": "#/definitions/headers"
+ },
+ "examples": {
+ "$ref": "#/definitions/examples"
+ }
+ },
+ "additionalProperties": false,
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "headers": {
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/definitions/header"
+ }
+ },
+ "header": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "type"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "string",
+ "number",
+ "integer",
+ "boolean",
+ "array"
+ ]
+ },
+ "format": {
+ "type": "string"
+ },
+ "items": {
+ "$ref": "#/definitions/primitivesItems"
+ },
+ "collectionFormat": {
+ "$ref": "#/definitions/collectionFormat"
+ },
+ "default": {
+ "$ref": "#/definitions/default"
+ },
+ "maximum": {
+ "$ref": "#/definitions/maximum"
+ },
+ "exclusiveMaximum": {
+ "$ref": "#/definitions/exclusiveMaximum"
+ },
+ "minimum": {
+ "$ref": "#/definitions/minimum"
+ },
+ "exclusiveMinimum": {
+ "$ref": "#/definitions/exclusiveMinimum"
+ },
+ "maxLength": {
+ "$ref": "#/definitions/maxLength"
+ },
+ "minLength": {
+ "$ref": "#/definitions/minLength"
+ },
+ "pattern": {
+ "$ref": "#/definitions/pattern"
+ },
+ "maxItems": {
+ "$ref": "#/definitions/maxItems"
+ },
+ "minItems": {
+ "$ref": "#/definitions/minItems"
+ },
+ "uniqueItems": {
+ "$ref": "#/definitions/uniqueItems"
+ },
+ "enum": {
+ "$ref": "#/definitions/enum"
+ },
+ "multipleOf": {
+ "$ref": "#/definitions/multipleOf"
+ },
+ "description": {
+ "type": "string"
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "vendorExtension": {
+ "description": "Any property starting with x- is valid.",
+ "additionalProperties": true,
+ "additionalItems": true
+ },
+ "bodyParameter": {
+ "type": "object",
+ "required": [
+ "name",
+ "in",
+ "schema"
+ ],
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ },
+ "properties": {
+ "description": {
+ "type": "string",
+ "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
+ },
+ "name": {
+ "type": "string",
+ "description": "The name of the parameter."
+ },
+ "in": {
+ "type": "string",
+ "description": "Determines the location of the parameter.",
+ "enum": [
+ "body"
+ ]
+ },
+ "required": {
+ "type": "boolean",
+ "description": "Determines whether or not this parameter is required or optional.",
+ "default": false
+ },
+ "schema": {
+ "$ref": "#/definitions/schema"
+ }
+ },
+ "additionalProperties": false
+ },
+ "headerParameterSubSchema": {
+ "additionalProperties": false,
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ },
+ "properties": {
+ "required": {
+ "type": "boolean",
+ "description": "Determines whether or not this parameter is required or optional.",
+ "default": false
+ },
+ "in": {
+ "type": "string",
+ "description": "Determines the location of the parameter.",
+ "enum": [
+ "header"
+ ]
+ },
+ "description": {
+ "type": "string",
+ "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
+ },
+ "name": {
+ "type": "string",
+ "description": "The name of the parameter."
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "string",
+ "number",
+ "boolean",
+ "integer",
+ "array"
+ ]
+ },
+ "format": {
+ "type": "string"
+ },
+ "items": {
+ "$ref": "#/definitions/primitivesItems"
+ },
+ "collectionFormat": {
+ "$ref": "#/definitions/collectionFormat"
+ },
+ "default": {
+ "$ref": "#/definitions/default"
+ },
+ "maximum": {
+ "$ref": "#/definitions/maximum"
+ },
+ "exclusiveMaximum": {
+ "$ref": "#/definitions/exclusiveMaximum"
+ },
+ "minimum": {
+ "$ref": "#/definitions/minimum"
+ },
+ "exclusiveMinimum": {
+ "$ref": "#/definitions/exclusiveMinimum"
+ },
+ "maxLength": {
+ "$ref": "#/definitions/maxLength"
+ },
+ "minLength": {
+ "$ref": "#/definitions/minLength"
+ },
+ "pattern": {
+ "$ref": "#/definitions/pattern"
+ },
+ "maxItems": {
+ "$ref": "#/definitions/maxItems"
+ },
+ "minItems": {
+ "$ref": "#/definitions/minItems"
+ },
+ "uniqueItems": {
+ "$ref": "#/definitions/uniqueItems"
+ },
+ "enum": {
+ "$ref": "#/definitions/enum"
+ },
+ "multipleOf": {
+ "$ref": "#/definitions/multipleOf"
+ }
+ }
+ },
+ "queryParameterSubSchema": {
+ "additionalProperties": false,
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ },
+ "properties": {
+ "required": {
+ "type": "boolean",
+ "description": "Determines whether or not this parameter is required or optional.",
+ "default": false
+ },
+ "in": {
+ "type": "string",
+ "description": "Determines the location of the parameter.",
+ "enum": [
+ "query"
+ ]
+ },
+ "description": {
+ "type": "string",
+ "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
+ },
+ "name": {
+ "type": "string",
+ "description": "The name of the parameter."
+ },
+ "allowEmptyValue": {
+ "type": "boolean",
+ "default": false,
+ "description": "allows sending a parameter by name only or with an empty value."
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "string",
+ "number",
+ "boolean",
+ "integer",
+ "array"
+ ]
+ },
+ "format": {
+ "type": "string"
+ },
+ "items": {
+ "$ref": "#/definitions/primitivesItems"
+ },
+ "collectionFormat": {
+ "$ref": "#/definitions/collectionFormatWithMulti"
+ },
+ "default": {
+ "$ref": "#/definitions/default"
+ },
+ "maximum": {
+ "$ref": "#/definitions/maximum"
+ },
+ "exclusiveMaximum": {
+ "$ref": "#/definitions/exclusiveMaximum"
+ },
+ "minimum": {
+ "$ref": "#/definitions/minimum"
+ },
+ "exclusiveMinimum": {
+ "$ref": "#/definitions/exclusiveMinimum"
+ },
+ "maxLength": {
+ "$ref": "#/definitions/maxLength"
+ },
+ "minLength": {
+ "$ref": "#/definitions/minLength"
+ },
+ "pattern": {
+ "$ref": "#/definitions/pattern"
+ },
+ "maxItems": {
+ "$ref": "#/definitions/maxItems"
+ },
+ "minItems": {
+ "$ref": "#/definitions/minItems"
+ },
+ "uniqueItems": {
+ "$ref": "#/definitions/uniqueItems"
+ },
+ "enum": {
+ "$ref": "#/definitions/enum"
+ },
+ "multipleOf": {
+ "$ref": "#/definitions/multipleOf"
+ }
+ }
+ },
+ "formDataParameterSubSchema": {
+ "additionalProperties": false,
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ },
+ "properties": {
+ "required": {
+ "type": "boolean",
+ "description": "Determines whether or not this parameter is required or optional.",
+ "default": false
+ },
+ "in": {
+ "type": "string",
+ "description": "Determines the location of the parameter.",
+ "enum": [
+ "formData"
+ ]
+ },
+ "description": {
+ "type": "string",
+ "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
+ },
+ "name": {
+ "type": "string",
+ "description": "The name of the parameter."
+ },
+ "allowEmptyValue": {
+ "type": "boolean",
+ "default": false,
+ "description": "allows sending a parameter by name only or with an empty value."
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "string",
+ "number",
+ "boolean",
+ "integer",
+ "array",
+ "file"
+ ]
+ },
+ "format": {
+ "type": "string"
+ },
+ "items": {
+ "$ref": "#/definitions/primitivesItems"
+ },
+ "collectionFormat": {
+ "$ref": "#/definitions/collectionFormatWithMulti"
+ },
+ "default": {
+ "$ref": "#/definitions/default"
+ },
+ "maximum": {
+ "$ref": "#/definitions/maximum"
+ },
+ "exclusiveMaximum": {
+ "$ref": "#/definitions/exclusiveMaximum"
+ },
+ "minimum": {
+ "$ref": "#/definitions/minimum"
+ },
+ "exclusiveMinimum": {
+ "$ref": "#/definitions/exclusiveMinimum"
+ },
+ "maxLength": {
+ "$ref": "#/definitions/maxLength"
+ },
+ "minLength": {
+ "$ref": "#/definitions/minLength"
+ },
+ "pattern": {
+ "$ref": "#/definitions/pattern"
+ },
+ "maxItems": {
+ "$ref": "#/definitions/maxItems"
+ },
+ "minItems": {
+ "$ref": "#/definitions/minItems"
+ },
+ "uniqueItems": {
+ "$ref": "#/definitions/uniqueItems"
+ },
+ "enum": {
+ "$ref": "#/definitions/enum"
+ },
+ "multipleOf": {
+ "$ref": "#/definitions/multipleOf"
+ }
+ }
+ },
+ "pathParameterSubSchema": {
+ "additionalProperties": false,
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ },
+ "required": [
+ "required"
+ ],
+ "properties": {
+ "required": {
+ "type": "boolean",
+ "enum": [
+ true
+ ],
+ "description": "Determines whether or not this parameter is required or optional."
+ },
+ "in": {
+ "type": "string",
+ "description": "Determines the location of the parameter.",
+ "enum": [
+ "path"
+ ]
+ },
+ "description": {
+ "type": "string",
+ "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
+ },
+ "name": {
+ "type": "string",
+ "description": "The name of the parameter."
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "string",
+ "number",
+ "boolean",
+ "integer",
+ "array"
+ ]
+ },
+ "format": {
+ "type": "string"
+ },
+ "items": {
+ "$ref": "#/definitions/primitivesItems"
+ },
+ "collectionFormat": {
+ "$ref": "#/definitions/collectionFormat"
+ },
+ "default": {
+ "$ref": "#/definitions/default"
+ },
+ "maximum": {
+ "$ref": "#/definitions/maximum"
+ },
+ "exclusiveMaximum": {
+ "$ref": "#/definitions/exclusiveMaximum"
+ },
+ "minimum": {
+ "$ref": "#/definitions/minimum"
+ },
+ "exclusiveMinimum": {
+ "$ref": "#/definitions/exclusiveMinimum"
+ },
+ "maxLength": {
+ "$ref": "#/definitions/maxLength"
+ },
+ "minLength": {
+ "$ref": "#/definitions/minLength"
+ },
+ "pattern": {
+ "$ref": "#/definitions/pattern"
+ },
+ "maxItems": {
+ "$ref": "#/definitions/maxItems"
+ },
+ "minItems": {
+ "$ref": "#/definitions/minItems"
+ },
+ "uniqueItems": {
+ "$ref": "#/definitions/uniqueItems"
+ },
+ "enum": {
+ "$ref": "#/definitions/enum"
+ },
+ "multipleOf": {
+ "$ref": "#/definitions/multipleOf"
+ }
+ }
+ },
+ "nonBodyParameter": {
+ "type": "object",
+ "required": [
+ "name",
+ "in",
+ "type"
+ ],
+ "oneOf": [
+ {
+ "$ref": "#/definitions/headerParameterSubSchema"
+ },
+ {
+ "$ref": "#/definitions/formDataParameterSubSchema"
+ },
+ {
+ "$ref": "#/definitions/queryParameterSubSchema"
+ },
+ {
+ "$ref": "#/definitions/pathParameterSubSchema"
+ }
+ ]
+ },
+ "parameter": {
+ "oneOf": [
+ {
+ "$ref": "#/definitions/bodyParameter"
+ },
+ {
+ "$ref": "#/definitions/nonBodyParameter"
+ }
+ ]
+ },
+ "schema": {
+ "type": "object",
+ "description": "A deterministic version of a JSON Schema object.",
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ },
+ "properties": {
+ "$ref": {
+ "type": "string"
+ },
+ "format": {
+ "type": "string"
+ },
+ "title": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/title"
+ },
+ "description": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/description"
+ },
+ "default": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/default"
+ },
+ "multipleOf": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf"
+ },
+ "maximum": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum"
+ },
+ "exclusiveMaximum": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"
+ },
+ "minimum": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum"
+ },
+ "exclusiveMinimum": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"
+ },
+ "maxLength": {
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
+ },
+ "minLength": {
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
+ },
+ "pattern": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern"
+ },
+ "maxItems": {
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
+ },
+ "minItems": {
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
+ },
+ "uniqueItems": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems"
+ },
+ "maxProperties": {
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
+ },
+ "minProperties": {
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
+ },
+ "required": {
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray"
+ },
+ "enum": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/enum"
+ },
+ "additionalProperties": {
+ "oneOf": [
+ {
+ "$ref": "#/definitions/schema"
+ },
+ {
+ "type": "boolean"
+ }
+ ],
+ "default": {}
+ },
+ "type": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/type"
+ },
+ "items": {
+ "anyOf": [
+ {
+ "$ref": "#/definitions/schema"
+ },
+ {
+ "type": "array",
+ "minItems": 1,
+ "items": {
+ "$ref": "#/definitions/schema"
+ }
+ }
+ ],
+ "default": {}
+ },
+ "allOf": {
+ "type": "array",
+ "minItems": 1,
+ "items": {
+ "$ref": "#/definitions/schema"
+ }
+ },
+ "properties": {
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/definitions/schema"
+ },
+ "default": {}
+ },
+ "discriminator": {
+ "type": "string"
+ },
+ "readOnly": {
+ "type": "boolean",
+ "default": false
+ },
+ "xml": {
+ "$ref": "#/definitions/xml"
+ },
+ "externalDocs": {
+ "$ref": "#/definitions/externalDocs"
+ },
+ "example": {}
+ },
+ "additionalProperties": false
+ },
+ "fileSchema": {
+ "type": "object",
+ "description": "A deterministic version of a JSON Schema object.",
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ },
+ "required": [
+ "type"
+ ],
+ "properties": {
+ "format": {
+ "type": "string"
+ },
+ "title": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/title"
+ },
+ "description": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/description"
+ },
+ "default": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/default"
+ },
+ "required": {
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "file"
+ ]
+ },
+ "readOnly": {
+ "type": "boolean",
+ "default": false
+ },
+ "externalDocs": {
+ "$ref": "#/definitions/externalDocs"
+ },
+ "example": {}
+ },
+ "additionalProperties": false
+ },
+ "primitivesItems": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "string",
+ "number",
+ "integer",
+ "boolean",
+ "array"
+ ]
+ },
+ "format": {
+ "type": "string"
+ },
+ "items": {
+ "$ref": "#/definitions/primitivesItems"
+ },
+ "collectionFormat": {
+ "$ref": "#/definitions/collectionFormat"
+ },
+ "default": {
+ "$ref": "#/definitions/default"
+ },
+ "maximum": {
+ "$ref": "#/definitions/maximum"
+ },
+ "exclusiveMaximum": {
+ "$ref": "#/definitions/exclusiveMaximum"
+ },
+ "minimum": {
+ "$ref": "#/definitions/minimum"
+ },
+ "exclusiveMinimum": {
+ "$ref": "#/definitions/exclusiveMinimum"
+ },
+ "maxLength": {
+ "$ref": "#/definitions/maxLength"
+ },
+ "minLength": {
+ "$ref": "#/definitions/minLength"
+ },
+ "pattern": {
+ "$ref": "#/definitions/pattern"
+ },
+ "maxItems": {
+ "$ref": "#/definitions/maxItems"
+ },
+ "minItems": {
+ "$ref": "#/definitions/minItems"
+ },
+ "uniqueItems": {
+ "$ref": "#/definitions/uniqueItems"
+ },
+ "enum": {
+ "$ref": "#/definitions/enum"
+ },
+ "multipleOf": {
+ "$ref": "#/definitions/multipleOf"
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "security": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/securityRequirement"
+ },
+ "uniqueItems": true
+ },
+ "securityRequirement": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "uniqueItems": true
+ }
+ },
+ "xml": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "namespace": {
+ "type": "string"
+ },
+ "prefix": {
+ "type": "string"
+ },
+ "attribute": {
+ "type": "boolean",
+ "default": false
+ },
+ "wrapped": {
+ "type": "boolean",
+ "default": false
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "tag": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "name"
+ ],
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "description": {
+ "type": "string"
+ },
+ "externalDocs": {
+ "$ref": "#/definitions/externalDocs"
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "securityDefinitions": {
+ "type": "object",
+ "additionalProperties": {
+ "oneOf": [
+ {
+ "$ref": "#/definitions/basicAuthenticationSecurity"
+ },
+ {
+ "$ref": "#/definitions/apiKeySecurity"
+ },
+ {
+ "$ref": "#/definitions/oauth2ImplicitSecurity"
+ },
+ {
+ "$ref": "#/definitions/oauth2PasswordSecurity"
+ },
+ {
+ "$ref": "#/definitions/oauth2ApplicationSecurity"
+ },
+ {
+ "$ref": "#/definitions/oauth2AccessCodeSecurity"
+ }
+ ]
+ }
+ },
+ "basicAuthenticationSecurity": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "type"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "basic"
+ ]
+ },
+ "description": {
+ "type": "string"
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "apiKeySecurity": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "name",
+ "in"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "apiKey"
+ ]
+ },
+ "name": {
+ "type": "string"
+ },
+ "in": {
+ "type": "string",
+ "enum": [
+ "header",
+ "query"
+ ]
+ },
+ "description": {
+ "type": "string"
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "oauth2ImplicitSecurity": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "flow",
+ "authorizationUrl"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "oauth2"
+ ]
+ },
+ "flow": {
+ "type": "string",
+ "enum": [
+ "implicit"
+ ]
+ },
+ "scopes": {
+ "$ref": "#/definitions/oauth2Scopes"
+ },
+ "authorizationUrl": {
+ "type": "string",
+ "format": "uri"
+ },
+ "description": {
+ "type": "string"
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "oauth2PasswordSecurity": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "flow",
+ "tokenUrl"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "oauth2"
+ ]
+ },
+ "flow": {
+ "type": "string",
+ "enum": [
+ "password"
+ ]
+ },
+ "scopes": {
+ "$ref": "#/definitions/oauth2Scopes"
+ },
+ "tokenUrl": {
+ "type": "string",
+ "format": "uri"
+ },
+ "description": {
+ "type": "string"
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "oauth2ApplicationSecurity": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "flow",
+ "tokenUrl"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "oauth2"
+ ]
+ },
+ "flow": {
+ "type": "string",
+ "enum": [
+ "application"
+ ]
+ },
+ "scopes": {
+ "$ref": "#/definitions/oauth2Scopes"
+ },
+ "tokenUrl": {
+ "type": "string",
+ "format": "uri"
+ },
+ "description": {
+ "type": "string"
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "oauth2AccessCodeSecurity": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "flow",
+ "authorizationUrl",
+ "tokenUrl"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "oauth2"
+ ]
+ },
+ "flow": {
+ "type": "string",
+ "enum": [
+ "accessCode"
+ ]
+ },
+ "scopes": {
+ "$ref": "#/definitions/oauth2Scopes"
+ },
+ "authorizationUrl": {
+ "type": "string",
+ "format": "uri"
+ },
+ "tokenUrl": {
+ "type": "string",
+ "format": "uri"
+ },
+ "description": {
+ "type": "string"
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "oauth2Scopes": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "mediaTypeList": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/mimeType"
+ },
+ "uniqueItems": true
+ },
+ "parametersList": {
+ "type": "array",
+ "description": "The parameters needed to send a valid API call.",
+ "additionalItems": false,
+ "items": {
+ "oneOf": [
+ {
+ "$ref": "#/definitions/parameter"
+ },
+ {
+ "$ref": "#/definitions/jsonReference"
+ }
+ ]
+ },
+ "uniqueItems": true
+ },
+ "schemesList": {
+ "type": "array",
+ "description": "The transfer protocol of the API.",
+ "items": {
+ "type": "string",
+ "enum": [
+ "http",
+ "https",
+ "ws",
+ "wss"
+ ]
+ },
+ "uniqueItems": true
+ },
+ "collectionFormat": {
+ "type": "string",
+ "enum": [
+ "csv",
+ "ssv",
+ "tsv",
+ "pipes"
+ ],
+ "default": "csv"
+ },
+ "collectionFormatWithMulti": {
+ "type": "string",
+ "enum": [
+ "csv",
+ "ssv",
+ "tsv",
+ "pipes",
+ "multi"
+ ],
+ "default": "csv"
+ },
+ "title": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/title"
+ },
+ "description": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/description"
+ },
+ "default": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/default"
+ },
+ "multipleOf": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf"
+ },
+ "maximum": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum"
+ },
+ "exclusiveMaximum": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"
+ },
+ "minimum": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum"
+ },
+ "exclusiveMinimum": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"
+ },
+ "maxLength": {
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
+ },
+ "minLength": {
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
+ },
+ "pattern": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern"
+ },
+ "maxItems": {
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
+ },
+ "minItems": {
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
+ },
+ "uniqueItems": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems"
+ },
+ "enum": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/enum"
+ },
+ "jsonReference": {
+ "type": "object",
+ "required": [
+ "$ref"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "$ref": {
+ "type": "string"
+ },
+ "description": {
+ "type": "string"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.go b/vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.go
new file mode 100644
index 000000000..4b1131ce1
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.go
@@ -0,0 +1,8633 @@
+// Copyright 2020 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// THIS FILE IS AUTOMATICALLY GENERATED.
+
+package openapi_v3
+
+import (
+ "fmt"
+ "regexp"
+ "strings"
+
+ "gopkg.in/yaml.v3"
+
+ "github.com/google/gnostic-models/compiler"
+)
+
+// Version returns the package name (and OpenAPI version).
+func Version() string {
+ return "openapi_v3"
+}
+
+// NewAdditionalPropertiesItem creates an object of type AdditionalPropertiesItem if possible, returning an error if not.
+func NewAdditionalPropertiesItem(in *yaml.Node, context *compiler.Context) (*AdditionalPropertiesItem, error) {
+ errors := make([]error, 0)
+ x := &AdditionalPropertiesItem{}
+ matched := false
+ // SchemaOrReference schema_or_reference = 1;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewSchemaOrReference(m, compiler.NewContext("schemaOrReference", m, context))
+ if matchingError == nil {
+ x.Oneof = &AdditionalPropertiesItem_SchemaOrReference{SchemaOrReference: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // bool boolean = 2;
+ boolValue, ok := compiler.BoolForScalarNode(in)
+ if ok {
+ x.Oneof = &AdditionalPropertiesItem_Boolean{Boolean: boolValue}
+ matched = true
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ } else {
+ message := fmt.Sprintf("contains an invalid AdditionalPropertiesItem")
+ err := compiler.NewError(context, message)
+ errors = []error{err}
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewAny creates an object of type Any if possible, returning an error if not.
+func NewAny(in *yaml.Node, context *compiler.Context) (*Any, error) {
+ errors := make([]error, 0)
+ x := &Any{}
+ bytes := compiler.Marshal(in)
+ x.Yaml = string(bytes)
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewAnyOrExpression creates an object of type AnyOrExpression if possible, returning an error if not.
+func NewAnyOrExpression(in *yaml.Node, context *compiler.Context) (*AnyOrExpression, error) {
+ errors := make([]error, 0)
+ x := &AnyOrExpression{}
+ matched := false
+ // Any any = 1;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewAny(m, compiler.NewContext("any", m, context))
+ if matchingError == nil {
+ x.Oneof = &AnyOrExpression_Any{Any: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // Expression expression = 2;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewExpression(m, compiler.NewContext("expression", m, context))
+ if matchingError == nil {
+ x.Oneof = &AnyOrExpression_Expression{Expression: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ } else {
+ message := fmt.Sprintf("contains an invalid AnyOrExpression")
+ err := compiler.NewError(context, message)
+ errors = []error{err}
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewCallback creates an object of type Callback if possible, returning an error if not.
+func NewCallback(in *yaml.Node, context *compiler.Context) (*Callback, error) {
+ errors := make([]error, 0)
+ x := &Callback{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{}
+ allowedPatterns := []*regexp.Regexp{pattern0, pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // repeated NamedPathItem path = 1;
+ // MAP: PathItem ^
+ x.Path = make([]*NamedPathItem, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if true {
+ pair := &NamedPathItem{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewPathItem(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Path = append(x.Path, pair)
+ }
+ }
+ }
+ // repeated NamedAny specification_extension = 2;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewCallbackOrReference creates an object of type CallbackOrReference if possible, returning an error if not.
+func NewCallbackOrReference(in *yaml.Node, context *compiler.Context) (*CallbackOrReference, error) {
+ errors := make([]error, 0)
+ x := &CallbackOrReference{}
+ matched := false
+ // Callback callback = 1;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewCallback(m, compiler.NewContext("callback", m, context))
+ if matchingError == nil {
+ x.Oneof = &CallbackOrReference_Callback{Callback: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // Reference reference = 2;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewReference(m, compiler.NewContext("reference", m, context))
+ if matchingError == nil {
+ x.Oneof = &CallbackOrReference_Reference{Reference: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ } else {
+ message := fmt.Sprintf("contains an invalid CallbackOrReference")
+ err := compiler.NewError(context, message)
+ errors = []error{err}
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewCallbacksOrReferences creates an object of type CallbacksOrReferences if possible, returning an error if not.
+func NewCallbacksOrReferences(in *yaml.Node, context *compiler.Context) (*CallbacksOrReferences, error) {
+ errors := make([]error, 0)
+ x := &CallbacksOrReferences{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedCallbackOrReference additional_properties = 1;
+ // MAP: CallbackOrReference
+ x.AdditionalProperties = make([]*NamedCallbackOrReference, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedCallbackOrReference{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewCallbackOrReference(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewComponents creates an object of type Components if possible, returning an error if not.
+func NewComponents(in *yaml.Node, context *compiler.Context) (*Components, error) {
+ errors := make([]error, 0)
+ x := &Components{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"callbacks", "examples", "headers", "links", "parameters", "requestBodies", "responses", "schemas", "securitySchemes"}
+ allowedPatterns := []*regexp.Regexp{pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // SchemasOrReferences schemas = 1;
+ v1 := compiler.MapValueForKey(m, "schemas")
+ if v1 != nil {
+ var err error
+ x.Schemas, err = NewSchemasOrReferences(v1, compiler.NewContext("schemas", v1, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // ResponsesOrReferences responses = 2;
+ v2 := compiler.MapValueForKey(m, "responses")
+ if v2 != nil {
+ var err error
+ x.Responses, err = NewResponsesOrReferences(v2, compiler.NewContext("responses", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // ParametersOrReferences parameters = 3;
+ v3 := compiler.MapValueForKey(m, "parameters")
+ if v3 != nil {
+ var err error
+ x.Parameters, err = NewParametersOrReferences(v3, compiler.NewContext("parameters", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // ExamplesOrReferences examples = 4;
+ v4 := compiler.MapValueForKey(m, "examples")
+ if v4 != nil {
+ var err error
+ x.Examples, err = NewExamplesOrReferences(v4, compiler.NewContext("examples", v4, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // RequestBodiesOrReferences request_bodies = 5;
+ v5 := compiler.MapValueForKey(m, "requestBodies")
+ if v5 != nil {
+ var err error
+ x.RequestBodies, err = NewRequestBodiesOrReferences(v5, compiler.NewContext("requestBodies", v5, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // HeadersOrReferences headers = 6;
+ v6 := compiler.MapValueForKey(m, "headers")
+ if v6 != nil {
+ var err error
+ x.Headers, err = NewHeadersOrReferences(v6, compiler.NewContext("headers", v6, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // SecuritySchemesOrReferences security_schemes = 7;
+ v7 := compiler.MapValueForKey(m, "securitySchemes")
+ if v7 != nil {
+ var err error
+ x.SecuritySchemes, err = NewSecuritySchemesOrReferences(v7, compiler.NewContext("securitySchemes", v7, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // LinksOrReferences links = 8;
+ v8 := compiler.MapValueForKey(m, "links")
+ if v8 != nil {
+ var err error
+ x.Links, err = NewLinksOrReferences(v8, compiler.NewContext("links", v8, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // CallbacksOrReferences callbacks = 9;
+ v9 := compiler.MapValueForKey(m, "callbacks")
+ if v9 != nil {
+ var err error
+ x.Callbacks, err = NewCallbacksOrReferences(v9, compiler.NewContext("callbacks", v9, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny specification_extension = 10;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewContact creates an object of type Contact if possible, returning an error if not.
+func NewContact(in *yaml.Node, context *compiler.Context) (*Contact, error) {
+ errors := make([]error, 0)
+ x := &Contact{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"email", "name", "url"}
+ allowedPatterns := []*regexp.Regexp{pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string url = 2;
+ v2 := compiler.MapValueForKey(m, "url")
+ if v2 != nil {
+ x.Url, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string email = 3;
+ v3 := compiler.MapValueForKey(m, "email")
+ if v3 != nil {
+ x.Email, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for email: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny specification_extension = 4;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewDefaultType creates an object of type DefaultType if possible, returning an error if not.
+func NewDefaultType(in *yaml.Node, context *compiler.Context) (*DefaultType, error) {
+ errors := make([]error, 0)
+ x := &DefaultType{}
+ matched := false
+ switch in.Tag {
+ case "!!bool":
+ var v bool
+ v, matched = compiler.BoolForScalarNode(in)
+ x.Oneof = &DefaultType_Boolean{Boolean: v}
+ case "!!str":
+ var v string
+ v, matched = compiler.StringForScalarNode(in)
+ x.Oneof = &DefaultType_String_{String_: v}
+ case "!!float":
+ var v float64
+ v, matched = compiler.FloatForScalarNode(in)
+ x.Oneof = &DefaultType_Number{Number: v}
+ case "!!int":
+ var v int64
+ v, matched = compiler.IntForScalarNode(in)
+ x.Oneof = &DefaultType_Number{Number: float64(v)}
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewDiscriminator creates an object of type Discriminator if possible, returning an error if not.
+func NewDiscriminator(in *yaml.Node, context *compiler.Context) (*Discriminator, error) {
+ errors := make([]error, 0)
+ x := &Discriminator{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"propertyName"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"mapping", "propertyName"}
+ allowedPatterns := []*regexp.Regexp{pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string property_name = 1;
+ v1 := compiler.MapValueForKey(m, "propertyName")
+ if v1 != nil {
+ x.PropertyName, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for propertyName: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Strings mapping = 2;
+ v2 := compiler.MapValueForKey(m, "mapping")
+ if v2 != nil {
+ var err error
+ x.Mapping, err = NewStrings(v2, compiler.NewContext("mapping", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny specification_extension = 3;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewDocument creates an object of type Document if possible, returning an error if not.
+func NewDocument(in *yaml.Node, context *compiler.Context) (*Document, error) {
+ errors := make([]error, 0)
+ x := &Document{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"info", "openapi", "paths"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"components", "externalDocs", "info", "openapi", "paths", "security", "servers", "tags"}
+ allowedPatterns := []*regexp.Regexp{pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string openapi = 1;
+ v1 := compiler.MapValueForKey(m, "openapi")
+ if v1 != nil {
+ x.Openapi, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for openapi: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Info info = 2;
+ v2 := compiler.MapValueForKey(m, "info")
+ if v2 != nil {
+ var err error
+ x.Info, err = NewInfo(v2, compiler.NewContext("info", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated Server servers = 3;
+ v3 := compiler.MapValueForKey(m, "servers")
+ if v3 != nil {
+ // repeated Server
+ x.Servers = make([]*Server, 0)
+ a, ok := compiler.SequenceNodeForNode(v3)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewServer(item, compiler.NewContext("servers", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Servers = append(x.Servers, y)
+ }
+ }
+ }
+ // Paths paths = 4;
+ v4 := compiler.MapValueForKey(m, "paths")
+ if v4 != nil {
+ var err error
+ x.Paths, err = NewPaths(v4, compiler.NewContext("paths", v4, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Components components = 5;
+ v5 := compiler.MapValueForKey(m, "components")
+ if v5 != nil {
+ var err error
+ x.Components, err = NewComponents(v5, compiler.NewContext("components", v5, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated SecurityRequirement security = 6;
+ v6 := compiler.MapValueForKey(m, "security")
+ if v6 != nil {
+ // repeated SecurityRequirement
+ x.Security = make([]*SecurityRequirement, 0)
+ a, ok := compiler.SequenceNodeForNode(v6)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewSecurityRequirement(item, compiler.NewContext("security", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Security = append(x.Security, y)
+ }
+ }
+ }
+ // repeated Tag tags = 7;
+ v7 := compiler.MapValueForKey(m, "tags")
+ if v7 != nil {
+ // repeated Tag
+ x.Tags = make([]*Tag, 0)
+ a, ok := compiler.SequenceNodeForNode(v7)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewTag(item, compiler.NewContext("tags", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Tags = append(x.Tags, y)
+ }
+ }
+ }
+ // ExternalDocs external_docs = 8;
+ v8 := compiler.MapValueForKey(m, "externalDocs")
+ if v8 != nil {
+ var err error
+ x.ExternalDocs, err = NewExternalDocs(v8, compiler.NewContext("externalDocs", v8, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny specification_extension = 9;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewEncoding creates an object of type Encoding if possible, returning an error if not.
+func NewEncoding(in *yaml.Node, context *compiler.Context) (*Encoding, error) {
+ errors := make([]error, 0)
+ x := &Encoding{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"allowReserved", "contentType", "explode", "headers", "style"}
+ allowedPatterns := []*regexp.Regexp{pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string content_type = 1;
+ v1 := compiler.MapValueForKey(m, "contentType")
+ if v1 != nil {
+ x.ContentType, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for contentType: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // HeadersOrReferences headers = 2;
+ v2 := compiler.MapValueForKey(m, "headers")
+ if v2 != nil {
+ var err error
+ x.Headers, err = NewHeadersOrReferences(v2, compiler.NewContext("headers", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string style = 3;
+ v3 := compiler.MapValueForKey(m, "style")
+ if v3 != nil {
+ x.Style, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for style: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool explode = 4;
+ v4 := compiler.MapValueForKey(m, "explode")
+ if v4 != nil {
+ x.Explode, ok = compiler.BoolForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for explode: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool allow_reserved = 5;
+ v5 := compiler.MapValueForKey(m, "allowReserved")
+ if v5 != nil {
+ x.AllowReserved, ok = compiler.BoolForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for allowReserved: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny specification_extension = 6;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewEncodings creates an object of type Encodings if possible, returning an error if not.
+func NewEncodings(in *yaml.Node, context *compiler.Context) (*Encodings, error) {
+ errors := make([]error, 0)
+ x := &Encodings{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedEncoding additional_properties = 1;
+ // MAP: Encoding
+ x.AdditionalProperties = make([]*NamedEncoding, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedEncoding{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewEncoding(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewExample creates an object of type Example if possible, returning an error if not.
+func NewExample(in *yaml.Node, context *compiler.Context) (*Example, error) {
+ errors := make([]error, 0)
+ x := &Example{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"description", "externalValue", "summary", "value"}
+ allowedPatterns := []*regexp.Regexp{pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string summary = 1;
+ v1 := compiler.MapValueForKey(m, "summary")
+ if v1 != nil {
+ x.Summary, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for summary: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 2;
+ v2 := compiler.MapValueForKey(m, "description")
+ if v2 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Any value = 3;
+ v3 := compiler.MapValueForKey(m, "value")
+ if v3 != nil {
+ var err error
+ x.Value, err = NewAny(v3, compiler.NewContext("value", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string external_value = 4;
+ v4 := compiler.MapValueForKey(m, "externalValue")
+ if v4 != nil {
+ x.ExternalValue, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for externalValue: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny specification_extension = 5;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewExampleOrReference creates an object of type ExampleOrReference if possible, returning an error if not.
+func NewExampleOrReference(in *yaml.Node, context *compiler.Context) (*ExampleOrReference, error) {
+ errors := make([]error, 0)
+ x := &ExampleOrReference{}
+ matched := false
+ // Example example = 1;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewExample(m, compiler.NewContext("example", m, context))
+ if matchingError == nil {
+ x.Oneof = &ExampleOrReference_Example{Example: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // Reference reference = 2;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewReference(m, compiler.NewContext("reference", m, context))
+ if matchingError == nil {
+ x.Oneof = &ExampleOrReference_Reference{Reference: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ } else {
+ message := fmt.Sprintf("contains an invalid ExampleOrReference")
+ err := compiler.NewError(context, message)
+ errors = []error{err}
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewExamplesOrReferences creates an object of type ExamplesOrReferences if possible, returning an error if not.
+func NewExamplesOrReferences(in *yaml.Node, context *compiler.Context) (*ExamplesOrReferences, error) {
+ errors := make([]error, 0)
+ x := &ExamplesOrReferences{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedExampleOrReference additional_properties = 1;
+ // MAP: ExampleOrReference
+ x.AdditionalProperties = make([]*NamedExampleOrReference, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedExampleOrReference{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewExampleOrReference(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewExpression creates an object of type Expression if possible, returning an error if not.
+func NewExpression(in *yaml.Node, context *compiler.Context) (*Expression, error) {
+ errors := make([]error, 0)
+ x := &Expression{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedAny additional_properties = 1;
+ // MAP: Any
+ x.AdditionalProperties = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewExternalDocs creates an object of type ExternalDocs if possible, returning an error if not.
+func NewExternalDocs(in *yaml.Node, context *compiler.Context) (*ExternalDocs, error) {
+ errors := make([]error, 0)
+ x := &ExternalDocs{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"url"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"description", "url"}
+ allowedPatterns := []*regexp.Regexp{pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string description = 1;
+ v1 := compiler.MapValueForKey(m, "description")
+ if v1 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string url = 2;
+ v2 := compiler.MapValueForKey(m, "url")
+ if v2 != nil {
+ x.Url, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny specification_extension = 3;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewHeader creates an object of type Header if possible, returning an error if not.
+func NewHeader(in *yaml.Node, context *compiler.Context) (*Header, error) {
+ errors := make([]error, 0)
+ x := &Header{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"allowEmptyValue", "allowReserved", "content", "deprecated", "description", "example", "examples", "explode", "required", "schema", "style"}
+ allowedPatterns := []*regexp.Regexp{pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string description = 1;
+ v1 := compiler.MapValueForKey(m, "description")
+ if v1 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool required = 2;
+ v2 := compiler.MapValueForKey(m, "required")
+ if v2 != nil {
+ x.Required, ok = compiler.BoolForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool deprecated = 3;
+ v3 := compiler.MapValueForKey(m, "deprecated")
+ if v3 != nil {
+ x.Deprecated, ok = compiler.BoolForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for deprecated: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool allow_empty_value = 4;
+ v4 := compiler.MapValueForKey(m, "allowEmptyValue")
+ if v4 != nil {
+ x.AllowEmptyValue, ok = compiler.BoolForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for allowEmptyValue: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string style = 5;
+ v5 := compiler.MapValueForKey(m, "style")
+ if v5 != nil {
+ x.Style, ok = compiler.StringForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for style: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool explode = 6;
+ v6 := compiler.MapValueForKey(m, "explode")
+ if v6 != nil {
+ x.Explode, ok = compiler.BoolForScalarNode(v6)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for explode: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool allow_reserved = 7;
+ v7 := compiler.MapValueForKey(m, "allowReserved")
+ if v7 != nil {
+ x.AllowReserved, ok = compiler.BoolForScalarNode(v7)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for allowReserved: %s", compiler.Display(v7))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // SchemaOrReference schema = 8;
+ v8 := compiler.MapValueForKey(m, "schema")
+ if v8 != nil {
+ var err error
+ x.Schema, err = NewSchemaOrReference(v8, compiler.NewContext("schema", v8, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Any example = 9;
+ v9 := compiler.MapValueForKey(m, "example")
+ if v9 != nil {
+ var err error
+ x.Example, err = NewAny(v9, compiler.NewContext("example", v9, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // ExamplesOrReferences examples = 10;
+ v10 := compiler.MapValueForKey(m, "examples")
+ if v10 != nil {
+ var err error
+ x.Examples, err = NewExamplesOrReferences(v10, compiler.NewContext("examples", v10, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // MediaTypes content = 11;
+ v11 := compiler.MapValueForKey(m, "content")
+ if v11 != nil {
+ var err error
+ x.Content, err = NewMediaTypes(v11, compiler.NewContext("content", v11, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny specification_extension = 12;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewHeaderOrReference creates an object of type HeaderOrReference if possible, returning an error if not.
+func NewHeaderOrReference(in *yaml.Node, context *compiler.Context) (*HeaderOrReference, error) {
+ errors := make([]error, 0)
+ x := &HeaderOrReference{}
+ matched := false
+ // Header header = 1;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewHeader(m, compiler.NewContext("header", m, context))
+ if matchingError == nil {
+ x.Oneof = &HeaderOrReference_Header{Header: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // Reference reference = 2;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewReference(m, compiler.NewContext("reference", m, context))
+ if matchingError == nil {
+ x.Oneof = &HeaderOrReference_Reference{Reference: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ } else {
+ message := fmt.Sprintf("contains an invalid HeaderOrReference")
+ err := compiler.NewError(context, message)
+ errors = []error{err}
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewHeadersOrReferences creates an object of type HeadersOrReferences if possible, returning an error if not.
+func NewHeadersOrReferences(in *yaml.Node, context *compiler.Context) (*HeadersOrReferences, error) {
+ errors := make([]error, 0)
+ x := &HeadersOrReferences{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedHeaderOrReference additional_properties = 1;
+ // MAP: HeaderOrReference
+ x.AdditionalProperties = make([]*NamedHeaderOrReference, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedHeaderOrReference{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewHeaderOrReference(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewInfo creates an object of type Info if possible, returning an error if not.
+func NewInfo(in *yaml.Node, context *compiler.Context) (*Info, error) {
+ errors := make([]error, 0)
+ x := &Info{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"title", "version"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"contact", "description", "license", "summary", "termsOfService", "title", "version"}
+ allowedPatterns := []*regexp.Regexp{pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string title = 1;
+ v1 := compiler.MapValueForKey(m, "title")
+ if v1 != nil {
+ x.Title, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for title: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 2;
+ v2 := compiler.MapValueForKey(m, "description")
+ if v2 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string terms_of_service = 3;
+ v3 := compiler.MapValueForKey(m, "termsOfService")
+ if v3 != nil {
+ x.TermsOfService, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for termsOfService: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Contact contact = 4;
+ v4 := compiler.MapValueForKey(m, "contact")
+ if v4 != nil {
+ var err error
+ x.Contact, err = NewContact(v4, compiler.NewContext("contact", v4, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // License license = 5;
+ v5 := compiler.MapValueForKey(m, "license")
+ if v5 != nil {
+ var err error
+ x.License, err = NewLicense(v5, compiler.NewContext("license", v5, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string version = 6;
+ v6 := compiler.MapValueForKey(m, "version")
+ if v6 != nil {
+ x.Version, ok = compiler.StringForScalarNode(v6)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for version: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string summary = 7;
+ v7 := compiler.MapValueForKey(m, "summary")
+ if v7 != nil {
+ x.Summary, ok = compiler.StringForScalarNode(v7)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for summary: %s", compiler.Display(v7))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny specification_extension = 8;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewItemsItem creates an object of type ItemsItem if possible, returning an error if not.
+func NewItemsItem(in *yaml.Node, context *compiler.Context) (*ItemsItem, error) {
+ errors := make([]error, 0)
+ x := &ItemsItem{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for item array: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ x.SchemaOrReference = make([]*SchemaOrReference, 0)
+ y, err := NewSchemaOrReference(m, compiler.NewContext("", m, context))
+ if err != nil {
+ return nil, err
+ }
+ x.SchemaOrReference = append(x.SchemaOrReference, y)
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewLicense creates an object of type License if possible, returning an error if not.
+func NewLicense(in *yaml.Node, context *compiler.Context) (*License, error) {
+ errors := make([]error, 0)
+ x := &License{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"name"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"name", "url"}
+ allowedPatterns := []*regexp.Regexp{pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string url = 2;
+ v2 := compiler.MapValueForKey(m, "url")
+ if v2 != nil {
+ x.Url, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny specification_extension = 3;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewLink creates an object of type Link if possible, returning an error if not.
+func NewLink(in *yaml.Node, context *compiler.Context) (*Link, error) {
+ errors := make([]error, 0)
+ x := &Link{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"description", "operationId", "operationRef", "parameters", "requestBody", "server"}
+ allowedPatterns := []*regexp.Regexp{pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string operation_ref = 1;
+ v1 := compiler.MapValueForKey(m, "operationRef")
+ if v1 != nil {
+ x.OperationRef, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for operationRef: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string operation_id = 2;
+ v2 := compiler.MapValueForKey(m, "operationId")
+ if v2 != nil {
+ x.OperationId, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for operationId: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // AnyOrExpression parameters = 3;
+ v3 := compiler.MapValueForKey(m, "parameters")
+ if v3 != nil {
+ var err error
+ x.Parameters, err = NewAnyOrExpression(v3, compiler.NewContext("parameters", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // AnyOrExpression request_body = 4;
+ v4 := compiler.MapValueForKey(m, "requestBody")
+ if v4 != nil {
+ var err error
+ x.RequestBody, err = NewAnyOrExpression(v4, compiler.NewContext("requestBody", v4, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string description = 5;
+ v5 := compiler.MapValueForKey(m, "description")
+ if v5 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Server server = 6;
+ v6 := compiler.MapValueForKey(m, "server")
+ if v6 != nil {
+ var err error
+ x.Server, err = NewServer(v6, compiler.NewContext("server", v6, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny specification_extension = 7;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewLinkOrReference creates an object of type LinkOrReference if possible, returning an error if not.
+func NewLinkOrReference(in *yaml.Node, context *compiler.Context) (*LinkOrReference, error) {
+ errors := make([]error, 0)
+ x := &LinkOrReference{}
+ matched := false
+ // Link link = 1;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewLink(m, compiler.NewContext("link", m, context))
+ if matchingError == nil {
+ x.Oneof = &LinkOrReference_Link{Link: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // Reference reference = 2;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewReference(m, compiler.NewContext("reference", m, context))
+ if matchingError == nil {
+ x.Oneof = &LinkOrReference_Reference{Reference: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ } else {
+ message := fmt.Sprintf("contains an invalid LinkOrReference")
+ err := compiler.NewError(context, message)
+ errors = []error{err}
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewLinksOrReferences creates an object of type LinksOrReferences if possible, returning an error if not.
+func NewLinksOrReferences(in *yaml.Node, context *compiler.Context) (*LinksOrReferences, error) {
+ errors := make([]error, 0)
+ x := &LinksOrReferences{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedLinkOrReference additional_properties = 1;
+ // MAP: LinkOrReference
+ x.AdditionalProperties = make([]*NamedLinkOrReference, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedLinkOrReference{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewLinkOrReference(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewMediaType creates an object of type MediaType if possible, returning an error if not.
+func NewMediaType(in *yaml.Node, context *compiler.Context) (*MediaType, error) {
+ errors := make([]error, 0)
+ x := &MediaType{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"encoding", "example", "examples", "schema"}
+ allowedPatterns := []*regexp.Regexp{pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // SchemaOrReference schema = 1;
+ v1 := compiler.MapValueForKey(m, "schema")
+ if v1 != nil {
+ var err error
+ x.Schema, err = NewSchemaOrReference(v1, compiler.NewContext("schema", v1, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Any example = 2;
+ v2 := compiler.MapValueForKey(m, "example")
+ if v2 != nil {
+ var err error
+ x.Example, err = NewAny(v2, compiler.NewContext("example", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // ExamplesOrReferences examples = 3;
+ v3 := compiler.MapValueForKey(m, "examples")
+ if v3 != nil {
+ var err error
+ x.Examples, err = NewExamplesOrReferences(v3, compiler.NewContext("examples", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Encodings encoding = 4;
+ v4 := compiler.MapValueForKey(m, "encoding")
+ if v4 != nil {
+ var err error
+ x.Encoding, err = NewEncodings(v4, compiler.NewContext("encoding", v4, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny specification_extension = 5;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewMediaTypes creates an object of type MediaTypes if possible, returning an error if not.
+func NewMediaTypes(in *yaml.Node, context *compiler.Context) (*MediaTypes, error) {
+ errors := make([]error, 0)
+ x := &MediaTypes{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedMediaType additional_properties = 1;
+ // MAP: MediaType
+ x.AdditionalProperties = make([]*NamedMediaType, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedMediaType{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewMediaType(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedAny creates an object of type NamedAny if possible, returning an error if not.
+func NewNamedAny(in *yaml.Node, context *compiler.Context) (*NamedAny, error) {
+ errors := make([]error, 0)
+ x := &NamedAny{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Any value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewAny(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedCallbackOrReference creates an object of type NamedCallbackOrReference if possible, returning an error if not.
+func NewNamedCallbackOrReference(in *yaml.Node, context *compiler.Context) (*NamedCallbackOrReference, error) {
+ errors := make([]error, 0)
+ x := &NamedCallbackOrReference{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // CallbackOrReference value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewCallbackOrReference(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedEncoding creates an object of type NamedEncoding if possible, returning an error if not.
+func NewNamedEncoding(in *yaml.Node, context *compiler.Context) (*NamedEncoding, error) {
+ errors := make([]error, 0)
+ x := &NamedEncoding{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Encoding value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewEncoding(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedExampleOrReference creates an object of type NamedExampleOrReference if possible, returning an error if not.
+func NewNamedExampleOrReference(in *yaml.Node, context *compiler.Context) (*NamedExampleOrReference, error) {
+ errors := make([]error, 0)
+ x := &NamedExampleOrReference{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // ExampleOrReference value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewExampleOrReference(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedHeaderOrReference creates an object of type NamedHeaderOrReference if possible, returning an error if not.
+func NewNamedHeaderOrReference(in *yaml.Node, context *compiler.Context) (*NamedHeaderOrReference, error) {
+ errors := make([]error, 0)
+ x := &NamedHeaderOrReference{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // HeaderOrReference value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewHeaderOrReference(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedLinkOrReference creates an object of type NamedLinkOrReference if possible, returning an error if not.
+func NewNamedLinkOrReference(in *yaml.Node, context *compiler.Context) (*NamedLinkOrReference, error) {
+ errors := make([]error, 0)
+ x := &NamedLinkOrReference{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // LinkOrReference value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewLinkOrReference(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedMediaType creates an object of type NamedMediaType if possible, returning an error if not.
+func NewNamedMediaType(in *yaml.Node, context *compiler.Context) (*NamedMediaType, error) {
+ errors := make([]error, 0)
+ x := &NamedMediaType{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // MediaType value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewMediaType(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedParameterOrReference creates an object of type NamedParameterOrReference if possible, returning an error if not.
+func NewNamedParameterOrReference(in *yaml.Node, context *compiler.Context) (*NamedParameterOrReference, error) {
+ errors := make([]error, 0)
+ x := &NamedParameterOrReference{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // ParameterOrReference value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewParameterOrReference(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedPathItem creates an object of type NamedPathItem if possible, returning an error if not.
+func NewNamedPathItem(in *yaml.Node, context *compiler.Context) (*NamedPathItem, error) {
+ errors := make([]error, 0)
+ x := &NamedPathItem{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // PathItem value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewPathItem(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedRequestBodyOrReference creates an object of type NamedRequestBodyOrReference if possible, returning an error if not.
+func NewNamedRequestBodyOrReference(in *yaml.Node, context *compiler.Context) (*NamedRequestBodyOrReference, error) {
+ errors := make([]error, 0)
+ x := &NamedRequestBodyOrReference{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // RequestBodyOrReference value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewRequestBodyOrReference(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedResponseOrReference creates an object of type NamedResponseOrReference if possible, returning an error if not.
+func NewNamedResponseOrReference(in *yaml.Node, context *compiler.Context) (*NamedResponseOrReference, error) {
+ errors := make([]error, 0)
+ x := &NamedResponseOrReference{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // ResponseOrReference value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewResponseOrReference(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedSchemaOrReference creates an object of type NamedSchemaOrReference if possible, returning an error if not.
+func NewNamedSchemaOrReference(in *yaml.Node, context *compiler.Context) (*NamedSchemaOrReference, error) {
+ errors := make([]error, 0)
+ x := &NamedSchemaOrReference{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // SchemaOrReference value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewSchemaOrReference(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedSecuritySchemeOrReference creates an object of type NamedSecuritySchemeOrReference if possible, returning an error if not.
+func NewNamedSecuritySchemeOrReference(in *yaml.Node, context *compiler.Context) (*NamedSecuritySchemeOrReference, error) {
+ errors := make([]error, 0)
+ x := &NamedSecuritySchemeOrReference{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // SecuritySchemeOrReference value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewSecuritySchemeOrReference(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedServerVariable creates an object of type NamedServerVariable if possible, returning an error if not.
+func NewNamedServerVariable(in *yaml.Node, context *compiler.Context) (*NamedServerVariable, error) {
+ errors := make([]error, 0)
+ x := &NamedServerVariable{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // ServerVariable value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewServerVariable(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedString creates an object of type NamedString if possible, returning an error if not.
+func NewNamedString(in *yaml.Node, context *compiler.Context) (*NamedString, error) {
+ errors := make([]error, 0)
+ x := &NamedString{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ x.Value, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for value: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedStringArray creates an object of type NamedStringArray if possible, returning an error if not.
+func NewNamedStringArray(in *yaml.Node, context *compiler.Context) (*NamedStringArray, error) {
+ errors := make([]error, 0)
+ x := &NamedStringArray{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // StringArray value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewStringArray(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewOauthFlow creates an object of type OauthFlow if possible, returning an error if not.
+func NewOauthFlow(in *yaml.Node, context *compiler.Context) (*OauthFlow, error) {
+ errors := make([]error, 0)
+ x := &OauthFlow{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"authorizationUrl", "refreshUrl", "scopes", "tokenUrl"}
+ allowedPatterns := []*regexp.Regexp{pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string authorization_url = 1;
+ v1 := compiler.MapValueForKey(m, "authorizationUrl")
+ if v1 != nil {
+ x.AuthorizationUrl, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for authorizationUrl: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string token_url = 2;
+ v2 := compiler.MapValueForKey(m, "tokenUrl")
+ if v2 != nil {
+ x.TokenUrl, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for tokenUrl: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string refresh_url = 3;
+ v3 := compiler.MapValueForKey(m, "refreshUrl")
+ if v3 != nil {
+ x.RefreshUrl, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for refreshUrl: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Strings scopes = 4;
+ v4 := compiler.MapValueForKey(m, "scopes")
+ if v4 != nil {
+ var err error
+ x.Scopes, err = NewStrings(v4, compiler.NewContext("scopes", v4, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny specification_extension = 5;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewOauthFlows creates an object of type OauthFlows if possible, returning an error if not.
+func NewOauthFlows(in *yaml.Node, context *compiler.Context) (*OauthFlows, error) {
+ errors := make([]error, 0)
+ x := &OauthFlows{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"authorizationCode", "clientCredentials", "implicit", "password"}
+ allowedPatterns := []*regexp.Regexp{pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // OauthFlow implicit = 1;
+ v1 := compiler.MapValueForKey(m, "implicit")
+ if v1 != nil {
+ var err error
+ x.Implicit, err = NewOauthFlow(v1, compiler.NewContext("implicit", v1, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // OauthFlow password = 2;
+ v2 := compiler.MapValueForKey(m, "password")
+ if v2 != nil {
+ var err error
+ x.Password, err = NewOauthFlow(v2, compiler.NewContext("password", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // OauthFlow client_credentials = 3;
+ v3 := compiler.MapValueForKey(m, "clientCredentials")
+ if v3 != nil {
+ var err error
+ x.ClientCredentials, err = NewOauthFlow(v3, compiler.NewContext("clientCredentials", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // OauthFlow authorization_code = 4;
+ v4 := compiler.MapValueForKey(m, "authorizationCode")
+ if v4 != nil {
+ var err error
+ x.AuthorizationCode, err = NewOauthFlow(v4, compiler.NewContext("authorizationCode", v4, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny specification_extension = 5;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewObject creates an object of type Object if possible, returning an error if not.
+func NewObject(in *yaml.Node, context *compiler.Context) (*Object, error) {
+ errors := make([]error, 0)
+ x := &Object{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedAny additional_properties = 1;
+ // MAP: Any
+ x.AdditionalProperties = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewOperation creates an object of type Operation if possible, returning an error if not.
+func NewOperation(in *yaml.Node, context *compiler.Context) (*Operation, error) {
+ errors := make([]error, 0)
+ x := &Operation{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"responses"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"callbacks", "deprecated", "description", "externalDocs", "operationId", "parameters", "requestBody", "responses", "security", "servers", "summary", "tags"}
+ allowedPatterns := []*regexp.Regexp{pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // repeated string tags = 1;
+ v1 := compiler.MapValueForKey(m, "tags")
+ if v1 != nil {
+ v, ok := compiler.SequenceNodeForNode(v1)
+ if ok {
+ x.Tags = compiler.StringArrayForSequenceNode(v)
+ } else {
+ message := fmt.Sprintf("has unexpected value for tags: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string summary = 2;
+ v2 := compiler.MapValueForKey(m, "summary")
+ if v2 != nil {
+ x.Summary, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for summary: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 3;
+ v3 := compiler.MapValueForKey(m, "description")
+ if v3 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // ExternalDocs external_docs = 4;
+ v4 := compiler.MapValueForKey(m, "externalDocs")
+ if v4 != nil {
+ var err error
+ x.ExternalDocs, err = NewExternalDocs(v4, compiler.NewContext("externalDocs", v4, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string operation_id = 5;
+ v5 := compiler.MapValueForKey(m, "operationId")
+ if v5 != nil {
+ x.OperationId, ok = compiler.StringForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for operationId: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated ParameterOrReference parameters = 6;
+ v6 := compiler.MapValueForKey(m, "parameters")
+ if v6 != nil {
+ // repeated ParameterOrReference
+ x.Parameters = make([]*ParameterOrReference, 0)
+ a, ok := compiler.SequenceNodeForNode(v6)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewParameterOrReference(item, compiler.NewContext("parameters", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Parameters = append(x.Parameters, y)
+ }
+ }
+ }
+ // RequestBodyOrReference request_body = 7;
+ v7 := compiler.MapValueForKey(m, "requestBody")
+ if v7 != nil {
+ var err error
+ x.RequestBody, err = NewRequestBodyOrReference(v7, compiler.NewContext("requestBody", v7, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Responses responses = 8;
+ v8 := compiler.MapValueForKey(m, "responses")
+ if v8 != nil {
+ var err error
+ x.Responses, err = NewResponses(v8, compiler.NewContext("responses", v8, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // CallbacksOrReferences callbacks = 9;
+ v9 := compiler.MapValueForKey(m, "callbacks")
+ if v9 != nil {
+ var err error
+ x.Callbacks, err = NewCallbacksOrReferences(v9, compiler.NewContext("callbacks", v9, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // bool deprecated = 10;
+ v10 := compiler.MapValueForKey(m, "deprecated")
+ if v10 != nil {
+ x.Deprecated, ok = compiler.BoolForScalarNode(v10)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for deprecated: %s", compiler.Display(v10))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated SecurityRequirement security = 11;
+ v11 := compiler.MapValueForKey(m, "security")
+ if v11 != nil {
+ // repeated SecurityRequirement
+ x.Security = make([]*SecurityRequirement, 0)
+ a, ok := compiler.SequenceNodeForNode(v11)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewSecurityRequirement(item, compiler.NewContext("security", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Security = append(x.Security, y)
+ }
+ }
+ }
+ // repeated Server servers = 12;
+ v12 := compiler.MapValueForKey(m, "servers")
+ if v12 != nil {
+ // repeated Server
+ x.Servers = make([]*Server, 0)
+ a, ok := compiler.SequenceNodeForNode(v12)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewServer(item, compiler.NewContext("servers", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Servers = append(x.Servers, y)
+ }
+ }
+ }
+ // repeated NamedAny specification_extension = 13;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewParameter creates an object of type Parameter if possible, returning an error if not.
+func NewParameter(in *yaml.Node, context *compiler.Context) (*Parameter, error) {
+ errors := make([]error, 0)
+ x := &Parameter{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"in", "name"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"allowEmptyValue", "allowReserved", "content", "deprecated", "description", "example", "examples", "explode", "in", "name", "required", "schema", "style"}
+ allowedPatterns := []*regexp.Regexp{pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string in = 2;
+ v2 := compiler.MapValueForKey(m, "in")
+ if v2 != nil {
+ x.In, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 3;
+ v3 := compiler.MapValueForKey(m, "description")
+ if v3 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool required = 4;
+ v4 := compiler.MapValueForKey(m, "required")
+ if v4 != nil {
+ x.Required, ok = compiler.BoolForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool deprecated = 5;
+ v5 := compiler.MapValueForKey(m, "deprecated")
+ if v5 != nil {
+ x.Deprecated, ok = compiler.BoolForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for deprecated: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool allow_empty_value = 6;
+ v6 := compiler.MapValueForKey(m, "allowEmptyValue")
+ if v6 != nil {
+ x.AllowEmptyValue, ok = compiler.BoolForScalarNode(v6)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for allowEmptyValue: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string style = 7;
+ v7 := compiler.MapValueForKey(m, "style")
+ if v7 != nil {
+ x.Style, ok = compiler.StringForScalarNode(v7)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for style: %s", compiler.Display(v7))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool explode = 8;
+ v8 := compiler.MapValueForKey(m, "explode")
+ if v8 != nil {
+ x.Explode, ok = compiler.BoolForScalarNode(v8)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for explode: %s", compiler.Display(v8))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool allow_reserved = 9;
+ v9 := compiler.MapValueForKey(m, "allowReserved")
+ if v9 != nil {
+ x.AllowReserved, ok = compiler.BoolForScalarNode(v9)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for allowReserved: %s", compiler.Display(v9))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // SchemaOrReference schema = 10;
+ v10 := compiler.MapValueForKey(m, "schema")
+ if v10 != nil {
+ var err error
+ x.Schema, err = NewSchemaOrReference(v10, compiler.NewContext("schema", v10, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Any example = 11;
+ v11 := compiler.MapValueForKey(m, "example")
+ if v11 != nil {
+ var err error
+ x.Example, err = NewAny(v11, compiler.NewContext("example", v11, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // ExamplesOrReferences examples = 12;
+ v12 := compiler.MapValueForKey(m, "examples")
+ if v12 != nil {
+ var err error
+ x.Examples, err = NewExamplesOrReferences(v12, compiler.NewContext("examples", v12, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // MediaTypes content = 13;
+ v13 := compiler.MapValueForKey(m, "content")
+ if v13 != nil {
+ var err error
+ x.Content, err = NewMediaTypes(v13, compiler.NewContext("content", v13, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny specification_extension = 14;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewParameterOrReference creates an object of type ParameterOrReference if possible, returning an error if not.
+func NewParameterOrReference(in *yaml.Node, context *compiler.Context) (*ParameterOrReference, error) {
+ errors := make([]error, 0)
+ x := &ParameterOrReference{}
+ matched := false
+ // Parameter parameter = 1;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewParameter(m, compiler.NewContext("parameter", m, context))
+ if matchingError == nil {
+ x.Oneof = &ParameterOrReference_Parameter{Parameter: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // Reference reference = 2;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewReference(m, compiler.NewContext("reference", m, context))
+ if matchingError == nil {
+ x.Oneof = &ParameterOrReference_Reference{Reference: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ } else {
+ message := fmt.Sprintf("contains an invalid ParameterOrReference")
+ err := compiler.NewError(context, message)
+ errors = []error{err}
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewParametersOrReferences creates an object of type ParametersOrReferences if possible, returning an error if not.
+func NewParametersOrReferences(in *yaml.Node, context *compiler.Context) (*ParametersOrReferences, error) {
+ errors := make([]error, 0)
+ x := &ParametersOrReferences{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedParameterOrReference additional_properties = 1;
+ // MAP: ParameterOrReference
+ x.AdditionalProperties = make([]*NamedParameterOrReference, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedParameterOrReference{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewParameterOrReference(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewPathItem creates an object of type PathItem if possible, returning an error if not.
+func NewPathItem(in *yaml.Node, context *compiler.Context) (*PathItem, error) {
+ errors := make([]error, 0)
+ x := &PathItem{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"$ref", "delete", "description", "get", "head", "options", "parameters", "patch", "post", "put", "servers", "summary", "trace"}
+ allowedPatterns := []*regexp.Regexp{pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string _ref = 1;
+ v1 := compiler.MapValueForKey(m, "$ref")
+ if v1 != nil {
+ x.XRef, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for $ref: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string summary = 2;
+ v2 := compiler.MapValueForKey(m, "summary")
+ if v2 != nil {
+ x.Summary, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for summary: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 3;
+ v3 := compiler.MapValueForKey(m, "description")
+ if v3 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Operation get = 4;
+ v4 := compiler.MapValueForKey(m, "get")
+ if v4 != nil {
+ var err error
+ x.Get, err = NewOperation(v4, compiler.NewContext("get", v4, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Operation put = 5;
+ v5 := compiler.MapValueForKey(m, "put")
+ if v5 != nil {
+ var err error
+ x.Put, err = NewOperation(v5, compiler.NewContext("put", v5, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Operation post = 6;
+ v6 := compiler.MapValueForKey(m, "post")
+ if v6 != nil {
+ var err error
+ x.Post, err = NewOperation(v6, compiler.NewContext("post", v6, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Operation delete = 7;
+ v7 := compiler.MapValueForKey(m, "delete")
+ if v7 != nil {
+ var err error
+ x.Delete, err = NewOperation(v7, compiler.NewContext("delete", v7, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Operation options = 8;
+ v8 := compiler.MapValueForKey(m, "options")
+ if v8 != nil {
+ var err error
+ x.Options, err = NewOperation(v8, compiler.NewContext("options", v8, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Operation head = 9;
+ v9 := compiler.MapValueForKey(m, "head")
+ if v9 != nil {
+ var err error
+ x.Head, err = NewOperation(v9, compiler.NewContext("head", v9, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Operation patch = 10;
+ v10 := compiler.MapValueForKey(m, "patch")
+ if v10 != nil {
+ var err error
+ x.Patch, err = NewOperation(v10, compiler.NewContext("patch", v10, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Operation trace = 11;
+ v11 := compiler.MapValueForKey(m, "trace")
+ if v11 != nil {
+ var err error
+ x.Trace, err = NewOperation(v11, compiler.NewContext("trace", v11, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated Server servers = 12;
+ v12 := compiler.MapValueForKey(m, "servers")
+ if v12 != nil {
+ // repeated Server
+ x.Servers = make([]*Server, 0)
+ a, ok := compiler.SequenceNodeForNode(v12)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewServer(item, compiler.NewContext("servers", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Servers = append(x.Servers, y)
+ }
+ }
+ }
+ // repeated ParameterOrReference parameters = 13;
+ v13 := compiler.MapValueForKey(m, "parameters")
+ if v13 != nil {
+ // repeated ParameterOrReference
+ x.Parameters = make([]*ParameterOrReference, 0)
+ a, ok := compiler.SequenceNodeForNode(v13)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewParameterOrReference(item, compiler.NewContext("parameters", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Parameters = append(x.Parameters, y)
+ }
+ }
+ }
+ // repeated NamedAny specification_extension = 14;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewPaths creates an object of type Paths if possible, returning an error if not.
+func NewPaths(in *yaml.Node, context *compiler.Context) (*Paths, error) {
+ errors := make([]error, 0)
+ x := &Paths{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{}
+ allowedPatterns := []*regexp.Regexp{pattern2, pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // repeated NamedPathItem path = 1;
+ // MAP: PathItem ^/
+ x.Path = make([]*NamedPathItem, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "/") {
+ pair := &NamedPathItem{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewPathItem(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Path = append(x.Path, pair)
+ }
+ }
+ }
+ // repeated NamedAny specification_extension = 2;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewProperties creates an object of type Properties if possible, returning an error if not.
+func NewProperties(in *yaml.Node, context *compiler.Context) (*Properties, error) {
+ errors := make([]error, 0)
+ x := &Properties{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedSchemaOrReference additional_properties = 1;
+ // MAP: SchemaOrReference
+ x.AdditionalProperties = make([]*NamedSchemaOrReference, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedSchemaOrReference{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewSchemaOrReference(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewReference creates an object of type Reference if possible, returning an error if not.
+func NewReference(in *yaml.Node, context *compiler.Context) (*Reference, error) {
+ errors := make([]error, 0)
+ x := &Reference{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"$ref"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string _ref = 1;
+ v1 := compiler.MapValueForKey(m, "$ref")
+ if v1 != nil {
+ x.XRef, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for $ref: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string summary = 2;
+ v2 := compiler.MapValueForKey(m, "summary")
+ if v2 != nil {
+ x.Summary, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for summary: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 3;
+ v3 := compiler.MapValueForKey(m, "description")
+ if v3 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewRequestBodiesOrReferences creates an object of type RequestBodiesOrReferences if possible, returning an error if not.
+func NewRequestBodiesOrReferences(in *yaml.Node, context *compiler.Context) (*RequestBodiesOrReferences, error) {
+ errors := make([]error, 0)
+ x := &RequestBodiesOrReferences{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedRequestBodyOrReference additional_properties = 1;
+ // MAP: RequestBodyOrReference
+ x.AdditionalProperties = make([]*NamedRequestBodyOrReference, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedRequestBodyOrReference{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewRequestBodyOrReference(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewRequestBody creates an object of type RequestBody if possible, returning an error if not.
+func NewRequestBody(in *yaml.Node, context *compiler.Context) (*RequestBody, error) {
+ errors := make([]error, 0)
+ x := &RequestBody{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"content"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"content", "description", "required"}
+ allowedPatterns := []*regexp.Regexp{pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string description = 1;
+ v1 := compiler.MapValueForKey(m, "description")
+ if v1 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // MediaTypes content = 2;
+ v2 := compiler.MapValueForKey(m, "content")
+ if v2 != nil {
+ var err error
+ x.Content, err = NewMediaTypes(v2, compiler.NewContext("content", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // bool required = 3;
+ v3 := compiler.MapValueForKey(m, "required")
+ if v3 != nil {
+ x.Required, ok = compiler.BoolForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny specification_extension = 4;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewRequestBodyOrReference creates an object of type RequestBodyOrReference if possible, returning an error if not.
+func NewRequestBodyOrReference(in *yaml.Node, context *compiler.Context) (*RequestBodyOrReference, error) {
+ errors := make([]error, 0)
+ x := &RequestBodyOrReference{}
+ matched := false
+ // RequestBody request_body = 1;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewRequestBody(m, compiler.NewContext("requestBody", m, context))
+ if matchingError == nil {
+ x.Oneof = &RequestBodyOrReference_RequestBody{RequestBody: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // Reference reference = 2;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewReference(m, compiler.NewContext("reference", m, context))
+ if matchingError == nil {
+ x.Oneof = &RequestBodyOrReference_Reference{Reference: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ } else {
+ message := fmt.Sprintf("contains an invalid RequestBodyOrReference")
+ err := compiler.NewError(context, message)
+ errors = []error{err}
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewResponse creates an object of type Response if possible, returning an error if not.
+func NewResponse(in *yaml.Node, context *compiler.Context) (*Response, error) {
+ errors := make([]error, 0)
+ x := &Response{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"description"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"content", "description", "headers", "links"}
+ allowedPatterns := []*regexp.Regexp{pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string description = 1;
+ v1 := compiler.MapValueForKey(m, "description")
+ if v1 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // HeadersOrReferences headers = 2;
+ v2 := compiler.MapValueForKey(m, "headers")
+ if v2 != nil {
+ var err error
+ x.Headers, err = NewHeadersOrReferences(v2, compiler.NewContext("headers", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // MediaTypes content = 3;
+ v3 := compiler.MapValueForKey(m, "content")
+ if v3 != nil {
+ var err error
+ x.Content, err = NewMediaTypes(v3, compiler.NewContext("content", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // LinksOrReferences links = 4;
+ v4 := compiler.MapValueForKey(m, "links")
+ if v4 != nil {
+ var err error
+ x.Links, err = NewLinksOrReferences(v4, compiler.NewContext("links", v4, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny specification_extension = 5;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewResponseOrReference creates an object of type ResponseOrReference if possible, returning an error if not.
+func NewResponseOrReference(in *yaml.Node, context *compiler.Context) (*ResponseOrReference, error) {
+ errors := make([]error, 0)
+ x := &ResponseOrReference{}
+ matched := false
+ // Response response = 1;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewResponse(m, compiler.NewContext("response", m, context))
+ if matchingError == nil {
+ x.Oneof = &ResponseOrReference_Response{Response: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // Reference reference = 2;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewReference(m, compiler.NewContext("reference", m, context))
+ if matchingError == nil {
+ x.Oneof = &ResponseOrReference_Reference{Reference: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ } else {
+ message := fmt.Sprintf("contains an invalid ResponseOrReference")
+ err := compiler.NewError(context, message)
+ errors = []error{err}
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewResponses creates an object of type Responses if possible, returning an error if not.
+func NewResponses(in *yaml.Node, context *compiler.Context) (*Responses, error) {
+ errors := make([]error, 0)
+ x := &Responses{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"default"}
+ allowedPatterns := []*regexp.Regexp{pattern3, pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // ResponseOrReference default = 1;
+ v1 := compiler.MapValueForKey(m, "default")
+ if v1 != nil {
+ var err error
+ x.Default, err = NewResponseOrReference(v1, compiler.NewContext("default", v1, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedResponseOrReference response_or_reference = 2;
+ // MAP: ResponseOrReference ^([0-9X]{3})$
+ x.ResponseOrReference = make([]*NamedResponseOrReference, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if pattern3.MatchString(k) {
+ pair := &NamedResponseOrReference{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewResponseOrReference(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.ResponseOrReference = append(x.ResponseOrReference, pair)
+ }
+ }
+ }
+ // repeated NamedAny specification_extension = 3;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewResponsesOrReferences creates an object of type ResponsesOrReferences if possible, returning an error if not.
+func NewResponsesOrReferences(in *yaml.Node, context *compiler.Context) (*ResponsesOrReferences, error) {
+ errors := make([]error, 0)
+ x := &ResponsesOrReferences{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedResponseOrReference additional_properties = 1;
+ // MAP: ResponseOrReference
+ x.AdditionalProperties = make([]*NamedResponseOrReference, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedResponseOrReference{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewResponseOrReference(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewSchema creates an object of type Schema if possible, returning an error if not.
+func NewSchema(in *yaml.Node, context *compiler.Context) (*Schema, error) {
+ errors := make([]error, 0)
+ x := &Schema{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"additionalProperties", "allOf", "anyOf", "default", "deprecated", "description", "discriminator", "enum", "example", "exclusiveMaximum", "exclusiveMinimum", "externalDocs", "format", "items", "maxItems", "maxLength", "maxProperties", "maximum", "minItems", "minLength", "minProperties", "minimum", "multipleOf", "not", "nullable", "oneOf", "pattern", "properties", "readOnly", "required", "title", "type", "uniqueItems", "writeOnly", "xml"}
+ allowedPatterns := []*regexp.Regexp{pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // bool nullable = 1;
+ v1 := compiler.MapValueForKey(m, "nullable")
+ if v1 != nil {
+ x.Nullable, ok = compiler.BoolForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for nullable: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Discriminator discriminator = 2;
+ v2 := compiler.MapValueForKey(m, "discriminator")
+ if v2 != nil {
+ var err error
+ x.Discriminator, err = NewDiscriminator(v2, compiler.NewContext("discriminator", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // bool read_only = 3;
+ v3 := compiler.MapValueForKey(m, "readOnly")
+ if v3 != nil {
+ x.ReadOnly, ok = compiler.BoolForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for readOnly: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool write_only = 4;
+ v4 := compiler.MapValueForKey(m, "writeOnly")
+ if v4 != nil {
+ x.WriteOnly, ok = compiler.BoolForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for writeOnly: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Xml xml = 5;
+ v5 := compiler.MapValueForKey(m, "xml")
+ if v5 != nil {
+ var err error
+ x.Xml, err = NewXml(v5, compiler.NewContext("xml", v5, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // ExternalDocs external_docs = 6;
+ v6 := compiler.MapValueForKey(m, "externalDocs")
+ if v6 != nil {
+ var err error
+ x.ExternalDocs, err = NewExternalDocs(v6, compiler.NewContext("externalDocs", v6, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Any example = 7;
+ v7 := compiler.MapValueForKey(m, "example")
+ if v7 != nil {
+ var err error
+ x.Example, err = NewAny(v7, compiler.NewContext("example", v7, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // bool deprecated = 8;
+ v8 := compiler.MapValueForKey(m, "deprecated")
+ if v8 != nil {
+ x.Deprecated, ok = compiler.BoolForScalarNode(v8)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for deprecated: %s", compiler.Display(v8))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string title = 9;
+ v9 := compiler.MapValueForKey(m, "title")
+ if v9 != nil {
+ x.Title, ok = compiler.StringForScalarNode(v9)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for title: %s", compiler.Display(v9))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // float multiple_of = 10;
+ v10 := compiler.MapValueForKey(m, "multipleOf")
+ if v10 != nil {
+ v, ok := compiler.FloatForScalarNode(v10)
+ if ok {
+ x.MultipleOf = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v10))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // float maximum = 11;
+ v11 := compiler.MapValueForKey(m, "maximum")
+ if v11 != nil {
+ v, ok := compiler.FloatForScalarNode(v11)
+ if ok {
+ x.Maximum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v11))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_maximum = 12;
+ v12 := compiler.MapValueForKey(m, "exclusiveMaximum")
+ if v12 != nil {
+ x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v12)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v12))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // float minimum = 13;
+ v13 := compiler.MapValueForKey(m, "minimum")
+ if v13 != nil {
+ v, ok := compiler.FloatForScalarNode(v13)
+ if ok {
+ x.Minimum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v13))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_minimum = 14;
+ v14 := compiler.MapValueForKey(m, "exclusiveMinimum")
+ if v14 != nil {
+ x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v14)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v14))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_length = 15;
+ v15 := compiler.MapValueForKey(m, "maxLength")
+ if v15 != nil {
+ t, ok := compiler.IntForScalarNode(v15)
+ if ok {
+ x.MaxLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v15))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_length = 16;
+ v16 := compiler.MapValueForKey(m, "minLength")
+ if v16 != nil {
+ t, ok := compiler.IntForScalarNode(v16)
+ if ok {
+ x.MinLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v16))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string pattern = 17;
+ v17 := compiler.MapValueForKey(m, "pattern")
+ if v17 != nil {
+ x.Pattern, ok = compiler.StringForScalarNode(v17)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v17))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_items = 18;
+ v18 := compiler.MapValueForKey(m, "maxItems")
+ if v18 != nil {
+ t, ok := compiler.IntForScalarNode(v18)
+ if ok {
+ x.MaxItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v18))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_items = 19;
+ v19 := compiler.MapValueForKey(m, "minItems")
+ if v19 != nil {
+ t, ok := compiler.IntForScalarNode(v19)
+ if ok {
+ x.MinItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v19))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool unique_items = 20;
+ v20 := compiler.MapValueForKey(m, "uniqueItems")
+ if v20 != nil {
+ x.UniqueItems, ok = compiler.BoolForScalarNode(v20)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v20))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_properties = 21;
+ v21 := compiler.MapValueForKey(m, "maxProperties")
+ if v21 != nil {
+ t, ok := compiler.IntForScalarNode(v21)
+ if ok {
+ x.MaxProperties = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxProperties: %s", compiler.Display(v21))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_properties = 22;
+ v22 := compiler.MapValueForKey(m, "minProperties")
+ if v22 != nil {
+ t, ok := compiler.IntForScalarNode(v22)
+ if ok {
+ x.MinProperties = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minProperties: %s", compiler.Display(v22))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated string required = 23;
+ v23 := compiler.MapValueForKey(m, "required")
+ if v23 != nil {
+ v, ok := compiler.SequenceNodeForNode(v23)
+ if ok {
+ x.Required = compiler.StringArrayForSequenceNode(v)
+ } else {
+ message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v23))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated Any enum = 24;
+ v24 := compiler.MapValueForKey(m, "enum")
+ if v24 != nil {
+ // repeated Any
+ x.Enum = make([]*Any, 0)
+ a, ok := compiler.SequenceNodeForNode(v24)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewAny(item, compiler.NewContext("enum", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Enum = append(x.Enum, y)
+ }
+ }
+ }
+ // string type = 25;
+ v25 := compiler.MapValueForKey(m, "type")
+ if v25 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v25)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v25))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated SchemaOrReference all_of = 26;
+ v26 := compiler.MapValueForKey(m, "allOf")
+ if v26 != nil {
+ // repeated SchemaOrReference
+ x.AllOf = make([]*SchemaOrReference, 0)
+ a, ok := compiler.SequenceNodeForNode(v26)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewSchemaOrReference(item, compiler.NewContext("allOf", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AllOf = append(x.AllOf, y)
+ }
+ }
+ }
+ // repeated SchemaOrReference one_of = 27;
+ v27 := compiler.MapValueForKey(m, "oneOf")
+ if v27 != nil {
+ // repeated SchemaOrReference
+ x.OneOf = make([]*SchemaOrReference, 0)
+ a, ok := compiler.SequenceNodeForNode(v27)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewSchemaOrReference(item, compiler.NewContext("oneOf", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.OneOf = append(x.OneOf, y)
+ }
+ }
+ }
+ // repeated SchemaOrReference any_of = 28;
+ v28 := compiler.MapValueForKey(m, "anyOf")
+ if v28 != nil {
+ // repeated SchemaOrReference
+ x.AnyOf = make([]*SchemaOrReference, 0)
+ a, ok := compiler.SequenceNodeForNode(v28)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewSchemaOrReference(item, compiler.NewContext("anyOf", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AnyOf = append(x.AnyOf, y)
+ }
+ }
+ }
+ // Schema not = 29;
+ v29 := compiler.MapValueForKey(m, "not")
+ if v29 != nil {
+ var err error
+ x.Not, err = NewSchema(v29, compiler.NewContext("not", v29, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // ItemsItem items = 30;
+ v30 := compiler.MapValueForKey(m, "items")
+ if v30 != nil {
+ var err error
+ x.Items, err = NewItemsItem(v30, compiler.NewContext("items", v30, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Properties properties = 31;
+ v31 := compiler.MapValueForKey(m, "properties")
+ if v31 != nil {
+ var err error
+ x.Properties, err = NewProperties(v31, compiler.NewContext("properties", v31, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // AdditionalPropertiesItem additional_properties = 32;
+ v32 := compiler.MapValueForKey(m, "additionalProperties")
+ if v32 != nil {
+ var err error
+ x.AdditionalProperties, err = NewAdditionalPropertiesItem(v32, compiler.NewContext("additionalProperties", v32, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // DefaultType default = 33;
+ v33 := compiler.MapValueForKey(m, "default")
+ if v33 != nil {
+ var err error
+ x.Default, err = NewDefaultType(v33, compiler.NewContext("default", v33, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string description = 34;
+ v34 := compiler.MapValueForKey(m, "description")
+ if v34 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v34)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v34))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string format = 35;
+ v35 := compiler.MapValueForKey(m, "format")
+ if v35 != nil {
+ x.Format, ok = compiler.StringForScalarNode(v35)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v35))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny specification_extension = 36;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewSchemaOrReference creates an object of type SchemaOrReference if possible, returning an error if not.
+func NewSchemaOrReference(in *yaml.Node, context *compiler.Context) (*SchemaOrReference, error) {
+ errors := make([]error, 0)
+ x := &SchemaOrReference{}
+ matched := false
+ // Schema schema = 1;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewSchema(m, compiler.NewContext("schema", m, context))
+ if matchingError == nil {
+ x.Oneof = &SchemaOrReference_Schema{Schema: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // Reference reference = 2;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewReference(m, compiler.NewContext("reference", m, context))
+ if matchingError == nil {
+ x.Oneof = &SchemaOrReference_Reference{Reference: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ } else {
+ message := fmt.Sprintf("contains an invalid SchemaOrReference")
+ err := compiler.NewError(context, message)
+ errors = []error{err}
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewSchemasOrReferences creates an object of type SchemasOrReferences if possible, returning an error if not.
+func NewSchemasOrReferences(in *yaml.Node, context *compiler.Context) (*SchemasOrReferences, error) {
+ errors := make([]error, 0)
+ x := &SchemasOrReferences{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedSchemaOrReference additional_properties = 1;
+ // MAP: SchemaOrReference
+ x.AdditionalProperties = make([]*NamedSchemaOrReference, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedSchemaOrReference{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewSchemaOrReference(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewSecurityRequirement creates an object of type SecurityRequirement if possible, returning an error if not.
+func NewSecurityRequirement(in *yaml.Node, context *compiler.Context) (*SecurityRequirement, error) {
+ errors := make([]error, 0)
+ x := &SecurityRequirement{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedStringArray additional_properties = 1;
+ // MAP: StringArray
+ x.AdditionalProperties = make([]*NamedStringArray, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedStringArray{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewStringArray(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewSecurityScheme creates an object of type SecurityScheme if possible, returning an error if not.
+func NewSecurityScheme(in *yaml.Node, context *compiler.Context) (*SecurityScheme, error) {
+ errors := make([]error, 0)
+ x := &SecurityScheme{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"type"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"bearerFormat", "description", "flows", "in", "name", "openIdConnectUrl", "scheme", "type"}
+ allowedPatterns := []*regexp.Regexp{pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string type = 1;
+ v1 := compiler.MapValueForKey(m, "type")
+ if v1 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 2;
+ v2 := compiler.MapValueForKey(m, "description")
+ if v2 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string name = 3;
+ v3 := compiler.MapValueForKey(m, "name")
+ if v3 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string in = 4;
+ v4 := compiler.MapValueForKey(m, "in")
+ if v4 != nil {
+ x.In, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string scheme = 5;
+ v5 := compiler.MapValueForKey(m, "scheme")
+ if v5 != nil {
+ x.Scheme, ok = compiler.StringForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for scheme: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string bearer_format = 6;
+ v6 := compiler.MapValueForKey(m, "bearerFormat")
+ if v6 != nil {
+ x.BearerFormat, ok = compiler.StringForScalarNode(v6)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for bearerFormat: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // OauthFlows flows = 7;
+ v7 := compiler.MapValueForKey(m, "flows")
+ if v7 != nil {
+ var err error
+ x.Flows, err = NewOauthFlows(v7, compiler.NewContext("flows", v7, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string open_id_connect_url = 8;
+ v8 := compiler.MapValueForKey(m, "openIdConnectUrl")
+ if v8 != nil {
+ x.OpenIdConnectUrl, ok = compiler.StringForScalarNode(v8)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for openIdConnectUrl: %s", compiler.Display(v8))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny specification_extension = 9;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewSecuritySchemeOrReference creates an object of type SecuritySchemeOrReference if possible, returning an error if not.
+func NewSecuritySchemeOrReference(in *yaml.Node, context *compiler.Context) (*SecuritySchemeOrReference, error) {
+ errors := make([]error, 0)
+ x := &SecuritySchemeOrReference{}
+ matched := false
+ // SecurityScheme security_scheme = 1;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewSecurityScheme(m, compiler.NewContext("securityScheme", m, context))
+ if matchingError == nil {
+ x.Oneof = &SecuritySchemeOrReference_SecurityScheme{SecurityScheme: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // Reference reference = 2;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewReference(m, compiler.NewContext("reference", m, context))
+ if matchingError == nil {
+ x.Oneof = &SecuritySchemeOrReference_Reference{Reference: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ } else {
+ message := fmt.Sprintf("contains an invalid SecuritySchemeOrReference")
+ err := compiler.NewError(context, message)
+ errors = []error{err}
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewSecuritySchemesOrReferences creates an object of type SecuritySchemesOrReferences if possible, returning an error if not.
+func NewSecuritySchemesOrReferences(in *yaml.Node, context *compiler.Context) (*SecuritySchemesOrReferences, error) {
+ errors := make([]error, 0)
+ x := &SecuritySchemesOrReferences{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedSecuritySchemeOrReference additional_properties = 1;
+ // MAP: SecuritySchemeOrReference
+ x.AdditionalProperties = make([]*NamedSecuritySchemeOrReference, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedSecuritySchemeOrReference{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewSecuritySchemeOrReference(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewServer creates an object of type Server if possible, returning an error if not.
+func NewServer(in *yaml.Node, context *compiler.Context) (*Server, error) {
+ errors := make([]error, 0)
+ x := &Server{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"url"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"description", "url", "variables"}
+ allowedPatterns := []*regexp.Regexp{pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string url = 1;
+ v1 := compiler.MapValueForKey(m, "url")
+ if v1 != nil {
+ x.Url, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 2;
+ v2 := compiler.MapValueForKey(m, "description")
+ if v2 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // ServerVariables variables = 3;
+ v3 := compiler.MapValueForKey(m, "variables")
+ if v3 != nil {
+ var err error
+ x.Variables, err = NewServerVariables(v3, compiler.NewContext("variables", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny specification_extension = 4;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewServerVariable creates an object of type ServerVariable if possible, returning an error if not.
+func NewServerVariable(in *yaml.Node, context *compiler.Context) (*ServerVariable, error) {
+ errors := make([]error, 0)
+ x := &ServerVariable{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"default"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"default", "description", "enum"}
+ allowedPatterns := []*regexp.Regexp{pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // repeated string enum = 1;
+ v1 := compiler.MapValueForKey(m, "enum")
+ if v1 != nil {
+ v, ok := compiler.SequenceNodeForNode(v1)
+ if ok {
+ x.Enum = compiler.StringArrayForSequenceNode(v)
+ } else {
+ message := fmt.Sprintf("has unexpected value for enum: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string default = 2;
+ v2 := compiler.MapValueForKey(m, "default")
+ if v2 != nil {
+ x.Default, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for default: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 3;
+ v3 := compiler.MapValueForKey(m, "description")
+ if v3 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny specification_extension = 4;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewServerVariables creates an object of type ServerVariables if possible, returning an error if not.
+func NewServerVariables(in *yaml.Node, context *compiler.Context) (*ServerVariables, error) {
+ errors := make([]error, 0)
+ x := &ServerVariables{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedServerVariable additional_properties = 1;
+ // MAP: ServerVariable
+ x.AdditionalProperties = make([]*NamedServerVariable, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedServerVariable{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewServerVariable(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewSpecificationExtension creates an object of type SpecificationExtension if possible, returning an error if not.
+func NewSpecificationExtension(in *yaml.Node, context *compiler.Context) (*SpecificationExtension, error) {
+ errors := make([]error, 0)
+ x := &SpecificationExtension{}
+ matched := false
+ switch in.Tag {
+ case "!!bool":
+ var v bool
+ v, matched = compiler.BoolForScalarNode(in)
+ x.Oneof = &SpecificationExtension_Boolean{Boolean: v}
+ case "!!str":
+ var v string
+ v, matched = compiler.StringForScalarNode(in)
+ x.Oneof = &SpecificationExtension_String_{String_: v}
+ case "!!float":
+ var v float64
+ v, matched = compiler.FloatForScalarNode(in)
+ x.Oneof = &SpecificationExtension_Number{Number: v}
+ case "!!int":
+ var v int64
+ v, matched = compiler.IntForScalarNode(in)
+ x.Oneof = &SpecificationExtension_Number{Number: float64(v)}
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewStringArray creates an object of type StringArray if possible, returning an error if not.
+func NewStringArray(in *yaml.Node, context *compiler.Context) (*StringArray, error) {
+ errors := make([]error, 0)
+ x := &StringArray{}
+ x.Value = make([]string, 0)
+ for _, node := range in.Content {
+ s, _ := compiler.StringForScalarNode(node)
+ x.Value = append(x.Value, s)
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewStrings creates an object of type Strings if possible, returning an error if not.
+func NewStrings(in *yaml.Node, context *compiler.Context) (*Strings, error) {
+ errors := make([]error, 0)
+ x := &Strings{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedString additional_properties = 1;
+ // MAP: string
+ x.AdditionalProperties = make([]*NamedString, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedString{}
+ pair.Name = k
+ pair.Value, _ = compiler.StringForScalarNode(v)
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewTag creates an object of type Tag if possible, returning an error if not.
+func NewTag(in *yaml.Node, context *compiler.Context) (*Tag, error) {
+ errors := make([]error, 0)
+ x := &Tag{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"name"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"description", "externalDocs", "name"}
+ allowedPatterns := []*regexp.Regexp{pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 2;
+ v2 := compiler.MapValueForKey(m, "description")
+ if v2 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // ExternalDocs external_docs = 3;
+ v3 := compiler.MapValueForKey(m, "externalDocs")
+ if v3 != nil {
+ var err error
+ x.ExternalDocs, err = NewExternalDocs(v3, compiler.NewContext("externalDocs", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny specification_extension = 4;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewXml creates an object of type Xml if possible, returning an error if not.
+func NewXml(in *yaml.Node, context *compiler.Context) (*Xml, error) {
+ errors := make([]error, 0)
+ x := &Xml{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"attribute", "name", "namespace", "prefix", "wrapped"}
+ allowedPatterns := []*regexp.Regexp{pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string namespace = 2;
+ v2 := compiler.MapValueForKey(m, "namespace")
+ if v2 != nil {
+ x.Namespace, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for namespace: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string prefix = 3;
+ v3 := compiler.MapValueForKey(m, "prefix")
+ if v3 != nil {
+ x.Prefix, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for prefix: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool attribute = 4;
+ v4 := compiler.MapValueForKey(m, "attribute")
+ if v4 != nil {
+ x.Attribute, ok = compiler.BoolForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for attribute: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool wrapped = 5;
+ v5 := compiler.MapValueForKey(m, "wrapped")
+ if v5 != nil {
+ x.Wrapped, ok = compiler.BoolForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for wrapped: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny specification_extension = 6;
+ // MAP: Any ^x-
+ x.SpecificationExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.SpecificationExtension = append(x.SpecificationExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside AdditionalPropertiesItem objects.
+func (m *AdditionalPropertiesItem) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ {
+ p, ok := m.Oneof.(*AdditionalPropertiesItem_SchemaOrReference)
+ if ok {
+ _, err := p.SchemaOrReference.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Any objects.
+func (m *Any) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside AnyOrExpression objects.
+func (m *AnyOrExpression) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ {
+ p, ok := m.Oneof.(*AnyOrExpression_Any)
+ if ok {
+ _, err := p.Any.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*AnyOrExpression_Expression)
+ if ok {
+ _, err := p.Expression.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Callback objects.
+func (m *Callback) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.Path {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside CallbackOrReference objects.
+func (m *CallbackOrReference) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ {
+ p, ok := m.Oneof.(*CallbackOrReference_Callback)
+ if ok {
+ _, err := p.Callback.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*CallbackOrReference_Reference)
+ if ok {
+ _, err := p.Reference.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside CallbacksOrReferences objects.
+func (m *CallbacksOrReferences) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Components objects.
+func (m *Components) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Schemas != nil {
+ _, err := m.Schemas.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Responses != nil {
+ _, err := m.Responses.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Parameters != nil {
+ _, err := m.Parameters.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Examples != nil {
+ _, err := m.Examples.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.RequestBodies != nil {
+ _, err := m.RequestBodies.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Headers != nil {
+ _, err := m.Headers.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.SecuritySchemes != nil {
+ _, err := m.SecuritySchemes.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Links != nil {
+ _, err := m.Links.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Callbacks != nil {
+ _, err := m.Callbacks.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Contact objects.
+func (m *Contact) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside DefaultType objects.
+func (m *DefaultType) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Discriminator objects.
+func (m *Discriminator) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Mapping != nil {
+ _, err := m.Mapping.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Document objects.
+func (m *Document) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Info != nil {
+ _, err := m.Info.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Servers {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ if m.Paths != nil {
+ _, err := m.Paths.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Components != nil {
+ _, err := m.Components.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Security {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.Tags {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ if m.ExternalDocs != nil {
+ _, err := m.ExternalDocs.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Encoding objects.
+func (m *Encoding) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Headers != nil {
+ _, err := m.Headers.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Encodings objects.
+func (m *Encodings) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Example objects.
+func (m *Example) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside ExampleOrReference objects.
+func (m *ExampleOrReference) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ {
+ p, ok := m.Oneof.(*ExampleOrReference_Example)
+ if ok {
+ _, err := p.Example.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*ExampleOrReference_Reference)
+ if ok {
+ _, err := p.Reference.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside ExamplesOrReferences objects.
+func (m *ExamplesOrReferences) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Expression objects.
+func (m *Expression) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside ExternalDocs objects.
+func (m *ExternalDocs) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Header objects.
+func (m *Header) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Schema != nil {
+ _, err := m.Schema.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Example != nil {
+ _, err := m.Example.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Examples != nil {
+ _, err := m.Examples.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Content != nil {
+ _, err := m.Content.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside HeaderOrReference objects.
+func (m *HeaderOrReference) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ {
+ p, ok := m.Oneof.(*HeaderOrReference_Header)
+ if ok {
+ _, err := p.Header.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*HeaderOrReference_Reference)
+ if ok {
+ _, err := p.Reference.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside HeadersOrReferences objects.
+func (m *HeadersOrReferences) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Info objects.
+func (m *Info) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Contact != nil {
+ _, err := m.Contact.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.License != nil {
+ _, err := m.License.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside ItemsItem objects.
+func (m *ItemsItem) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.SchemaOrReference {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside License objects.
+func (m *License) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Link objects.
+func (m *Link) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Parameters != nil {
+ _, err := m.Parameters.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.RequestBody != nil {
+ _, err := m.RequestBody.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Server != nil {
+ _, err := m.Server.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside LinkOrReference objects.
+func (m *LinkOrReference) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ {
+ p, ok := m.Oneof.(*LinkOrReference_Link)
+ if ok {
+ _, err := p.Link.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*LinkOrReference_Reference)
+ if ok {
+ _, err := p.Reference.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside LinksOrReferences objects.
+func (m *LinksOrReferences) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside MediaType objects.
+func (m *MediaType) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Schema != nil {
+ _, err := m.Schema.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Example != nil {
+ _, err := m.Example.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Examples != nil {
+ _, err := m.Examples.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Encoding != nil {
+ _, err := m.Encoding.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside MediaTypes objects.
+func (m *MediaTypes) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedAny objects.
+func (m *NamedAny) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedCallbackOrReference objects.
+func (m *NamedCallbackOrReference) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedEncoding objects.
+func (m *NamedEncoding) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedExampleOrReference objects.
+func (m *NamedExampleOrReference) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedHeaderOrReference objects.
+func (m *NamedHeaderOrReference) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedLinkOrReference objects.
+func (m *NamedLinkOrReference) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedMediaType objects.
+func (m *NamedMediaType) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedParameterOrReference objects.
+func (m *NamedParameterOrReference) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedPathItem objects.
+func (m *NamedPathItem) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedRequestBodyOrReference objects.
+func (m *NamedRequestBodyOrReference) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedResponseOrReference objects.
+func (m *NamedResponseOrReference) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedSchemaOrReference objects.
+func (m *NamedSchemaOrReference) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedSecuritySchemeOrReference objects.
+func (m *NamedSecuritySchemeOrReference) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedServerVariable objects.
+func (m *NamedServerVariable) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedString objects.
+func (m *NamedString) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedStringArray objects.
+func (m *NamedStringArray) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside OauthFlow objects.
+func (m *OauthFlow) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Scopes != nil {
+ _, err := m.Scopes.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside OauthFlows objects.
+func (m *OauthFlows) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Implicit != nil {
+ _, err := m.Implicit.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Password != nil {
+ _, err := m.Password.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.ClientCredentials != nil {
+ _, err := m.ClientCredentials.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.AuthorizationCode != nil {
+ _, err := m.AuthorizationCode.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Object objects.
+func (m *Object) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Operation objects.
+func (m *Operation) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.ExternalDocs != nil {
+ _, err := m.ExternalDocs.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Parameters {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ if m.RequestBody != nil {
+ _, err := m.RequestBody.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Responses != nil {
+ _, err := m.Responses.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Callbacks != nil {
+ _, err := m.Callbacks.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Security {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.Servers {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Parameter objects.
+func (m *Parameter) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Schema != nil {
+ _, err := m.Schema.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Example != nil {
+ _, err := m.Example.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Examples != nil {
+ _, err := m.Examples.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Content != nil {
+ _, err := m.Content.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside ParameterOrReference objects.
+func (m *ParameterOrReference) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ {
+ p, ok := m.Oneof.(*ParameterOrReference_Parameter)
+ if ok {
+ _, err := p.Parameter.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*ParameterOrReference_Reference)
+ if ok {
+ _, err := p.Reference.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside ParametersOrReferences objects.
+func (m *ParametersOrReferences) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside PathItem objects.
+func (m *PathItem) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.XRef != "" {
+ info, err := compiler.ReadInfoForRef(root, m.XRef)
+ if err != nil {
+ return nil, err
+ }
+ if info != nil {
+ replacement, err := NewPathItem(info, nil)
+ if err == nil {
+ *m = *replacement
+ return m.ResolveReferences(root)
+ }
+ }
+ return info, nil
+ }
+ if m.Get != nil {
+ _, err := m.Get.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Put != nil {
+ _, err := m.Put.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Post != nil {
+ _, err := m.Post.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Delete != nil {
+ _, err := m.Delete.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Options != nil {
+ _, err := m.Options.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Head != nil {
+ _, err := m.Head.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Patch != nil {
+ _, err := m.Patch.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Trace != nil {
+ _, err := m.Trace.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Servers {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.Parameters {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Paths objects.
+func (m *Paths) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.Path {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Properties objects.
+func (m *Properties) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Reference objects.
+func (m *Reference) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.XRef != "" {
+ info, err := compiler.ReadInfoForRef(root, m.XRef)
+ if err != nil {
+ return nil, err
+ }
+ if info != nil {
+ replacement, err := NewReference(info, nil)
+ if err == nil {
+ *m = *replacement
+ return m.ResolveReferences(root)
+ }
+ }
+ return info, nil
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside RequestBodiesOrReferences objects.
+func (m *RequestBodiesOrReferences) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside RequestBody objects.
+func (m *RequestBody) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Content != nil {
+ _, err := m.Content.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside RequestBodyOrReference objects.
+func (m *RequestBodyOrReference) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ {
+ p, ok := m.Oneof.(*RequestBodyOrReference_RequestBody)
+ if ok {
+ _, err := p.RequestBody.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*RequestBodyOrReference_Reference)
+ if ok {
+ _, err := p.Reference.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Response objects.
+func (m *Response) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Headers != nil {
+ _, err := m.Headers.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Content != nil {
+ _, err := m.Content.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Links != nil {
+ _, err := m.Links.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside ResponseOrReference objects.
+func (m *ResponseOrReference) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ {
+ p, ok := m.Oneof.(*ResponseOrReference_Response)
+ if ok {
+ _, err := p.Response.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*ResponseOrReference_Reference)
+ if ok {
+ _, err := p.Reference.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Responses objects.
+func (m *Responses) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Default != nil {
+ _, err := m.Default.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.ResponseOrReference {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside ResponsesOrReferences objects.
+func (m *ResponsesOrReferences) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Schema objects.
+func (m *Schema) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Discriminator != nil {
+ _, err := m.Discriminator.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Xml != nil {
+ _, err := m.Xml.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.ExternalDocs != nil {
+ _, err := m.ExternalDocs.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Example != nil {
+ _, err := m.Example.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Enum {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.AllOf {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.OneOf {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.AnyOf {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ if m.Not != nil {
+ _, err := m.Not.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Items != nil {
+ _, err := m.Items.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Properties != nil {
+ _, err := m.Properties.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.AdditionalProperties != nil {
+ _, err := m.AdditionalProperties.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Default != nil {
+ _, err := m.Default.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside SchemaOrReference objects.
+func (m *SchemaOrReference) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ {
+ p, ok := m.Oneof.(*SchemaOrReference_Schema)
+ if ok {
+ _, err := p.Schema.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*SchemaOrReference_Reference)
+ if ok {
+ _, err := p.Reference.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside SchemasOrReferences objects.
+func (m *SchemasOrReferences) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside SecurityRequirement objects.
+func (m *SecurityRequirement) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside SecurityScheme objects.
+func (m *SecurityScheme) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Flows != nil {
+ _, err := m.Flows.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside SecuritySchemeOrReference objects.
+func (m *SecuritySchemeOrReference) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ {
+ p, ok := m.Oneof.(*SecuritySchemeOrReference_SecurityScheme)
+ if ok {
+ _, err := p.SecurityScheme.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*SecuritySchemeOrReference_Reference)
+ if ok {
+ _, err := p.Reference.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside SecuritySchemesOrReferences objects.
+func (m *SecuritySchemesOrReferences) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Server objects.
+func (m *Server) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Variables != nil {
+ _, err := m.Variables.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside ServerVariable objects.
+func (m *ServerVariable) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside ServerVariables objects.
+func (m *ServerVariables) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside SpecificationExtension objects.
+func (m *SpecificationExtension) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside StringArray objects.
+func (m *StringArray) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Strings objects.
+func (m *Strings) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Tag objects.
+func (m *Tag) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.ExternalDocs != nil {
+ _, err := m.ExternalDocs.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Xml objects.
+func (m *Xml) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.SpecificationExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ToRawInfo returns a description of AdditionalPropertiesItem suitable for JSON or YAML export.
+func (m *AdditionalPropertiesItem) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // AdditionalPropertiesItem
+ // {Name:schemaOrReference Type:SchemaOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v0 := m.GetSchemaOrReference()
+ if v0 != nil {
+ return v0.ToRawInfo()
+ }
+ // {Name:boolean Type:bool StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ if v1, ok := m.GetOneof().(*AdditionalPropertiesItem_Boolean); ok {
+ return compiler.NewScalarNodeForBool(v1.Boolean)
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of Any suitable for JSON or YAML export.
+func (m *Any) ToRawInfo() *yaml.Node {
+ var err error
+ var node yaml.Node
+ err = yaml.Unmarshal([]byte(m.Yaml), &node)
+ if err == nil {
+ if node.Kind == yaml.DocumentNode {
+ return node.Content[0]
+ }
+ return &node
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of AnyOrExpression suitable for JSON or YAML export.
+func (m *AnyOrExpression) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // AnyOrExpression
+ // {Name:any Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v0 := m.GetAny()
+ if v0 != nil {
+ return v0.ToRawInfo()
+ }
+ // {Name:expression Type:Expression StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v1 := m.GetExpression()
+ if v1 != nil {
+ return v1.ToRawInfo()
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of Callback suitable for JSON or YAML export.
+func (m *Callback) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Path != nil {
+ for _, item := range m.Path {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of CallbackOrReference suitable for JSON or YAML export.
+func (m *CallbackOrReference) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // CallbackOrReference
+ // {Name:callback Type:Callback StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v0 := m.GetCallback()
+ if v0 != nil {
+ return v0.ToRawInfo()
+ }
+ // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v1 := m.GetReference()
+ if v1 != nil {
+ return v1.ToRawInfo()
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of CallbacksOrReferences suitable for JSON or YAML export.
+func (m *CallbacksOrReferences) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Components suitable for JSON or YAML export.
+func (m *Components) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Schemas != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("schemas"))
+ info.Content = append(info.Content, m.Schemas.ToRawInfo())
+ }
+ if m.Responses != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("responses"))
+ info.Content = append(info.Content, m.Responses.ToRawInfo())
+ }
+ if m.Parameters != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters"))
+ info.Content = append(info.Content, m.Parameters.ToRawInfo())
+ }
+ if m.Examples != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("examples"))
+ info.Content = append(info.Content, m.Examples.ToRawInfo())
+ }
+ if m.RequestBodies != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("requestBodies"))
+ info.Content = append(info.Content, m.RequestBodies.ToRawInfo())
+ }
+ if m.Headers != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("headers"))
+ info.Content = append(info.Content, m.Headers.ToRawInfo())
+ }
+ if m.SecuritySchemes != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("securitySchemes"))
+ info.Content = append(info.Content, m.SecuritySchemes.ToRawInfo())
+ }
+ if m.Links != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("links"))
+ info.Content = append(info.Content, m.Links.ToRawInfo())
+ }
+ if m.Callbacks != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("callbacks"))
+ info.Content = append(info.Content, m.Callbacks.ToRawInfo())
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Contact suitable for JSON or YAML export.
+func (m *Contact) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ if m.Url != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("url"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url))
+ }
+ if m.Email != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("email"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Email))
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of DefaultType suitable for JSON or YAML export.
+func (m *DefaultType) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // DefaultType
+ // {Name:number Type:float StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ if v0, ok := m.GetOneof().(*DefaultType_Number); ok {
+ return compiler.NewScalarNodeForFloat(v0.Number)
+ }
+ // {Name:boolean Type:bool StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ if v1, ok := m.GetOneof().(*DefaultType_Boolean); ok {
+ return compiler.NewScalarNodeForBool(v1.Boolean)
+ }
+ // {Name:string Type:string StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ if v2, ok := m.GetOneof().(*DefaultType_String_); ok {
+ return compiler.NewScalarNodeForString(v2.String_)
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of Discriminator suitable for JSON or YAML export.
+func (m *Discriminator) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("propertyName"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.PropertyName))
+ if m.Mapping != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("mapping"))
+ info.Content = append(info.Content, m.Mapping.ToRawInfo())
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Document suitable for JSON or YAML export.
+func (m *Document) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("openapi"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Openapi))
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("info"))
+ info.Content = append(info.Content, m.Info.ToRawInfo())
+ if len(m.Servers) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Servers {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("servers"))
+ info.Content = append(info.Content, items)
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("paths"))
+ info.Content = append(info.Content, m.Paths.ToRawInfo())
+ if m.Components != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("components"))
+ info.Content = append(info.Content, m.Components.ToRawInfo())
+ }
+ if len(m.Security) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Security {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("security"))
+ info.Content = append(info.Content, items)
+ }
+ if len(m.Tags) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Tags {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("tags"))
+ info.Content = append(info.Content, items)
+ }
+ if m.ExternalDocs != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs"))
+ info.Content = append(info.Content, m.ExternalDocs.ToRawInfo())
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Encoding suitable for JSON or YAML export.
+func (m *Encoding) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.ContentType != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("contentType"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.ContentType))
+ }
+ if m.Headers != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("headers"))
+ info.Content = append(info.Content, m.Headers.ToRawInfo())
+ }
+ if m.Style != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("style"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Style))
+ }
+ if m.Explode != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("explode"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Explode))
+ }
+ if m.AllowReserved != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("allowReserved"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.AllowReserved))
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Encodings suitable for JSON or YAML export.
+func (m *Encodings) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Example suitable for JSON or YAML export.
+func (m *Example) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Summary != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("summary"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Summary))
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.Value != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("value"))
+ info.Content = append(info.Content, m.Value.ToRawInfo())
+ }
+ if m.ExternalValue != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("externalValue"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.ExternalValue))
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of ExampleOrReference suitable for JSON or YAML export.
+func (m *ExampleOrReference) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // ExampleOrReference
+ // {Name:example Type:Example StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v0 := m.GetExample()
+ if v0 != nil {
+ return v0.ToRawInfo()
+ }
+ // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v1 := m.GetReference()
+ if v1 != nil {
+ return v1.ToRawInfo()
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of ExamplesOrReferences suitable for JSON or YAML export.
+func (m *ExamplesOrReferences) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Expression suitable for JSON or YAML export.
+func (m *Expression) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of ExternalDocs suitable for JSON or YAML export.
+func (m *ExternalDocs) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("url"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url))
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Header suitable for JSON or YAML export.
+func (m *Header) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.Required != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("required"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required))
+ }
+ if m.Deprecated != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("deprecated"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Deprecated))
+ }
+ if m.AllowEmptyValue != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("allowEmptyValue"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.AllowEmptyValue))
+ }
+ if m.Style != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("style"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Style))
+ }
+ if m.Explode != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("explode"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Explode))
+ }
+ if m.AllowReserved != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("allowReserved"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.AllowReserved))
+ }
+ if m.Schema != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("schema"))
+ info.Content = append(info.Content, m.Schema.ToRawInfo())
+ }
+ if m.Example != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("example"))
+ info.Content = append(info.Content, m.Example.ToRawInfo())
+ }
+ if m.Examples != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("examples"))
+ info.Content = append(info.Content, m.Examples.ToRawInfo())
+ }
+ if m.Content != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("content"))
+ info.Content = append(info.Content, m.Content.ToRawInfo())
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of HeaderOrReference suitable for JSON or YAML export.
+func (m *HeaderOrReference) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // HeaderOrReference
+ // {Name:header Type:Header StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v0 := m.GetHeader()
+ if v0 != nil {
+ return v0.ToRawInfo()
+ }
+ // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v1 := m.GetReference()
+ if v1 != nil {
+ return v1.ToRawInfo()
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of HeadersOrReferences suitable for JSON or YAML export.
+func (m *HeadersOrReferences) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Info suitable for JSON or YAML export.
+func (m *Info) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("title"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Title))
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.TermsOfService != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("termsOfService"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TermsOfService))
+ }
+ if m.Contact != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("contact"))
+ info.Content = append(info.Content, m.Contact.ToRawInfo())
+ }
+ if m.License != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("license"))
+ info.Content = append(info.Content, m.License.ToRawInfo())
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("version"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Version))
+ if m.Summary != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("summary"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Summary))
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of ItemsItem suitable for JSON or YAML export.
+func (m *ItemsItem) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if len(m.SchemaOrReference) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.SchemaOrReference {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("schemaOrReference"))
+ info.Content = append(info.Content, items)
+ }
+ return info
+}
+
+// ToRawInfo returns a description of License suitable for JSON or YAML export.
+func (m *License) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ if m.Url != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("url"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url))
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Link suitable for JSON or YAML export.
+func (m *Link) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.OperationRef != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("operationRef"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.OperationRef))
+ }
+ if m.OperationId != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("operationId"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.OperationId))
+ }
+ if m.Parameters != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters"))
+ info.Content = append(info.Content, m.Parameters.ToRawInfo())
+ }
+ if m.RequestBody != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("requestBody"))
+ info.Content = append(info.Content, m.RequestBody.ToRawInfo())
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.Server != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("server"))
+ info.Content = append(info.Content, m.Server.ToRawInfo())
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of LinkOrReference suitable for JSON or YAML export.
+func (m *LinkOrReference) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // LinkOrReference
+ // {Name:link Type:Link StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v0 := m.GetLink()
+ if v0 != nil {
+ return v0.ToRawInfo()
+ }
+ // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v1 := m.GetReference()
+ if v1 != nil {
+ return v1.ToRawInfo()
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of LinksOrReferences suitable for JSON or YAML export.
+func (m *LinksOrReferences) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of MediaType suitable for JSON or YAML export.
+func (m *MediaType) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Schema != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("schema"))
+ info.Content = append(info.Content, m.Schema.ToRawInfo())
+ }
+ if m.Example != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("example"))
+ info.Content = append(info.Content, m.Example.ToRawInfo())
+ }
+ if m.Examples != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("examples"))
+ info.Content = append(info.Content, m.Examples.ToRawInfo())
+ }
+ if m.Encoding != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("encoding"))
+ info.Content = append(info.Content, m.Encoding.ToRawInfo())
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of MediaTypes suitable for JSON or YAML export.
+func (m *MediaTypes) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of NamedAny suitable for JSON or YAML export.
+func (m *NamedAny) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ if m.Value != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("value"))
+ info.Content = append(info.Content, m.Value.ToRawInfo())
+ }
+ return info
+}
+
+// ToRawInfo returns a description of NamedCallbackOrReference suitable for JSON or YAML export.
+func (m *NamedCallbackOrReference) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:CallbackOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedEncoding suitable for JSON or YAML export.
+func (m *NamedEncoding) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:Encoding StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedExampleOrReference suitable for JSON or YAML export.
+func (m *NamedExampleOrReference) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:ExampleOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedHeaderOrReference suitable for JSON or YAML export.
+func (m *NamedHeaderOrReference) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:HeaderOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedLinkOrReference suitable for JSON or YAML export.
+func (m *NamedLinkOrReference) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:LinkOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedMediaType suitable for JSON or YAML export.
+func (m *NamedMediaType) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:MediaType StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedParameterOrReference suitable for JSON or YAML export.
+func (m *NamedParameterOrReference) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:ParameterOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedPathItem suitable for JSON or YAML export.
+func (m *NamedPathItem) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:PathItem StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedRequestBodyOrReference suitable for JSON or YAML export.
+func (m *NamedRequestBodyOrReference) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:RequestBodyOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedResponseOrReference suitable for JSON or YAML export.
+func (m *NamedResponseOrReference) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:ResponseOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedSchemaOrReference suitable for JSON or YAML export.
+func (m *NamedSchemaOrReference) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:SchemaOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedSecuritySchemeOrReference suitable for JSON or YAML export.
+func (m *NamedSecuritySchemeOrReference) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:SecuritySchemeOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedServerVariable suitable for JSON or YAML export.
+func (m *NamedServerVariable) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:ServerVariable StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedString suitable for JSON or YAML export.
+func (m *NamedString) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ if m.Value != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("value"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Value))
+ }
+ return info
+}
+
+// ToRawInfo returns a description of NamedStringArray suitable for JSON or YAML export.
+func (m *NamedStringArray) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:StringArray StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of OauthFlow suitable for JSON or YAML export.
+func (m *OauthFlow) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AuthorizationUrl != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("authorizationUrl"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.AuthorizationUrl))
+ }
+ if m.TokenUrl != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("tokenUrl"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TokenUrl))
+ }
+ if m.RefreshUrl != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("refreshUrl"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.RefreshUrl))
+ }
+ if m.Scopes != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("scopes"))
+ info.Content = append(info.Content, m.Scopes.ToRawInfo())
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of OauthFlows suitable for JSON or YAML export.
+func (m *OauthFlows) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Implicit != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("implicit"))
+ info.Content = append(info.Content, m.Implicit.ToRawInfo())
+ }
+ if m.Password != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("password"))
+ info.Content = append(info.Content, m.Password.ToRawInfo())
+ }
+ if m.ClientCredentials != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("clientCredentials"))
+ info.Content = append(info.Content, m.ClientCredentials.ToRawInfo())
+ }
+ if m.AuthorizationCode != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("authorizationCode"))
+ info.Content = append(info.Content, m.AuthorizationCode.ToRawInfo())
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Object suitable for JSON or YAML export.
+func (m *Object) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Operation suitable for JSON or YAML export.
+func (m *Operation) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if len(m.Tags) != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("tags"))
+ info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Tags))
+ }
+ if m.Summary != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("summary"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Summary))
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.ExternalDocs != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs"))
+ info.Content = append(info.Content, m.ExternalDocs.ToRawInfo())
+ }
+ if m.OperationId != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("operationId"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.OperationId))
+ }
+ if len(m.Parameters) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Parameters {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters"))
+ info.Content = append(info.Content, items)
+ }
+ if m.RequestBody != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("requestBody"))
+ info.Content = append(info.Content, m.RequestBody.ToRawInfo())
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("responses"))
+ info.Content = append(info.Content, m.Responses.ToRawInfo())
+ if m.Callbacks != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("callbacks"))
+ info.Content = append(info.Content, m.Callbacks.ToRawInfo())
+ }
+ if m.Deprecated != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("deprecated"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Deprecated))
+ }
+ if len(m.Security) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Security {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("security"))
+ info.Content = append(info.Content, items)
+ }
+ if len(m.Servers) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Servers {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("servers"))
+ info.Content = append(info.Content, items)
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Parameter suitable for JSON or YAML export.
+func (m *Parameter) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("in"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In))
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.Required != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("required"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required))
+ }
+ if m.Deprecated != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("deprecated"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Deprecated))
+ }
+ if m.AllowEmptyValue != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("allowEmptyValue"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.AllowEmptyValue))
+ }
+ if m.Style != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("style"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Style))
+ }
+ if m.Explode != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("explode"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Explode))
+ }
+ if m.AllowReserved != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("allowReserved"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.AllowReserved))
+ }
+ if m.Schema != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("schema"))
+ info.Content = append(info.Content, m.Schema.ToRawInfo())
+ }
+ if m.Example != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("example"))
+ info.Content = append(info.Content, m.Example.ToRawInfo())
+ }
+ if m.Examples != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("examples"))
+ info.Content = append(info.Content, m.Examples.ToRawInfo())
+ }
+ if m.Content != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("content"))
+ info.Content = append(info.Content, m.Content.ToRawInfo())
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of ParameterOrReference suitable for JSON or YAML export.
+func (m *ParameterOrReference) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // ParameterOrReference
+ // {Name:parameter Type:Parameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v0 := m.GetParameter()
+ if v0 != nil {
+ return v0.ToRawInfo()
+ }
+ // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v1 := m.GetReference()
+ if v1 != nil {
+ return v1.ToRawInfo()
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of ParametersOrReferences suitable for JSON or YAML export.
+func (m *ParametersOrReferences) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of PathItem suitable for JSON or YAML export.
+func (m *PathItem) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.XRef != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("$ref"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.XRef))
+ }
+ if m.Summary != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("summary"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Summary))
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.Get != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("get"))
+ info.Content = append(info.Content, m.Get.ToRawInfo())
+ }
+ if m.Put != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("put"))
+ info.Content = append(info.Content, m.Put.ToRawInfo())
+ }
+ if m.Post != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("post"))
+ info.Content = append(info.Content, m.Post.ToRawInfo())
+ }
+ if m.Delete != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("delete"))
+ info.Content = append(info.Content, m.Delete.ToRawInfo())
+ }
+ if m.Options != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("options"))
+ info.Content = append(info.Content, m.Options.ToRawInfo())
+ }
+ if m.Head != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("head"))
+ info.Content = append(info.Content, m.Head.ToRawInfo())
+ }
+ if m.Patch != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("patch"))
+ info.Content = append(info.Content, m.Patch.ToRawInfo())
+ }
+ if m.Trace != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("trace"))
+ info.Content = append(info.Content, m.Trace.ToRawInfo())
+ }
+ if len(m.Servers) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Servers {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("servers"))
+ info.Content = append(info.Content, items)
+ }
+ if len(m.Parameters) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Parameters {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters"))
+ info.Content = append(info.Content, items)
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Paths suitable for JSON or YAML export.
+func (m *Paths) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Path != nil {
+ for _, item := range m.Path {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Properties suitable for JSON or YAML export.
+func (m *Properties) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Reference suitable for JSON or YAML export.
+func (m *Reference) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("$ref"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.XRef))
+ if m.Summary != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("summary"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Summary))
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ return info
+}
+
+// ToRawInfo returns a description of RequestBodiesOrReferences suitable for JSON or YAML export.
+func (m *RequestBodiesOrReferences) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of RequestBody suitable for JSON or YAML export.
+func (m *RequestBody) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("content"))
+ info.Content = append(info.Content, m.Content.ToRawInfo())
+ if m.Required != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("required"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required))
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of RequestBodyOrReference suitable for JSON or YAML export.
+func (m *RequestBodyOrReference) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // RequestBodyOrReference
+ // {Name:requestBody Type:RequestBody StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v0 := m.GetRequestBody()
+ if v0 != nil {
+ return v0.ToRawInfo()
+ }
+ // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v1 := m.GetReference()
+ if v1 != nil {
+ return v1.ToRawInfo()
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of Response suitable for JSON or YAML export.
+func (m *Response) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ if m.Headers != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("headers"))
+ info.Content = append(info.Content, m.Headers.ToRawInfo())
+ }
+ if m.Content != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("content"))
+ info.Content = append(info.Content, m.Content.ToRawInfo())
+ }
+ if m.Links != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("links"))
+ info.Content = append(info.Content, m.Links.ToRawInfo())
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of ResponseOrReference suitable for JSON or YAML export.
+func (m *ResponseOrReference) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // ResponseOrReference
+ // {Name:response Type:Response StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v0 := m.GetResponse()
+ if v0 != nil {
+ return v0.ToRawInfo()
+ }
+ // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v1 := m.GetReference()
+ if v1 != nil {
+ return v1.ToRawInfo()
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of Responses suitable for JSON or YAML export.
+func (m *Responses) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Default != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("default"))
+ info.Content = append(info.Content, m.Default.ToRawInfo())
+ }
+ if m.ResponseOrReference != nil {
+ for _, item := range m.ResponseOrReference {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of ResponsesOrReferences suitable for JSON or YAML export.
+func (m *ResponsesOrReferences) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Schema suitable for JSON or YAML export.
+func (m *Schema) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Nullable != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("nullable"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Nullable))
+ }
+ if m.Discriminator != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("discriminator"))
+ info.Content = append(info.Content, m.Discriminator.ToRawInfo())
+ }
+ if m.ReadOnly != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("readOnly"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ReadOnly))
+ }
+ if m.WriteOnly != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("writeOnly"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.WriteOnly))
+ }
+ if m.Xml != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("xml"))
+ info.Content = append(info.Content, m.Xml.ToRawInfo())
+ }
+ if m.ExternalDocs != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs"))
+ info.Content = append(info.Content, m.ExternalDocs.ToRawInfo())
+ }
+ if m.Example != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("example"))
+ info.Content = append(info.Content, m.Example.ToRawInfo())
+ }
+ if m.Deprecated != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("deprecated"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Deprecated))
+ }
+ if m.Title != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("title"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Title))
+ }
+ if m.MultipleOf != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf))
+ }
+ if m.Maximum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum))
+ }
+ if m.ExclusiveMaximum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum))
+ }
+ if m.Minimum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum))
+ }
+ if m.ExclusiveMinimum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum))
+ }
+ if m.MaxLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength))
+ }
+ if m.MinLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength))
+ }
+ if m.Pattern != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern))
+ }
+ if m.MaxItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems))
+ }
+ if m.MinItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems))
+ }
+ if m.UniqueItems != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems))
+ }
+ if m.MaxProperties != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxProperties"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxProperties))
+ }
+ if m.MinProperties != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minProperties"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinProperties))
+ }
+ if len(m.Required) != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("required"))
+ info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Required))
+ }
+ if len(m.Enum) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Enum {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("enum"))
+ info.Content = append(info.Content, items)
+ }
+ if m.Type != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ }
+ if len(m.AllOf) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.AllOf {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("allOf"))
+ info.Content = append(info.Content, items)
+ }
+ if len(m.OneOf) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.OneOf {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("oneOf"))
+ info.Content = append(info.Content, items)
+ }
+ if len(m.AnyOf) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.AnyOf {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("anyOf"))
+ info.Content = append(info.Content, items)
+ }
+ if m.Not != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("not"))
+ info.Content = append(info.Content, m.Not.ToRawInfo())
+ }
+ if m.Items != nil {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Items.SchemaOrReference {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ if len(items.Content) == 1 {
+ items = items.Content[0]
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("items"))
+ info.Content = append(info.Content, items)
+ }
+ if m.Properties != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("properties"))
+ info.Content = append(info.Content, m.Properties.ToRawInfo())
+ }
+ if m.AdditionalProperties != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("additionalProperties"))
+ info.Content = append(info.Content, m.AdditionalProperties.ToRawInfo())
+ }
+ if m.Default != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("default"))
+ info.Content = append(info.Content, m.Default.ToRawInfo())
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.Format != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("format"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format))
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of SchemaOrReference suitable for JSON or YAML export.
+func (m *SchemaOrReference) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // SchemaOrReference
+ // {Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v0 := m.GetSchema()
+ if v0 != nil {
+ return v0.ToRawInfo()
+ }
+ // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v1 := m.GetReference()
+ if v1 != nil {
+ return v1.ToRawInfo()
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of SchemasOrReferences suitable for JSON or YAML export.
+func (m *SchemasOrReferences) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of SecurityRequirement suitable for JSON or YAML export.
+func (m *SecurityRequirement) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of SecurityScheme suitable for JSON or YAML export.
+func (m *SecurityScheme) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ if m.In != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("in"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In))
+ }
+ if m.Scheme != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("scheme"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Scheme))
+ }
+ if m.BearerFormat != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("bearerFormat"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.BearerFormat))
+ }
+ if m.Flows != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("flows"))
+ info.Content = append(info.Content, m.Flows.ToRawInfo())
+ }
+ if m.OpenIdConnectUrl != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("openIdConnectUrl"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.OpenIdConnectUrl))
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of SecuritySchemeOrReference suitable for JSON or YAML export.
+func (m *SecuritySchemeOrReference) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // SecuritySchemeOrReference
+ // {Name:securityScheme Type:SecurityScheme StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v0 := m.GetSecurityScheme()
+ if v0 != nil {
+ return v0.ToRawInfo()
+ }
+ // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v1 := m.GetReference()
+ if v1 != nil {
+ return v1.ToRawInfo()
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of SecuritySchemesOrReferences suitable for JSON or YAML export.
+func (m *SecuritySchemesOrReferences) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Server suitable for JSON or YAML export.
+func (m *Server) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("url"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url))
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.Variables != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("variables"))
+ info.Content = append(info.Content, m.Variables.ToRawInfo())
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of ServerVariable suitable for JSON or YAML export.
+func (m *ServerVariable) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if len(m.Enum) != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("enum"))
+ info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Enum))
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("default"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Default))
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of ServerVariables suitable for JSON or YAML export.
+func (m *ServerVariables) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of SpecificationExtension suitable for JSON or YAML export.
+func (m *SpecificationExtension) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // SpecificationExtension
+ // {Name:number Type:float StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ if v0, ok := m.GetOneof().(*SpecificationExtension_Number); ok {
+ return compiler.NewScalarNodeForFloat(v0.Number)
+ }
+ // {Name:boolean Type:bool StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ if v1, ok := m.GetOneof().(*SpecificationExtension_Boolean); ok {
+ return compiler.NewScalarNodeForBool(v1.Boolean)
+ }
+ // {Name:string Type:string StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ if v2, ok := m.GetOneof().(*SpecificationExtension_String_); ok {
+ return compiler.NewScalarNodeForString(v2.String_)
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of StringArray suitable for JSON or YAML export.
+func (m *StringArray) ToRawInfo() *yaml.Node {
+ return compiler.NewSequenceNodeForStringArray(m.Value)
+}
+
+// ToRawInfo returns a description of Strings suitable for JSON or YAML export.
+func (m *Strings) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // &{Name:additionalProperties Type:NamedString StringEnumValues:[] MapType:string Repeated:true Pattern: Implicit:true Description:}
+ return info
+}
+
+// ToRawInfo returns a description of Tag suitable for JSON or YAML export.
+func (m *Tag) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.ExternalDocs != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs"))
+ info.Content = append(info.Content, m.ExternalDocs.ToRawInfo())
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Xml suitable for JSON or YAML export.
+func (m *Xml) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ if m.Namespace != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("namespace"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Namespace))
+ }
+ if m.Prefix != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("prefix"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Prefix))
+ }
+ if m.Attribute != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("attribute"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Attribute))
+ }
+ if m.Wrapped != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("wrapped"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Wrapped))
+ }
+ if m.SpecificationExtension != nil {
+ for _, item := range m.SpecificationExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+var (
+ pattern0 = regexp.MustCompile("^")
+ pattern1 = regexp.MustCompile("^x-")
+ pattern2 = regexp.MustCompile("^/")
+ pattern3 = regexp.MustCompile("^([0-9X]{3})$")
+)
diff --git a/vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.pb.go b/vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.pb.go
new file mode 100644
index 000000000..945b8d11f
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.pb.go
@@ -0,0 +1,8053 @@
+// Copyright 2020 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// THIS FILE IS AUTOMATICALLY GENERATED.
+
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.27.1
+// protoc v3.19.3
+// source: openapiv3/OpenAPIv3.proto
+
+package openapi_v3
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ anypb "google.golang.org/protobuf/types/known/anypb"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type AdditionalPropertiesItem struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *AdditionalPropertiesItem_SchemaOrReference
+ // *AdditionalPropertiesItem_Boolean
+ Oneof isAdditionalPropertiesItem_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *AdditionalPropertiesItem) Reset() {
+ *x = AdditionalPropertiesItem{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *AdditionalPropertiesItem) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*AdditionalPropertiesItem) ProtoMessage() {}
+
+func (x *AdditionalPropertiesItem) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use AdditionalPropertiesItem.ProtoReflect.Descriptor instead.
+func (*AdditionalPropertiesItem) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{0}
+}
+
+func (m *AdditionalPropertiesItem) GetOneof() isAdditionalPropertiesItem_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *AdditionalPropertiesItem) GetSchemaOrReference() *SchemaOrReference {
+ if x, ok := x.GetOneof().(*AdditionalPropertiesItem_SchemaOrReference); ok {
+ return x.SchemaOrReference
+ }
+ return nil
+}
+
+func (x *AdditionalPropertiesItem) GetBoolean() bool {
+ if x, ok := x.GetOneof().(*AdditionalPropertiesItem_Boolean); ok {
+ return x.Boolean
+ }
+ return false
+}
+
+type isAdditionalPropertiesItem_Oneof interface {
+ isAdditionalPropertiesItem_Oneof()
+}
+
+type AdditionalPropertiesItem_SchemaOrReference struct {
+ SchemaOrReference *SchemaOrReference `protobuf:"bytes,1,opt,name=schema_or_reference,json=schemaOrReference,proto3,oneof"`
+}
+
+type AdditionalPropertiesItem_Boolean struct {
+ Boolean bool `protobuf:"varint,2,opt,name=boolean,proto3,oneof"`
+}
+
+func (*AdditionalPropertiesItem_SchemaOrReference) isAdditionalPropertiesItem_Oneof() {}
+
+func (*AdditionalPropertiesItem_Boolean) isAdditionalPropertiesItem_Oneof() {}
+
+type Any struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Value *anypb.Any `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
+ Yaml string `protobuf:"bytes,2,opt,name=yaml,proto3" json:"yaml,omitempty"`
+}
+
+func (x *Any) Reset() {
+ *x = Any{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Any) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Any) ProtoMessage() {}
+
+func (x *Any) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Any.ProtoReflect.Descriptor instead.
+func (*Any) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *Any) GetValue() *anypb.Any {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+func (x *Any) GetYaml() string {
+ if x != nil {
+ return x.Yaml
+ }
+ return ""
+}
+
+type AnyOrExpression struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *AnyOrExpression_Any
+ // *AnyOrExpression_Expression
+ Oneof isAnyOrExpression_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *AnyOrExpression) Reset() {
+ *x = AnyOrExpression{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *AnyOrExpression) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*AnyOrExpression) ProtoMessage() {}
+
+func (x *AnyOrExpression) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use AnyOrExpression.ProtoReflect.Descriptor instead.
+func (*AnyOrExpression) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{2}
+}
+
+func (m *AnyOrExpression) GetOneof() isAnyOrExpression_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *AnyOrExpression) GetAny() *Any {
+ if x, ok := x.GetOneof().(*AnyOrExpression_Any); ok {
+ return x.Any
+ }
+ return nil
+}
+
+func (x *AnyOrExpression) GetExpression() *Expression {
+ if x, ok := x.GetOneof().(*AnyOrExpression_Expression); ok {
+ return x.Expression
+ }
+ return nil
+}
+
+type isAnyOrExpression_Oneof interface {
+ isAnyOrExpression_Oneof()
+}
+
+type AnyOrExpression_Any struct {
+ Any *Any `protobuf:"bytes,1,opt,name=any,proto3,oneof"`
+}
+
+type AnyOrExpression_Expression struct {
+ Expression *Expression `protobuf:"bytes,2,opt,name=expression,proto3,oneof"`
+}
+
+func (*AnyOrExpression_Any) isAnyOrExpression_Oneof() {}
+
+func (*AnyOrExpression_Expression) isAnyOrExpression_Oneof() {}
+
+// A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.
+type Callback struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Path []*NamedPathItem `protobuf:"bytes,1,rep,name=path,proto3" json:"path,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,2,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *Callback) Reset() {
+ *x = Callback{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Callback) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Callback) ProtoMessage() {}
+
+func (x *Callback) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Callback.ProtoReflect.Descriptor instead.
+func (*Callback) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *Callback) GetPath() []*NamedPathItem {
+ if x != nil {
+ return x.Path
+ }
+ return nil
+}
+
+func (x *Callback) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+type CallbackOrReference struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *CallbackOrReference_Callback
+ // *CallbackOrReference_Reference
+ Oneof isCallbackOrReference_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *CallbackOrReference) Reset() {
+ *x = CallbackOrReference{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CallbackOrReference) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CallbackOrReference) ProtoMessage() {}
+
+func (x *CallbackOrReference) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[4]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CallbackOrReference.ProtoReflect.Descriptor instead.
+func (*CallbackOrReference) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{4}
+}
+
+func (m *CallbackOrReference) GetOneof() isCallbackOrReference_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *CallbackOrReference) GetCallback() *Callback {
+ if x, ok := x.GetOneof().(*CallbackOrReference_Callback); ok {
+ return x.Callback
+ }
+ return nil
+}
+
+func (x *CallbackOrReference) GetReference() *Reference {
+ if x, ok := x.GetOneof().(*CallbackOrReference_Reference); ok {
+ return x.Reference
+ }
+ return nil
+}
+
+type isCallbackOrReference_Oneof interface {
+ isCallbackOrReference_Oneof()
+}
+
+type CallbackOrReference_Callback struct {
+ Callback *Callback `protobuf:"bytes,1,opt,name=callback,proto3,oneof"`
+}
+
+type CallbackOrReference_Reference struct {
+ Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"`
+}
+
+func (*CallbackOrReference_Callback) isCallbackOrReference_Oneof() {}
+
+func (*CallbackOrReference_Reference) isCallbackOrReference_Oneof() {}
+
+type CallbacksOrReferences struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedCallbackOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *CallbacksOrReferences) Reset() {
+ *x = CallbacksOrReferences{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[5]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CallbacksOrReferences) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CallbacksOrReferences) ProtoMessage() {}
+
+func (x *CallbacksOrReferences) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[5]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CallbacksOrReferences.ProtoReflect.Descriptor instead.
+func (*CallbacksOrReferences) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{5}
+}
+
+func (x *CallbacksOrReferences) GetAdditionalProperties() []*NamedCallbackOrReference {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+// Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.
+type Components struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Schemas *SchemasOrReferences `protobuf:"bytes,1,opt,name=schemas,proto3" json:"schemas,omitempty"`
+ Responses *ResponsesOrReferences `protobuf:"bytes,2,opt,name=responses,proto3" json:"responses,omitempty"`
+ Parameters *ParametersOrReferences `protobuf:"bytes,3,opt,name=parameters,proto3" json:"parameters,omitempty"`
+ Examples *ExamplesOrReferences `protobuf:"bytes,4,opt,name=examples,proto3" json:"examples,omitempty"`
+ RequestBodies *RequestBodiesOrReferences `protobuf:"bytes,5,opt,name=request_bodies,json=requestBodies,proto3" json:"request_bodies,omitempty"`
+ Headers *HeadersOrReferences `protobuf:"bytes,6,opt,name=headers,proto3" json:"headers,omitempty"`
+ SecuritySchemes *SecuritySchemesOrReferences `protobuf:"bytes,7,opt,name=security_schemes,json=securitySchemes,proto3" json:"security_schemes,omitempty"`
+ Links *LinksOrReferences `protobuf:"bytes,8,opt,name=links,proto3" json:"links,omitempty"`
+ Callbacks *CallbacksOrReferences `protobuf:"bytes,9,opt,name=callbacks,proto3" json:"callbacks,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,10,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *Components) Reset() {
+ *x = Components{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[6]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Components) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Components) ProtoMessage() {}
+
+func (x *Components) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[6]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Components.ProtoReflect.Descriptor instead.
+func (*Components) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{6}
+}
+
+func (x *Components) GetSchemas() *SchemasOrReferences {
+ if x != nil {
+ return x.Schemas
+ }
+ return nil
+}
+
+func (x *Components) GetResponses() *ResponsesOrReferences {
+ if x != nil {
+ return x.Responses
+ }
+ return nil
+}
+
+func (x *Components) GetParameters() *ParametersOrReferences {
+ if x != nil {
+ return x.Parameters
+ }
+ return nil
+}
+
+func (x *Components) GetExamples() *ExamplesOrReferences {
+ if x != nil {
+ return x.Examples
+ }
+ return nil
+}
+
+func (x *Components) GetRequestBodies() *RequestBodiesOrReferences {
+ if x != nil {
+ return x.RequestBodies
+ }
+ return nil
+}
+
+func (x *Components) GetHeaders() *HeadersOrReferences {
+ if x != nil {
+ return x.Headers
+ }
+ return nil
+}
+
+func (x *Components) GetSecuritySchemes() *SecuritySchemesOrReferences {
+ if x != nil {
+ return x.SecuritySchemes
+ }
+ return nil
+}
+
+func (x *Components) GetLinks() *LinksOrReferences {
+ if x != nil {
+ return x.Links
+ }
+ return nil
+}
+
+func (x *Components) GetCallbacks() *CallbacksOrReferences {
+ if x != nil {
+ return x.Callbacks
+ }
+ return nil
+}
+
+func (x *Components) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+// Contact information for the exposed API.
+type Contact struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
+ Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,4,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *Contact) Reset() {
+ *x = Contact{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[7]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Contact) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Contact) ProtoMessage() {}
+
+func (x *Contact) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[7]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Contact.ProtoReflect.Descriptor instead.
+func (*Contact) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{7}
+}
+
+func (x *Contact) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *Contact) GetUrl() string {
+ if x != nil {
+ return x.Url
+ }
+ return ""
+}
+
+func (x *Contact) GetEmail() string {
+ if x != nil {
+ return x.Email
+ }
+ return ""
+}
+
+func (x *Contact) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+type DefaultType struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *DefaultType_Number
+ // *DefaultType_Boolean
+ // *DefaultType_String_
+ Oneof isDefaultType_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *DefaultType) Reset() {
+ *x = DefaultType{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[8]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *DefaultType) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DefaultType) ProtoMessage() {}
+
+func (x *DefaultType) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[8]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use DefaultType.ProtoReflect.Descriptor instead.
+func (*DefaultType) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{8}
+}
+
+func (m *DefaultType) GetOneof() isDefaultType_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *DefaultType) GetNumber() float64 {
+ if x, ok := x.GetOneof().(*DefaultType_Number); ok {
+ return x.Number
+ }
+ return 0
+}
+
+func (x *DefaultType) GetBoolean() bool {
+ if x, ok := x.GetOneof().(*DefaultType_Boolean); ok {
+ return x.Boolean
+ }
+ return false
+}
+
+func (x *DefaultType) GetString_() string {
+ if x, ok := x.GetOneof().(*DefaultType_String_); ok {
+ return x.String_
+ }
+ return ""
+}
+
+type isDefaultType_Oneof interface {
+ isDefaultType_Oneof()
+}
+
+type DefaultType_Number struct {
+ Number float64 `protobuf:"fixed64,1,opt,name=number,proto3,oneof"`
+}
+
+type DefaultType_Boolean struct {
+ Boolean bool `protobuf:"varint,2,opt,name=boolean,proto3,oneof"`
+}
+
+type DefaultType_String_ struct {
+ String_ string `protobuf:"bytes,3,opt,name=string,proto3,oneof"`
+}
+
+func (*DefaultType_Number) isDefaultType_Oneof() {}
+
+func (*DefaultType_Boolean) isDefaultType_Oneof() {}
+
+func (*DefaultType_String_) isDefaultType_Oneof() {}
+
+// When request bodies or response payloads may be one of a number of different schemas, a `discriminator` object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it. When using the discriminator, _inline_ schemas will not be considered.
+type Discriminator struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ PropertyName string `protobuf:"bytes,1,opt,name=property_name,json=propertyName,proto3" json:"property_name,omitempty"`
+ Mapping *Strings `protobuf:"bytes,2,opt,name=mapping,proto3" json:"mapping,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,3,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *Discriminator) Reset() {
+ *x = Discriminator{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[9]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Discriminator) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Discriminator) ProtoMessage() {}
+
+func (x *Discriminator) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[9]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Discriminator.ProtoReflect.Descriptor instead.
+func (*Discriminator) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{9}
+}
+
+func (x *Discriminator) GetPropertyName() string {
+ if x != nil {
+ return x.PropertyName
+ }
+ return ""
+}
+
+func (x *Discriminator) GetMapping() *Strings {
+ if x != nil {
+ return x.Mapping
+ }
+ return nil
+}
+
+func (x *Discriminator) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+type Document struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Openapi string `protobuf:"bytes,1,opt,name=openapi,proto3" json:"openapi,omitempty"`
+ Info *Info `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"`
+ Servers []*Server `protobuf:"bytes,3,rep,name=servers,proto3" json:"servers,omitempty"`
+ Paths *Paths `protobuf:"bytes,4,opt,name=paths,proto3" json:"paths,omitempty"`
+ Components *Components `protobuf:"bytes,5,opt,name=components,proto3" json:"components,omitempty"`
+ Security []*SecurityRequirement `protobuf:"bytes,6,rep,name=security,proto3" json:"security,omitempty"`
+ Tags []*Tag `protobuf:"bytes,7,rep,name=tags,proto3" json:"tags,omitempty"`
+ ExternalDocs *ExternalDocs `protobuf:"bytes,8,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,9,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *Document) Reset() {
+ *x = Document{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[10]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Document) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Document) ProtoMessage() {}
+
+func (x *Document) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[10]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Document.ProtoReflect.Descriptor instead.
+func (*Document) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{10}
+}
+
+func (x *Document) GetOpenapi() string {
+ if x != nil {
+ return x.Openapi
+ }
+ return ""
+}
+
+func (x *Document) GetInfo() *Info {
+ if x != nil {
+ return x.Info
+ }
+ return nil
+}
+
+func (x *Document) GetServers() []*Server {
+ if x != nil {
+ return x.Servers
+ }
+ return nil
+}
+
+func (x *Document) GetPaths() *Paths {
+ if x != nil {
+ return x.Paths
+ }
+ return nil
+}
+
+func (x *Document) GetComponents() *Components {
+ if x != nil {
+ return x.Components
+ }
+ return nil
+}
+
+func (x *Document) GetSecurity() []*SecurityRequirement {
+ if x != nil {
+ return x.Security
+ }
+ return nil
+}
+
+func (x *Document) GetTags() []*Tag {
+ if x != nil {
+ return x.Tags
+ }
+ return nil
+}
+
+func (x *Document) GetExternalDocs() *ExternalDocs {
+ if x != nil {
+ return x.ExternalDocs
+ }
+ return nil
+}
+
+func (x *Document) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+// A single encoding definition applied to a single schema property.
+type Encoding struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ ContentType string `protobuf:"bytes,1,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"`
+ Headers *HeadersOrReferences `protobuf:"bytes,2,opt,name=headers,proto3" json:"headers,omitempty"`
+ Style string `protobuf:"bytes,3,opt,name=style,proto3" json:"style,omitempty"`
+ Explode bool `protobuf:"varint,4,opt,name=explode,proto3" json:"explode,omitempty"`
+ AllowReserved bool `protobuf:"varint,5,opt,name=allow_reserved,json=allowReserved,proto3" json:"allow_reserved,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,6,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *Encoding) Reset() {
+ *x = Encoding{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[11]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Encoding) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Encoding) ProtoMessage() {}
+
+func (x *Encoding) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[11]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Encoding.ProtoReflect.Descriptor instead.
+func (*Encoding) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{11}
+}
+
+func (x *Encoding) GetContentType() string {
+ if x != nil {
+ return x.ContentType
+ }
+ return ""
+}
+
+func (x *Encoding) GetHeaders() *HeadersOrReferences {
+ if x != nil {
+ return x.Headers
+ }
+ return nil
+}
+
+func (x *Encoding) GetStyle() string {
+ if x != nil {
+ return x.Style
+ }
+ return ""
+}
+
+func (x *Encoding) GetExplode() bool {
+ if x != nil {
+ return x.Explode
+ }
+ return false
+}
+
+func (x *Encoding) GetAllowReserved() bool {
+ if x != nil {
+ return x.AllowReserved
+ }
+ return false
+}
+
+func (x *Encoding) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+type Encodings struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedEncoding `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *Encodings) Reset() {
+ *x = Encodings{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[12]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Encodings) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Encodings) ProtoMessage() {}
+
+func (x *Encodings) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[12]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Encodings.ProtoReflect.Descriptor instead.
+func (*Encodings) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{12}
+}
+
+func (x *Encodings) GetAdditionalProperties() []*NamedEncoding {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+type Example struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Summary string `protobuf:"bytes,1,opt,name=summary,proto3" json:"summary,omitempty"`
+ Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
+ Value *Any `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"`
+ ExternalValue string `protobuf:"bytes,4,opt,name=external_value,json=externalValue,proto3" json:"external_value,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,5,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *Example) Reset() {
+ *x = Example{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[13]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Example) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Example) ProtoMessage() {}
+
+func (x *Example) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[13]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Example.ProtoReflect.Descriptor instead.
+func (*Example) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{13}
+}
+
+func (x *Example) GetSummary() string {
+ if x != nil {
+ return x.Summary
+ }
+ return ""
+}
+
+func (x *Example) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Example) GetValue() *Any {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+func (x *Example) GetExternalValue() string {
+ if x != nil {
+ return x.ExternalValue
+ }
+ return ""
+}
+
+func (x *Example) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+type ExampleOrReference struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *ExampleOrReference_Example
+ // *ExampleOrReference_Reference
+ Oneof isExampleOrReference_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *ExampleOrReference) Reset() {
+ *x = ExampleOrReference{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[14]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ExampleOrReference) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ExampleOrReference) ProtoMessage() {}
+
+func (x *ExampleOrReference) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[14]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ExampleOrReference.ProtoReflect.Descriptor instead.
+func (*ExampleOrReference) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{14}
+}
+
+func (m *ExampleOrReference) GetOneof() isExampleOrReference_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *ExampleOrReference) GetExample() *Example {
+ if x, ok := x.GetOneof().(*ExampleOrReference_Example); ok {
+ return x.Example
+ }
+ return nil
+}
+
+func (x *ExampleOrReference) GetReference() *Reference {
+ if x, ok := x.GetOneof().(*ExampleOrReference_Reference); ok {
+ return x.Reference
+ }
+ return nil
+}
+
+type isExampleOrReference_Oneof interface {
+ isExampleOrReference_Oneof()
+}
+
+type ExampleOrReference_Example struct {
+ Example *Example `protobuf:"bytes,1,opt,name=example,proto3,oneof"`
+}
+
+type ExampleOrReference_Reference struct {
+ Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"`
+}
+
+func (*ExampleOrReference_Example) isExampleOrReference_Oneof() {}
+
+func (*ExampleOrReference_Reference) isExampleOrReference_Oneof() {}
+
+type ExamplesOrReferences struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedExampleOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *ExamplesOrReferences) Reset() {
+ *x = ExamplesOrReferences{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[15]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ExamplesOrReferences) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ExamplesOrReferences) ProtoMessage() {}
+
+func (x *ExamplesOrReferences) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[15]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ExamplesOrReferences.ProtoReflect.Descriptor instead.
+func (*ExamplesOrReferences) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{15}
+}
+
+func (x *ExamplesOrReferences) GetAdditionalProperties() []*NamedExampleOrReference {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+type Expression struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedAny `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *Expression) Reset() {
+ *x = Expression{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[16]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Expression) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Expression) ProtoMessage() {}
+
+func (x *Expression) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[16]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Expression.ProtoReflect.Descriptor instead.
+func (*Expression) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{16}
+}
+
+func (x *Expression) GetAdditionalProperties() []*NamedAny {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+// Allows referencing an external resource for extended documentation.
+type ExternalDocs struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"`
+ Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,3,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *ExternalDocs) Reset() {
+ *x = ExternalDocs{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[17]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ExternalDocs) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ExternalDocs) ProtoMessage() {}
+
+func (x *ExternalDocs) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[17]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ExternalDocs.ProtoReflect.Descriptor instead.
+func (*ExternalDocs) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{17}
+}
+
+func (x *ExternalDocs) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *ExternalDocs) GetUrl() string {
+ if x != nil {
+ return x.Url
+ }
+ return ""
+}
+
+func (x *ExternalDocs) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+// The Header Object follows the structure of the Parameter Object with the following changes: 1. `name` MUST NOT be specified, it is given in the corresponding `headers` map. 1. `in` MUST NOT be specified, it is implicitly in `header`. 1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, `style`).
+type Header struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"`
+ Required bool `protobuf:"varint,2,opt,name=required,proto3" json:"required,omitempty"`
+ Deprecated bool `protobuf:"varint,3,opt,name=deprecated,proto3" json:"deprecated,omitempty"`
+ AllowEmptyValue bool `protobuf:"varint,4,opt,name=allow_empty_value,json=allowEmptyValue,proto3" json:"allow_empty_value,omitempty"`
+ Style string `protobuf:"bytes,5,opt,name=style,proto3" json:"style,omitempty"`
+ Explode bool `protobuf:"varint,6,opt,name=explode,proto3" json:"explode,omitempty"`
+ AllowReserved bool `protobuf:"varint,7,opt,name=allow_reserved,json=allowReserved,proto3" json:"allow_reserved,omitempty"`
+ Schema *SchemaOrReference `protobuf:"bytes,8,opt,name=schema,proto3" json:"schema,omitempty"`
+ Example *Any `protobuf:"bytes,9,opt,name=example,proto3" json:"example,omitempty"`
+ Examples *ExamplesOrReferences `protobuf:"bytes,10,opt,name=examples,proto3" json:"examples,omitempty"`
+ Content *MediaTypes `protobuf:"bytes,11,opt,name=content,proto3" json:"content,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,12,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *Header) Reset() {
+ *x = Header{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[18]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Header) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Header) ProtoMessage() {}
+
+func (x *Header) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[18]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Header.ProtoReflect.Descriptor instead.
+func (*Header) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{18}
+}
+
+func (x *Header) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Header) GetRequired() bool {
+ if x != nil {
+ return x.Required
+ }
+ return false
+}
+
+func (x *Header) GetDeprecated() bool {
+ if x != nil {
+ return x.Deprecated
+ }
+ return false
+}
+
+func (x *Header) GetAllowEmptyValue() bool {
+ if x != nil {
+ return x.AllowEmptyValue
+ }
+ return false
+}
+
+func (x *Header) GetStyle() string {
+ if x != nil {
+ return x.Style
+ }
+ return ""
+}
+
+func (x *Header) GetExplode() bool {
+ if x != nil {
+ return x.Explode
+ }
+ return false
+}
+
+func (x *Header) GetAllowReserved() bool {
+ if x != nil {
+ return x.AllowReserved
+ }
+ return false
+}
+
+func (x *Header) GetSchema() *SchemaOrReference {
+ if x != nil {
+ return x.Schema
+ }
+ return nil
+}
+
+func (x *Header) GetExample() *Any {
+ if x != nil {
+ return x.Example
+ }
+ return nil
+}
+
+func (x *Header) GetExamples() *ExamplesOrReferences {
+ if x != nil {
+ return x.Examples
+ }
+ return nil
+}
+
+func (x *Header) GetContent() *MediaTypes {
+ if x != nil {
+ return x.Content
+ }
+ return nil
+}
+
+func (x *Header) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+type HeaderOrReference struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *HeaderOrReference_Header
+ // *HeaderOrReference_Reference
+ Oneof isHeaderOrReference_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *HeaderOrReference) Reset() {
+ *x = HeaderOrReference{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[19]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *HeaderOrReference) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*HeaderOrReference) ProtoMessage() {}
+
+func (x *HeaderOrReference) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[19]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use HeaderOrReference.ProtoReflect.Descriptor instead.
+func (*HeaderOrReference) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{19}
+}
+
+func (m *HeaderOrReference) GetOneof() isHeaderOrReference_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *HeaderOrReference) GetHeader() *Header {
+ if x, ok := x.GetOneof().(*HeaderOrReference_Header); ok {
+ return x.Header
+ }
+ return nil
+}
+
+func (x *HeaderOrReference) GetReference() *Reference {
+ if x, ok := x.GetOneof().(*HeaderOrReference_Reference); ok {
+ return x.Reference
+ }
+ return nil
+}
+
+type isHeaderOrReference_Oneof interface {
+ isHeaderOrReference_Oneof()
+}
+
+type HeaderOrReference_Header struct {
+ Header *Header `protobuf:"bytes,1,opt,name=header,proto3,oneof"`
+}
+
+type HeaderOrReference_Reference struct {
+ Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"`
+}
+
+func (*HeaderOrReference_Header) isHeaderOrReference_Oneof() {}
+
+func (*HeaderOrReference_Reference) isHeaderOrReference_Oneof() {}
+
+type HeadersOrReferences struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedHeaderOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *HeadersOrReferences) Reset() {
+ *x = HeadersOrReferences{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[20]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *HeadersOrReferences) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*HeadersOrReferences) ProtoMessage() {}
+
+func (x *HeadersOrReferences) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[20]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use HeadersOrReferences.ProtoReflect.Descriptor instead.
+func (*HeadersOrReferences) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{20}
+}
+
+func (x *HeadersOrReferences) GetAdditionalProperties() []*NamedHeaderOrReference {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+// The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.
+type Info struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
+ Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
+ TermsOfService string `protobuf:"bytes,3,opt,name=terms_of_service,json=termsOfService,proto3" json:"terms_of_service,omitempty"`
+ Contact *Contact `protobuf:"bytes,4,opt,name=contact,proto3" json:"contact,omitempty"`
+ License *License `protobuf:"bytes,5,opt,name=license,proto3" json:"license,omitempty"`
+ Version string `protobuf:"bytes,6,opt,name=version,proto3" json:"version,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,7,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+ Summary string `protobuf:"bytes,8,opt,name=summary,proto3" json:"summary,omitempty"`
+}
+
+func (x *Info) Reset() {
+ *x = Info{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[21]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Info) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Info) ProtoMessage() {}
+
+func (x *Info) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[21]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Info.ProtoReflect.Descriptor instead.
+func (*Info) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{21}
+}
+
+func (x *Info) GetTitle() string {
+ if x != nil {
+ return x.Title
+ }
+ return ""
+}
+
+func (x *Info) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Info) GetTermsOfService() string {
+ if x != nil {
+ return x.TermsOfService
+ }
+ return ""
+}
+
+func (x *Info) GetContact() *Contact {
+ if x != nil {
+ return x.Contact
+ }
+ return nil
+}
+
+func (x *Info) GetLicense() *License {
+ if x != nil {
+ return x.License
+ }
+ return nil
+}
+
+func (x *Info) GetVersion() string {
+ if x != nil {
+ return x.Version
+ }
+ return ""
+}
+
+func (x *Info) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+func (x *Info) GetSummary() string {
+ if x != nil {
+ return x.Summary
+ }
+ return ""
+}
+
+type ItemsItem struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ SchemaOrReference []*SchemaOrReference `protobuf:"bytes,1,rep,name=schema_or_reference,json=schemaOrReference,proto3" json:"schema_or_reference,omitempty"`
+}
+
+func (x *ItemsItem) Reset() {
+ *x = ItemsItem{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[22]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ItemsItem) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ItemsItem) ProtoMessage() {}
+
+func (x *ItemsItem) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[22]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ItemsItem.ProtoReflect.Descriptor instead.
+func (*ItemsItem) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{22}
+}
+
+func (x *ItemsItem) GetSchemaOrReference() []*SchemaOrReference {
+ if x != nil {
+ return x.SchemaOrReference
+ }
+ return nil
+}
+
+// License information for the exposed API.
+type License struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,3,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *License) Reset() {
+ *x = License{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[23]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *License) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*License) ProtoMessage() {}
+
+func (x *License) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[23]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use License.ProtoReflect.Descriptor instead.
+func (*License) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{23}
+}
+
+func (x *License) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *License) GetUrl() string {
+ if x != nil {
+ return x.Url
+ }
+ return ""
+}
+
+func (x *License) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+// The `Link object` represents a possible design-time link for a response. The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. Unlike _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require link information in the runtime response. For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.
+type Link struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ OperationRef string `protobuf:"bytes,1,opt,name=operation_ref,json=operationRef,proto3" json:"operation_ref,omitempty"`
+ OperationId string `protobuf:"bytes,2,opt,name=operation_id,json=operationId,proto3" json:"operation_id,omitempty"`
+ Parameters *AnyOrExpression `protobuf:"bytes,3,opt,name=parameters,proto3" json:"parameters,omitempty"`
+ RequestBody *AnyOrExpression `protobuf:"bytes,4,opt,name=request_body,json=requestBody,proto3" json:"request_body,omitempty"`
+ Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"`
+ Server *Server `protobuf:"bytes,6,opt,name=server,proto3" json:"server,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,7,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *Link) Reset() {
+ *x = Link{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[24]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Link) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Link) ProtoMessage() {}
+
+func (x *Link) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[24]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Link.ProtoReflect.Descriptor instead.
+func (*Link) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{24}
+}
+
+func (x *Link) GetOperationRef() string {
+ if x != nil {
+ return x.OperationRef
+ }
+ return ""
+}
+
+func (x *Link) GetOperationId() string {
+ if x != nil {
+ return x.OperationId
+ }
+ return ""
+}
+
+func (x *Link) GetParameters() *AnyOrExpression {
+ if x != nil {
+ return x.Parameters
+ }
+ return nil
+}
+
+func (x *Link) GetRequestBody() *AnyOrExpression {
+ if x != nil {
+ return x.RequestBody
+ }
+ return nil
+}
+
+func (x *Link) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Link) GetServer() *Server {
+ if x != nil {
+ return x.Server
+ }
+ return nil
+}
+
+func (x *Link) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+type LinkOrReference struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *LinkOrReference_Link
+ // *LinkOrReference_Reference
+ Oneof isLinkOrReference_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *LinkOrReference) Reset() {
+ *x = LinkOrReference{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[25]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *LinkOrReference) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*LinkOrReference) ProtoMessage() {}
+
+func (x *LinkOrReference) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[25]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use LinkOrReference.ProtoReflect.Descriptor instead.
+func (*LinkOrReference) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{25}
+}
+
+func (m *LinkOrReference) GetOneof() isLinkOrReference_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *LinkOrReference) GetLink() *Link {
+ if x, ok := x.GetOneof().(*LinkOrReference_Link); ok {
+ return x.Link
+ }
+ return nil
+}
+
+func (x *LinkOrReference) GetReference() *Reference {
+ if x, ok := x.GetOneof().(*LinkOrReference_Reference); ok {
+ return x.Reference
+ }
+ return nil
+}
+
+type isLinkOrReference_Oneof interface {
+ isLinkOrReference_Oneof()
+}
+
+type LinkOrReference_Link struct {
+ Link *Link `protobuf:"bytes,1,opt,name=link,proto3,oneof"`
+}
+
+type LinkOrReference_Reference struct {
+ Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"`
+}
+
+func (*LinkOrReference_Link) isLinkOrReference_Oneof() {}
+
+func (*LinkOrReference_Reference) isLinkOrReference_Oneof() {}
+
+type LinksOrReferences struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedLinkOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *LinksOrReferences) Reset() {
+ *x = LinksOrReferences{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[26]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *LinksOrReferences) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*LinksOrReferences) ProtoMessage() {}
+
+func (x *LinksOrReferences) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[26]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use LinksOrReferences.ProtoReflect.Descriptor instead.
+func (*LinksOrReferences) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{26}
+}
+
+func (x *LinksOrReferences) GetAdditionalProperties() []*NamedLinkOrReference {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+// Each Media Type Object provides schema and examples for the media type identified by its key.
+type MediaType struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Schema *SchemaOrReference `protobuf:"bytes,1,opt,name=schema,proto3" json:"schema,omitempty"`
+ Example *Any `protobuf:"bytes,2,opt,name=example,proto3" json:"example,omitempty"`
+ Examples *ExamplesOrReferences `protobuf:"bytes,3,opt,name=examples,proto3" json:"examples,omitempty"`
+ Encoding *Encodings `protobuf:"bytes,4,opt,name=encoding,proto3" json:"encoding,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,5,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *MediaType) Reset() {
+ *x = MediaType{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[27]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *MediaType) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*MediaType) ProtoMessage() {}
+
+func (x *MediaType) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[27]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use MediaType.ProtoReflect.Descriptor instead.
+func (*MediaType) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{27}
+}
+
+func (x *MediaType) GetSchema() *SchemaOrReference {
+ if x != nil {
+ return x.Schema
+ }
+ return nil
+}
+
+func (x *MediaType) GetExample() *Any {
+ if x != nil {
+ return x.Example
+ }
+ return nil
+}
+
+func (x *MediaType) GetExamples() *ExamplesOrReferences {
+ if x != nil {
+ return x.Examples
+ }
+ return nil
+}
+
+func (x *MediaType) GetEncoding() *Encodings {
+ if x != nil {
+ return x.Encoding
+ }
+ return nil
+}
+
+func (x *MediaType) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+type MediaTypes struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedMediaType `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *MediaTypes) Reset() {
+ *x = MediaTypes{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[28]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *MediaTypes) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*MediaTypes) ProtoMessage() {}
+
+func (x *MediaTypes) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[28]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use MediaTypes.ProtoReflect.Descriptor instead.
+func (*MediaTypes) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{28}
+}
+
+func (x *MediaTypes) GetAdditionalProperties() []*NamedMediaType {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of Any as ordered (name,value) pairs.
+type NamedAny struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *Any `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedAny) Reset() {
+ *x = NamedAny{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[29]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedAny) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedAny) ProtoMessage() {}
+
+func (x *NamedAny) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[29]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedAny.ProtoReflect.Descriptor instead.
+func (*NamedAny) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{29}
+}
+
+func (x *NamedAny) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedAny) GetValue() *Any {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of CallbackOrReference as ordered (name,value) pairs.
+type NamedCallbackOrReference struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *CallbackOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedCallbackOrReference) Reset() {
+ *x = NamedCallbackOrReference{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[30]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedCallbackOrReference) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedCallbackOrReference) ProtoMessage() {}
+
+func (x *NamedCallbackOrReference) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[30]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedCallbackOrReference.ProtoReflect.Descriptor instead.
+func (*NamedCallbackOrReference) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{30}
+}
+
+func (x *NamedCallbackOrReference) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedCallbackOrReference) GetValue() *CallbackOrReference {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of Encoding as ordered (name,value) pairs.
+type NamedEncoding struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *Encoding `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedEncoding) Reset() {
+ *x = NamedEncoding{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[31]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedEncoding) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedEncoding) ProtoMessage() {}
+
+func (x *NamedEncoding) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[31]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedEncoding.ProtoReflect.Descriptor instead.
+func (*NamedEncoding) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{31}
+}
+
+func (x *NamedEncoding) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedEncoding) GetValue() *Encoding {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of ExampleOrReference as ordered (name,value) pairs.
+type NamedExampleOrReference struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *ExampleOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedExampleOrReference) Reset() {
+ *x = NamedExampleOrReference{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[32]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedExampleOrReference) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedExampleOrReference) ProtoMessage() {}
+
+func (x *NamedExampleOrReference) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[32]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedExampleOrReference.ProtoReflect.Descriptor instead.
+func (*NamedExampleOrReference) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{32}
+}
+
+func (x *NamedExampleOrReference) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedExampleOrReference) GetValue() *ExampleOrReference {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of HeaderOrReference as ordered (name,value) pairs.
+type NamedHeaderOrReference struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *HeaderOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedHeaderOrReference) Reset() {
+ *x = NamedHeaderOrReference{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[33]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedHeaderOrReference) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedHeaderOrReference) ProtoMessage() {}
+
+func (x *NamedHeaderOrReference) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[33]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedHeaderOrReference.ProtoReflect.Descriptor instead.
+func (*NamedHeaderOrReference) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{33}
+}
+
+func (x *NamedHeaderOrReference) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedHeaderOrReference) GetValue() *HeaderOrReference {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of LinkOrReference as ordered (name,value) pairs.
+type NamedLinkOrReference struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *LinkOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedLinkOrReference) Reset() {
+ *x = NamedLinkOrReference{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[34]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedLinkOrReference) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedLinkOrReference) ProtoMessage() {}
+
+func (x *NamedLinkOrReference) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[34]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedLinkOrReference.ProtoReflect.Descriptor instead.
+func (*NamedLinkOrReference) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{34}
+}
+
+func (x *NamedLinkOrReference) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedLinkOrReference) GetValue() *LinkOrReference {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of MediaType as ordered (name,value) pairs.
+type NamedMediaType struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *MediaType `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedMediaType) Reset() {
+ *x = NamedMediaType{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[35]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedMediaType) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedMediaType) ProtoMessage() {}
+
+func (x *NamedMediaType) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[35]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedMediaType.ProtoReflect.Descriptor instead.
+func (*NamedMediaType) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{35}
+}
+
+func (x *NamedMediaType) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedMediaType) GetValue() *MediaType {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of ParameterOrReference as ordered (name,value) pairs.
+type NamedParameterOrReference struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *ParameterOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedParameterOrReference) Reset() {
+ *x = NamedParameterOrReference{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[36]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedParameterOrReference) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedParameterOrReference) ProtoMessage() {}
+
+func (x *NamedParameterOrReference) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[36]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedParameterOrReference.ProtoReflect.Descriptor instead.
+func (*NamedParameterOrReference) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{36}
+}
+
+func (x *NamedParameterOrReference) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedParameterOrReference) GetValue() *ParameterOrReference {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of PathItem as ordered (name,value) pairs.
+type NamedPathItem struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *PathItem `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedPathItem) Reset() {
+ *x = NamedPathItem{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[37]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedPathItem) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedPathItem) ProtoMessage() {}
+
+func (x *NamedPathItem) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[37]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedPathItem.ProtoReflect.Descriptor instead.
+func (*NamedPathItem) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{37}
+}
+
+func (x *NamedPathItem) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedPathItem) GetValue() *PathItem {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of RequestBodyOrReference as ordered (name,value) pairs.
+type NamedRequestBodyOrReference struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *RequestBodyOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedRequestBodyOrReference) Reset() {
+ *x = NamedRequestBodyOrReference{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[38]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedRequestBodyOrReference) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedRequestBodyOrReference) ProtoMessage() {}
+
+func (x *NamedRequestBodyOrReference) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[38]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedRequestBodyOrReference.ProtoReflect.Descriptor instead.
+func (*NamedRequestBodyOrReference) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{38}
+}
+
+func (x *NamedRequestBodyOrReference) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedRequestBodyOrReference) GetValue() *RequestBodyOrReference {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of ResponseOrReference as ordered (name,value) pairs.
+type NamedResponseOrReference struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *ResponseOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedResponseOrReference) Reset() {
+ *x = NamedResponseOrReference{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[39]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedResponseOrReference) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedResponseOrReference) ProtoMessage() {}
+
+func (x *NamedResponseOrReference) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[39]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedResponseOrReference.ProtoReflect.Descriptor instead.
+func (*NamedResponseOrReference) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{39}
+}
+
+func (x *NamedResponseOrReference) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedResponseOrReference) GetValue() *ResponseOrReference {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of SchemaOrReference as ordered (name,value) pairs.
+type NamedSchemaOrReference struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *SchemaOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedSchemaOrReference) Reset() {
+ *x = NamedSchemaOrReference{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[40]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedSchemaOrReference) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedSchemaOrReference) ProtoMessage() {}
+
+func (x *NamedSchemaOrReference) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[40]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedSchemaOrReference.ProtoReflect.Descriptor instead.
+func (*NamedSchemaOrReference) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{40}
+}
+
+func (x *NamedSchemaOrReference) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedSchemaOrReference) GetValue() *SchemaOrReference {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of SecuritySchemeOrReference as ordered (name,value) pairs.
+type NamedSecuritySchemeOrReference struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *SecuritySchemeOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedSecuritySchemeOrReference) Reset() {
+ *x = NamedSecuritySchemeOrReference{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[41]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedSecuritySchemeOrReference) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedSecuritySchemeOrReference) ProtoMessage() {}
+
+func (x *NamedSecuritySchemeOrReference) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[41]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedSecuritySchemeOrReference.ProtoReflect.Descriptor instead.
+func (*NamedSecuritySchemeOrReference) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{41}
+}
+
+func (x *NamedSecuritySchemeOrReference) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedSecuritySchemeOrReference) GetValue() *SecuritySchemeOrReference {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of ServerVariable as ordered (name,value) pairs.
+type NamedServerVariable struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *ServerVariable `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedServerVariable) Reset() {
+ *x = NamedServerVariable{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[42]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedServerVariable) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedServerVariable) ProtoMessage() {}
+
+func (x *NamedServerVariable) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[42]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedServerVariable.ProtoReflect.Descriptor instead.
+func (*NamedServerVariable) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{42}
+}
+
+func (x *NamedServerVariable) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedServerVariable) GetValue() *ServerVariable {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of string as ordered (name,value) pairs.
+type NamedString struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedString) Reset() {
+ *x = NamedString{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[43]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedString) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedString) ProtoMessage() {}
+
+func (x *NamedString) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[43]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedString.ProtoReflect.Descriptor instead.
+func (*NamedString) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{43}
+}
+
+func (x *NamedString) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedString) GetValue() string {
+ if x != nil {
+ return x.Value
+ }
+ return ""
+}
+
+// Automatically-generated message used to represent maps of StringArray as ordered (name,value) pairs.
+type NamedStringArray struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *StringArray `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedStringArray) Reset() {
+ *x = NamedStringArray{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[44]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedStringArray) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedStringArray) ProtoMessage() {}
+
+func (x *NamedStringArray) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[44]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedStringArray.ProtoReflect.Descriptor instead.
+func (*NamedStringArray) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{44}
+}
+
+func (x *NamedStringArray) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedStringArray) GetValue() *StringArray {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Configuration details for a supported OAuth Flow
+type OauthFlow struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AuthorizationUrl string `protobuf:"bytes,1,opt,name=authorization_url,json=authorizationUrl,proto3" json:"authorization_url,omitempty"`
+ TokenUrl string `protobuf:"bytes,2,opt,name=token_url,json=tokenUrl,proto3" json:"token_url,omitempty"`
+ RefreshUrl string `protobuf:"bytes,3,opt,name=refresh_url,json=refreshUrl,proto3" json:"refresh_url,omitempty"`
+ Scopes *Strings `protobuf:"bytes,4,opt,name=scopes,proto3" json:"scopes,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,5,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *OauthFlow) Reset() {
+ *x = OauthFlow{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[45]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *OauthFlow) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*OauthFlow) ProtoMessage() {}
+
+func (x *OauthFlow) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[45]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use OauthFlow.ProtoReflect.Descriptor instead.
+func (*OauthFlow) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{45}
+}
+
+func (x *OauthFlow) GetAuthorizationUrl() string {
+ if x != nil {
+ return x.AuthorizationUrl
+ }
+ return ""
+}
+
+func (x *OauthFlow) GetTokenUrl() string {
+ if x != nil {
+ return x.TokenUrl
+ }
+ return ""
+}
+
+func (x *OauthFlow) GetRefreshUrl() string {
+ if x != nil {
+ return x.RefreshUrl
+ }
+ return ""
+}
+
+func (x *OauthFlow) GetScopes() *Strings {
+ if x != nil {
+ return x.Scopes
+ }
+ return nil
+}
+
+func (x *OauthFlow) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+// Allows configuration of the supported OAuth Flows.
+type OauthFlows struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Implicit *OauthFlow `protobuf:"bytes,1,opt,name=implicit,proto3" json:"implicit,omitempty"`
+ Password *OauthFlow `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
+ ClientCredentials *OauthFlow `protobuf:"bytes,3,opt,name=client_credentials,json=clientCredentials,proto3" json:"client_credentials,omitempty"`
+ AuthorizationCode *OauthFlow `protobuf:"bytes,4,opt,name=authorization_code,json=authorizationCode,proto3" json:"authorization_code,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,5,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *OauthFlows) Reset() {
+ *x = OauthFlows{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[46]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *OauthFlows) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*OauthFlows) ProtoMessage() {}
+
+func (x *OauthFlows) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[46]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use OauthFlows.ProtoReflect.Descriptor instead.
+func (*OauthFlows) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{46}
+}
+
+func (x *OauthFlows) GetImplicit() *OauthFlow {
+ if x != nil {
+ return x.Implicit
+ }
+ return nil
+}
+
+func (x *OauthFlows) GetPassword() *OauthFlow {
+ if x != nil {
+ return x.Password
+ }
+ return nil
+}
+
+func (x *OauthFlows) GetClientCredentials() *OauthFlow {
+ if x != nil {
+ return x.ClientCredentials
+ }
+ return nil
+}
+
+func (x *OauthFlows) GetAuthorizationCode() *OauthFlow {
+ if x != nil {
+ return x.AuthorizationCode
+ }
+ return nil
+}
+
+func (x *OauthFlows) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+type Object struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedAny `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *Object) Reset() {
+ *x = Object{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[47]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Object) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Object) ProtoMessage() {}
+
+func (x *Object) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[47]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Object.ProtoReflect.Descriptor instead.
+func (*Object) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{47}
+}
+
+func (x *Object) GetAdditionalProperties() []*NamedAny {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+// Describes a single API operation on a path.
+type Operation struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Tags []string `protobuf:"bytes,1,rep,name=tags,proto3" json:"tags,omitempty"`
+ Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"`
+ Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
+ ExternalDocs *ExternalDocs `protobuf:"bytes,4,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"`
+ OperationId string `protobuf:"bytes,5,opt,name=operation_id,json=operationId,proto3" json:"operation_id,omitempty"`
+ Parameters []*ParameterOrReference `protobuf:"bytes,6,rep,name=parameters,proto3" json:"parameters,omitempty"`
+ RequestBody *RequestBodyOrReference `protobuf:"bytes,7,opt,name=request_body,json=requestBody,proto3" json:"request_body,omitempty"`
+ Responses *Responses `protobuf:"bytes,8,opt,name=responses,proto3" json:"responses,omitempty"`
+ Callbacks *CallbacksOrReferences `protobuf:"bytes,9,opt,name=callbacks,proto3" json:"callbacks,omitempty"`
+ Deprecated bool `protobuf:"varint,10,opt,name=deprecated,proto3" json:"deprecated,omitempty"`
+ Security []*SecurityRequirement `protobuf:"bytes,11,rep,name=security,proto3" json:"security,omitempty"`
+ Servers []*Server `protobuf:"bytes,12,rep,name=servers,proto3" json:"servers,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,13,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *Operation) Reset() {
+ *x = Operation{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[48]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Operation) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Operation) ProtoMessage() {}
+
+func (x *Operation) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[48]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Operation.ProtoReflect.Descriptor instead.
+func (*Operation) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{48}
+}
+
+func (x *Operation) GetTags() []string {
+ if x != nil {
+ return x.Tags
+ }
+ return nil
+}
+
+func (x *Operation) GetSummary() string {
+ if x != nil {
+ return x.Summary
+ }
+ return ""
+}
+
+func (x *Operation) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Operation) GetExternalDocs() *ExternalDocs {
+ if x != nil {
+ return x.ExternalDocs
+ }
+ return nil
+}
+
+func (x *Operation) GetOperationId() string {
+ if x != nil {
+ return x.OperationId
+ }
+ return ""
+}
+
+func (x *Operation) GetParameters() []*ParameterOrReference {
+ if x != nil {
+ return x.Parameters
+ }
+ return nil
+}
+
+func (x *Operation) GetRequestBody() *RequestBodyOrReference {
+ if x != nil {
+ return x.RequestBody
+ }
+ return nil
+}
+
+func (x *Operation) GetResponses() *Responses {
+ if x != nil {
+ return x.Responses
+ }
+ return nil
+}
+
+func (x *Operation) GetCallbacks() *CallbacksOrReferences {
+ if x != nil {
+ return x.Callbacks
+ }
+ return nil
+}
+
+func (x *Operation) GetDeprecated() bool {
+ if x != nil {
+ return x.Deprecated
+ }
+ return false
+}
+
+func (x *Operation) GetSecurity() []*SecurityRequirement {
+ if x != nil {
+ return x.Security
+ }
+ return nil
+}
+
+func (x *Operation) GetServers() []*Server {
+ if x != nil {
+ return x.Servers
+ }
+ return nil
+}
+
+func (x *Operation) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+// Describes a single operation parameter. A unique parameter is defined by a combination of a name and location.
+type Parameter struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ In string `protobuf:"bytes,2,opt,name=in,proto3" json:"in,omitempty"`
+ Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
+ Required bool `protobuf:"varint,4,opt,name=required,proto3" json:"required,omitempty"`
+ Deprecated bool `protobuf:"varint,5,opt,name=deprecated,proto3" json:"deprecated,omitempty"`
+ AllowEmptyValue bool `protobuf:"varint,6,opt,name=allow_empty_value,json=allowEmptyValue,proto3" json:"allow_empty_value,omitempty"`
+ Style string `protobuf:"bytes,7,opt,name=style,proto3" json:"style,omitempty"`
+ Explode bool `protobuf:"varint,8,opt,name=explode,proto3" json:"explode,omitempty"`
+ AllowReserved bool `protobuf:"varint,9,opt,name=allow_reserved,json=allowReserved,proto3" json:"allow_reserved,omitempty"`
+ Schema *SchemaOrReference `protobuf:"bytes,10,opt,name=schema,proto3" json:"schema,omitempty"`
+ Example *Any `protobuf:"bytes,11,opt,name=example,proto3" json:"example,omitempty"`
+ Examples *ExamplesOrReferences `protobuf:"bytes,12,opt,name=examples,proto3" json:"examples,omitempty"`
+ Content *MediaTypes `protobuf:"bytes,13,opt,name=content,proto3" json:"content,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,14,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *Parameter) Reset() {
+ *x = Parameter{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[49]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Parameter) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Parameter) ProtoMessage() {}
+
+func (x *Parameter) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[49]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Parameter.ProtoReflect.Descriptor instead.
+func (*Parameter) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{49}
+}
+
+func (x *Parameter) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *Parameter) GetIn() string {
+ if x != nil {
+ return x.In
+ }
+ return ""
+}
+
+func (x *Parameter) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Parameter) GetRequired() bool {
+ if x != nil {
+ return x.Required
+ }
+ return false
+}
+
+func (x *Parameter) GetDeprecated() bool {
+ if x != nil {
+ return x.Deprecated
+ }
+ return false
+}
+
+func (x *Parameter) GetAllowEmptyValue() bool {
+ if x != nil {
+ return x.AllowEmptyValue
+ }
+ return false
+}
+
+func (x *Parameter) GetStyle() string {
+ if x != nil {
+ return x.Style
+ }
+ return ""
+}
+
+func (x *Parameter) GetExplode() bool {
+ if x != nil {
+ return x.Explode
+ }
+ return false
+}
+
+func (x *Parameter) GetAllowReserved() bool {
+ if x != nil {
+ return x.AllowReserved
+ }
+ return false
+}
+
+func (x *Parameter) GetSchema() *SchemaOrReference {
+ if x != nil {
+ return x.Schema
+ }
+ return nil
+}
+
+func (x *Parameter) GetExample() *Any {
+ if x != nil {
+ return x.Example
+ }
+ return nil
+}
+
+func (x *Parameter) GetExamples() *ExamplesOrReferences {
+ if x != nil {
+ return x.Examples
+ }
+ return nil
+}
+
+func (x *Parameter) GetContent() *MediaTypes {
+ if x != nil {
+ return x.Content
+ }
+ return nil
+}
+
+func (x *Parameter) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+type ParameterOrReference struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *ParameterOrReference_Parameter
+ // *ParameterOrReference_Reference
+ Oneof isParameterOrReference_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *ParameterOrReference) Reset() {
+ *x = ParameterOrReference{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[50]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ParameterOrReference) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ParameterOrReference) ProtoMessage() {}
+
+func (x *ParameterOrReference) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[50]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ParameterOrReference.ProtoReflect.Descriptor instead.
+func (*ParameterOrReference) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{50}
+}
+
+func (m *ParameterOrReference) GetOneof() isParameterOrReference_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *ParameterOrReference) GetParameter() *Parameter {
+ if x, ok := x.GetOneof().(*ParameterOrReference_Parameter); ok {
+ return x.Parameter
+ }
+ return nil
+}
+
+func (x *ParameterOrReference) GetReference() *Reference {
+ if x, ok := x.GetOneof().(*ParameterOrReference_Reference); ok {
+ return x.Reference
+ }
+ return nil
+}
+
+type isParameterOrReference_Oneof interface {
+ isParameterOrReference_Oneof()
+}
+
+type ParameterOrReference_Parameter struct {
+ Parameter *Parameter `protobuf:"bytes,1,opt,name=parameter,proto3,oneof"`
+}
+
+type ParameterOrReference_Reference struct {
+ Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"`
+}
+
+func (*ParameterOrReference_Parameter) isParameterOrReference_Oneof() {}
+
+func (*ParameterOrReference_Reference) isParameterOrReference_Oneof() {}
+
+type ParametersOrReferences struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedParameterOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *ParametersOrReferences) Reset() {
+ *x = ParametersOrReferences{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[51]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ParametersOrReferences) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ParametersOrReferences) ProtoMessage() {}
+
+func (x *ParametersOrReferences) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[51]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ParametersOrReferences.ProtoReflect.Descriptor instead.
+func (*ParametersOrReferences) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{51}
+}
+
+func (x *ParametersOrReferences) GetAdditionalProperties() []*NamedParameterOrReference {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+// Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.
+type PathItem struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ XRef string `protobuf:"bytes,1,opt,name=_ref,json=Ref,proto3" json:"_ref,omitempty"`
+ Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"`
+ Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
+ Get *Operation `protobuf:"bytes,4,opt,name=get,proto3" json:"get,omitempty"`
+ Put *Operation `protobuf:"bytes,5,opt,name=put,proto3" json:"put,omitempty"`
+ Post *Operation `protobuf:"bytes,6,opt,name=post,proto3" json:"post,omitempty"`
+ Delete *Operation `protobuf:"bytes,7,opt,name=delete,proto3" json:"delete,omitempty"`
+ Options *Operation `protobuf:"bytes,8,opt,name=options,proto3" json:"options,omitempty"`
+ Head *Operation `protobuf:"bytes,9,opt,name=head,proto3" json:"head,omitempty"`
+ Patch *Operation `protobuf:"bytes,10,opt,name=patch,proto3" json:"patch,omitempty"`
+ Trace *Operation `protobuf:"bytes,11,opt,name=trace,proto3" json:"trace,omitempty"`
+ Servers []*Server `protobuf:"bytes,12,rep,name=servers,proto3" json:"servers,omitempty"`
+ Parameters []*ParameterOrReference `protobuf:"bytes,13,rep,name=parameters,proto3" json:"parameters,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,14,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *PathItem) Reset() {
+ *x = PathItem{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[52]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *PathItem) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*PathItem) ProtoMessage() {}
+
+func (x *PathItem) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[52]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use PathItem.ProtoReflect.Descriptor instead.
+func (*PathItem) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{52}
+}
+
+func (x *PathItem) GetXRef() string {
+ if x != nil {
+ return x.XRef
+ }
+ return ""
+}
+
+func (x *PathItem) GetSummary() string {
+ if x != nil {
+ return x.Summary
+ }
+ return ""
+}
+
+func (x *PathItem) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *PathItem) GetGet() *Operation {
+ if x != nil {
+ return x.Get
+ }
+ return nil
+}
+
+func (x *PathItem) GetPut() *Operation {
+ if x != nil {
+ return x.Put
+ }
+ return nil
+}
+
+func (x *PathItem) GetPost() *Operation {
+ if x != nil {
+ return x.Post
+ }
+ return nil
+}
+
+func (x *PathItem) GetDelete() *Operation {
+ if x != nil {
+ return x.Delete
+ }
+ return nil
+}
+
+func (x *PathItem) GetOptions() *Operation {
+ if x != nil {
+ return x.Options
+ }
+ return nil
+}
+
+func (x *PathItem) GetHead() *Operation {
+ if x != nil {
+ return x.Head
+ }
+ return nil
+}
+
+func (x *PathItem) GetPatch() *Operation {
+ if x != nil {
+ return x.Patch
+ }
+ return nil
+}
+
+func (x *PathItem) GetTrace() *Operation {
+ if x != nil {
+ return x.Trace
+ }
+ return nil
+}
+
+func (x *PathItem) GetServers() []*Server {
+ if x != nil {
+ return x.Servers
+ }
+ return nil
+}
+
+func (x *PathItem) GetParameters() []*ParameterOrReference {
+ if x != nil {
+ return x.Parameters
+ }
+ return nil
+}
+
+func (x *PathItem) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+// Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the `Server Object` in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.
+type Paths struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Path []*NamedPathItem `protobuf:"bytes,1,rep,name=path,proto3" json:"path,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,2,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *Paths) Reset() {
+ *x = Paths{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[53]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Paths) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Paths) ProtoMessage() {}
+
+func (x *Paths) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[53]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Paths.ProtoReflect.Descriptor instead.
+func (*Paths) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{53}
+}
+
+func (x *Paths) GetPath() []*NamedPathItem {
+ if x != nil {
+ return x.Path
+ }
+ return nil
+}
+
+func (x *Paths) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+type Properties struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedSchemaOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *Properties) Reset() {
+ *x = Properties{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[54]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Properties) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Properties) ProtoMessage() {}
+
+func (x *Properties) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[54]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Properties.ProtoReflect.Descriptor instead.
+func (*Properties) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{54}
+}
+
+func (x *Properties) GetAdditionalProperties() []*NamedSchemaOrReference {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+// A simple object to allow referencing other components in the specification, internally and externally. The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules. For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.
+type Reference struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ XRef string `protobuf:"bytes,1,opt,name=_ref,json=Ref,proto3" json:"_ref,omitempty"`
+ Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"`
+ Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
+}
+
+func (x *Reference) Reset() {
+ *x = Reference{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[55]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Reference) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Reference) ProtoMessage() {}
+
+func (x *Reference) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[55]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Reference.ProtoReflect.Descriptor instead.
+func (*Reference) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{55}
+}
+
+func (x *Reference) GetXRef() string {
+ if x != nil {
+ return x.XRef
+ }
+ return ""
+}
+
+func (x *Reference) GetSummary() string {
+ if x != nil {
+ return x.Summary
+ }
+ return ""
+}
+
+func (x *Reference) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+type RequestBodiesOrReferences struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedRequestBodyOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *RequestBodiesOrReferences) Reset() {
+ *x = RequestBodiesOrReferences{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[56]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *RequestBodiesOrReferences) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*RequestBodiesOrReferences) ProtoMessage() {}
+
+func (x *RequestBodiesOrReferences) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[56]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use RequestBodiesOrReferences.ProtoReflect.Descriptor instead.
+func (*RequestBodiesOrReferences) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{56}
+}
+
+func (x *RequestBodiesOrReferences) GetAdditionalProperties() []*NamedRequestBodyOrReference {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+// Describes a single request body.
+type RequestBody struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"`
+ Content *MediaTypes `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"`
+ Required bool `protobuf:"varint,3,opt,name=required,proto3" json:"required,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,4,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *RequestBody) Reset() {
+ *x = RequestBody{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[57]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *RequestBody) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*RequestBody) ProtoMessage() {}
+
+func (x *RequestBody) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[57]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use RequestBody.ProtoReflect.Descriptor instead.
+func (*RequestBody) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{57}
+}
+
+func (x *RequestBody) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *RequestBody) GetContent() *MediaTypes {
+ if x != nil {
+ return x.Content
+ }
+ return nil
+}
+
+func (x *RequestBody) GetRequired() bool {
+ if x != nil {
+ return x.Required
+ }
+ return false
+}
+
+func (x *RequestBody) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+type RequestBodyOrReference struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *RequestBodyOrReference_RequestBody
+ // *RequestBodyOrReference_Reference
+ Oneof isRequestBodyOrReference_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *RequestBodyOrReference) Reset() {
+ *x = RequestBodyOrReference{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[58]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *RequestBodyOrReference) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*RequestBodyOrReference) ProtoMessage() {}
+
+func (x *RequestBodyOrReference) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[58]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use RequestBodyOrReference.ProtoReflect.Descriptor instead.
+func (*RequestBodyOrReference) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{58}
+}
+
+func (m *RequestBodyOrReference) GetOneof() isRequestBodyOrReference_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *RequestBodyOrReference) GetRequestBody() *RequestBody {
+ if x, ok := x.GetOneof().(*RequestBodyOrReference_RequestBody); ok {
+ return x.RequestBody
+ }
+ return nil
+}
+
+func (x *RequestBodyOrReference) GetReference() *Reference {
+ if x, ok := x.GetOneof().(*RequestBodyOrReference_Reference); ok {
+ return x.Reference
+ }
+ return nil
+}
+
+type isRequestBodyOrReference_Oneof interface {
+ isRequestBodyOrReference_Oneof()
+}
+
+type RequestBodyOrReference_RequestBody struct {
+ RequestBody *RequestBody `protobuf:"bytes,1,opt,name=request_body,json=requestBody,proto3,oneof"`
+}
+
+type RequestBodyOrReference_Reference struct {
+ Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"`
+}
+
+func (*RequestBodyOrReference_RequestBody) isRequestBodyOrReference_Oneof() {}
+
+func (*RequestBodyOrReference_Reference) isRequestBodyOrReference_Oneof() {}
+
+// Describes a single response from an API Operation, including design-time, static `links` to operations based on the response.
+type Response struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"`
+ Headers *HeadersOrReferences `protobuf:"bytes,2,opt,name=headers,proto3" json:"headers,omitempty"`
+ Content *MediaTypes `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"`
+ Links *LinksOrReferences `protobuf:"bytes,4,opt,name=links,proto3" json:"links,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,5,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *Response) Reset() {
+ *x = Response{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[59]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Response) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Response) ProtoMessage() {}
+
+func (x *Response) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[59]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Response.ProtoReflect.Descriptor instead.
+func (*Response) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{59}
+}
+
+func (x *Response) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Response) GetHeaders() *HeadersOrReferences {
+ if x != nil {
+ return x.Headers
+ }
+ return nil
+}
+
+func (x *Response) GetContent() *MediaTypes {
+ if x != nil {
+ return x.Content
+ }
+ return nil
+}
+
+func (x *Response) GetLinks() *LinksOrReferences {
+ if x != nil {
+ return x.Links
+ }
+ return nil
+}
+
+func (x *Response) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+type ResponseOrReference struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *ResponseOrReference_Response
+ // *ResponseOrReference_Reference
+ Oneof isResponseOrReference_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *ResponseOrReference) Reset() {
+ *x = ResponseOrReference{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[60]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ResponseOrReference) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ResponseOrReference) ProtoMessage() {}
+
+func (x *ResponseOrReference) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[60]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ResponseOrReference.ProtoReflect.Descriptor instead.
+func (*ResponseOrReference) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{60}
+}
+
+func (m *ResponseOrReference) GetOneof() isResponseOrReference_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *ResponseOrReference) GetResponse() *Response {
+ if x, ok := x.GetOneof().(*ResponseOrReference_Response); ok {
+ return x.Response
+ }
+ return nil
+}
+
+func (x *ResponseOrReference) GetReference() *Reference {
+ if x, ok := x.GetOneof().(*ResponseOrReference_Reference); ok {
+ return x.Reference
+ }
+ return nil
+}
+
+type isResponseOrReference_Oneof interface {
+ isResponseOrReference_Oneof()
+}
+
+type ResponseOrReference_Response struct {
+ Response *Response `protobuf:"bytes,1,opt,name=response,proto3,oneof"`
+}
+
+type ResponseOrReference_Reference struct {
+ Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"`
+}
+
+func (*ResponseOrReference_Response) isResponseOrReference_Oneof() {}
+
+func (*ResponseOrReference_Reference) isResponseOrReference_Oneof() {}
+
+// A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. However, documentation is expected to cover a successful operation response and any known errors. The `default` MAY be used as a default response object for all HTTP codes that are not covered individually by the specification. The `Responses Object` MUST contain at least one response code, and it SHOULD be the response for a successful operation call.
+type Responses struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Default *ResponseOrReference `protobuf:"bytes,1,opt,name=default,proto3" json:"default,omitempty"`
+ ResponseOrReference []*NamedResponseOrReference `protobuf:"bytes,2,rep,name=response_or_reference,json=responseOrReference,proto3" json:"response_or_reference,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,3,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *Responses) Reset() {
+ *x = Responses{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[61]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Responses) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Responses) ProtoMessage() {}
+
+func (x *Responses) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[61]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Responses.ProtoReflect.Descriptor instead.
+func (*Responses) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{61}
+}
+
+func (x *Responses) GetDefault() *ResponseOrReference {
+ if x != nil {
+ return x.Default
+ }
+ return nil
+}
+
+func (x *Responses) GetResponseOrReference() []*NamedResponseOrReference {
+ if x != nil {
+ return x.ResponseOrReference
+ }
+ return nil
+}
+
+func (x *Responses) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+type ResponsesOrReferences struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedResponseOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *ResponsesOrReferences) Reset() {
+ *x = ResponsesOrReferences{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[62]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ResponsesOrReferences) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ResponsesOrReferences) ProtoMessage() {}
+
+func (x *ResponsesOrReferences) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[62]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ResponsesOrReferences.ProtoReflect.Descriptor instead.
+func (*ResponsesOrReferences) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{62}
+}
+
+func (x *ResponsesOrReferences) GetAdditionalProperties() []*NamedResponseOrReference {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+// The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is an extended subset of the JSON Schema Specification Wright Draft 00. For more information about the properties, see JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema.
+type Schema struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Nullable bool `protobuf:"varint,1,opt,name=nullable,proto3" json:"nullable,omitempty"`
+ Discriminator *Discriminator `protobuf:"bytes,2,opt,name=discriminator,proto3" json:"discriminator,omitempty"`
+ ReadOnly bool `protobuf:"varint,3,opt,name=read_only,json=readOnly,proto3" json:"read_only,omitempty"`
+ WriteOnly bool `protobuf:"varint,4,opt,name=write_only,json=writeOnly,proto3" json:"write_only,omitempty"`
+ Xml *Xml `protobuf:"bytes,5,opt,name=xml,proto3" json:"xml,omitempty"`
+ ExternalDocs *ExternalDocs `protobuf:"bytes,6,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"`
+ Example *Any `protobuf:"bytes,7,opt,name=example,proto3" json:"example,omitempty"`
+ Deprecated bool `protobuf:"varint,8,opt,name=deprecated,proto3" json:"deprecated,omitempty"`
+ Title string `protobuf:"bytes,9,opt,name=title,proto3" json:"title,omitempty"`
+ MultipleOf float64 `protobuf:"fixed64,10,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"`
+ Maximum float64 `protobuf:"fixed64,11,opt,name=maximum,proto3" json:"maximum,omitempty"`
+ ExclusiveMaximum bool `protobuf:"varint,12,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"`
+ Minimum float64 `protobuf:"fixed64,13,opt,name=minimum,proto3" json:"minimum,omitempty"`
+ ExclusiveMinimum bool `protobuf:"varint,14,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"`
+ MaxLength int64 `protobuf:"varint,15,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"`
+ MinLength int64 `protobuf:"varint,16,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"`
+ Pattern string `protobuf:"bytes,17,opt,name=pattern,proto3" json:"pattern,omitempty"`
+ MaxItems int64 `protobuf:"varint,18,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"`
+ MinItems int64 `protobuf:"varint,19,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"`
+ UniqueItems bool `protobuf:"varint,20,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"`
+ MaxProperties int64 `protobuf:"varint,21,opt,name=max_properties,json=maxProperties,proto3" json:"max_properties,omitempty"`
+ MinProperties int64 `protobuf:"varint,22,opt,name=min_properties,json=minProperties,proto3" json:"min_properties,omitempty"`
+ Required []string `protobuf:"bytes,23,rep,name=required,proto3" json:"required,omitempty"`
+ Enum []*Any `protobuf:"bytes,24,rep,name=enum,proto3" json:"enum,omitempty"`
+ Type string `protobuf:"bytes,25,opt,name=type,proto3" json:"type,omitempty"`
+ AllOf []*SchemaOrReference `protobuf:"bytes,26,rep,name=all_of,json=allOf,proto3" json:"all_of,omitempty"`
+ OneOf []*SchemaOrReference `protobuf:"bytes,27,rep,name=one_of,json=oneOf,proto3" json:"one_of,omitempty"`
+ AnyOf []*SchemaOrReference `protobuf:"bytes,28,rep,name=any_of,json=anyOf,proto3" json:"any_of,omitempty"`
+ Not *Schema `protobuf:"bytes,29,opt,name=not,proto3" json:"not,omitempty"`
+ Items *ItemsItem `protobuf:"bytes,30,opt,name=items,proto3" json:"items,omitempty"`
+ Properties *Properties `protobuf:"bytes,31,opt,name=properties,proto3" json:"properties,omitempty"`
+ AdditionalProperties *AdditionalPropertiesItem `protobuf:"bytes,32,opt,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+ Default *DefaultType `protobuf:"bytes,33,opt,name=default,proto3" json:"default,omitempty"`
+ Description string `protobuf:"bytes,34,opt,name=description,proto3" json:"description,omitempty"`
+ Format string `protobuf:"bytes,35,opt,name=format,proto3" json:"format,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,36,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *Schema) Reset() {
+ *x = Schema{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[63]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Schema) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Schema) ProtoMessage() {}
+
+func (x *Schema) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[63]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Schema.ProtoReflect.Descriptor instead.
+func (*Schema) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{63}
+}
+
+func (x *Schema) GetNullable() bool {
+ if x != nil {
+ return x.Nullable
+ }
+ return false
+}
+
+func (x *Schema) GetDiscriminator() *Discriminator {
+ if x != nil {
+ return x.Discriminator
+ }
+ return nil
+}
+
+func (x *Schema) GetReadOnly() bool {
+ if x != nil {
+ return x.ReadOnly
+ }
+ return false
+}
+
+func (x *Schema) GetWriteOnly() bool {
+ if x != nil {
+ return x.WriteOnly
+ }
+ return false
+}
+
+func (x *Schema) GetXml() *Xml {
+ if x != nil {
+ return x.Xml
+ }
+ return nil
+}
+
+func (x *Schema) GetExternalDocs() *ExternalDocs {
+ if x != nil {
+ return x.ExternalDocs
+ }
+ return nil
+}
+
+func (x *Schema) GetExample() *Any {
+ if x != nil {
+ return x.Example
+ }
+ return nil
+}
+
+func (x *Schema) GetDeprecated() bool {
+ if x != nil {
+ return x.Deprecated
+ }
+ return false
+}
+
+func (x *Schema) GetTitle() string {
+ if x != nil {
+ return x.Title
+ }
+ return ""
+}
+
+func (x *Schema) GetMultipleOf() float64 {
+ if x != nil {
+ return x.MultipleOf
+ }
+ return 0
+}
+
+func (x *Schema) GetMaximum() float64 {
+ if x != nil {
+ return x.Maximum
+ }
+ return 0
+}
+
+func (x *Schema) GetExclusiveMaximum() bool {
+ if x != nil {
+ return x.ExclusiveMaximum
+ }
+ return false
+}
+
+func (x *Schema) GetMinimum() float64 {
+ if x != nil {
+ return x.Minimum
+ }
+ return 0
+}
+
+func (x *Schema) GetExclusiveMinimum() bool {
+ if x != nil {
+ return x.ExclusiveMinimum
+ }
+ return false
+}
+
+func (x *Schema) GetMaxLength() int64 {
+ if x != nil {
+ return x.MaxLength
+ }
+ return 0
+}
+
+func (x *Schema) GetMinLength() int64 {
+ if x != nil {
+ return x.MinLength
+ }
+ return 0
+}
+
+func (x *Schema) GetPattern() string {
+ if x != nil {
+ return x.Pattern
+ }
+ return ""
+}
+
+func (x *Schema) GetMaxItems() int64 {
+ if x != nil {
+ return x.MaxItems
+ }
+ return 0
+}
+
+func (x *Schema) GetMinItems() int64 {
+ if x != nil {
+ return x.MinItems
+ }
+ return 0
+}
+
+func (x *Schema) GetUniqueItems() bool {
+ if x != nil {
+ return x.UniqueItems
+ }
+ return false
+}
+
+func (x *Schema) GetMaxProperties() int64 {
+ if x != nil {
+ return x.MaxProperties
+ }
+ return 0
+}
+
+func (x *Schema) GetMinProperties() int64 {
+ if x != nil {
+ return x.MinProperties
+ }
+ return 0
+}
+
+func (x *Schema) GetRequired() []string {
+ if x != nil {
+ return x.Required
+ }
+ return nil
+}
+
+func (x *Schema) GetEnum() []*Any {
+ if x != nil {
+ return x.Enum
+ }
+ return nil
+}
+
+func (x *Schema) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *Schema) GetAllOf() []*SchemaOrReference {
+ if x != nil {
+ return x.AllOf
+ }
+ return nil
+}
+
+func (x *Schema) GetOneOf() []*SchemaOrReference {
+ if x != nil {
+ return x.OneOf
+ }
+ return nil
+}
+
+func (x *Schema) GetAnyOf() []*SchemaOrReference {
+ if x != nil {
+ return x.AnyOf
+ }
+ return nil
+}
+
+func (x *Schema) GetNot() *Schema {
+ if x != nil {
+ return x.Not
+ }
+ return nil
+}
+
+func (x *Schema) GetItems() *ItemsItem {
+ if x != nil {
+ return x.Items
+ }
+ return nil
+}
+
+func (x *Schema) GetProperties() *Properties {
+ if x != nil {
+ return x.Properties
+ }
+ return nil
+}
+
+func (x *Schema) GetAdditionalProperties() *AdditionalPropertiesItem {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+func (x *Schema) GetDefault() *DefaultType {
+ if x != nil {
+ return x.Default
+ }
+ return nil
+}
+
+func (x *Schema) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Schema) GetFormat() string {
+ if x != nil {
+ return x.Format
+ }
+ return ""
+}
+
+func (x *Schema) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+type SchemaOrReference struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *SchemaOrReference_Schema
+ // *SchemaOrReference_Reference
+ Oneof isSchemaOrReference_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *SchemaOrReference) Reset() {
+ *x = SchemaOrReference{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[64]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SchemaOrReference) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SchemaOrReference) ProtoMessage() {}
+
+func (x *SchemaOrReference) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[64]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SchemaOrReference.ProtoReflect.Descriptor instead.
+func (*SchemaOrReference) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{64}
+}
+
+func (m *SchemaOrReference) GetOneof() isSchemaOrReference_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *SchemaOrReference) GetSchema() *Schema {
+ if x, ok := x.GetOneof().(*SchemaOrReference_Schema); ok {
+ return x.Schema
+ }
+ return nil
+}
+
+func (x *SchemaOrReference) GetReference() *Reference {
+ if x, ok := x.GetOneof().(*SchemaOrReference_Reference); ok {
+ return x.Reference
+ }
+ return nil
+}
+
+type isSchemaOrReference_Oneof interface {
+ isSchemaOrReference_Oneof()
+}
+
+type SchemaOrReference_Schema struct {
+ Schema *Schema `protobuf:"bytes,1,opt,name=schema,proto3,oneof"`
+}
+
+type SchemaOrReference_Reference struct {
+ Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"`
+}
+
+func (*SchemaOrReference_Schema) isSchemaOrReference_Oneof() {}
+
+func (*SchemaOrReference_Reference) isSchemaOrReference_Oneof() {}
+
+type SchemasOrReferences struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedSchemaOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *SchemasOrReferences) Reset() {
+ *x = SchemasOrReferences{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[65]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SchemasOrReferences) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SchemasOrReferences) ProtoMessage() {}
+
+func (x *SchemasOrReferences) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[65]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SchemasOrReferences.ProtoReflect.Descriptor instead.
+func (*SchemasOrReferences) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{65}
+}
+
+func (x *SchemasOrReferences) GetAdditionalProperties() []*NamedSchemaOrReference {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+// Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object. Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information. When a list of Security Requirement Objects is defined on the OpenAPI Object or Operation Object, only one of the Security Requirement Objects in the list needs to be satisfied to authorize the request.
+type SecurityRequirement struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedStringArray `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *SecurityRequirement) Reset() {
+ *x = SecurityRequirement{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[66]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SecurityRequirement) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SecurityRequirement) ProtoMessage() {}
+
+func (x *SecurityRequirement) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[66]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SecurityRequirement.ProtoReflect.Descriptor instead.
+func (*SecurityRequirement) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{66}
+}
+
+func (x *SecurityRequirement) GetAdditionalProperties() []*NamedStringArray {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+// Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header, a cookie parameter or as a query parameter), mutual TLS (use of a client certificate), OAuth2's common flows (implicit, password, application and access code) as defined in RFC6749, and OpenID Connect. Please note that currently (2019) the implicit flow is about to be deprecated OAuth 2.0 Security Best Current Practice. Recommended for most use case is Authorization Code Grant flow with PKCE.
+type SecurityScheme struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
+ Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
+ Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
+ In string `protobuf:"bytes,4,opt,name=in,proto3" json:"in,omitempty"`
+ Scheme string `protobuf:"bytes,5,opt,name=scheme,proto3" json:"scheme,omitempty"`
+ BearerFormat string `protobuf:"bytes,6,opt,name=bearer_format,json=bearerFormat,proto3" json:"bearer_format,omitempty"`
+ Flows *OauthFlows `protobuf:"bytes,7,opt,name=flows,proto3" json:"flows,omitempty"`
+ OpenIdConnectUrl string `protobuf:"bytes,8,opt,name=open_id_connect_url,json=openIdConnectUrl,proto3" json:"open_id_connect_url,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,9,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *SecurityScheme) Reset() {
+ *x = SecurityScheme{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[67]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SecurityScheme) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SecurityScheme) ProtoMessage() {}
+
+func (x *SecurityScheme) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[67]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SecurityScheme.ProtoReflect.Descriptor instead.
+func (*SecurityScheme) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{67}
+}
+
+func (x *SecurityScheme) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *SecurityScheme) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *SecurityScheme) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *SecurityScheme) GetIn() string {
+ if x != nil {
+ return x.In
+ }
+ return ""
+}
+
+func (x *SecurityScheme) GetScheme() string {
+ if x != nil {
+ return x.Scheme
+ }
+ return ""
+}
+
+func (x *SecurityScheme) GetBearerFormat() string {
+ if x != nil {
+ return x.BearerFormat
+ }
+ return ""
+}
+
+func (x *SecurityScheme) GetFlows() *OauthFlows {
+ if x != nil {
+ return x.Flows
+ }
+ return nil
+}
+
+func (x *SecurityScheme) GetOpenIdConnectUrl() string {
+ if x != nil {
+ return x.OpenIdConnectUrl
+ }
+ return ""
+}
+
+func (x *SecurityScheme) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+type SecuritySchemeOrReference struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *SecuritySchemeOrReference_SecurityScheme
+ // *SecuritySchemeOrReference_Reference
+ Oneof isSecuritySchemeOrReference_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *SecuritySchemeOrReference) Reset() {
+ *x = SecuritySchemeOrReference{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[68]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SecuritySchemeOrReference) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SecuritySchemeOrReference) ProtoMessage() {}
+
+func (x *SecuritySchemeOrReference) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[68]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SecuritySchemeOrReference.ProtoReflect.Descriptor instead.
+func (*SecuritySchemeOrReference) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{68}
+}
+
+func (m *SecuritySchemeOrReference) GetOneof() isSecuritySchemeOrReference_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *SecuritySchemeOrReference) GetSecurityScheme() *SecurityScheme {
+ if x, ok := x.GetOneof().(*SecuritySchemeOrReference_SecurityScheme); ok {
+ return x.SecurityScheme
+ }
+ return nil
+}
+
+func (x *SecuritySchemeOrReference) GetReference() *Reference {
+ if x, ok := x.GetOneof().(*SecuritySchemeOrReference_Reference); ok {
+ return x.Reference
+ }
+ return nil
+}
+
+type isSecuritySchemeOrReference_Oneof interface {
+ isSecuritySchemeOrReference_Oneof()
+}
+
+type SecuritySchemeOrReference_SecurityScheme struct {
+ SecurityScheme *SecurityScheme `protobuf:"bytes,1,opt,name=security_scheme,json=securityScheme,proto3,oneof"`
+}
+
+type SecuritySchemeOrReference_Reference struct {
+ Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"`
+}
+
+func (*SecuritySchemeOrReference_SecurityScheme) isSecuritySchemeOrReference_Oneof() {}
+
+func (*SecuritySchemeOrReference_Reference) isSecuritySchemeOrReference_Oneof() {}
+
+type SecuritySchemesOrReferences struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedSecuritySchemeOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *SecuritySchemesOrReferences) Reset() {
+ *x = SecuritySchemesOrReferences{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[69]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SecuritySchemesOrReferences) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SecuritySchemesOrReferences) ProtoMessage() {}
+
+func (x *SecuritySchemesOrReferences) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[69]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SecuritySchemesOrReferences.ProtoReflect.Descriptor instead.
+func (*SecuritySchemesOrReferences) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{69}
+}
+
+func (x *SecuritySchemesOrReferences) GetAdditionalProperties() []*NamedSecuritySchemeOrReference {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+// An object representing a Server.
+type Server struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
+ Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
+ Variables *ServerVariables `protobuf:"bytes,3,opt,name=variables,proto3" json:"variables,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,4,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *Server) Reset() {
+ *x = Server{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[70]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Server) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Server) ProtoMessage() {}
+
+func (x *Server) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[70]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Server.ProtoReflect.Descriptor instead.
+func (*Server) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{70}
+}
+
+func (x *Server) GetUrl() string {
+ if x != nil {
+ return x.Url
+ }
+ return ""
+}
+
+func (x *Server) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Server) GetVariables() *ServerVariables {
+ if x != nil {
+ return x.Variables
+ }
+ return nil
+}
+
+func (x *Server) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+// An object representing a Server Variable for server URL template substitution.
+type ServerVariable struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Enum []string `protobuf:"bytes,1,rep,name=enum,proto3" json:"enum,omitempty"`
+ Default string `protobuf:"bytes,2,opt,name=default,proto3" json:"default,omitempty"`
+ Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,4,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *ServerVariable) Reset() {
+ *x = ServerVariable{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[71]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ServerVariable) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ServerVariable) ProtoMessage() {}
+
+func (x *ServerVariable) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[71]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ServerVariable.ProtoReflect.Descriptor instead.
+func (*ServerVariable) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{71}
+}
+
+func (x *ServerVariable) GetEnum() []string {
+ if x != nil {
+ return x.Enum
+ }
+ return nil
+}
+
+func (x *ServerVariable) GetDefault() string {
+ if x != nil {
+ return x.Default
+ }
+ return ""
+}
+
+func (x *ServerVariable) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *ServerVariable) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+type ServerVariables struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedServerVariable `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *ServerVariables) Reset() {
+ *x = ServerVariables{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[72]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ServerVariables) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ServerVariables) ProtoMessage() {}
+
+func (x *ServerVariables) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[72]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ServerVariables.ProtoReflect.Descriptor instead.
+func (*ServerVariables) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{72}
+}
+
+func (x *ServerVariables) GetAdditionalProperties() []*NamedServerVariable {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+// Any property starting with x- is valid.
+type SpecificationExtension struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *SpecificationExtension_Number
+ // *SpecificationExtension_Boolean
+ // *SpecificationExtension_String_
+ Oneof isSpecificationExtension_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *SpecificationExtension) Reset() {
+ *x = SpecificationExtension{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[73]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SpecificationExtension) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SpecificationExtension) ProtoMessage() {}
+
+func (x *SpecificationExtension) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[73]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SpecificationExtension.ProtoReflect.Descriptor instead.
+func (*SpecificationExtension) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{73}
+}
+
+func (m *SpecificationExtension) GetOneof() isSpecificationExtension_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *SpecificationExtension) GetNumber() float64 {
+ if x, ok := x.GetOneof().(*SpecificationExtension_Number); ok {
+ return x.Number
+ }
+ return 0
+}
+
+func (x *SpecificationExtension) GetBoolean() bool {
+ if x, ok := x.GetOneof().(*SpecificationExtension_Boolean); ok {
+ return x.Boolean
+ }
+ return false
+}
+
+func (x *SpecificationExtension) GetString_() string {
+ if x, ok := x.GetOneof().(*SpecificationExtension_String_); ok {
+ return x.String_
+ }
+ return ""
+}
+
+type isSpecificationExtension_Oneof interface {
+ isSpecificationExtension_Oneof()
+}
+
+type SpecificationExtension_Number struct {
+ Number float64 `protobuf:"fixed64,1,opt,name=number,proto3,oneof"`
+}
+
+type SpecificationExtension_Boolean struct {
+ Boolean bool `protobuf:"varint,2,opt,name=boolean,proto3,oneof"`
+}
+
+type SpecificationExtension_String_ struct {
+ String_ string `protobuf:"bytes,3,opt,name=string,proto3,oneof"`
+}
+
+func (*SpecificationExtension_Number) isSpecificationExtension_Oneof() {}
+
+func (*SpecificationExtension_Boolean) isSpecificationExtension_Oneof() {}
+
+func (*SpecificationExtension_String_) isSpecificationExtension_Oneof() {}
+
+type StringArray struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Value []string `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *StringArray) Reset() {
+ *x = StringArray{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[74]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *StringArray) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*StringArray) ProtoMessage() {}
+
+func (x *StringArray) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[74]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use StringArray.ProtoReflect.Descriptor instead.
+func (*StringArray) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{74}
+}
+
+func (x *StringArray) GetValue() []string {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+type Strings struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedString `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *Strings) Reset() {
+ *x = Strings{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[75]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Strings) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Strings) ProtoMessage() {}
+
+func (x *Strings) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[75]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Strings.ProtoReflect.Descriptor instead.
+func (*Strings) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{75}
+}
+
+func (x *Strings) GetAdditionalProperties() []*NamedString {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+// Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.
+type Tag struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
+ ExternalDocs *ExternalDocs `protobuf:"bytes,3,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,4,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *Tag) Reset() {
+ *x = Tag{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[76]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Tag) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Tag) ProtoMessage() {}
+
+func (x *Tag) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[76]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Tag.ProtoReflect.Descriptor instead.
+func (*Tag) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{76}
+}
+
+func (x *Tag) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *Tag) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Tag) GetExternalDocs() *ExternalDocs {
+ if x != nil {
+ return x.ExternalDocs
+ }
+ return nil
+}
+
+func (x *Tag) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+// A metadata object that allows for more fine-tuned XML model definitions. When using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property SHOULD be used to add that information. See examples for expected behavior.
+type Xml struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"`
+ Prefix string `protobuf:"bytes,3,opt,name=prefix,proto3" json:"prefix,omitempty"`
+ Attribute bool `protobuf:"varint,4,opt,name=attribute,proto3" json:"attribute,omitempty"`
+ Wrapped bool `protobuf:"varint,5,opt,name=wrapped,proto3" json:"wrapped,omitempty"`
+ SpecificationExtension []*NamedAny `protobuf:"bytes,6,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"`
+}
+
+func (x *Xml) Reset() {
+ *x = Xml{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[77]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Xml) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Xml) ProtoMessage() {}
+
+func (x *Xml) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[77]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Xml.ProtoReflect.Descriptor instead.
+func (*Xml) Descriptor() ([]byte, []int) {
+ return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{77}
+}
+
+func (x *Xml) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *Xml) GetNamespace() string {
+ if x != nil {
+ return x.Namespace
+ }
+ return ""
+}
+
+func (x *Xml) GetPrefix() string {
+ if x != nil {
+ return x.Prefix
+ }
+ return ""
+}
+
+func (x *Xml) GetAttribute() bool {
+ if x != nil {
+ return x.Attribute
+ }
+ return false
+}
+
+func (x *Xml) GetWrapped() bool {
+ if x != nil {
+ return x.Wrapped
+ }
+ return false
+}
+
+func (x *Xml) GetSpecificationExtension() []*NamedAny {
+ if x != nil {
+ return x.SpecificationExtension
+ }
+ return nil
+}
+
+var File_openapiv3_OpenAPIv3_proto protoreflect.FileDescriptor
+
+var file_openapiv3_OpenAPIv3_proto_rawDesc = []byte{
+ 0x0a, 0x19, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x33, 0x2f, 0x4f, 0x70, 0x65, 0x6e,
+ 0x41, 0x50, 0x49, 0x76, 0x33, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f,
+ 0x74, 0x6f, 0x22, 0x90, 0x01, 0x0a, 0x18, 0x41, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61,
+ 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12,
+ 0x4f, 0x0a, 0x13, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, 0x5f, 0x72, 0x65, 0x66,
+ 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f,
+ 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61,
+ 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x11, 0x73,
+ 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65,
+ 0x12, 0x1a, 0x0a, 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28,
+ 0x08, 0x48, 0x00, 0x52, 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x42, 0x07, 0x0a, 0x05,
+ 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x45, 0x0a, 0x03, 0x41, 0x6e, 0x79, 0x12, 0x2a, 0x0a, 0x05,
+ 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f,
+ 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e,
+ 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x79, 0x61, 0x6d, 0x6c,
+ 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x22, 0x79, 0x0a, 0x0f,
+ 0x41, 0x6e, 0x79, 0x4f, 0x72, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12,
+ 0x23, 0x0a, 0x03, 0x61, 0x6e, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f,
+ 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, 0x79, 0x48, 0x00, 0x52,
+ 0x03, 0x61, 0x6e, 0x79, 0x12, 0x38, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69,
+ 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e,
+ 0x48, 0x00, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x07,
+ 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x88, 0x01, 0x0a, 0x08, 0x43, 0x61, 0x6c, 0x6c,
+ 0x62, 0x61, 0x63, 0x6b, 0x12, 0x2d, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03,
+ 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e,
+ 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x04, 0x70,
+ 0x61, 0x74, 0x68, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02,
+ 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76,
+ 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63,
+ 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69,
+ 0x6f, 0x6e, 0x22, 0x89, 0x01, 0x0a, 0x13, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x4f,
+ 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x32, 0x0a, 0x08, 0x63, 0x61,
+ 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f,
+ 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61,
+ 0x63, 0x6b, 0x48, 0x00, 0x52, 0x08, 0x63, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x12, 0x35,
+ 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52,
+ 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65,
+ 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x72,
+ 0x0a, 0x15, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66,
+ 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x59, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74,
+ 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73,
+ 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63,
+ 0x6b, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x14, 0x61, 0x64,
+ 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69,
+ 0x65, 0x73, 0x22, 0xac, 0x05, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74,
+ 0x73, 0x12, 0x39, 0x0a, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e,
+ 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e,
+ 0x63, 0x65, 0x73, 0x52, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x12, 0x3f, 0x0a, 0x09,
+ 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x21, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x73,
+ 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63,
+ 0x65, 0x73, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x12, 0x42, 0x0a,
+ 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x50,
+ 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72,
+ 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72,
+ 0x73, 0x12, 0x3c, 0x0a, 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20,
+ 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33,
+ 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72,
+ 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x12,
+ 0x4c, 0x0a, 0x0e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x6f, 0x64, 0x69, 0x65,
+ 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x69,
+ 0x65, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x0d,
+ 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x69, 0x65, 0x73, 0x12, 0x39, 0x0a,
+ 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x64,
+ 0x65, 0x72, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52,
+ 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x52, 0x0a, 0x10, 0x73, 0x65, 0x63, 0x75,
+ 0x72, 0x69, 0x74, 0x79, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e,
+ 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x4f,
+ 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x0f, 0x73, 0x65, 0x63,
+ 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x12, 0x33, 0x0a, 0x05,
+ 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4c, 0x69, 0x6e, 0x6b, 0x73, 0x4f, 0x72,
+ 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x05, 0x6c, 0x69, 0x6e, 0x6b,
+ 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x63, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x73, 0x18, 0x09,
+ 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76,
+ 0x33, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66,
+ 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x09, 0x63, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63,
+ 0x6b, 0x73, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
+ 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20,
+ 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33,
+ 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69,
+ 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f,
+ 0x6e, 0x22, 0x94, 0x01, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x12, 0x0a,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,
+ 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
+ 0x75, 0x72, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65,
+ 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e,
+ 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79,
+ 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45,
+ 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x66, 0x0a, 0x0b, 0x44, 0x65, 0x66, 0x61,
+ 0x75, 0x6c, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65,
+ 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65,
+ 0x72, 0x12, 0x1a, 0x0a, 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x08, 0x48, 0x00, 0x52, 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x12, 0x18, 0x0a,
+ 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52,
+ 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66,
+ 0x22, 0xb2, 0x01, 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74,
+ 0x6f, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x5f, 0x6e,
+ 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x70, 0x65,
+ 0x72, 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2d, 0x0a, 0x07, 0x6d, 0x61, 0x70, 0x70, 0x69,
+ 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x07, 0x6d,
+ 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66,
+ 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f,
+ 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73,
+ 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65,
+ 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xc9, 0x03, 0x0a, 0x08, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65,
+ 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x18, 0x01, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x12, 0x24, 0x0a, 0x04,
+ 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e,
+ 0x66, 0x6f, 0x12, 0x2c, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20,
+ 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33,
+ 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73,
+ 0x12, 0x27, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x11, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x61, 0x74,
+ 0x68, 0x73, 0x52, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x12, 0x36, 0x0a, 0x0a, 0x63, 0x6f, 0x6d,
+ 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e,
+ 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f,
+ 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74,
+ 0x73, 0x12, 0x3b, 0x0a, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x06, 0x20,
+ 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33,
+ 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65,
+ 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x23,
+ 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f,
+ 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x54, 0x61, 0x67, 0x52, 0x04, 0x74,
+ 0x61, 0x67, 0x73, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f,
+ 0x64, 0x6f, 0x63, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c,
+ 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f,
+ 0x63, 0x73, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
+ 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20,
+ 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33,
+ 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69,
+ 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f,
+ 0x6e, 0x22, 0x8e, 0x02, 0x0a, 0x08, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x21,
+ 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70,
+ 0x65, 0x12, 0x39, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e,
+ 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e,
+ 0x63, 0x65, 0x73, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x14, 0x0a, 0x05,
+ 0x73, 0x74, 0x79, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x79,
+ 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20,
+ 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x64, 0x65, 0x12, 0x25, 0x0a, 0x0e,
+ 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x18, 0x05,
+ 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x73, 0x65, 0x72,
+ 0x76, 0x65, 0x64, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06,
+ 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76,
+ 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63,
+ 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69,
+ 0x6f, 0x6e, 0x22, 0x5b, 0x0a, 0x09, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x12,
+ 0x4e, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72,
+ 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65,
+ 0x64, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74,
+ 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22,
+ 0xe2, 0x01, 0x0a, 0x07, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73,
+ 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75,
+ 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,
+ 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63,
+ 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
+ 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x25,
+ 0x0a, 0x0e, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65,
+ 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c,
+ 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69,
+ 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e,
+ 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70,
+ 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e,
+ 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x85, 0x01, 0x0a, 0x12, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65,
+ 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x2f, 0x0a, 0x07, 0x65,
+ 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f,
+ 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c,
+ 0x65, 0x48, 0x00, 0x52, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x35, 0x0a, 0x09,
+ 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x66,
+ 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65,
+ 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x70, 0x0a, 0x14,
+ 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65,
+ 0x6e, 0x63, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e,
+ 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20,
+ 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33,
+ 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x4f, 0x72, 0x52,
+ 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69,
+ 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x57,
+ 0x0a, 0x0a, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x49, 0x0a, 0x15,
+ 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65,
+ 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e,
+ 0x79, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f,
+ 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x91, 0x01, 0x0a, 0x0c, 0x45, 0x78, 0x74, 0x65,
+ 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63,
+ 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64,
+ 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72,
+ 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x4d, 0x0a, 0x17,
+ 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78,
+ 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e,
+ 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64,
+ 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69,
+ 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x8a, 0x04, 0x0a, 0x06,
+ 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
+ 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73,
+ 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75,
+ 0x69, 0x72, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75,
+ 0x69, 0x72, 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74,
+ 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63,
+ 0x61, 0x74, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x65, 0x6d,
+ 0x70, 0x74, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52,
+ 0x0f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65,
+ 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x05, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x64,
+ 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x64, 0x65,
+ 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76,
+ 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x52,
+ 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x35, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d,
+ 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66,
+ 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x29,
+ 0x0a, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, 0x79,
+ 0x52, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x3c, 0x0a, 0x08, 0x65, 0x78, 0x61,
+ 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65,
+ 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x08, 0x65,
+ 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x12, 0x30, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65,
+ 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x73,
+ 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65,
+ 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e,
+ 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79,
+ 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45,
+ 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x81, 0x01, 0x0a, 0x11, 0x48, 0x65, 0x61,
+ 0x64, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x2c,
+ 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x64,
+ 0x65, 0x72, 0x48, 0x00, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x35, 0x0a, 0x09,
+ 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x66,
+ 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65,
+ 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x6e, 0x0a, 0x13,
+ 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e,
+ 0x63, 0x65, 0x73, 0x12, 0x57, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61,
+ 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03,
+ 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e,
+ 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66,
+ 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e,
+ 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xc9, 0x02, 0x0a,
+ 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64,
+ 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a,
+ 0x10, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x5f, 0x6f, 0x66, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,
+ 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x4f, 0x66,
+ 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x2d, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x61,
+ 0x63, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x52, 0x07, 0x63,
+ 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x2d, 0x0a, 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73,
+ 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x52, 0x07, 0x6c, 0x69,
+ 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
+ 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12,
+ 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
+ 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b,
+ 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61,
+ 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63,
+ 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18,
+ 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x22, 0x5a, 0x0a, 0x09, 0x49, 0x74, 0x65, 0x6d,
+ 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x4d, 0x0a, 0x13, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f,
+ 0x6f, 0x72, 0x5f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x03,
+ 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e,
+ 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63,
+ 0x65, 0x52, 0x11, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72,
+ 0x65, 0x6e, 0x63, 0x65, 0x22, 0x7e, 0x0a, 0x07, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12,
+ 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
+ 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69,
+ 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e,
+ 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70,
+ 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e,
+ 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xe8, 0x02, 0x0a, 0x04, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x23, 0x0a,
+ 0x0d, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52,
+ 0x65, 0x66, 0x12, 0x21, 0x0a, 0x0c, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f,
+ 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74,
+ 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x3b, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74,
+ 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, 0x79, 0x4f, 0x72, 0x45, 0x78, 0x70, 0x72,
+ 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65,
+ 0x72, 0x73, 0x12, 0x3e, 0x0a, 0x0c, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x6f,
+ 0x64, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, 0x79, 0x4f, 0x72, 0x45, 0x78, 0x70, 0x72, 0x65,
+ 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f,
+ 0x64, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
+ 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,
+ 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x06,
+ 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76,
+ 0x33, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
+ 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
+ 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28,
+ 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e,
+ 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69,
+ 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22,
+ 0x79, 0x0a, 0x0f, 0x4c, 0x69, 0x6e, 0x6b, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e,
+ 0x63, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
+ 0x32, 0x10, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4c, 0x69,
+ 0x6e, 0x6b, 0x48, 0x00, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x12, 0x35, 0x0a, 0x09, 0x72, 0x65,
+ 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e,
+ 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72,
+ 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63,
+ 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x6a, 0x0a, 0x11, 0x4c, 0x69,
+ 0x6e, 0x6b, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12,
+ 0x55, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72,
+ 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65,
+ 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65,
+ 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70,
+ 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xad, 0x02, 0x0a, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61,
+ 0x54, 0x79, 0x70, 0x65, 0x12, 0x35, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76,
+ 0x33, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65,
+ 0x6e, 0x63, 0x65, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x29, 0x0a, 0x07, 0x65,
+ 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f,
+ 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x65,
+ 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x3c, 0x0a, 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c,
+ 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x4f, 0x72,
+ 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x08, 0x65, 0x78, 0x61, 0x6d,
+ 0x70, 0x6c, 0x65, 0x73, 0x12, 0x31, 0x0a, 0x08, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67,
+ 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x08, 0x65,
+ 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69,
+ 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69,
+ 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16,
+ 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74,
+ 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x5d, 0x0a, 0x0a, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54,
+ 0x79, 0x70, 0x65, 0x73, 0x12, 0x4f, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e,
+ 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20,
+ 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33,
+ 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x52,
+ 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65,
+ 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x45, 0x0a, 0x08, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e,
+ 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x25, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02,
+ 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76,
+ 0x33, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x65, 0x0a, 0x18,
+ 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x4f, 0x72, 0x52,
+ 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x05,
+ 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63,
+ 0x6b, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x76, 0x61,
+ 0x6c, 0x75, 0x65, 0x22, 0x4f, 0x0a, 0x0d, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x45, 0x6e, 0x63, 0x6f,
+ 0x64, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,
+ 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x05, 0x76,
+ 0x61, 0x6c, 0x75, 0x65, 0x22, 0x63, 0x0a, 0x17, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x45, 0x78, 0x61,
+ 0x6d, 0x70, 0x6c, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12,
+ 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
+ 0x61, 0x6d, 0x65, 0x12, 0x34, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e,
+ 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e,
+ 0x63, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x61, 0x0a, 0x16, 0x4e, 0x61, 0x6d,
+ 0x65, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65,
+ 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x33, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
+ 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65,
+ 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x5d, 0x0a, 0x14,
+ 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72,
+ 0x65, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x31, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,
+ 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4c, 0x69, 0x6e, 0x6b, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72,
+ 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x51, 0x0a, 0x0e, 0x4e,
+ 0x61, 0x6d, 0x65, 0x64, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,
+ 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
+ 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65,
+ 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x67,
+ 0x0a, 0x19, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72,
+ 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e,
+ 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
+ 0x36, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x61, 0x72, 0x61,
+ 0x6d, 0x65, 0x74, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65,
+ 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x4f, 0x0a, 0x0d, 0x4e, 0x61, 0x6d, 0x65, 0x64,
+ 0x50, 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x05,
+ 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x49, 0x74, 0x65,
+ 0x6d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x6b, 0x0a, 0x1b, 0x4e, 0x61, 0x6d, 0x65,
+ 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x79, 0x4f, 0x72, 0x52, 0x65,
+ 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x38, 0x0a, 0x05, 0x76,
+ 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42,
+ 0x6f, 0x64, 0x79, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05,
+ 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x65, 0x0a, 0x18, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x52, 0x65,
+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63,
+ 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02,
+ 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76,
+ 0x33, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65,
+ 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x61, 0x0a, 0x16,
+ 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66,
+ 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x33, 0x0a, 0x05, 0x76, 0x61,
+ 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52,
+ 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22,
+ 0x71, 0x0a, 0x1e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79,
+ 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63,
+ 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02,
+ 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76,
+ 0x33, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65,
+ 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c,
+ 0x75, 0x65, 0x22, 0x5b, 0x0a, 0x13, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65,
+ 0x72, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
+ 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x30, 0x0a,
+ 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f,
+ 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72,
+ 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22,
+ 0x37, 0x0a, 0x0b, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x12,
+ 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
+ 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x55, 0x0a, 0x10, 0x4e, 0x61, 0x6d, 0x65,
+ 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, 0x12, 0x0a, 0x04,
+ 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
+ 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x17, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x74, 0x72,
+ 0x69, 0x6e, 0x67, 0x41, 0x72, 0x72, 0x61, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22,
+ 0xf2, 0x01, 0x0a, 0x09, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x46, 0x6c, 0x6f, 0x77, 0x12, 0x2b, 0x0a,
+ 0x11, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x75,
+ 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72,
+ 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x6f,
+ 0x6b, 0x65, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74,
+ 0x6f, 0x6b, 0x65, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x66, 0x72, 0x65,
+ 0x73, 0x68, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65,
+ 0x66, 0x72, 0x65, 0x73, 0x68, 0x55, 0x72, 0x6c, 0x12, 0x2b, 0x0a, 0x06, 0x73, 0x63, 0x6f, 0x70,
+ 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x06, 0x73,
+ 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69,
+ 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e,
+ 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70,
+ 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e,
+ 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xcd, 0x02, 0x0a, 0x0a, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x46, 0x6c,
+ 0x6f, 0x77, 0x73, 0x12, 0x31, 0x0a, 0x08, 0x69, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x33, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x08, 0x69, 0x6d,
+ 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x12, 0x31, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f,
+ 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x46, 0x6c, 0x6f, 0x77, 0x52,
+ 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x44, 0x0a, 0x12, 0x63, 0x6c, 0x69,
+ 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x18,
+ 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x33, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x11, 0x63, 0x6c,
+ 0x69, 0x65, 0x6e, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x12,
+ 0x44, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e,
+ 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x46, 0x6c,
+ 0x6f, 0x77, 0x52, 0x11, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f,
+ 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69,
+ 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e,
+ 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70,
+ 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e,
+ 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x53, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x49,
+ 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f,
+ 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e,
+ 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64,
+ 0x41, 0x6e, 0x79, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50,
+ 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x96, 0x05, 0x0a, 0x09, 0x4f, 0x70,
+ 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18,
+ 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73,
+ 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75,
+ 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,
+ 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63,
+ 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72,
+ 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x74, 0x65,
+ 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e,
+ 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74,
+ 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x70,
+ 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x40, 0x0a, 0x0a, 0x70, 0x61, 0x72,
+ 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e,
+ 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d,
+ 0x65, 0x74, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52,
+ 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x45, 0x0a, 0x0c, 0x72,
+ 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52,
+ 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x79, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65,
+ 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x0b, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f,
+ 0x64, 0x79, 0x12, 0x33, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18,
+ 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x33, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x52, 0x09, 0x72, 0x65,
+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x63, 0x61, 0x6c, 0x6c, 0x62,
+ 0x61, 0x63, 0x6b, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b,
+ 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x09, 0x63,
+ 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72,
+ 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65,
+ 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x3b, 0x0a, 0x08, 0x73, 0x65, 0x63, 0x75,
+ 0x72, 0x69, 0x74, 0x79, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79,
+ 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x73, 0x65, 0x63,
+ 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x2c, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73,
+ 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76,
+ 0x65, 0x72, 0x73, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0d,
+ 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76,
+ 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63,
+ 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69,
+ 0x6f, 0x6e, 0x22, 0xb1, 0x04, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72,
+ 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
+ 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x02, 0x69, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
+ 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72,
+ 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72,
+ 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72,
+ 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64,
+ 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74,
+ 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x65, 0x6d, 0x70, 0x74,
+ 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x61,
+ 0x6c, 0x6c, 0x6f, 0x77, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14,
+ 0x0a, 0x05, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73,
+ 0x74, 0x79, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x64, 0x65, 0x18,
+ 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x64, 0x65, 0x12, 0x25,
+ 0x0a, 0x0e, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64,
+ 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x73,
+ 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x35, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18,
+ 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x33, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72,
+ 0x65, 0x6e, 0x63, 0x65, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x29, 0x0a, 0x07,
+ 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e,
+ 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07,
+ 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x3c, 0x0a, 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70,
+ 0x6c, 0x65, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x4f,
+ 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x08, 0x65, 0x78, 0x61,
+ 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x12, 0x30, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74,
+ 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x07,
+ 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69,
+ 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69,
+ 0x6f, 0x6e, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16,
+ 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74,
+ 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x8d, 0x01, 0x0a, 0x14, 0x50, 0x61, 0x72, 0x61, 0x6d,
+ 0x65, 0x74, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12,
+ 0x35, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e,
+ 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x09, 0x70, 0x61, 0x72,
+ 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x35, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65,
+ 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65,
+ 0x48, 0x00, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a,
+ 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x74, 0x0a, 0x16, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65,
+ 0x74, 0x65, 0x72, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73,
+ 0x12, 0x5a, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70,
+ 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
+ 0x25, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d,
+ 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66,
+ 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e,
+ 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xfa, 0x04, 0x0a,
+ 0x08, 0x50, 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x11, 0x0a, 0x04, 0x5f, 0x72, 0x65,
+ 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x52, 0x65, 0x66, 0x12, 0x18, 0x0a, 0x07,
+ 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73,
+ 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
+ 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73,
+ 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x03, 0x67, 0x65, 0x74, 0x18,
+ 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x33, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x67, 0x65,
+ 0x74, 0x12, 0x27, 0x0a, 0x03, 0x70, 0x75, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4f, 0x70, 0x65, 0x72,
+ 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x70, 0x75, 0x74, 0x12, 0x29, 0x0a, 0x04, 0x70, 0x6f,
+ 0x73, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52,
+ 0x04, 0x70, 0x6f, 0x73, 0x74, 0x12, 0x2d, 0x0a, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18,
+ 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x33, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x64, 0x65,
+ 0x6c, 0x65, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18,
+ 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x33, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, 0x70,
+ 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x29, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x18, 0x09, 0x20,
+ 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33,
+ 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x68, 0x65, 0x61, 0x64,
+ 0x12, 0x2b, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4f, 0x70, 0x65,
+ 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x12, 0x2b, 0x0a,
+ 0x05, 0x74, 0x72, 0x61, 0x63, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f,
+ 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74,
+ 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x74, 0x72, 0x61, 0x63, 0x65, 0x12, 0x2c, 0x0a, 0x07, 0x73, 0x65,
+ 0x72, 0x76, 0x65, 0x72, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52,
+ 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x12, 0x40, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61,
+ 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f,
+ 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65,
+ 0x74, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x0a,
+ 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70,
+ 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65,
+ 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e,
+ 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
+ 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x85, 0x01, 0x0a, 0x05, 0x50, 0x61,
+ 0x74, 0x68, 0x73, 0x12, 0x2d, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28,
+ 0x0b, 0x32, 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e,
+ 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x04, 0x70, 0x61,
+ 0x74, 0x68, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
+ 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20,
+ 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33,
+ 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69,
+ 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f,
+ 0x6e, 0x22, 0x65, 0x0a, 0x0a, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12,
+ 0x57, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72,
+ 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65,
+ 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e,
+ 0x63, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72,
+ 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x5a, 0x0a, 0x09, 0x52, 0x65, 0x66, 0x65,
+ 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x11, 0x0a, 0x04, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x01, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x03, 0x52, 0x65, 0x66, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d,
+ 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61,
+ 0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
+ 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,
+ 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x79, 0x0a, 0x19, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42,
+ 0x6f, 0x64, 0x69, 0x65, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65,
+ 0x73, 0x12, 0x5c, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f,
+ 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
+ 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61,
+ 0x6d, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x79, 0x4f, 0x72,
+ 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74,
+ 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22,
+ 0xcc, 0x01, 0x0a, 0x0b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x79, 0x12,
+ 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
+ 0x6e, 0x12, 0x30, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e,
+ 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74,
+ 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18,
+ 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12,
+ 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
+ 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b,
+ 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61,
+ 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63,
+ 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x96,
+ 0x01, 0x0a, 0x16, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x79, 0x4f, 0x72,
+ 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x3c, 0x0a, 0x0c, 0x72, 0x65, 0x71,
+ 0x75, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x17, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x71,
+ 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x79, 0x48, 0x00, 0x52, 0x0b, 0x72, 0x65, 0x71, 0x75,
+ 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x35, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72,
+ 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63,
+ 0x65, 0x48, 0x00, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07,
+ 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x9d, 0x02, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70,
+ 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
+ 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72,
+ 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x39, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72,
+ 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x4f, 0x72, 0x52, 0x65,
+ 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72,
+ 0x73, 0x12, 0x30, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e,
+ 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74,
+ 0x65, 0x6e, 0x74, 0x12, 0x33, 0x0a, 0x05, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x18, 0x04, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e,
+ 0x4c, 0x69, 0x6e, 0x6b, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65,
+ 0x73, 0x52, 0x05, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63,
+ 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73,
+ 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52,
+ 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78,
+ 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x89, 0x01, 0x0a, 0x13, 0x52, 0x65, 0x73, 0x70,
+ 0x6f, 0x6e, 0x73, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12,
+ 0x32, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52,
+ 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f,
+ 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65,
+ 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52,
+ 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e,
+ 0x65, 0x6f, 0x66, 0x22, 0xef, 0x01, 0x0a, 0x09, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+ 0x73, 0x12, 0x39, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e,
+ 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65,
+ 0x6e, 0x63, 0x65, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x58, 0x0a, 0x15,
+ 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x6f, 0x72, 0x5f, 0x72, 0x65, 0x66, 0x65,
+ 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x52, 0x65,
+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63,
+ 0x65, 0x52, 0x13, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66,
+ 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66,
+ 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f,
+ 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73,
+ 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65,
+ 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x72, 0x0a, 0x15, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
+ 0x65, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x59,
+ 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f,
+ 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e,
+ 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64,
+ 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65,
+ 0x6e, 0x63, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50,
+ 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xaf, 0x0b, 0x0a, 0x06, 0x53, 0x63,
+ 0x68, 0x65, 0x6d, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65,
+ 0x12, 0x3f, 0x0a, 0x0d, 0x64, 0x69, 0x73, 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f,
+ 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74,
+ 0x6f, 0x72, 0x52, 0x0d, 0x64, 0x69, 0x73, 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f,
+ 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x03,
+ 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x61, 0x64, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x1d,
+ 0x0a, 0x0a, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x04, 0x20, 0x01,
+ 0x28, 0x08, 0x52, 0x09, 0x77, 0x72, 0x69, 0x74, 0x65, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x21, 0x0a,
+ 0x03, 0x78, 0x6d, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x58, 0x6d, 0x6c, 0x52, 0x03, 0x78, 0x6d, 0x6c,
+ 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63,
+ 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63,
+ 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12,
+ 0x29, 0x0a, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b,
+ 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e,
+ 0x79, 0x52, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65,
+ 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a,
+ 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69,
+ 0x74, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65,
+ 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18,
+ 0x0a, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f,
+ 0x66, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01,
+ 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65,
+ 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d,
+ 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76,
+ 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x69,
+ 0x6d, 0x75, 0x6d, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d,
+ 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f,
+ 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65,
+ 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12,
+ 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0f, 0x20,
+ 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1d,
+ 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x10, 0x20, 0x01,
+ 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, 0x0a,
+ 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
+ 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x69,
+ 0x74, 0x65, 0x6d, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49,
+ 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d,
+ 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d,
+ 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d,
+ 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49,
+ 0x74, 0x65, 0x6d, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x72, 0x6f, 0x70,
+ 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x15, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6d, 0x61,
+ 0x78, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x6d,
+ 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x16, 0x20,
+ 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6d, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69,
+ 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x17,
+ 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x23,
+ 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x18, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f,
+ 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65,
+ 0x6e, 0x75, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x19, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x34, 0x0a, 0x06, 0x61, 0x6c, 0x6c, 0x5f, 0x6f,
+ 0x66, 0x18, 0x1a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66,
+ 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x61, 0x6c, 0x6c, 0x4f, 0x66, 0x12, 0x34, 0x0a,
+ 0x06, 0x6f, 0x6e, 0x65, 0x5f, 0x6f, 0x66, 0x18, 0x1b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e,
+ 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d,
+ 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x6f, 0x6e,
+ 0x65, 0x4f, 0x66, 0x12, 0x34, 0x0a, 0x06, 0x61, 0x6e, 0x79, 0x5f, 0x6f, 0x66, 0x18, 0x1c, 0x20,
+ 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33,
+ 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e,
+ 0x63, 0x65, 0x52, 0x05, 0x61, 0x6e, 0x79, 0x4f, 0x66, 0x12, 0x24, 0x0a, 0x03, 0x6e, 0x6f, 0x74,
+ 0x18, 0x1d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x03, 0x6e, 0x6f, 0x74, 0x12,
+ 0x2b, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x74, 0x65, 0x6d,
+ 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x0a,
+ 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x0b,
+ 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x72,
+ 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72,
+ 0x74, 0x69, 0x65, 0x73, 0x12, 0x59, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e,
+ 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x20, 0x20,
+ 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33,
+ 0x2e, 0x41, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65,
+ 0x72, 0x74, 0x69, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74,
+ 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12,
+ 0x31, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x21, 0x20, 0x01, 0x28, 0x0b,
+ 0x32, 0x17, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x65,
+ 0x66, 0x61, 0x75, 0x6c, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75,
+ 0x6c, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
+ 0x6e, 0x18, 0x22, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,
+ 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x23,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x4d, 0x0a, 0x17,
+ 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78,
+ 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x24, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e,
+ 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64,
+ 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69,
+ 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x81, 0x01, 0x0a, 0x11,
+ 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63,
+ 0x65, 0x12, 0x2c, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53,
+ 0x63, 0x68, 0x65, 0x6d, 0x61, 0x48, 0x00, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12,
+ 0x35, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e,
+ 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x09, 0x72, 0x65, 0x66,
+ 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22,
+ 0x6e, 0x0a, 0x13, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65,
+ 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x57, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69,
+ 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18,
+ 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72,
+ 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74,
+ 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22,
+ 0x68, 0x0a, 0x13, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69,
+ 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x51, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69,
+ 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18,
+ 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x41, 0x72,
+ 0x72, 0x61, 0x79, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50,
+ 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xd3, 0x02, 0x0a, 0x0e, 0x53, 0x65,
+ 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04,
+ 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65,
+ 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69,
+ 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65,
+ 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x23,
+ 0x0a, 0x0d, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18,
+ 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x46, 0x6f, 0x72,
+ 0x6d, 0x61, 0x74, 0x12, 0x2c, 0x0a, 0x05, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x18, 0x07, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e,
+ 0x4f, 0x61, 0x75, 0x74, 0x68, 0x46, 0x6c, 0x6f, 0x77, 0x73, 0x52, 0x05, 0x66, 0x6c, 0x6f, 0x77,
+ 0x73, 0x12, 0x2d, 0x0a, 0x13, 0x6f, 0x70, 0x65, 0x6e, 0x5f, 0x69, 0x64, 0x5f, 0x63, 0x6f, 0x6e,
+ 0x6e, 0x65, 0x63, 0x74, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10,
+ 0x6f, 0x70, 0x65, 0x6e, 0x49, 0x64, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x55, 0x72, 0x6c,
+ 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
+ 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x03, 0x28,
+ 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e,
+ 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69,
+ 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22,
+ 0xa2, 0x01, 0x0a, 0x19, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, 0x65,
+ 0x6d, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x45, 0x0a,
+ 0x0f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, 0x65,
+ 0x6d, 0x65, 0x48, 0x00, 0x52, 0x0e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63,
+ 0x68, 0x65, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63,
+ 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00,
+ 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f,
+ 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x7e, 0x0a, 0x1b, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79,
+ 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e,
+ 0x63, 0x65, 0x73, 0x12, 0x5f, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61,
+ 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03,
+ 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e,
+ 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68,
+ 0x65, 0x6d, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x14,
+ 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72,
+ 0x74, 0x69, 0x65, 0x73, 0x22, 0xc6, 0x01, 0x0a, 0x06, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12,
+ 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72,
+ 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e,
+ 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
+ 0x69, 0x6f, 0x6e, 0x12, 0x39, 0x0a, 0x09, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x73,
+ 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62,
+ 0x6c, 0x65, 0x73, 0x52, 0x09, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x12, 0x4d,
+ 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f,
+ 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32,
+ 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d,
+ 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xaf, 0x01,
+ 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65,
+ 0x12, 0x12, 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04,
+ 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x20,
+ 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e,
+ 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
+ 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28,
+ 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e,
+ 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69,
+ 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22,
+ 0x67, 0x0a, 0x0f, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c,
+ 0x65, 0x73, 0x12, 0x54, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c,
+ 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,
+ 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e,
+ 0x61, 0x6d, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62,
+ 0x6c, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72,
+ 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x71, 0x0a, 0x16, 0x53, 0x70, 0x65, 0x63,
+ 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69,
+ 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x01, 0x48, 0x00, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x07,
+ 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52,
+ 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x12, 0x18, 0x0a, 0x06, 0x73, 0x74, 0x72, 0x69,
+ 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x72, 0x69,
+ 0x6e, 0x67, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x23, 0x0a, 0x0b, 0x53,
+ 0x74, 0x72, 0x69, 0x6e, 0x67, 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61,
+ 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
+ 0x22, 0x57, 0x0a, 0x07, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x4c, 0x0a, 0x15, 0x61,
+ 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72,
+ 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x74, 0x72,
+ 0x69, 0x6e, 0x67, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50,
+ 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xc9, 0x01, 0x0a, 0x03, 0x54, 0x61,
+ 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,
+ 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63,
+ 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72,
+ 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x74, 0x65,
+ 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e,
+ 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66,
+ 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f,
+ 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73,
+ 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65,
+ 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xd6, 0x01, 0x0a, 0x03, 0x58, 0x6d, 0x6c, 0x12, 0x12, 0x0a,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,
+ 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12,
+ 0x16, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x74, 0x74, 0x72, 0x69,
+ 0x62, 0x75, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x61, 0x74, 0x74, 0x72,
+ 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x64,
+ 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x64, 0x12,
+ 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
+ 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b,
+ 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61,
+ 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63,
+ 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x3e,
+ 0x0a, 0x0e, 0x6f, 0x72, 0x67, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x33,
+ 0x42, 0x0c, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x50, 0x49, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01,
+ 0x5a, 0x16, 0x2e, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x33, 0x3b, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x33, 0xa2, 0x02, 0x03, 0x4f, 0x41, 0x53, 0x62, 0x06,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_openapiv3_OpenAPIv3_proto_rawDescOnce sync.Once
+ file_openapiv3_OpenAPIv3_proto_rawDescData = file_openapiv3_OpenAPIv3_proto_rawDesc
+)
+
+func file_openapiv3_OpenAPIv3_proto_rawDescGZIP() []byte {
+ file_openapiv3_OpenAPIv3_proto_rawDescOnce.Do(func() {
+ file_openapiv3_OpenAPIv3_proto_rawDescData = protoimpl.X.CompressGZIP(file_openapiv3_OpenAPIv3_proto_rawDescData)
+ })
+ return file_openapiv3_OpenAPIv3_proto_rawDescData
+}
+
+var file_openapiv3_OpenAPIv3_proto_msgTypes = make([]protoimpl.MessageInfo, 78)
+var file_openapiv3_OpenAPIv3_proto_goTypes = []interface{}{
+ (*AdditionalPropertiesItem)(nil), // 0: openapi.v3.AdditionalPropertiesItem
+ (*Any)(nil), // 1: openapi.v3.Any
+ (*AnyOrExpression)(nil), // 2: openapi.v3.AnyOrExpression
+ (*Callback)(nil), // 3: openapi.v3.Callback
+ (*CallbackOrReference)(nil), // 4: openapi.v3.CallbackOrReference
+ (*CallbacksOrReferences)(nil), // 5: openapi.v3.CallbacksOrReferences
+ (*Components)(nil), // 6: openapi.v3.Components
+ (*Contact)(nil), // 7: openapi.v3.Contact
+ (*DefaultType)(nil), // 8: openapi.v3.DefaultType
+ (*Discriminator)(nil), // 9: openapi.v3.Discriminator
+ (*Document)(nil), // 10: openapi.v3.Document
+ (*Encoding)(nil), // 11: openapi.v3.Encoding
+ (*Encodings)(nil), // 12: openapi.v3.Encodings
+ (*Example)(nil), // 13: openapi.v3.Example
+ (*ExampleOrReference)(nil), // 14: openapi.v3.ExampleOrReference
+ (*ExamplesOrReferences)(nil), // 15: openapi.v3.ExamplesOrReferences
+ (*Expression)(nil), // 16: openapi.v3.Expression
+ (*ExternalDocs)(nil), // 17: openapi.v3.ExternalDocs
+ (*Header)(nil), // 18: openapi.v3.Header
+ (*HeaderOrReference)(nil), // 19: openapi.v3.HeaderOrReference
+ (*HeadersOrReferences)(nil), // 20: openapi.v3.HeadersOrReferences
+ (*Info)(nil), // 21: openapi.v3.Info
+ (*ItemsItem)(nil), // 22: openapi.v3.ItemsItem
+ (*License)(nil), // 23: openapi.v3.License
+ (*Link)(nil), // 24: openapi.v3.Link
+ (*LinkOrReference)(nil), // 25: openapi.v3.LinkOrReference
+ (*LinksOrReferences)(nil), // 26: openapi.v3.LinksOrReferences
+ (*MediaType)(nil), // 27: openapi.v3.MediaType
+ (*MediaTypes)(nil), // 28: openapi.v3.MediaTypes
+ (*NamedAny)(nil), // 29: openapi.v3.NamedAny
+ (*NamedCallbackOrReference)(nil), // 30: openapi.v3.NamedCallbackOrReference
+ (*NamedEncoding)(nil), // 31: openapi.v3.NamedEncoding
+ (*NamedExampleOrReference)(nil), // 32: openapi.v3.NamedExampleOrReference
+ (*NamedHeaderOrReference)(nil), // 33: openapi.v3.NamedHeaderOrReference
+ (*NamedLinkOrReference)(nil), // 34: openapi.v3.NamedLinkOrReference
+ (*NamedMediaType)(nil), // 35: openapi.v3.NamedMediaType
+ (*NamedParameterOrReference)(nil), // 36: openapi.v3.NamedParameterOrReference
+ (*NamedPathItem)(nil), // 37: openapi.v3.NamedPathItem
+ (*NamedRequestBodyOrReference)(nil), // 38: openapi.v3.NamedRequestBodyOrReference
+ (*NamedResponseOrReference)(nil), // 39: openapi.v3.NamedResponseOrReference
+ (*NamedSchemaOrReference)(nil), // 40: openapi.v3.NamedSchemaOrReference
+ (*NamedSecuritySchemeOrReference)(nil), // 41: openapi.v3.NamedSecuritySchemeOrReference
+ (*NamedServerVariable)(nil), // 42: openapi.v3.NamedServerVariable
+ (*NamedString)(nil), // 43: openapi.v3.NamedString
+ (*NamedStringArray)(nil), // 44: openapi.v3.NamedStringArray
+ (*OauthFlow)(nil), // 45: openapi.v3.OauthFlow
+ (*OauthFlows)(nil), // 46: openapi.v3.OauthFlows
+ (*Object)(nil), // 47: openapi.v3.Object
+ (*Operation)(nil), // 48: openapi.v3.Operation
+ (*Parameter)(nil), // 49: openapi.v3.Parameter
+ (*ParameterOrReference)(nil), // 50: openapi.v3.ParameterOrReference
+ (*ParametersOrReferences)(nil), // 51: openapi.v3.ParametersOrReferences
+ (*PathItem)(nil), // 52: openapi.v3.PathItem
+ (*Paths)(nil), // 53: openapi.v3.Paths
+ (*Properties)(nil), // 54: openapi.v3.Properties
+ (*Reference)(nil), // 55: openapi.v3.Reference
+ (*RequestBodiesOrReferences)(nil), // 56: openapi.v3.RequestBodiesOrReferences
+ (*RequestBody)(nil), // 57: openapi.v3.RequestBody
+ (*RequestBodyOrReference)(nil), // 58: openapi.v3.RequestBodyOrReference
+ (*Response)(nil), // 59: openapi.v3.Response
+ (*ResponseOrReference)(nil), // 60: openapi.v3.ResponseOrReference
+ (*Responses)(nil), // 61: openapi.v3.Responses
+ (*ResponsesOrReferences)(nil), // 62: openapi.v3.ResponsesOrReferences
+ (*Schema)(nil), // 63: openapi.v3.Schema
+ (*SchemaOrReference)(nil), // 64: openapi.v3.SchemaOrReference
+ (*SchemasOrReferences)(nil), // 65: openapi.v3.SchemasOrReferences
+ (*SecurityRequirement)(nil), // 66: openapi.v3.SecurityRequirement
+ (*SecurityScheme)(nil), // 67: openapi.v3.SecurityScheme
+ (*SecuritySchemeOrReference)(nil), // 68: openapi.v3.SecuritySchemeOrReference
+ (*SecuritySchemesOrReferences)(nil), // 69: openapi.v3.SecuritySchemesOrReferences
+ (*Server)(nil), // 70: openapi.v3.Server
+ (*ServerVariable)(nil), // 71: openapi.v3.ServerVariable
+ (*ServerVariables)(nil), // 72: openapi.v3.ServerVariables
+ (*SpecificationExtension)(nil), // 73: openapi.v3.SpecificationExtension
+ (*StringArray)(nil), // 74: openapi.v3.StringArray
+ (*Strings)(nil), // 75: openapi.v3.Strings
+ (*Tag)(nil), // 76: openapi.v3.Tag
+ (*Xml)(nil), // 77: openapi.v3.Xml
+ (*anypb.Any)(nil), // 78: google.protobuf.Any
+}
+var file_openapiv3_OpenAPIv3_proto_depIdxs = []int32{
+ 64, // 0: openapi.v3.AdditionalPropertiesItem.schema_or_reference:type_name -> openapi.v3.SchemaOrReference
+ 78, // 1: openapi.v3.Any.value:type_name -> google.protobuf.Any
+ 1, // 2: openapi.v3.AnyOrExpression.any:type_name -> openapi.v3.Any
+ 16, // 3: openapi.v3.AnyOrExpression.expression:type_name -> openapi.v3.Expression
+ 37, // 4: openapi.v3.Callback.path:type_name -> openapi.v3.NamedPathItem
+ 29, // 5: openapi.v3.Callback.specification_extension:type_name -> openapi.v3.NamedAny
+ 3, // 6: openapi.v3.CallbackOrReference.callback:type_name -> openapi.v3.Callback
+ 55, // 7: openapi.v3.CallbackOrReference.reference:type_name -> openapi.v3.Reference
+ 30, // 8: openapi.v3.CallbacksOrReferences.additional_properties:type_name -> openapi.v3.NamedCallbackOrReference
+ 65, // 9: openapi.v3.Components.schemas:type_name -> openapi.v3.SchemasOrReferences
+ 62, // 10: openapi.v3.Components.responses:type_name -> openapi.v3.ResponsesOrReferences
+ 51, // 11: openapi.v3.Components.parameters:type_name -> openapi.v3.ParametersOrReferences
+ 15, // 12: openapi.v3.Components.examples:type_name -> openapi.v3.ExamplesOrReferences
+ 56, // 13: openapi.v3.Components.request_bodies:type_name -> openapi.v3.RequestBodiesOrReferences
+ 20, // 14: openapi.v3.Components.headers:type_name -> openapi.v3.HeadersOrReferences
+ 69, // 15: openapi.v3.Components.security_schemes:type_name -> openapi.v3.SecuritySchemesOrReferences
+ 26, // 16: openapi.v3.Components.links:type_name -> openapi.v3.LinksOrReferences
+ 5, // 17: openapi.v3.Components.callbacks:type_name -> openapi.v3.CallbacksOrReferences
+ 29, // 18: openapi.v3.Components.specification_extension:type_name -> openapi.v3.NamedAny
+ 29, // 19: openapi.v3.Contact.specification_extension:type_name -> openapi.v3.NamedAny
+ 75, // 20: openapi.v3.Discriminator.mapping:type_name -> openapi.v3.Strings
+ 29, // 21: openapi.v3.Discriminator.specification_extension:type_name -> openapi.v3.NamedAny
+ 21, // 22: openapi.v3.Document.info:type_name -> openapi.v3.Info
+ 70, // 23: openapi.v3.Document.servers:type_name -> openapi.v3.Server
+ 53, // 24: openapi.v3.Document.paths:type_name -> openapi.v3.Paths
+ 6, // 25: openapi.v3.Document.components:type_name -> openapi.v3.Components
+ 66, // 26: openapi.v3.Document.security:type_name -> openapi.v3.SecurityRequirement
+ 76, // 27: openapi.v3.Document.tags:type_name -> openapi.v3.Tag
+ 17, // 28: openapi.v3.Document.external_docs:type_name -> openapi.v3.ExternalDocs
+ 29, // 29: openapi.v3.Document.specification_extension:type_name -> openapi.v3.NamedAny
+ 20, // 30: openapi.v3.Encoding.headers:type_name -> openapi.v3.HeadersOrReferences
+ 29, // 31: openapi.v3.Encoding.specification_extension:type_name -> openapi.v3.NamedAny
+ 31, // 32: openapi.v3.Encodings.additional_properties:type_name -> openapi.v3.NamedEncoding
+ 1, // 33: openapi.v3.Example.value:type_name -> openapi.v3.Any
+ 29, // 34: openapi.v3.Example.specification_extension:type_name -> openapi.v3.NamedAny
+ 13, // 35: openapi.v3.ExampleOrReference.example:type_name -> openapi.v3.Example
+ 55, // 36: openapi.v3.ExampleOrReference.reference:type_name -> openapi.v3.Reference
+ 32, // 37: openapi.v3.ExamplesOrReferences.additional_properties:type_name -> openapi.v3.NamedExampleOrReference
+ 29, // 38: openapi.v3.Expression.additional_properties:type_name -> openapi.v3.NamedAny
+ 29, // 39: openapi.v3.ExternalDocs.specification_extension:type_name -> openapi.v3.NamedAny
+ 64, // 40: openapi.v3.Header.schema:type_name -> openapi.v3.SchemaOrReference
+ 1, // 41: openapi.v3.Header.example:type_name -> openapi.v3.Any
+ 15, // 42: openapi.v3.Header.examples:type_name -> openapi.v3.ExamplesOrReferences
+ 28, // 43: openapi.v3.Header.content:type_name -> openapi.v3.MediaTypes
+ 29, // 44: openapi.v3.Header.specification_extension:type_name -> openapi.v3.NamedAny
+ 18, // 45: openapi.v3.HeaderOrReference.header:type_name -> openapi.v3.Header
+ 55, // 46: openapi.v3.HeaderOrReference.reference:type_name -> openapi.v3.Reference
+ 33, // 47: openapi.v3.HeadersOrReferences.additional_properties:type_name -> openapi.v3.NamedHeaderOrReference
+ 7, // 48: openapi.v3.Info.contact:type_name -> openapi.v3.Contact
+ 23, // 49: openapi.v3.Info.license:type_name -> openapi.v3.License
+ 29, // 50: openapi.v3.Info.specification_extension:type_name -> openapi.v3.NamedAny
+ 64, // 51: openapi.v3.ItemsItem.schema_or_reference:type_name -> openapi.v3.SchemaOrReference
+ 29, // 52: openapi.v3.License.specification_extension:type_name -> openapi.v3.NamedAny
+ 2, // 53: openapi.v3.Link.parameters:type_name -> openapi.v3.AnyOrExpression
+ 2, // 54: openapi.v3.Link.request_body:type_name -> openapi.v3.AnyOrExpression
+ 70, // 55: openapi.v3.Link.server:type_name -> openapi.v3.Server
+ 29, // 56: openapi.v3.Link.specification_extension:type_name -> openapi.v3.NamedAny
+ 24, // 57: openapi.v3.LinkOrReference.link:type_name -> openapi.v3.Link
+ 55, // 58: openapi.v3.LinkOrReference.reference:type_name -> openapi.v3.Reference
+ 34, // 59: openapi.v3.LinksOrReferences.additional_properties:type_name -> openapi.v3.NamedLinkOrReference
+ 64, // 60: openapi.v3.MediaType.schema:type_name -> openapi.v3.SchemaOrReference
+ 1, // 61: openapi.v3.MediaType.example:type_name -> openapi.v3.Any
+ 15, // 62: openapi.v3.MediaType.examples:type_name -> openapi.v3.ExamplesOrReferences
+ 12, // 63: openapi.v3.MediaType.encoding:type_name -> openapi.v3.Encodings
+ 29, // 64: openapi.v3.MediaType.specification_extension:type_name -> openapi.v3.NamedAny
+ 35, // 65: openapi.v3.MediaTypes.additional_properties:type_name -> openapi.v3.NamedMediaType
+ 1, // 66: openapi.v3.NamedAny.value:type_name -> openapi.v3.Any
+ 4, // 67: openapi.v3.NamedCallbackOrReference.value:type_name -> openapi.v3.CallbackOrReference
+ 11, // 68: openapi.v3.NamedEncoding.value:type_name -> openapi.v3.Encoding
+ 14, // 69: openapi.v3.NamedExampleOrReference.value:type_name -> openapi.v3.ExampleOrReference
+ 19, // 70: openapi.v3.NamedHeaderOrReference.value:type_name -> openapi.v3.HeaderOrReference
+ 25, // 71: openapi.v3.NamedLinkOrReference.value:type_name -> openapi.v3.LinkOrReference
+ 27, // 72: openapi.v3.NamedMediaType.value:type_name -> openapi.v3.MediaType
+ 50, // 73: openapi.v3.NamedParameterOrReference.value:type_name -> openapi.v3.ParameterOrReference
+ 52, // 74: openapi.v3.NamedPathItem.value:type_name -> openapi.v3.PathItem
+ 58, // 75: openapi.v3.NamedRequestBodyOrReference.value:type_name -> openapi.v3.RequestBodyOrReference
+ 60, // 76: openapi.v3.NamedResponseOrReference.value:type_name -> openapi.v3.ResponseOrReference
+ 64, // 77: openapi.v3.NamedSchemaOrReference.value:type_name -> openapi.v3.SchemaOrReference
+ 68, // 78: openapi.v3.NamedSecuritySchemeOrReference.value:type_name -> openapi.v3.SecuritySchemeOrReference
+ 71, // 79: openapi.v3.NamedServerVariable.value:type_name -> openapi.v3.ServerVariable
+ 74, // 80: openapi.v3.NamedStringArray.value:type_name -> openapi.v3.StringArray
+ 75, // 81: openapi.v3.OauthFlow.scopes:type_name -> openapi.v3.Strings
+ 29, // 82: openapi.v3.OauthFlow.specification_extension:type_name -> openapi.v3.NamedAny
+ 45, // 83: openapi.v3.OauthFlows.implicit:type_name -> openapi.v3.OauthFlow
+ 45, // 84: openapi.v3.OauthFlows.password:type_name -> openapi.v3.OauthFlow
+ 45, // 85: openapi.v3.OauthFlows.client_credentials:type_name -> openapi.v3.OauthFlow
+ 45, // 86: openapi.v3.OauthFlows.authorization_code:type_name -> openapi.v3.OauthFlow
+ 29, // 87: openapi.v3.OauthFlows.specification_extension:type_name -> openapi.v3.NamedAny
+ 29, // 88: openapi.v3.Object.additional_properties:type_name -> openapi.v3.NamedAny
+ 17, // 89: openapi.v3.Operation.external_docs:type_name -> openapi.v3.ExternalDocs
+ 50, // 90: openapi.v3.Operation.parameters:type_name -> openapi.v3.ParameterOrReference
+ 58, // 91: openapi.v3.Operation.request_body:type_name -> openapi.v3.RequestBodyOrReference
+ 61, // 92: openapi.v3.Operation.responses:type_name -> openapi.v3.Responses
+ 5, // 93: openapi.v3.Operation.callbacks:type_name -> openapi.v3.CallbacksOrReferences
+ 66, // 94: openapi.v3.Operation.security:type_name -> openapi.v3.SecurityRequirement
+ 70, // 95: openapi.v3.Operation.servers:type_name -> openapi.v3.Server
+ 29, // 96: openapi.v3.Operation.specification_extension:type_name -> openapi.v3.NamedAny
+ 64, // 97: openapi.v3.Parameter.schema:type_name -> openapi.v3.SchemaOrReference
+ 1, // 98: openapi.v3.Parameter.example:type_name -> openapi.v3.Any
+ 15, // 99: openapi.v3.Parameter.examples:type_name -> openapi.v3.ExamplesOrReferences
+ 28, // 100: openapi.v3.Parameter.content:type_name -> openapi.v3.MediaTypes
+ 29, // 101: openapi.v3.Parameter.specification_extension:type_name -> openapi.v3.NamedAny
+ 49, // 102: openapi.v3.ParameterOrReference.parameter:type_name -> openapi.v3.Parameter
+ 55, // 103: openapi.v3.ParameterOrReference.reference:type_name -> openapi.v3.Reference
+ 36, // 104: openapi.v3.ParametersOrReferences.additional_properties:type_name -> openapi.v3.NamedParameterOrReference
+ 48, // 105: openapi.v3.PathItem.get:type_name -> openapi.v3.Operation
+ 48, // 106: openapi.v3.PathItem.put:type_name -> openapi.v3.Operation
+ 48, // 107: openapi.v3.PathItem.post:type_name -> openapi.v3.Operation
+ 48, // 108: openapi.v3.PathItem.delete:type_name -> openapi.v3.Operation
+ 48, // 109: openapi.v3.PathItem.options:type_name -> openapi.v3.Operation
+ 48, // 110: openapi.v3.PathItem.head:type_name -> openapi.v3.Operation
+ 48, // 111: openapi.v3.PathItem.patch:type_name -> openapi.v3.Operation
+ 48, // 112: openapi.v3.PathItem.trace:type_name -> openapi.v3.Operation
+ 70, // 113: openapi.v3.PathItem.servers:type_name -> openapi.v3.Server
+ 50, // 114: openapi.v3.PathItem.parameters:type_name -> openapi.v3.ParameterOrReference
+ 29, // 115: openapi.v3.PathItem.specification_extension:type_name -> openapi.v3.NamedAny
+ 37, // 116: openapi.v3.Paths.path:type_name -> openapi.v3.NamedPathItem
+ 29, // 117: openapi.v3.Paths.specification_extension:type_name -> openapi.v3.NamedAny
+ 40, // 118: openapi.v3.Properties.additional_properties:type_name -> openapi.v3.NamedSchemaOrReference
+ 38, // 119: openapi.v3.RequestBodiesOrReferences.additional_properties:type_name -> openapi.v3.NamedRequestBodyOrReference
+ 28, // 120: openapi.v3.RequestBody.content:type_name -> openapi.v3.MediaTypes
+ 29, // 121: openapi.v3.RequestBody.specification_extension:type_name -> openapi.v3.NamedAny
+ 57, // 122: openapi.v3.RequestBodyOrReference.request_body:type_name -> openapi.v3.RequestBody
+ 55, // 123: openapi.v3.RequestBodyOrReference.reference:type_name -> openapi.v3.Reference
+ 20, // 124: openapi.v3.Response.headers:type_name -> openapi.v3.HeadersOrReferences
+ 28, // 125: openapi.v3.Response.content:type_name -> openapi.v3.MediaTypes
+ 26, // 126: openapi.v3.Response.links:type_name -> openapi.v3.LinksOrReferences
+ 29, // 127: openapi.v3.Response.specification_extension:type_name -> openapi.v3.NamedAny
+ 59, // 128: openapi.v3.ResponseOrReference.response:type_name -> openapi.v3.Response
+ 55, // 129: openapi.v3.ResponseOrReference.reference:type_name -> openapi.v3.Reference
+ 60, // 130: openapi.v3.Responses.default:type_name -> openapi.v3.ResponseOrReference
+ 39, // 131: openapi.v3.Responses.response_or_reference:type_name -> openapi.v3.NamedResponseOrReference
+ 29, // 132: openapi.v3.Responses.specification_extension:type_name -> openapi.v3.NamedAny
+ 39, // 133: openapi.v3.ResponsesOrReferences.additional_properties:type_name -> openapi.v3.NamedResponseOrReference
+ 9, // 134: openapi.v3.Schema.discriminator:type_name -> openapi.v3.Discriminator
+ 77, // 135: openapi.v3.Schema.xml:type_name -> openapi.v3.Xml
+ 17, // 136: openapi.v3.Schema.external_docs:type_name -> openapi.v3.ExternalDocs
+ 1, // 137: openapi.v3.Schema.example:type_name -> openapi.v3.Any
+ 1, // 138: openapi.v3.Schema.enum:type_name -> openapi.v3.Any
+ 64, // 139: openapi.v3.Schema.all_of:type_name -> openapi.v3.SchemaOrReference
+ 64, // 140: openapi.v3.Schema.one_of:type_name -> openapi.v3.SchemaOrReference
+ 64, // 141: openapi.v3.Schema.any_of:type_name -> openapi.v3.SchemaOrReference
+ 63, // 142: openapi.v3.Schema.not:type_name -> openapi.v3.Schema
+ 22, // 143: openapi.v3.Schema.items:type_name -> openapi.v3.ItemsItem
+ 54, // 144: openapi.v3.Schema.properties:type_name -> openapi.v3.Properties
+ 0, // 145: openapi.v3.Schema.additional_properties:type_name -> openapi.v3.AdditionalPropertiesItem
+ 8, // 146: openapi.v3.Schema.default:type_name -> openapi.v3.DefaultType
+ 29, // 147: openapi.v3.Schema.specification_extension:type_name -> openapi.v3.NamedAny
+ 63, // 148: openapi.v3.SchemaOrReference.schema:type_name -> openapi.v3.Schema
+ 55, // 149: openapi.v3.SchemaOrReference.reference:type_name -> openapi.v3.Reference
+ 40, // 150: openapi.v3.SchemasOrReferences.additional_properties:type_name -> openapi.v3.NamedSchemaOrReference
+ 44, // 151: openapi.v3.SecurityRequirement.additional_properties:type_name -> openapi.v3.NamedStringArray
+ 46, // 152: openapi.v3.SecurityScheme.flows:type_name -> openapi.v3.OauthFlows
+ 29, // 153: openapi.v3.SecurityScheme.specification_extension:type_name -> openapi.v3.NamedAny
+ 67, // 154: openapi.v3.SecuritySchemeOrReference.security_scheme:type_name -> openapi.v3.SecurityScheme
+ 55, // 155: openapi.v3.SecuritySchemeOrReference.reference:type_name -> openapi.v3.Reference
+ 41, // 156: openapi.v3.SecuritySchemesOrReferences.additional_properties:type_name -> openapi.v3.NamedSecuritySchemeOrReference
+ 72, // 157: openapi.v3.Server.variables:type_name -> openapi.v3.ServerVariables
+ 29, // 158: openapi.v3.Server.specification_extension:type_name -> openapi.v3.NamedAny
+ 29, // 159: openapi.v3.ServerVariable.specification_extension:type_name -> openapi.v3.NamedAny
+ 42, // 160: openapi.v3.ServerVariables.additional_properties:type_name -> openapi.v3.NamedServerVariable
+ 43, // 161: openapi.v3.Strings.additional_properties:type_name -> openapi.v3.NamedString
+ 17, // 162: openapi.v3.Tag.external_docs:type_name -> openapi.v3.ExternalDocs
+ 29, // 163: openapi.v3.Tag.specification_extension:type_name -> openapi.v3.NamedAny
+ 29, // 164: openapi.v3.Xml.specification_extension:type_name -> openapi.v3.NamedAny
+ 165, // [165:165] is the sub-list for method output_type
+ 165, // [165:165] is the sub-list for method input_type
+ 165, // [165:165] is the sub-list for extension type_name
+ 165, // [165:165] is the sub-list for extension extendee
+ 0, // [0:165] is the sub-list for field type_name
+}
+
+func init() { file_openapiv3_OpenAPIv3_proto_init() }
+func file_openapiv3_OpenAPIv3_proto_init() {
+ if File_openapiv3_OpenAPIv3_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_openapiv3_OpenAPIv3_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*AdditionalPropertiesItem); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Any); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*AnyOrExpression); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Callback); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CallbackOrReference); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CallbacksOrReferences); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Components); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Contact); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*DefaultType); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Discriminator); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Document); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Encoding); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Encodings); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Example); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ExampleOrReference); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ExamplesOrReferences); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Expression); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ExternalDocs); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Header); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*HeaderOrReference); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*HeadersOrReferences); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Info); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ItemsItem); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*License); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Link); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*LinkOrReference); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*LinksOrReferences); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*MediaType); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*MediaTypes); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedAny); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedCallbackOrReference); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedEncoding); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedExampleOrReference); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedHeaderOrReference); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedLinkOrReference); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedMediaType); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedParameterOrReference); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedPathItem); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedRequestBodyOrReference); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedResponseOrReference); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedSchemaOrReference); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedSecuritySchemeOrReference); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedServerVariable); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedString); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedStringArray); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*OauthFlow); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*OauthFlows); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Object); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Operation); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[49].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Parameter); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[50].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ParameterOrReference); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[51].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ParametersOrReferences); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[52].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*PathItem); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[53].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Paths); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[54].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Properties); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[55].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Reference); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[56].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*RequestBodiesOrReferences); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[57].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*RequestBody); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[58].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*RequestBodyOrReference); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[59].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Response); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[60].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ResponseOrReference); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[61].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Responses); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[62].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ResponsesOrReferences); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[63].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Schema); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[64].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SchemaOrReference); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[65].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SchemasOrReferences); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[66].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SecurityRequirement); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[67].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SecurityScheme); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[68].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SecuritySchemeOrReference); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[69].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SecuritySchemesOrReferences); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[70].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Server); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[71].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ServerVariable); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[72].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ServerVariables); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[73].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SpecificationExtension); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[74].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*StringArray); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[75].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Strings); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[76].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Tag); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[77].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Xml); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[0].OneofWrappers = []interface{}{
+ (*AdditionalPropertiesItem_SchemaOrReference)(nil),
+ (*AdditionalPropertiesItem_Boolean)(nil),
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[2].OneofWrappers = []interface{}{
+ (*AnyOrExpression_Any)(nil),
+ (*AnyOrExpression_Expression)(nil),
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[4].OneofWrappers = []interface{}{
+ (*CallbackOrReference_Callback)(nil),
+ (*CallbackOrReference_Reference)(nil),
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[8].OneofWrappers = []interface{}{
+ (*DefaultType_Number)(nil),
+ (*DefaultType_Boolean)(nil),
+ (*DefaultType_String_)(nil),
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[14].OneofWrappers = []interface{}{
+ (*ExampleOrReference_Example)(nil),
+ (*ExampleOrReference_Reference)(nil),
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[19].OneofWrappers = []interface{}{
+ (*HeaderOrReference_Header)(nil),
+ (*HeaderOrReference_Reference)(nil),
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[25].OneofWrappers = []interface{}{
+ (*LinkOrReference_Link)(nil),
+ (*LinkOrReference_Reference)(nil),
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[50].OneofWrappers = []interface{}{
+ (*ParameterOrReference_Parameter)(nil),
+ (*ParameterOrReference_Reference)(nil),
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[58].OneofWrappers = []interface{}{
+ (*RequestBodyOrReference_RequestBody)(nil),
+ (*RequestBodyOrReference_Reference)(nil),
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[60].OneofWrappers = []interface{}{
+ (*ResponseOrReference_Response)(nil),
+ (*ResponseOrReference_Reference)(nil),
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[64].OneofWrappers = []interface{}{
+ (*SchemaOrReference_Schema)(nil),
+ (*SchemaOrReference_Reference)(nil),
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[68].OneofWrappers = []interface{}{
+ (*SecuritySchemeOrReference_SecurityScheme)(nil),
+ (*SecuritySchemeOrReference_Reference)(nil),
+ }
+ file_openapiv3_OpenAPIv3_proto_msgTypes[73].OneofWrappers = []interface{}{
+ (*SpecificationExtension_Number)(nil),
+ (*SpecificationExtension_Boolean)(nil),
+ (*SpecificationExtension_String_)(nil),
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_openapiv3_OpenAPIv3_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 78,
+ NumExtensions: 0,
+ NumServices: 0,
+ },
+ GoTypes: file_openapiv3_OpenAPIv3_proto_goTypes,
+ DependencyIndexes: file_openapiv3_OpenAPIv3_proto_depIdxs,
+ MessageInfos: file_openapiv3_OpenAPIv3_proto_msgTypes,
+ }.Build()
+ File_openapiv3_OpenAPIv3_proto = out.File
+ file_openapiv3_OpenAPIv3_proto_rawDesc = nil
+ file_openapiv3_OpenAPIv3_proto_goTypes = nil
+ file_openapiv3_OpenAPIv3_proto_depIdxs = nil
+}
diff --git a/vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.proto b/vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.proto
new file mode 100644
index 000000000..1be335b89
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.proto
@@ -0,0 +1,672 @@
+// Copyright 2020 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// THIS FILE IS AUTOMATICALLY GENERATED.
+
+syntax = "proto3";
+
+package openapi.v3;
+
+import "google/protobuf/any.proto";
+
+// This option lets the proto compiler generate Java code inside the package
+// name (see below) instead of inside an outer class. It creates a simpler
+// developer experience by reducing one-level of name nesting and be
+// consistent with most programming languages that don't support outer classes.
+option java_multiple_files = true;
+
+// The Java outer classname should be the filename in UpperCamelCase. This
+// class is only used to hold proto descriptor, so developers don't need to
+// work with it directly.
+option java_outer_classname = "OpenAPIProto";
+
+// The Java package name must be proto package name with proper prefix.
+option java_package = "org.openapi_v3";
+
+// A reasonable prefix for the Objective-C symbols generated from the package.
+// It should at a minimum be 3 characters long, all uppercase, and convention
+// is to use an abbreviation of the package name. Something short, but
+// hopefully unique enough to not conflict with things that may come along in
+// the future. 'GPB' is reserved for the protocol buffer implementation itself.
+option objc_class_prefix = "OAS";
+
+// The Go package name.
+option go_package = "./openapiv3;openapi_v3";
+
+message AdditionalPropertiesItem {
+ oneof oneof {
+ SchemaOrReference schema_or_reference = 1;
+ bool boolean = 2;
+ }
+}
+
+message Any {
+ google.protobuf.Any value = 1;
+ string yaml = 2;
+}
+
+message AnyOrExpression {
+ oneof oneof {
+ Any any = 1;
+ Expression expression = 2;
+ }
+}
+
+// A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.
+message Callback {
+ repeated NamedPathItem path = 1;
+ repeated NamedAny specification_extension = 2;
+}
+
+message CallbackOrReference {
+ oneof oneof {
+ Callback callback = 1;
+ Reference reference = 2;
+ }
+}
+
+message CallbacksOrReferences {
+ repeated NamedCallbackOrReference additional_properties = 1;
+}
+
+// Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.
+message Components {
+ SchemasOrReferences schemas = 1;
+ ResponsesOrReferences responses = 2;
+ ParametersOrReferences parameters = 3;
+ ExamplesOrReferences examples = 4;
+ RequestBodiesOrReferences request_bodies = 5;
+ HeadersOrReferences headers = 6;
+ SecuritySchemesOrReferences security_schemes = 7;
+ LinksOrReferences links = 8;
+ CallbacksOrReferences callbacks = 9;
+ repeated NamedAny specification_extension = 10;
+}
+
+// Contact information for the exposed API.
+message Contact {
+ string name = 1;
+ string url = 2;
+ string email = 3;
+ repeated NamedAny specification_extension = 4;
+}
+
+message DefaultType {
+ oneof oneof {
+ double number = 1;
+ bool boolean = 2;
+ string string = 3;
+ }
+}
+
+// When request bodies or response payloads may be one of a number of different schemas, a `discriminator` object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it. When using the discriminator, _inline_ schemas will not be considered.
+message Discriminator {
+ string property_name = 1;
+ Strings mapping = 2;
+ repeated NamedAny specification_extension = 3;
+}
+
+message Document {
+ string openapi = 1;
+ Info info = 2;
+ repeated Server servers = 3;
+ Paths paths = 4;
+ Components components = 5;
+ repeated SecurityRequirement security = 6;
+ repeated Tag tags = 7;
+ ExternalDocs external_docs = 8;
+ repeated NamedAny specification_extension = 9;
+}
+
+// A single encoding definition applied to a single schema property.
+message Encoding {
+ string content_type = 1;
+ HeadersOrReferences headers = 2;
+ string style = 3;
+ bool explode = 4;
+ bool allow_reserved = 5;
+ repeated NamedAny specification_extension = 6;
+}
+
+message Encodings {
+ repeated NamedEncoding additional_properties = 1;
+}
+
+message Example {
+ string summary = 1;
+ string description = 2;
+ Any value = 3;
+ string external_value = 4;
+ repeated NamedAny specification_extension = 5;
+}
+
+message ExampleOrReference {
+ oneof oneof {
+ Example example = 1;
+ Reference reference = 2;
+ }
+}
+
+message ExamplesOrReferences {
+ repeated NamedExampleOrReference additional_properties = 1;
+}
+
+message Expression {
+ repeated NamedAny additional_properties = 1;
+}
+
+// Allows referencing an external resource for extended documentation.
+message ExternalDocs {
+ string description = 1;
+ string url = 2;
+ repeated NamedAny specification_extension = 3;
+}
+
+// The Header Object follows the structure of the Parameter Object with the following changes: 1. `name` MUST NOT be specified, it is given in the corresponding `headers` map. 1. `in` MUST NOT be specified, it is implicitly in `header`. 1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, `style`).
+message Header {
+ string description = 1;
+ bool required = 2;
+ bool deprecated = 3;
+ bool allow_empty_value = 4;
+ string style = 5;
+ bool explode = 6;
+ bool allow_reserved = 7;
+ SchemaOrReference schema = 8;
+ Any example = 9;
+ ExamplesOrReferences examples = 10;
+ MediaTypes content = 11;
+ repeated NamedAny specification_extension = 12;
+}
+
+message HeaderOrReference {
+ oneof oneof {
+ Header header = 1;
+ Reference reference = 2;
+ }
+}
+
+message HeadersOrReferences {
+ repeated NamedHeaderOrReference additional_properties = 1;
+}
+
+// The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.
+message Info {
+ string title = 1;
+ string description = 2;
+ string terms_of_service = 3;
+ Contact contact = 4;
+ License license = 5;
+ string version = 6;
+ repeated NamedAny specification_extension = 7;
+ string summary = 8;
+}
+
+message ItemsItem {
+ repeated SchemaOrReference schema_or_reference = 1;
+}
+
+// License information for the exposed API.
+message License {
+ string name = 1;
+ string url = 2;
+ repeated NamedAny specification_extension = 3;
+}
+
+// The `Link object` represents a possible design-time link for a response. The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. Unlike _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require link information in the runtime response. For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.
+message Link {
+ string operation_ref = 1;
+ string operation_id = 2;
+ AnyOrExpression parameters = 3;
+ AnyOrExpression request_body = 4;
+ string description = 5;
+ Server server = 6;
+ repeated NamedAny specification_extension = 7;
+}
+
+message LinkOrReference {
+ oneof oneof {
+ Link link = 1;
+ Reference reference = 2;
+ }
+}
+
+message LinksOrReferences {
+ repeated NamedLinkOrReference additional_properties = 1;
+}
+
+// Each Media Type Object provides schema and examples for the media type identified by its key.
+message MediaType {
+ SchemaOrReference schema = 1;
+ Any example = 2;
+ ExamplesOrReferences examples = 3;
+ Encodings encoding = 4;
+ repeated NamedAny specification_extension = 5;
+}
+
+message MediaTypes {
+ repeated NamedMediaType additional_properties = 1;
+}
+
+// Automatically-generated message used to represent maps of Any as ordered (name,value) pairs.
+message NamedAny {
+ // Map key
+ string name = 1;
+ // Mapped value
+ Any value = 2;
+}
+
+// Automatically-generated message used to represent maps of CallbackOrReference as ordered (name,value) pairs.
+message NamedCallbackOrReference {
+ // Map key
+ string name = 1;
+ // Mapped value
+ CallbackOrReference value = 2;
+}
+
+// Automatically-generated message used to represent maps of Encoding as ordered (name,value) pairs.
+message NamedEncoding {
+ // Map key
+ string name = 1;
+ // Mapped value
+ Encoding value = 2;
+}
+
+// Automatically-generated message used to represent maps of ExampleOrReference as ordered (name,value) pairs.
+message NamedExampleOrReference {
+ // Map key
+ string name = 1;
+ // Mapped value
+ ExampleOrReference value = 2;
+}
+
+// Automatically-generated message used to represent maps of HeaderOrReference as ordered (name,value) pairs.
+message NamedHeaderOrReference {
+ // Map key
+ string name = 1;
+ // Mapped value
+ HeaderOrReference value = 2;
+}
+
+// Automatically-generated message used to represent maps of LinkOrReference as ordered (name,value) pairs.
+message NamedLinkOrReference {
+ // Map key
+ string name = 1;
+ // Mapped value
+ LinkOrReference value = 2;
+}
+
+// Automatically-generated message used to represent maps of MediaType as ordered (name,value) pairs.
+message NamedMediaType {
+ // Map key
+ string name = 1;
+ // Mapped value
+ MediaType value = 2;
+}
+
+// Automatically-generated message used to represent maps of ParameterOrReference as ordered (name,value) pairs.
+message NamedParameterOrReference {
+ // Map key
+ string name = 1;
+ // Mapped value
+ ParameterOrReference value = 2;
+}
+
+// Automatically-generated message used to represent maps of PathItem as ordered (name,value) pairs.
+message NamedPathItem {
+ // Map key
+ string name = 1;
+ // Mapped value
+ PathItem value = 2;
+}
+
+// Automatically-generated message used to represent maps of RequestBodyOrReference as ordered (name,value) pairs.
+message NamedRequestBodyOrReference {
+ // Map key
+ string name = 1;
+ // Mapped value
+ RequestBodyOrReference value = 2;
+}
+
+// Automatically-generated message used to represent maps of ResponseOrReference as ordered (name,value) pairs.
+message NamedResponseOrReference {
+ // Map key
+ string name = 1;
+ // Mapped value
+ ResponseOrReference value = 2;
+}
+
+// Automatically-generated message used to represent maps of SchemaOrReference as ordered (name,value) pairs.
+message NamedSchemaOrReference {
+ // Map key
+ string name = 1;
+ // Mapped value
+ SchemaOrReference value = 2;
+}
+
+// Automatically-generated message used to represent maps of SecuritySchemeOrReference as ordered (name,value) pairs.
+message NamedSecuritySchemeOrReference {
+ // Map key
+ string name = 1;
+ // Mapped value
+ SecuritySchemeOrReference value = 2;
+}
+
+// Automatically-generated message used to represent maps of ServerVariable as ordered (name,value) pairs.
+message NamedServerVariable {
+ // Map key
+ string name = 1;
+ // Mapped value
+ ServerVariable value = 2;
+}
+
+// Automatically-generated message used to represent maps of string as ordered (name,value) pairs.
+message NamedString {
+ // Map key
+ string name = 1;
+ // Mapped value
+ string value = 2;
+}
+
+// Automatically-generated message used to represent maps of StringArray as ordered (name,value) pairs.
+message NamedStringArray {
+ // Map key
+ string name = 1;
+ // Mapped value
+ StringArray value = 2;
+}
+
+// Configuration details for a supported OAuth Flow
+message OauthFlow {
+ string authorization_url = 1;
+ string token_url = 2;
+ string refresh_url = 3;
+ Strings scopes = 4;
+ repeated NamedAny specification_extension = 5;
+}
+
+// Allows configuration of the supported OAuth Flows.
+message OauthFlows {
+ OauthFlow implicit = 1;
+ OauthFlow password = 2;
+ OauthFlow client_credentials = 3;
+ OauthFlow authorization_code = 4;
+ repeated NamedAny specification_extension = 5;
+}
+
+message Object {
+ repeated NamedAny additional_properties = 1;
+}
+
+// Describes a single API operation on a path.
+message Operation {
+ repeated string tags = 1;
+ string summary = 2;
+ string description = 3;
+ ExternalDocs external_docs = 4;
+ string operation_id = 5;
+ repeated ParameterOrReference parameters = 6;
+ RequestBodyOrReference request_body = 7;
+ Responses responses = 8;
+ CallbacksOrReferences callbacks = 9;
+ bool deprecated = 10;
+ repeated SecurityRequirement security = 11;
+ repeated Server servers = 12;
+ repeated NamedAny specification_extension = 13;
+}
+
+// Describes a single operation parameter. A unique parameter is defined by a combination of a name and location.
+message Parameter {
+ string name = 1;
+ string in = 2;
+ string description = 3;
+ bool required = 4;
+ bool deprecated = 5;
+ bool allow_empty_value = 6;
+ string style = 7;
+ bool explode = 8;
+ bool allow_reserved = 9;
+ SchemaOrReference schema = 10;
+ Any example = 11;
+ ExamplesOrReferences examples = 12;
+ MediaTypes content = 13;
+ repeated NamedAny specification_extension = 14;
+}
+
+message ParameterOrReference {
+ oneof oneof {
+ Parameter parameter = 1;
+ Reference reference = 2;
+ }
+}
+
+message ParametersOrReferences {
+ repeated NamedParameterOrReference additional_properties = 1;
+}
+
+// Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.
+message PathItem {
+ string _ref = 1;
+ string summary = 2;
+ string description = 3;
+ Operation get = 4;
+ Operation put = 5;
+ Operation post = 6;
+ Operation delete = 7;
+ Operation options = 8;
+ Operation head = 9;
+ Operation patch = 10;
+ Operation trace = 11;
+ repeated Server servers = 12;
+ repeated ParameterOrReference parameters = 13;
+ repeated NamedAny specification_extension = 14;
+}
+
+// Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the `Server Object` in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.
+message Paths {
+ repeated NamedPathItem path = 1;
+ repeated NamedAny specification_extension = 2;
+}
+
+message Properties {
+ repeated NamedSchemaOrReference additional_properties = 1;
+}
+
+// A simple object to allow referencing other components in the specification, internally and externally. The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules. For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.
+message Reference {
+ string _ref = 1;
+ string summary = 2;
+ string description = 3;
+}
+
+message RequestBodiesOrReferences {
+ repeated NamedRequestBodyOrReference additional_properties = 1;
+}
+
+// Describes a single request body.
+message RequestBody {
+ string description = 1;
+ MediaTypes content = 2;
+ bool required = 3;
+ repeated NamedAny specification_extension = 4;
+}
+
+message RequestBodyOrReference {
+ oneof oneof {
+ RequestBody request_body = 1;
+ Reference reference = 2;
+ }
+}
+
+// Describes a single response from an API Operation, including design-time, static `links` to operations based on the response.
+message Response {
+ string description = 1;
+ HeadersOrReferences headers = 2;
+ MediaTypes content = 3;
+ LinksOrReferences links = 4;
+ repeated NamedAny specification_extension = 5;
+}
+
+message ResponseOrReference {
+ oneof oneof {
+ Response response = 1;
+ Reference reference = 2;
+ }
+}
+
+// A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. However, documentation is expected to cover a successful operation response and any known errors. The `default` MAY be used as a default response object for all HTTP codes that are not covered individually by the specification. The `Responses Object` MUST contain at least one response code, and it SHOULD be the response for a successful operation call.
+message Responses {
+ ResponseOrReference default = 1;
+ repeated NamedResponseOrReference response_or_reference = 2;
+ repeated NamedAny specification_extension = 3;
+}
+
+message ResponsesOrReferences {
+ repeated NamedResponseOrReference additional_properties = 1;
+}
+
+// The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is an extended subset of the JSON Schema Specification Wright Draft 00. For more information about the properties, see JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema.
+message Schema {
+ bool nullable = 1;
+ Discriminator discriminator = 2;
+ bool read_only = 3;
+ bool write_only = 4;
+ Xml xml = 5;
+ ExternalDocs external_docs = 6;
+ Any example = 7;
+ bool deprecated = 8;
+ string title = 9;
+ double multiple_of = 10;
+ double maximum = 11;
+ bool exclusive_maximum = 12;
+ double minimum = 13;
+ bool exclusive_minimum = 14;
+ int64 max_length = 15;
+ int64 min_length = 16;
+ string pattern = 17;
+ int64 max_items = 18;
+ int64 min_items = 19;
+ bool unique_items = 20;
+ int64 max_properties = 21;
+ int64 min_properties = 22;
+ repeated string required = 23;
+ repeated Any enum = 24;
+ string type = 25;
+ repeated SchemaOrReference all_of = 26;
+ repeated SchemaOrReference one_of = 27;
+ repeated SchemaOrReference any_of = 28;
+ Schema not = 29;
+ ItemsItem items = 30;
+ Properties properties = 31;
+ AdditionalPropertiesItem additional_properties = 32;
+ DefaultType default = 33;
+ string description = 34;
+ string format = 35;
+ repeated NamedAny specification_extension = 36;
+}
+
+message SchemaOrReference {
+ oneof oneof {
+ Schema schema = 1;
+ Reference reference = 2;
+ }
+}
+
+message SchemasOrReferences {
+ repeated NamedSchemaOrReference additional_properties = 1;
+}
+
+// Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object. Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information. When a list of Security Requirement Objects is defined on the OpenAPI Object or Operation Object, only one of the Security Requirement Objects in the list needs to be satisfied to authorize the request.
+message SecurityRequirement {
+ repeated NamedStringArray additional_properties = 1;
+}
+
+// Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header, a cookie parameter or as a query parameter), mutual TLS (use of a client certificate), OAuth2's common flows (implicit, password, application and access code) as defined in RFC6749, and OpenID Connect. Please note that currently (2019) the implicit flow is about to be deprecated OAuth 2.0 Security Best Current Practice. Recommended for most use case is Authorization Code Grant flow with PKCE.
+message SecurityScheme {
+ string type = 1;
+ string description = 2;
+ string name = 3;
+ string in = 4;
+ string scheme = 5;
+ string bearer_format = 6;
+ OauthFlows flows = 7;
+ string open_id_connect_url = 8;
+ repeated NamedAny specification_extension = 9;
+}
+
+message SecuritySchemeOrReference {
+ oneof oneof {
+ SecurityScheme security_scheme = 1;
+ Reference reference = 2;
+ }
+}
+
+message SecuritySchemesOrReferences {
+ repeated NamedSecuritySchemeOrReference additional_properties = 1;
+}
+
+// An object representing a Server.
+message Server {
+ string url = 1;
+ string description = 2;
+ ServerVariables variables = 3;
+ repeated NamedAny specification_extension = 4;
+}
+
+// An object representing a Server Variable for server URL template substitution.
+message ServerVariable {
+ repeated string enum = 1;
+ string default = 2;
+ string description = 3;
+ repeated NamedAny specification_extension = 4;
+}
+
+message ServerVariables {
+ repeated NamedServerVariable additional_properties = 1;
+}
+
+// Any property starting with x- is valid.
+message SpecificationExtension {
+ oneof oneof {
+ double number = 1;
+ bool boolean = 2;
+ string string = 3;
+ }
+}
+
+message StringArray {
+ repeated string value = 1;
+}
+
+message Strings {
+ repeated NamedString additional_properties = 1;
+}
+
+// Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.
+message Tag {
+ string name = 1;
+ string description = 2;
+ ExternalDocs external_docs = 3;
+ repeated NamedAny specification_extension = 4;
+}
+
+// A metadata object that allows for more fine-tuned XML model definitions. When using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property SHOULD be used to add that information. See examples for expected behavior.
+message Xml {
+ string name = 1;
+ string namespace = 2;
+ string prefix = 3;
+ bool attribute = 4;
+ bool wrapped = 5;
+ repeated NamedAny specification_extension = 6;
+}
+
diff --git a/vendor/github.com/google/gnostic-models/openapiv3/README.md b/vendor/github.com/google/gnostic-models/openapiv3/README.md
new file mode 100644
index 000000000..5ee12d92e
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/openapiv3/README.md
@@ -0,0 +1,21 @@
+# OpenAPI v3 Protocol Buffer Models
+
+This directory contains a Protocol Buffer-language model and related code for
+supporting OpenAPI v3.
+
+Gnostic applications and plugins can use OpenAPIv3.proto to generate Protocol
+Buffer support code for their preferred languages.
+
+OpenAPIv3.go is used by Gnostic to read JSON and YAML OpenAPI descriptions into
+the Protocol Buffer-based datastructures generated from OpenAPIv3.proto.
+
+OpenAPIv3.proto and OpenAPIv3.go are generated by the Gnostic compiler
+generator, and OpenAPIv3.pb.go is generated by protoc, the Protocol Buffer
+compiler, and protoc-gen-go, the Protocol Buffer Go code generation plugin.
+
+openapi-3.1.json is a JSON schema for OpenAPI 3.1 that is automatically
+generated from the OpenAPI 3.1 specification. It is not an official JSON Schema
+for OpenAPI.
+
+The schema-generator directory contains support code which generates
+openapi-3.1.json from the OpenAPI 3.1 specification document (Markdown).
diff --git a/vendor/github.com/google/gnostic-models/openapiv3/document.go b/vendor/github.com/google/gnostic-models/openapiv3/document.go
new file mode 100644
index 000000000..1cee46773
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/openapiv3/document.go
@@ -0,0 +1,42 @@
+// Copyright 2020 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package openapi_v3
+
+import (
+ "gopkg.in/yaml.v3"
+
+ "github.com/google/gnostic-models/compiler"
+)
+
+// ParseDocument reads an OpenAPI v3 description from a YAML/JSON representation.
+func ParseDocument(b []byte) (*Document, error) {
+ info, err := compiler.ReadInfoFromBytes("", b)
+ if err != nil {
+ return nil, err
+ }
+ root := info.Content[0]
+ return NewDocument(root, compiler.NewContextWithExtensions("$root", root, nil, nil))
+}
+
+// YAMLValue produces a serialized YAML representation of the document.
+func (d *Document) YAMLValue(comment string) ([]byte, error) {
+ rawInfo := d.ToRawInfo()
+ rawInfo = &yaml.Node{
+ Kind: yaml.DocumentNode,
+ Content: []*yaml.Node{rawInfo},
+ HeadComment: comment,
+ }
+ return yaml.Marshal(rawInfo)
+}
diff --git a/vendor/github.com/google/go-cmp/cmp/compare.go b/vendor/github.com/google/go-cmp/cmp/compare.go
index 86d0903b8..0f5b8a48c 100644
--- a/vendor/github.com/google/go-cmp/cmp/compare.go
+++ b/vendor/github.com/google/go-cmp/cmp/compare.go
@@ -5,7 +5,7 @@
// Package cmp determines equality of values.
//
// This package is intended to be a more powerful and safer alternative to
-// reflect.DeepEqual for comparing whether two values are semantically equal.
+// [reflect.DeepEqual] for comparing whether two values are semantically equal.
// It is intended to only be used in tests, as performance is not a goal and
// it may panic if it cannot compare the values. Its propensity towards
// panicking means that its unsuitable for production environments where a
@@ -13,21 +13,22 @@
//
// The primary features of cmp are:
//
-// • When the default behavior of equality does not suit the needs of the test,
-// custom equality functions can override the equality operation.
-// For example, an equality function may report floats as equal so long as they
-// are within some tolerance of each other.
+// - When the default behavior of equality does not suit the test's needs,
+// custom equality functions can override the equality operation.
+// For example, an equality function may report floats as equal so long as
+// they are within some tolerance of each other.
//
-// • Types that have an Equal method may use that method to determine equality.
-// This allows package authors to determine the equality operation for the types
-// that they define.
+// - Types with an Equal method (e.g., [time.Time.Equal]) may use that method
+// to determine equality. This allows package authors to determine
+// the equality operation for the types that they define.
//
-// • If no custom equality functions are used and no Equal method is defined,
-// equality is determined by recursively comparing the primitive kinds on both
-// values, much like reflect.DeepEqual. Unlike reflect.DeepEqual, unexported
-// fields are not compared by default; they result in panics unless suppressed
-// by using an Ignore option (see cmpopts.IgnoreUnexported) or explicitly
-// compared using the Exporter option.
+// - If no custom equality functions are used and no Equal method is defined,
+// equality is determined by recursively comparing the primitive kinds on
+// both values, much like [reflect.DeepEqual]. Unlike [reflect.DeepEqual],
+// unexported fields are not compared by default; they result in panics
+// unless suppressed by using an [Ignore] option
+// (see [github.com/google/go-cmp/cmp/cmpopts.IgnoreUnexported])
+// or explicitly compared using the [Exporter] option.
package cmp
import (
@@ -36,50 +37,52 @@ import (
"strings"
"github.com/google/go-cmp/cmp/internal/diff"
- "github.com/google/go-cmp/cmp/internal/flags"
"github.com/google/go-cmp/cmp/internal/function"
"github.com/google/go-cmp/cmp/internal/value"
)
+// TODO(≥go1.18): Use any instead of interface{}.
+
// Equal reports whether x and y are equal by recursively applying the
// following rules in the given order to x and y and all of their sub-values:
//
-// • Let S be the set of all Ignore, Transformer, and Comparer options that
-// remain after applying all path filters, value filters, and type filters.
-// If at least one Ignore exists in S, then the comparison is ignored.
-// If the number of Transformer and Comparer options in S is greater than one,
-// then Equal panics because it is ambiguous which option to use.
-// If S contains a single Transformer, then use that to transform the current
-// values and recursively call Equal on the output values.
-// If S contains a single Comparer, then use that to compare the current values.
-// Otherwise, evaluation proceeds to the next rule.
+// - Let S be the set of all [Ignore], [Transformer], and [Comparer] options that
+// remain after applying all path filters, value filters, and type filters.
+// If at least one [Ignore] exists in S, then the comparison is ignored.
+// If the number of [Transformer] and [Comparer] options in S is non-zero,
+// then Equal panics because it is ambiguous which option to use.
+// If S contains a single [Transformer], then use that to transform
+// the current values and recursively call Equal on the output values.
+// If S contains a single [Comparer], then use that to compare the current values.
+// Otherwise, evaluation proceeds to the next rule.
//
-// • If the values have an Equal method of the form "(T) Equal(T) bool" or
-// "(T) Equal(I) bool" where T is assignable to I, then use the result of
-// x.Equal(y) even if x or y is nil. Otherwise, no such method exists and
-// evaluation proceeds to the next rule.
+// - If the values have an Equal method of the form "(T) Equal(T) bool" or
+// "(T) Equal(I) bool" where T is assignable to I, then use the result of
+// x.Equal(y) even if x or y is nil. Otherwise, no such method exists and
+// evaluation proceeds to the next rule.
//
-// • Lastly, try to compare x and y based on their basic kinds.
-// Simple kinds like booleans, integers, floats, complex numbers, strings, and
-// channels are compared using the equivalent of the == operator in Go.
-// Functions are only equal if they are both nil, otherwise they are unequal.
+// - Lastly, try to compare x and y based on their basic kinds.
+// Simple kinds like booleans, integers, floats, complex numbers, strings,
+// and channels are compared using the equivalent of the == operator in Go.
+// Functions are only equal if they are both nil, otherwise they are unequal.
//
// Structs are equal if recursively calling Equal on all fields report equal.
-// If a struct contains unexported fields, Equal panics unless an Ignore option
-// (e.g., cmpopts.IgnoreUnexported) ignores that field or the Exporter option
-// explicitly permits comparing the unexported field.
+// If a struct contains unexported fields, Equal panics unless an [Ignore] option
+// (e.g., [github.com/google/go-cmp/cmp/cmpopts.IgnoreUnexported]) ignores that field
+// or the [Exporter] option explicitly permits comparing the unexported field.
//
// Slices are equal if they are both nil or both non-nil, where recursively
// calling Equal on all non-ignored slice or array elements report equal.
// Empty non-nil slices and nil slices are not equal; to equate empty slices,
-// consider using cmpopts.EquateEmpty.
+// consider using [github.com/google/go-cmp/cmp/cmpopts.EquateEmpty].
//
// Maps are equal if they are both nil or both non-nil, where recursively
// calling Equal on all non-ignored map entries report equal.
// Map keys are equal according to the == operator.
-// To use custom comparisons for map keys, consider using cmpopts.SortMaps.
+// To use custom comparisons for map keys, consider using
+// [github.com/google/go-cmp/cmp/cmpopts.SortMaps].
// Empty non-nil maps and nil maps are not equal; to equate empty maps,
-// consider using cmpopts.EquateEmpty.
+// consider using [github.com/google/go-cmp/cmp/cmpopts.EquateEmpty].
//
// Pointers and interfaces are equal if they are both nil or both non-nil,
// where they have the same underlying concrete type and recursively
@@ -143,7 +146,7 @@ func rootStep(x, y interface{}) PathStep {
// so that they have the same parent type.
var t reflect.Type
if !vx.IsValid() || !vy.IsValid() || vx.Type() != vy.Type() {
- t = reflect.TypeOf((*interface{})(nil)).Elem()
+ t = anyType
if vx.IsValid() {
vvx := reflect.New(t).Elem()
vvx.Set(vx)
@@ -319,7 +322,6 @@ func (s *state) tryMethod(t reflect.Type, vx, vy reflect.Value) bool {
}
func (s *state) callTRFunc(f, v reflect.Value, step Transform) reflect.Value {
- v = sanitizeValue(v, f.Type().In(0))
if !s.dynChecker.Next() {
return f.Call([]reflect.Value{v})[0]
}
@@ -343,8 +345,6 @@ func (s *state) callTRFunc(f, v reflect.Value, step Transform) reflect.Value {
}
func (s *state) callTTBFunc(f, x, y reflect.Value) bool {
- x = sanitizeValue(x, f.Type().In(0))
- y = sanitizeValue(y, f.Type().In(1))
if !s.dynChecker.Next() {
return f.Call([]reflect.Value{x, y})[0].Bool()
}
@@ -372,19 +372,6 @@ func detectRaces(c chan<- reflect.Value, f reflect.Value, vs ...reflect.Value) {
ret = f.Call(vs)[0]
}
-// sanitizeValue converts nil interfaces of type T to those of type R,
-// assuming that T is assignable to R.
-// Otherwise, it returns the input value as is.
-func sanitizeValue(v reflect.Value, t reflect.Type) reflect.Value {
- // TODO(≥go1.10): Workaround for reflect bug (https://golang.org/issue/22143).
- if !flags.AtLeastGo110 {
- if v.Kind() == reflect.Interface && v.IsNil() && v.Type() != t {
- return reflect.New(t).Elem()
- }
- }
- return v
-}
-
func (s *state) compareStruct(t reflect.Type, vx, vy reflect.Value) {
var addr bool
var vax, vay reflect.Value // Addressable versions of vx and vy
@@ -654,7 +641,9 @@ type dynChecker struct{ curr, next int }
// Next increments the state and reports whether a check should be performed.
//
// Checks occur every Nth function call, where N is a triangular number:
+//
// 0 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 ...
+//
// See https://en.wikipedia.org/wiki/Triangular_number
//
// This sequence ensures that the cost of checks drops significantly as
diff --git a/vendor/github.com/google/go-cmp/cmp/export_unsafe.go b/vendor/github.com/google/go-cmp/cmp/export.go
similarity index 95%
rename from vendor/github.com/google/go-cmp/cmp/export_unsafe.go
rename to vendor/github.com/google/go-cmp/cmp/export.go
index 21eb54858..29f82fe6b 100644
--- a/vendor/github.com/google/go-cmp/cmp/export_unsafe.go
+++ b/vendor/github.com/google/go-cmp/cmp/export.go
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !purego
-
package cmp
import (
@@ -11,8 +9,6 @@ import (
"unsafe"
)
-const supportExporters = true
-
// retrieveUnexportedField uses unsafe to forcibly retrieve any field from
// a struct such that the value has read-write permissions.
//
diff --git a/vendor/github.com/google/go-cmp/cmp/export_panic.go b/vendor/github.com/google/go-cmp/cmp/export_panic.go
deleted file mode 100644
index 5ff0b4218..000000000
--- a/vendor/github.com/google/go-cmp/cmp/export_panic.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2017, The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build purego
-
-package cmp
-
-import "reflect"
-
-const supportExporters = false
-
-func retrieveUnexportedField(reflect.Value, reflect.StructField, bool) reflect.Value {
- panic("no support for forcibly accessing unexported fields")
-}
diff --git a/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go b/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go
index 1daaaacc5..36062a604 100644
--- a/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go
+++ b/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !cmp_debug
// +build !cmp_debug
package diff
diff --git a/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_enable.go b/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_enable.go
index 4b91dbcac..a3b97a1ad 100644
--- a/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_enable.go
+++ b/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_enable.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build cmp_debug
// +build cmp_debug
package diff
diff --git a/vendor/github.com/google/go-cmp/cmp/internal/diff/diff.go b/vendor/github.com/google/go-cmp/cmp/internal/diff/diff.go
index bc196b16c..a248e5436 100644
--- a/vendor/github.com/google/go-cmp/cmp/internal/diff/diff.go
+++ b/vendor/github.com/google/go-cmp/cmp/internal/diff/diff.go
@@ -127,9 +127,9 @@ var randBool = rand.New(rand.NewSource(time.Now().Unix())).Intn(2) == 0
// This function returns an edit-script, which is a sequence of operations
// needed to convert one list into the other. The following invariants for
// the edit-script are maintained:
-// • eq == (es.Dist()==0)
-// • nx == es.LenX()
-// • ny == es.LenY()
+// - eq == (es.Dist()==0)
+// - nx == es.LenX()
+// - ny == es.LenY()
//
// This algorithm is not guaranteed to be an optimal solution (i.e., one that
// produces an edit-script with a minimal Levenshtein distance). This algorithm
@@ -169,12 +169,13 @@ func Difference(nx, ny int, f EqualFunc) (es EditScript) {
// A diagonal edge is equivalent to a matching symbol between both X and Y.
// Invariants:
- // • 0 ≤ fwdPath.X ≤ (fwdFrontier.X, revFrontier.X) ≤ revPath.X ≤ nx
- // • 0 ≤ fwdPath.Y ≤ (fwdFrontier.Y, revFrontier.Y) ≤ revPath.Y ≤ ny
+ // - 0 ≤ fwdPath.X ≤ (fwdFrontier.X, revFrontier.X) ≤ revPath.X ≤ nx
+ // - 0 ≤ fwdPath.Y ≤ (fwdFrontier.Y, revFrontier.Y) ≤ revPath.Y ≤ ny
//
// In general:
- // • fwdFrontier.X < revFrontier.X
- // • fwdFrontier.Y < revFrontier.Y
+ // - fwdFrontier.X < revFrontier.X
+ // - fwdFrontier.Y < revFrontier.Y
+ //
// Unless, it is time for the algorithm to terminate.
fwdPath := path{+1, point{0, 0}, make(EditScript, 0, (nx+ny)/2)}
revPath := path{-1, point{nx, ny}, make(EditScript, 0)}
@@ -195,19 +196,21 @@ func Difference(nx, ny int, f EqualFunc) (es EditScript) {
// computing sub-optimal edit-scripts between two lists.
//
// The algorithm is approximately as follows:
- // • Searching for differences switches back-and-forth between
- // a search that starts at the beginning (the top-left corner), and
- // a search that starts at the end (the bottom-right corner). The goal of
- // the search is connect with the search from the opposite corner.
- // • As we search, we build a path in a greedy manner, where the first
- // match seen is added to the path (this is sub-optimal, but provides a
- // decent result in practice). When matches are found, we try the next pair
- // of symbols in the lists and follow all matches as far as possible.
- // • When searching for matches, we search along a diagonal going through
- // through the "frontier" point. If no matches are found, we advance the
- // frontier towards the opposite corner.
- // • This algorithm terminates when either the X coordinates or the
- // Y coordinates of the forward and reverse frontier points ever intersect.
+ // - Searching for differences switches back-and-forth between
+ // a search that starts at the beginning (the top-left corner), and
+ // a search that starts at the end (the bottom-right corner).
+ // The goal of the search is connect with the search
+ // from the opposite corner.
+ // - As we search, we build a path in a greedy manner,
+ // where the first match seen is added to the path (this is sub-optimal,
+ // but provides a decent result in practice). When matches are found,
+ // we try the next pair of symbols in the lists and follow all matches
+ // as far as possible.
+ // - When searching for matches, we search along a diagonal going through
+ // through the "frontier" point. If no matches are found,
+ // we advance the frontier towards the opposite corner.
+ // - This algorithm terminates when either the X coordinates or the
+ // Y coordinates of the forward and reverse frontier points ever intersect.
// This algorithm is correct even if searching only in the forward direction
// or in the reverse direction. We do both because it is commonly observed
@@ -389,6 +392,7 @@ type point struct{ X, Y int }
func (p *point) add(dx, dy int) { p.X += dx; p.Y += dy }
// zigzag maps a consecutive sequence of integers to a zig-zag sequence.
+//
// [0 1 2 3 4 5 ...] => [0 -1 +1 -2 +2 ...]
func zigzag(x int) int {
if x&1 != 0 {
diff --git a/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_legacy.go b/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_legacy.go
deleted file mode 100644
index 82d1d7fbf..000000000
--- a/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_legacy.go
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright 2019, The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !go1.10
-
-package flags
-
-// AtLeastGo110 reports whether the Go toolchain is at least Go 1.10.
-const AtLeastGo110 = false
diff --git a/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_recent.go b/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_recent.go
deleted file mode 100644
index 8646f0529..000000000
--- a/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_recent.go
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright 2019, The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.10
-
-package flags
-
-// AtLeastGo110 reports whether the Go toolchain is at least Go 1.10.
-const AtLeastGo110 = true
diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/name.go b/vendor/github.com/google/go-cmp/cmp/internal/value/name.go
index b6c12cefb..7b498bb2c 100644
--- a/vendor/github.com/google/go-cmp/cmp/internal/value/name.go
+++ b/vendor/github.com/google/go-cmp/cmp/internal/value/name.go
@@ -9,6 +9,8 @@ import (
"strconv"
)
+var anyType = reflect.TypeOf((*interface{})(nil)).Elem()
+
// TypeString is nearly identical to reflect.Type.String,
// but has an additional option to specify that full type names be used.
func TypeString(t reflect.Type, qualified bool) string {
@@ -20,6 +22,11 @@ func appendTypeName(b []byte, t reflect.Type, qualified, elideFunc bool) []byte
// of the same name and within the same package,
// but declared within the namespace of different functions.
+ // Use the "any" alias instead of "interface{}" for better readability.
+ if t == anyType {
+ return append(b, "any"...)
+ }
+
// Named type.
if t.Name() != "" {
if qualified && t.PkgPath() != "" {
diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go b/vendor/github.com/google/go-cmp/cmp/internal/value/pointer.go
similarity index 97%
rename from vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go
rename to vendor/github.com/google/go-cmp/cmp/internal/value/pointer.go
index a605953d4..e5dfff69a 100644
--- a/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go
+++ b/vendor/github.com/google/go-cmp/cmp/internal/value/pointer.go
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !purego
-
package value
import (
diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go b/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go
deleted file mode 100644
index 44f4a5afd..000000000
--- a/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2018, The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build purego
-
-package value
-
-import "reflect"
-
-// Pointer is an opaque typed pointer and is guaranteed to be comparable.
-type Pointer struct {
- p uintptr
- t reflect.Type
-}
-
-// PointerOf returns a Pointer from v, which must be a
-// reflect.Ptr, reflect.Slice, or reflect.Map.
-func PointerOf(v reflect.Value) Pointer {
- // NOTE: Storing a pointer as an uintptr is technically incorrect as it
- // assumes that the GC implementation does not use a moving collector.
- return Pointer{v.Pointer(), v.Type()}
-}
-
-// IsNil reports whether the pointer is nil.
-func (p Pointer) IsNil() bool {
- return p.p == 0
-}
-
-// Uintptr returns the pointer as a uintptr.
-func (p Pointer) Uintptr() uintptr {
- return p.p
-}
diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/zero.go b/vendor/github.com/google/go-cmp/cmp/internal/value/zero.go
deleted file mode 100644
index 9147a2997..000000000
--- a/vendor/github.com/google/go-cmp/cmp/internal/value/zero.go
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2017, The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package value
-
-import (
- "math"
- "reflect"
-)
-
-// IsZero reports whether v is the zero value.
-// This does not rely on Interface and so can be used on unexported fields.
-func IsZero(v reflect.Value) bool {
- switch v.Kind() {
- case reflect.Bool:
- return v.Bool() == false
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return v.Int() == 0
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return v.Uint() == 0
- case reflect.Float32, reflect.Float64:
- return math.Float64bits(v.Float()) == 0
- case reflect.Complex64, reflect.Complex128:
- return math.Float64bits(real(v.Complex())) == 0 && math.Float64bits(imag(v.Complex())) == 0
- case reflect.String:
- return v.String() == ""
- case reflect.UnsafePointer:
- return v.Pointer() == 0
- case reflect.Chan, reflect.Func, reflect.Interface, reflect.Ptr, reflect.Map, reflect.Slice:
- return v.IsNil()
- case reflect.Array:
- for i := 0; i < v.Len(); i++ {
- if !IsZero(v.Index(i)) {
- return false
- }
- }
- return true
- case reflect.Struct:
- for i := 0; i < v.NumField(); i++ {
- if !IsZero(v.Field(i)) {
- return false
- }
- }
- return true
- }
- return false
-}
diff --git a/vendor/github.com/google/go-cmp/cmp/options.go b/vendor/github.com/google/go-cmp/cmp/options.go
index e57b9eb53..754496f3b 100644
--- a/vendor/github.com/google/go-cmp/cmp/options.go
+++ b/vendor/github.com/google/go-cmp/cmp/options.go
@@ -13,15 +13,15 @@ import (
"github.com/google/go-cmp/cmp/internal/function"
)
-// Option configures for specific behavior of Equal and Diff. In particular,
-// the fundamental Option functions (Ignore, Transformer, and Comparer),
+// Option configures for specific behavior of [Equal] and [Diff]. In particular,
+// the fundamental Option functions ([Ignore], [Transformer], and [Comparer]),
// configure how equality is determined.
//
-// The fundamental options may be composed with filters (FilterPath and
-// FilterValues) to control the scope over which they are applied.
+// The fundamental options may be composed with filters ([FilterPath] and
+// [FilterValues]) to control the scope over which they are applied.
//
-// The cmp/cmpopts package provides helper functions for creating options that
-// may be used with Equal and Diff.
+// The [github.com/google/go-cmp/cmp/cmpopts] package provides helper functions
+// for creating options that may be used with [Equal] and [Diff].
type Option interface {
// filter applies all filters and returns the option that remains.
// Each option may only read s.curPath and call s.callTTBFunc.
@@ -33,6 +33,7 @@ type Option interface {
}
// applicableOption represents the following types:
+//
// Fundamental: ignore | validator | *comparer | *transformer
// Grouping: Options
type applicableOption interface {
@@ -43,6 +44,7 @@ type applicableOption interface {
}
// coreOption represents the following types:
+//
// Fundamental: ignore | validator | *comparer | *transformer
// Filters: *pathFilter | *valuesFilter
type coreOption interface {
@@ -54,9 +56,9 @@ type core struct{}
func (core) isCore() {}
-// Options is a list of Option values that also satisfies the Option interface.
+// Options is a list of [Option] values that also satisfies the [Option] interface.
// Helper comparison packages may return an Options value when packing multiple
-// Option values into a single Option. When this package processes an Options,
+// [Option] values into a single [Option]. When this package processes an Options,
// it will be implicitly expanded into a flat list.
//
// Applying a filter on an Options is equivalent to applying that same filter
@@ -103,16 +105,16 @@ func (opts Options) String() string {
return fmt.Sprintf("Options{%s}", strings.Join(ss, ", "))
}
-// FilterPath returns a new Option where opt is only evaluated if filter f
-// returns true for the current Path in the value tree.
+// FilterPath returns a new [Option] where opt is only evaluated if filter f
+// returns true for the current [Path] in the value tree.
//
// This filter is called even if a slice element or map entry is missing and
// provides an opportunity to ignore such cases. The filter function must be
// symmetric such that the filter result is identical regardless of whether the
// missing value is from x or y.
//
-// The option passed in may be an Ignore, Transformer, Comparer, Options, or
-// a previously filtered Option.
+// The option passed in may be an [Ignore], [Transformer], [Comparer], [Options], or
+// a previously filtered [Option].
func FilterPath(f func(Path) bool, opt Option) Option {
if f == nil {
panic("invalid path filter function")
@@ -140,7 +142,7 @@ func (f pathFilter) String() string {
return fmt.Sprintf("FilterPath(%s, %v)", function.NameOf(reflect.ValueOf(f.fnc)), f.opt)
}
-// FilterValues returns a new Option where opt is only evaluated if filter f,
+// FilterValues returns a new [Option] where opt is only evaluated if filter f,
// which is a function of the form "func(T, T) bool", returns true for the
// current pair of values being compared. If either value is invalid or
// the type of the values is not assignable to T, then this filter implicitly
@@ -152,8 +154,8 @@ func (f pathFilter) String() string {
// If T is an interface, it is possible that f is called with two values with
// different concrete types that both implement T.
//
-// The option passed in may be an Ignore, Transformer, Comparer, Options, or
-// a previously filtered Option.
+// The option passed in may be an [Ignore], [Transformer], [Comparer], [Options], or
+// a previously filtered [Option].
func FilterValues(f interface{}, opt Option) Option {
v := reflect.ValueOf(f)
if !function.IsType(v.Type(), function.ValueFilter) || v.IsNil() {
@@ -190,9 +192,9 @@ func (f valuesFilter) String() string {
return fmt.Sprintf("FilterValues(%s, %v)", function.NameOf(f.fnc), f.opt)
}
-// Ignore is an Option that causes all comparisons to be ignored.
-// This value is intended to be combined with FilterPath or FilterValues.
-// It is an error to pass an unfiltered Ignore option to Equal.
+// Ignore is an [Option] that causes all comparisons to be ignored.
+// This value is intended to be combined with [FilterPath] or [FilterValues].
+// It is an error to pass an unfiltered Ignore option to [Equal].
func Ignore() Option { return ignore{} }
type ignore struct{ core }
@@ -232,6 +234,8 @@ func (validator) apply(s *state, vx, vy reflect.Value) {
name = fmt.Sprintf("%q.%v", t.PkgPath(), t.Name()) // e.g., "path/to/package".MyType
if _, ok := reflect.New(t).Interface().(error); ok {
help = "consider using cmpopts.EquateErrors to compare error values"
+ } else if t.Comparable() {
+ help = "consider using cmpopts.EquateComparable to compare comparable Go types"
}
} else {
// Unnamed type with unexported fields. Derive PkgPath from field.
@@ -252,7 +256,7 @@ const identRx = `[_\p{L}][_\p{L}\p{N}]*`
var identsRx = regexp.MustCompile(`^` + identRx + `(\.` + identRx + `)*$`)
-// Transformer returns an Option that applies a transformation function that
+// Transformer returns an [Option] that applies a transformation function that
// converts values of a certain type into that of another.
//
// The transformer f must be a function "func(T) R" that converts values of
@@ -263,13 +267,14 @@ var identsRx = regexp.MustCompile(`^` + identRx + `(\.` + identRx + `)*$`)
// same transform to the output of itself (e.g., in the case where the
// input and output types are the same), an implicit filter is added such that
// a transformer is applicable only if that exact transformer is not already
-// in the tail of the Path since the last non-Transform step.
+// in the tail of the [Path] since the last non-[Transform] step.
// For situations where the implicit filter is still insufficient,
-// consider using cmpopts.AcyclicTransformer, which adds a filter
-// to prevent the transformer from being recursively applied upon itself.
+// consider using [github.com/google/go-cmp/cmp/cmpopts.AcyclicTransformer],
+// which adds a filter to prevent the transformer from
+// being recursively applied upon itself.
//
-// The name is a user provided label that is used as the Transform.Name in the
-// transformation PathStep (and eventually shown in the Diff output).
+// The name is a user provided label that is used as the [Transform.Name] in the
+// transformation [PathStep] (and eventually shown in the [Diff] output).
// The name must be a valid identifier or qualified identifier in Go syntax.
// If empty, an arbitrary name is used.
func Transformer(name string, f interface{}) Option {
@@ -327,7 +332,7 @@ func (tr transformer) String() string {
return fmt.Sprintf("Transformer(%s, %s)", tr.name, function.NameOf(tr.fnc))
}
-// Comparer returns an Option that determines whether two values are equal
+// Comparer returns an [Option] that determines whether two values are equal
// to each other.
//
// The comparer f must be a function "func(T, T) bool" and is implicitly
@@ -336,9 +341,9 @@ func (tr transformer) String() string {
// both implement T.
//
// The equality function must be:
-// • Symmetric: equal(x, y) == equal(y, x)
-// • Deterministic: equal(x, y) == equal(x, y)
-// • Pure: equal(x, y) does not modify x or y
+// - Symmetric: equal(x, y) == equal(y, x)
+// - Deterministic: equal(x, y) == equal(x, y)
+// - Pure: equal(x, y) does not modify x or y
func Comparer(f interface{}) Option {
v := reflect.ValueOf(f)
if !function.IsType(v.Type(), function.Equal) || v.IsNil() {
@@ -375,35 +380,32 @@ func (cm comparer) String() string {
return fmt.Sprintf("Comparer(%s)", function.NameOf(cm.fnc))
}
-// Exporter returns an Option that specifies whether Equal is allowed to
+// Exporter returns an [Option] that specifies whether [Equal] is allowed to
// introspect into the unexported fields of certain struct types.
//
// Users of this option must understand that comparing on unexported fields
// from external packages is not safe since changes in the internal
-// implementation of some external package may cause the result of Equal
+// implementation of some external package may cause the result of [Equal]
// to unexpectedly change. However, it may be valid to use this option on types
// defined in an internal package where the semantic meaning of an unexported
// field is in the control of the user.
//
-// In many cases, a custom Comparer should be used instead that defines
+// In many cases, a custom [Comparer] should be used instead that defines
// equality as a function of the public API of a type rather than the underlying
// unexported implementation.
//
-// For example, the reflect.Type documentation defines equality to be determined
+// For example, the [reflect.Type] documentation defines equality to be determined
// by the == operator on the interface (essentially performing a shallow pointer
-// comparison) and most attempts to compare *regexp.Regexp types are interested
+// comparison) and most attempts to compare *[regexp.Regexp] types are interested
// in only checking that the regular expression strings are equal.
-// Both of these are accomplished using Comparers:
+// Both of these are accomplished using [Comparer] options:
//
// Comparer(func(x, y reflect.Type) bool { return x == y })
// Comparer(func(x, y *regexp.Regexp) bool { return x.String() == y.String() })
//
-// In other cases, the cmpopts.IgnoreUnexported option can be used to ignore
-// all unexported fields on specified struct types.
+// In other cases, the [github.com/google/go-cmp/cmp/cmpopts.IgnoreUnexported]
+// option can be used to ignore all unexported fields on specified struct types.
func Exporter(f func(reflect.Type) bool) Option {
- if !supportExporters {
- panic("Exporter is not supported on purego builds")
- }
return exporter(f)
}
@@ -413,10 +415,10 @@ func (exporter) filter(_ *state, _ reflect.Type, _, _ reflect.Value) applicableO
panic("not implemented")
}
-// AllowUnexported returns an Options that allows Equal to forcibly introspect
+// AllowUnexported returns an [Option] that allows [Equal] to forcibly introspect
// unexported fields of the specified struct types.
//
-// See Exporter for the proper use of this option.
+// See [Exporter] for the proper use of this option.
func AllowUnexported(types ...interface{}) Option {
m := make(map[reflect.Type]bool)
for _, typ := range types {
@@ -430,7 +432,7 @@ func AllowUnexported(types ...interface{}) Option {
}
// Result represents the comparison result for a single node and
-// is provided by cmp when calling Result (see Reporter).
+// is provided by cmp when calling Report (see [Reporter]).
type Result struct {
_ [0]func() // Make Result incomparable
flags resultFlags
@@ -443,7 +445,7 @@ func (r Result) Equal() bool {
}
// ByIgnore reports whether the node is equal because it was ignored.
-// This never reports true if Equal reports false.
+// This never reports true if [Result.Equal] reports false.
func (r Result) ByIgnore() bool {
return r.flags&reportByIgnore != 0
}
@@ -453,7 +455,7 @@ func (r Result) ByMethod() bool {
return r.flags&reportByMethod != 0
}
-// ByFunc reports whether a Comparer function determined equality.
+// ByFunc reports whether a [Comparer] function determined equality.
func (r Result) ByFunc() bool {
return r.flags&reportByFunc != 0
}
@@ -476,7 +478,7 @@ const (
reportByCycle
)
-// Reporter is an Option that can be passed to Equal. When Equal traverses
+// Reporter is an [Option] that can be passed to [Equal]. When [Equal] traverses
// the value trees, it calls PushStep as it descends into each node in the
// tree and PopStep as it ascend out of the node. The leaves of the tree are
// either compared (determined to be equal or not equal) or ignored and reported
diff --git a/vendor/github.com/google/go-cmp/cmp/path.go b/vendor/github.com/google/go-cmp/cmp/path.go
index f01eff318..c3c145642 100644
--- a/vendor/github.com/google/go-cmp/cmp/path.go
+++ b/vendor/github.com/google/go-cmp/cmp/path.go
@@ -14,9 +14,9 @@ import (
"github.com/google/go-cmp/cmp/internal/value"
)
-// Path is a list of PathSteps describing the sequence of operations to get
+// Path is a list of [PathStep] describing the sequence of operations to get
// from some root type to the current position in the value tree.
-// The first Path element is always an operation-less PathStep that exists
+// The first Path element is always an operation-less [PathStep] that exists
// simply to identify the initial type.
//
// When traversing structs with embedded structs, the embedded struct will
@@ -29,8 +29,13 @@ type Path []PathStep
// a value's tree structure. Users of this package never need to implement
// these types as values of this type will be returned by this package.
//
-// Implementations of this interface are
-// StructField, SliceIndex, MapIndex, Indirect, TypeAssertion, and Transform.
+// Implementations of this interface:
+// - [StructField]
+// - [SliceIndex]
+// - [MapIndex]
+// - [Indirect]
+// - [TypeAssertion]
+// - [Transform]
type PathStep interface {
String() string
@@ -41,13 +46,13 @@ type PathStep interface {
// The type of each valid value is guaranteed to be identical to Type.
//
// In some cases, one or both may be invalid or have restrictions:
- // • For StructField, both are not interface-able if the current field
- // is unexported and the struct type is not explicitly permitted by
- // an Exporter to traverse unexported fields.
- // • For SliceIndex, one may be invalid if an element is missing from
- // either the x or y slice.
- // • For MapIndex, one may be invalid if an entry is missing from
- // either the x or y map.
+ // - For StructField, both are not interface-able if the current field
+ // is unexported and the struct type is not explicitly permitted by
+ // an Exporter to traverse unexported fields.
+ // - For SliceIndex, one may be invalid if an element is missing from
+ // either the x or y slice.
+ // - For MapIndex, one may be invalid if an entry is missing from
+ // either the x or y map.
//
// The provided values must not be mutated.
Values() (vx, vy reflect.Value)
@@ -70,8 +75,9 @@ func (pa *Path) pop() {
*pa = (*pa)[:len(*pa)-1]
}
-// Last returns the last PathStep in the Path.
-// If the path is empty, this returns a non-nil PathStep that reports a nil Type.
+// Last returns the last [PathStep] in the Path.
+// If the path is empty, this returns a non-nil [PathStep]
+// that reports a nil [PathStep.Type].
func (pa Path) Last() PathStep {
return pa.Index(-1)
}
@@ -79,7 +85,8 @@ func (pa Path) Last() PathStep {
// Index returns the ith step in the Path and supports negative indexing.
// A negative index starts counting from the tail of the Path such that -1
// refers to the last step, -2 refers to the second-to-last step, and so on.
-// If index is invalid, this returns a non-nil PathStep that reports a nil Type.
+// If index is invalid, this returns a non-nil [PathStep]
+// that reports a nil [PathStep.Type].
func (pa Path) Index(i int) PathStep {
if i < 0 {
i = len(pa) + i
@@ -94,6 +101,7 @@ func (pa Path) Index(i int) PathStep {
// The simplified path only contains struct field accesses.
//
// For example:
+//
// MyMap.MySlices.MyField
func (pa Path) String() string {
var ss []string
@@ -108,6 +116,7 @@ func (pa Path) String() string {
// GoString returns the path to a specific node using Go syntax.
//
// For example:
+//
// (*root.MyMap["key"].(*mypkg.MyStruct).MySlices)[2][3].MyField
func (pa Path) GoString() string {
var ssPre, ssPost []string
@@ -159,14 +168,15 @@ func (ps pathStep) String() string {
if ps.typ == nil {
return ""
}
- s := ps.typ.String()
+ s := value.TypeString(ps.typ, false)
if s == "" || strings.ContainsAny(s, "{}\n") {
return "root" // Type too simple or complex to print
}
return fmt.Sprintf("{%s}", s)
}
-// StructField represents a struct field access on a field called Name.
+// StructField is a [PathStep] that represents a struct field access
+// on a field called [StructField.Name].
type StructField struct{ *structField }
type structField struct {
pathStep
@@ -178,7 +188,7 @@ type structField struct {
unexported bool
mayForce bool // Forcibly allow visibility
paddr bool // Was parent addressable?
- pvx, pvy reflect.Value // Parent values (always addressible)
+ pvx, pvy reflect.Value // Parent values (always addressable)
field reflect.StructField // Field information
}
@@ -202,10 +212,11 @@ func (sf StructField) String() string { return fmt.Sprintf(".%s", sf.name) }
func (sf StructField) Name() string { return sf.name }
// Index is the index of the field in the parent struct type.
-// See reflect.Type.Field.
+// See [reflect.Type.Field].
func (sf StructField) Index() int { return sf.idx }
-// SliceIndex is an index operation on a slice or array at some index Key.
+// SliceIndex is a [PathStep] that represents an index operation on
+// a slice or array at some index [SliceIndex.Key].
type SliceIndex struct{ *sliceIndex }
type sliceIndex struct {
pathStep
@@ -245,12 +256,12 @@ func (si SliceIndex) Key() int {
// all of the indexes to be shifted. If an index is -1, then that
// indicates that the element does not exist in the associated slice.
//
-// Key is guaranteed to return -1 if and only if the indexes returned
-// by SplitKeys are not the same. SplitKeys will never return -1 for
+// [SliceIndex.Key] is guaranteed to return -1 if and only if the indexes
+// returned by SplitKeys are not the same. SplitKeys will never return -1 for
// both indexes.
func (si SliceIndex) SplitKeys() (ix, iy int) { return si.xkey, si.ykey }
-// MapIndex is an index operation on a map at some index Key.
+// MapIndex is a [PathStep] that represents an index operation on a map at some index Key.
type MapIndex struct{ *mapIndex }
type mapIndex struct {
pathStep
@@ -264,7 +275,7 @@ func (mi MapIndex) String() string { return fmt.Sprintf("[%#v]",
// Key is the value of the map key.
func (mi MapIndex) Key() reflect.Value { return mi.key }
-// Indirect represents pointer indirection on the parent type.
+// Indirect is a [PathStep] that represents pointer indirection on the parent type.
type Indirect struct{ *indirect }
type indirect struct {
pathStep
@@ -274,7 +285,7 @@ func (in Indirect) Type() reflect.Type { return in.typ }
func (in Indirect) Values() (vx, vy reflect.Value) { return in.vx, in.vy }
func (in Indirect) String() string { return "*" }
-// TypeAssertion represents a type assertion on an interface.
+// TypeAssertion is a [PathStep] that represents a type assertion on an interface.
type TypeAssertion struct{ *typeAssertion }
type typeAssertion struct {
pathStep
@@ -282,9 +293,10 @@ type typeAssertion struct {
func (ta TypeAssertion) Type() reflect.Type { return ta.typ }
func (ta TypeAssertion) Values() (vx, vy reflect.Value) { return ta.vx, ta.vy }
-func (ta TypeAssertion) String() string { return fmt.Sprintf(".(%v)", ta.typ) }
+func (ta TypeAssertion) String() string { return fmt.Sprintf(".(%v)", value.TypeString(ta.typ, false)) }
-// Transform is a transformation from the parent type to the current type.
+// Transform is a [PathStep] that represents a transformation
+// from the parent type to the current type.
type Transform struct{ *transform }
type transform struct {
pathStep
@@ -295,13 +307,13 @@ func (tf Transform) Type() reflect.Type { return tf.typ }
func (tf Transform) Values() (vx, vy reflect.Value) { return tf.vx, tf.vy }
func (tf Transform) String() string { return fmt.Sprintf("%s()", tf.trans.name) }
-// Name is the name of the Transformer.
+// Name is the name of the [Transformer].
func (tf Transform) Name() string { return tf.trans.name }
// Func is the function pointer to the transformer function.
func (tf Transform) Func() reflect.Value { return tf.trans.fnc }
-// Option returns the originally constructed Transformer option.
+// Option returns the originally constructed [Transformer] option.
// The == operator can be used to detect the exact option used.
func (tf Transform) Option() Option { return tf.trans }
diff --git a/vendor/github.com/google/go-cmp/cmp/report_compare.go b/vendor/github.com/google/go-cmp/cmp/report_compare.go
index 104bb3053..2050bf6b4 100644
--- a/vendor/github.com/google/go-cmp/cmp/report_compare.go
+++ b/vendor/github.com/google/go-cmp/cmp/report_compare.go
@@ -7,8 +7,6 @@ package cmp
import (
"fmt"
"reflect"
-
- "github.com/google/go-cmp/cmp/internal/value"
)
// numContextRecords is the number of surrounding equal records to print.
@@ -116,7 +114,10 @@ func (opts formatOptions) FormatDiff(v *valueNode, ptrs *pointerReferences) (out
}
// For leaf nodes, format the value based on the reflect.Values alone.
- if v.MaxDepth == 0 {
+ // As a special case, treat equal []byte as a leaf nodes.
+ isBytes := v.Type.Kind() == reflect.Slice && v.Type.Elem() == byteType
+ isEqualBytes := isBytes && v.NumDiff+v.NumIgnored+v.NumTransformed == 0
+ if v.MaxDepth == 0 || isEqualBytes {
switch opts.DiffMode {
case diffUnknown, diffIdentical:
// Format Equal.
@@ -245,11 +246,11 @@ func (opts formatOptions) formatDiffList(recs []reportRecord, k reflect.Kind, pt
var isZero bool
switch opts.DiffMode {
case diffIdentical:
- isZero = value.IsZero(r.Value.ValueX) || value.IsZero(r.Value.ValueY)
+ isZero = r.Value.ValueX.IsZero() || r.Value.ValueY.IsZero()
case diffRemoved:
- isZero = value.IsZero(r.Value.ValueX)
+ isZero = r.Value.ValueX.IsZero()
case diffInserted:
- isZero = value.IsZero(r.Value.ValueY)
+ isZero = r.Value.ValueY.IsZero()
}
if isZero {
continue
diff --git a/vendor/github.com/google/go-cmp/cmp/report_reflect.go b/vendor/github.com/google/go-cmp/cmp/report_reflect.go
index 33f03577f..e39f42284 100644
--- a/vendor/github.com/google/go-cmp/cmp/report_reflect.go
+++ b/vendor/github.com/google/go-cmp/cmp/report_reflect.go
@@ -16,6 +16,13 @@ import (
"github.com/google/go-cmp/cmp/internal/value"
)
+var (
+ anyType = reflect.TypeOf((*interface{})(nil)).Elem()
+ stringType = reflect.TypeOf((*string)(nil)).Elem()
+ bytesType = reflect.TypeOf((*[]byte)(nil)).Elem()
+ byteType = reflect.TypeOf((*byte)(nil)).Elem()
+)
+
type formatValueOptions struct {
// AvoidStringer controls whether to avoid calling custom stringer
// methods like error.Error or fmt.Stringer.String.
@@ -184,7 +191,7 @@ func (opts formatOptions) FormatValue(v reflect.Value, parentKind reflect.Kind,
}
for i := 0; i < v.NumField(); i++ {
vv := v.Field(i)
- if value.IsZero(vv) {
+ if vv.IsZero() {
continue // Elide fields with zero values
}
if len(list) == maxLen {
@@ -192,7 +199,7 @@ func (opts formatOptions) FormatValue(v reflect.Value, parentKind reflect.Kind,
break
}
sf := t.Field(i)
- if supportExporters && !isExported(sf.Name) {
+ if !isExported(sf.Name) {
vv = retrieveUnexportedField(v, sf, true)
}
s := opts.WithTypeMode(autoType).FormatValue(vv, t.Kind(), ptrs)
@@ -205,12 +212,13 @@ func (opts formatOptions) FormatValue(v reflect.Value, parentKind reflect.Kind,
}
// Check whether this is a []byte of text data.
- if t.Elem() == reflect.TypeOf(byte(0)) {
+ if t.Elem() == byteType {
b := v.Bytes()
- isPrintSpace := func(r rune) bool { return unicode.IsPrint(r) && unicode.IsSpace(r) }
+ isPrintSpace := func(r rune) bool { return unicode.IsPrint(r) || unicode.IsSpace(r) }
if len(b) > 0 && utf8.Valid(b) && len(bytes.TrimFunc(b, isPrintSpace)) == 0 {
out = opts.formatString("", string(b))
- return opts.WithTypeMode(emitType).FormatType(t, out)
+ skipType = true
+ return opts.FormatType(t, out)
}
}
@@ -281,7 +289,12 @@ func (opts formatOptions) FormatValue(v reflect.Value, parentKind reflect.Kind,
}
defer ptrs.Pop()
- skipType = true // Let the underlying value print the type instead
+ // Skip the name only if this is an unnamed pointer type.
+ // Otherwise taking the address of a value does not reproduce
+ // the named pointer type.
+ if v.Type().Name() == "" {
+ skipType = true // Let the underlying value print the type instead
+ }
out = opts.FormatValue(v.Elem(), t.Kind(), ptrs)
out = wrapTrunkReference(ptrRef, opts.PrintAddresses, out)
out = &textWrap{Prefix: "&", Value: out}
@@ -292,7 +305,6 @@ func (opts formatOptions) FormatValue(v reflect.Value, parentKind reflect.Kind,
}
// Interfaces accept different concrete types,
// so configure the underlying value to explicitly print the type.
- skipType = true // Print the concrete type instead
return opts.WithTypeMode(emitType).FormatValue(v.Elem(), t.Kind(), ptrs)
default:
panic(fmt.Sprintf("%v kind not handled", v.Kind()))
diff --git a/vendor/github.com/google/go-cmp/cmp/report_slices.go b/vendor/github.com/google/go-cmp/cmp/report_slices.go
index 2ad3bc85b..23e444f62 100644
--- a/vendor/github.com/google/go-cmp/cmp/report_slices.go
+++ b/vendor/github.com/google/go-cmp/cmp/report_slices.go
@@ -80,7 +80,7 @@ func (opts formatOptions) CanFormatDiffSlice(v *valueNode) bool {
}
// Use specialized string diffing for longer slices or strings.
- const minLength = 64
+ const minLength = 32
return vx.Len() >= minLength && vy.Len() >= minLength
}
@@ -104,7 +104,7 @@ func (opts formatOptions) FormatDiffSlice(v *valueNode) textNode {
case t.Kind() == reflect.String:
sx, sy = vx.String(), vy.String()
isString = true
- case t.Kind() == reflect.Slice && t.Elem() == reflect.TypeOf(byte(0)):
+ case t.Kind() == reflect.Slice && t.Elem() == byteType:
sx, sy = string(vx.Bytes()), string(vy.Bytes())
isString = true
case t.Kind() == reflect.Array:
@@ -147,7 +147,10 @@ func (opts formatOptions) FormatDiffSlice(v *valueNode) textNode {
})
efficiencyLines := float64(esLines.Dist()) / float64(len(esLines))
efficiencyBytes := float64(esBytes.Dist()) / float64(len(esBytes))
- isPureLinedText = efficiencyLines < 4*efficiencyBytes
+ quotedLength := len(strconv.Quote(sx + sy))
+ unquotedLength := len(sx) + len(sy)
+ escapeExpansionRatio := float64(quotedLength) / float64(unquotedLength)
+ isPureLinedText = efficiencyLines < 4*efficiencyBytes || escapeExpansionRatio > 1.1
}
}
@@ -171,12 +174,13 @@ func (opts formatOptions) FormatDiffSlice(v *valueNode) textNode {
// differences in a string literal. This format is more readable,
// but has edge-cases where differences are visually indistinguishable.
// This format is avoided under the following conditions:
- // • A line starts with `"""`
- // • A line starts with "..."
- // • A line contains non-printable characters
- // • Adjacent different lines differ only by whitespace
+ // - A line starts with `"""`
+ // - A line starts with "..."
+ // - A line contains non-printable characters
+ // - Adjacent different lines differ only by whitespace
//
// For example:
+ //
// """
// ... // 3 identical lines
// foo
@@ -231,7 +235,7 @@ func (opts formatOptions) FormatDiffSlice(v *valueNode) textNode {
var out textNode = &textWrap{Prefix: "(", Value: list2, Suffix: ")"}
switch t.Kind() {
case reflect.String:
- if t != reflect.TypeOf(string("")) {
+ if t != stringType {
out = opts.FormatType(t, out)
}
case reflect.Slice:
@@ -326,12 +330,12 @@ func (opts formatOptions) FormatDiffSlice(v *valueNode) textNode {
switch t.Kind() {
case reflect.String:
out = &textWrap{Prefix: "strings.Join(", Value: out, Suffix: fmt.Sprintf(", %q)", delim)}
- if t != reflect.TypeOf(string("")) {
+ if t != stringType {
out = opts.FormatType(t, out)
}
case reflect.Slice:
out = &textWrap{Prefix: "bytes.Join(", Value: out, Suffix: fmt.Sprintf(", %q)", delim)}
- if t != reflect.TypeOf([]byte(nil)) {
+ if t != bytesType {
out = opts.FormatType(t, out)
}
}
@@ -446,7 +450,6 @@ func (opts formatOptions) formatDiffSlice(
// {NumIdentical: 3},
// {NumInserted: 1},
// ]
-//
func coalesceAdjacentEdits(name string, es diff.EditScript) (groups []diffStats) {
var prevMode byte
lastStats := func(mode byte) *diffStats {
@@ -503,7 +506,6 @@ func coalesceAdjacentEdits(name string, es diff.EditScript) (groups []diffStats)
// {NumIdentical: 8, NumRemoved: 12, NumInserted: 3},
// {NumIdentical: 63},
// ]
-//
func coalesceInterveningIdentical(groups []diffStats, windowSize int) []diffStats {
groups, groupsOrig := groups[:0], groups
for i, ds := range groupsOrig {
@@ -548,7 +550,6 @@ func coalesceInterveningIdentical(groups []diffStats, windowSize int) []diffStat
// {NumRemoved: 9},
// {NumIdentical: 64}, // incremented by 10
// ]
-//
func cleanupSurroundingIdentical(groups []diffStats, eq func(i, j int) bool) []diffStats {
var ix, iy int // indexes into sequence x and y
for i, ds := range groups {
@@ -563,10 +564,10 @@ func cleanupSurroundingIdentical(groups []diffStats, eq func(i, j int) bool) []d
nx := ds.NumIdentical + ds.NumRemoved + ds.NumModified
ny := ds.NumIdentical + ds.NumInserted + ds.NumModified
var numLeadingIdentical, numTrailingIdentical int
- for i := 0; i < nx && i < ny && eq(ix+i, iy+i); i++ {
+ for j := 0; j < nx && j < ny && eq(ix+j, iy+j); j++ {
numLeadingIdentical++
}
- for i := 0; i < nx && i < ny && eq(ix+nx-1-i, iy+ny-1-i); i++ {
+ for j := 0; j < nx && j < ny && eq(ix+nx-1-j, iy+ny-1-j); j++ {
numTrailingIdentical++
}
if numIdentical := numLeadingIdentical + numTrailingIdentical; numIdentical > 0 {
diff --git a/vendor/github.com/google/go-cmp/cmp/report_text.go b/vendor/github.com/google/go-cmp/cmp/report_text.go
index 0fd46d7ff..388fcf571 100644
--- a/vendor/github.com/google/go-cmp/cmp/report_text.go
+++ b/vendor/github.com/google/go-cmp/cmp/report_text.go
@@ -393,6 +393,7 @@ func (s diffStats) Append(ds diffStats) diffStats {
// String prints a humanly-readable summary of coalesced records.
//
// Example:
+//
// diffStats{Name: "Field", NumIgnored: 5}.String() => "5 ignored fields"
func (s diffStats) String() string {
var ss []string
diff --git a/vendor/github.com/google/gofuzz/.travis.yml b/vendor/github.com/google/gofuzz/.travis.yml
index f8684d99f..061d72ae0 100644
--- a/vendor/github.com/google/gofuzz/.travis.yml
+++ b/vendor/github.com/google/gofuzz/.travis.yml
@@ -1,13 +1,10 @@
language: go
go:
- - 1.4
- - 1.3
- - 1.2
- - tip
-
-install:
- - if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi
+ - 1.11.x
+ - 1.12.x
+ - 1.13.x
+ - master
script:
- go test -cover
diff --git a/vendor/github.com/google/gofuzz/CONTRIBUTING.md b/vendor/github.com/google/gofuzz/CONTRIBUTING.md
index 51cf5cd1a..97c1b34fd 100644
--- a/vendor/github.com/google/gofuzz/CONTRIBUTING.md
+++ b/vendor/github.com/google/gofuzz/CONTRIBUTING.md
@@ -1,7 +1,7 @@
# How to contribute #
We'd love to accept your patches and contributions to this project. There are
-a just a few small guidelines you need to follow.
+just a few small guidelines you need to follow.
## Contributor License Agreement ##
diff --git a/vendor/github.com/google/gofuzz/README.md b/vendor/github.com/google/gofuzz/README.md
index 386c2a457..b503aae7d 100644
--- a/vendor/github.com/google/gofuzz/README.md
+++ b/vendor/github.com/google/gofuzz/README.md
@@ -68,4 +68,22 @@ f.Fuzz(&myObject) // Type will correspond to whether A or B info is set.
See more examples in ```example_test.go```.
+You can use this library for easier [go-fuzz](https://github.com/dvyukov/go-fuzz)ing.
+go-fuzz provides the user a byte-slice, which should be converted to different inputs
+for the tested function. This library can help convert the byte slice. Consider for
+example a fuzz test for a the function `mypackage.MyFunc` that takes an int arguments:
+```go
+// +build gofuzz
+package mypackage
+
+import fuzz "github.com/google/gofuzz"
+
+func Fuzz(data []byte) int {
+ var i int
+ fuzz.NewFromGoFuzz(data).Fuzz(&i)
+ MyFunc(i)
+ return 0
+}
+```
+
Happy testing!
diff --git a/vendor/github.com/google/gofuzz/bytesource/bytesource.go b/vendor/github.com/google/gofuzz/bytesource/bytesource.go
new file mode 100644
index 000000000..5bb365949
--- /dev/null
+++ b/vendor/github.com/google/gofuzz/bytesource/bytesource.go
@@ -0,0 +1,81 @@
+/*
+Copyright 2014 Google Inc. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Package bytesource provides a rand.Source64 that is determined by a slice of bytes.
+package bytesource
+
+import (
+ "bytes"
+ "encoding/binary"
+ "io"
+ "math/rand"
+)
+
+// ByteSource implements rand.Source64 determined by a slice of bytes. The random numbers are
+// generated from each 8 bytes in the slice, until the last bytes are consumed, from which a
+// fallback pseudo random source is created in case more random numbers are required.
+// It also exposes a `bytes.Reader` API, which lets callers consume the bytes directly.
+type ByteSource struct {
+ *bytes.Reader
+ fallback rand.Source
+}
+
+// New returns a new ByteSource from a given slice of bytes.
+func New(input []byte) *ByteSource {
+ s := &ByteSource{
+ Reader: bytes.NewReader(input),
+ fallback: rand.NewSource(0),
+ }
+ if len(input) > 0 {
+ s.fallback = rand.NewSource(int64(s.consumeUint64()))
+ }
+ return s
+}
+
+func (s *ByteSource) Uint64() uint64 {
+ // Return from input if it was not exhausted.
+ if s.Len() > 0 {
+ return s.consumeUint64()
+ }
+
+ // Input was exhausted, return random number from fallback (in this case fallback should not be
+ // nil). Try first having a Uint64 output (Should work in current rand implementation),
+ // otherwise return a conversion of Int63.
+ if s64, ok := s.fallback.(rand.Source64); ok {
+ return s64.Uint64()
+ }
+ return uint64(s.fallback.Int63())
+}
+
+func (s *ByteSource) Int63() int64 {
+ return int64(s.Uint64() >> 1)
+}
+
+func (s *ByteSource) Seed(seed int64) {
+ s.fallback = rand.NewSource(seed)
+ s.Reader = bytes.NewReader(nil)
+}
+
+// consumeUint64 reads 8 bytes from the input and convert them to a uint64. It assumes that the the
+// bytes reader is not empty.
+func (s *ByteSource) consumeUint64() uint64 {
+ var bytes [8]byte
+ _, err := s.Read(bytes[:])
+ if err != nil && err != io.EOF {
+ panic("failed reading source") // Should not happen.
+ }
+ return binary.BigEndian.Uint64(bytes[:])
+}
diff --git a/vendor/github.com/google/gofuzz/fuzz.go b/vendor/github.com/google/gofuzz/fuzz.go
index da0a5f938..761520a8c 100644
--- a/vendor/github.com/google/gofuzz/fuzz.go
+++ b/vendor/github.com/google/gofuzz/fuzz.go
@@ -22,6 +22,9 @@ import (
"reflect"
"regexp"
"time"
+
+ "github.com/google/gofuzz/bytesource"
+ "strings"
)
// fuzzFuncMap is a map from a type to a fuzzFunc that handles that type.
@@ -61,6 +64,34 @@ func NewWithSeed(seed int64) *Fuzzer {
return f
}
+// NewFromGoFuzz is a helper function that enables using gofuzz (this
+// project) with go-fuzz (https://github.com/dvyukov/go-fuzz) for continuous
+// fuzzing. Essentially, it enables translating the fuzzing bytes from
+// go-fuzz to any Go object using this library.
+//
+// This implementation promises a constant translation from a given slice of
+// bytes to the fuzzed objects. This promise will remain over future
+// versions of Go and of this library.
+//
+// Note: the returned Fuzzer should not be shared between multiple goroutines,
+// as its deterministic output will no longer be available.
+//
+// Example: use go-fuzz to test the function `MyFunc(int)` in the package
+// `mypackage`. Add the file: "mypacakge_fuzz.go" with the content:
+//
+// // +build gofuzz
+// package mypacakge
+// import fuzz "github.com/google/gofuzz"
+// func Fuzz(data []byte) int {
+// var i int
+// fuzz.NewFromGoFuzz(data).Fuzz(&i)
+// MyFunc(i)
+// return 0
+// }
+func NewFromGoFuzz(data []byte) *Fuzzer {
+ return New().RandSource(bytesource.New(data))
+}
+
// Funcs adds each entry in fuzzFuncs as a custom fuzzing function.
//
// Each entry in fuzzFuncs must be a function taking two parameters.
@@ -141,7 +172,7 @@ func (f *Fuzzer) genElementCount() int {
}
func (f *Fuzzer) genShouldFill() bool {
- return f.r.Float64() > f.nilChance
+ return f.r.Float64() >= f.nilChance
}
// MaxDepth sets the maximum number of recursive fuzz calls that will be made
@@ -240,6 +271,7 @@ func (fc *fuzzerContext) doFuzz(v reflect.Value, flags uint64) {
fn(v, fc.fuzzer.r)
return
}
+
switch v.Kind() {
case reflect.Map:
if fc.fuzzer.genShouldFill() {
@@ -450,10 +482,10 @@ var fillFuncMap = map[reflect.Kind]func(reflect.Value, *rand.Rand){
v.SetFloat(r.Float64())
},
reflect.Complex64: func(v reflect.Value, r *rand.Rand) {
- panic("unimplemented")
+ v.SetComplex(complex128(complex(r.Float32(), r.Float32())))
},
reflect.Complex128: func(v reflect.Value, r *rand.Rand) {
- panic("unimplemented")
+ v.SetComplex(complex(r.Float64(), r.Float64()))
},
reflect.String: func(v reflect.Value, r *rand.Rand) {
v.SetString(randString(r))
@@ -465,38 +497,105 @@ var fillFuncMap = map[reflect.Kind]func(reflect.Value, *rand.Rand){
// randBool returns true or false randomly.
func randBool(r *rand.Rand) bool {
- if r.Int()&1 == 1 {
- return true
- }
- return false
+ return r.Int31()&(1<<30) == 0
+}
+
+type int63nPicker interface {
+ Int63n(int64) int64
}
-type charRange struct {
- first, last rune
+// UnicodeRange describes a sequential range of unicode characters.
+// Last must be numerically greater than First.
+type UnicodeRange struct {
+ First, Last rune
}
+// UnicodeRanges describes an arbitrary number of sequential ranges of unicode characters.
+// To be useful, each range must have at least one character (First <= Last) and
+// there must be at least one range.
+type UnicodeRanges []UnicodeRange
+
// choose returns a random unicode character from the given range, using the
// given randomness source.
-func (r *charRange) choose(rand *rand.Rand) rune {
- count := int64(r.last - r.first)
- return r.first + rune(rand.Int63n(count))
+func (ur UnicodeRange) choose(r int63nPicker) rune {
+ count := int64(ur.Last - ur.First + 1)
+ return ur.First + rune(r.Int63n(count))
+}
+
+// CustomStringFuzzFunc constructs a FuzzFunc which produces random strings.
+// Each character is selected from the range ur. If there are no characters
+// in the range (cr.Last < cr.First), this will panic.
+func (ur UnicodeRange) CustomStringFuzzFunc() func(s *string, c Continue) {
+ ur.check()
+ return func(s *string, c Continue) {
+ *s = ur.randString(c.Rand)
+ }
}
-var unicodeRanges = []charRange{
+// check is a function that used to check whether the first of ur(UnicodeRange)
+// is greater than the last one.
+func (ur UnicodeRange) check() {
+ if ur.Last < ur.First {
+ panic("The last encoding must be greater than the first one.")
+ }
+}
+
+// randString of UnicodeRange makes a random string up to 20 characters long.
+// Each character is selected form ur(UnicodeRange).
+func (ur UnicodeRange) randString(r *rand.Rand) string {
+ n := r.Intn(20)
+ sb := strings.Builder{}
+ sb.Grow(n)
+ for i := 0; i < n; i++ {
+ sb.WriteRune(ur.choose(r))
+ }
+ return sb.String()
+}
+
+// defaultUnicodeRanges sets a default unicode range when user do not set
+// CustomStringFuzzFunc() but wants fuzz string.
+var defaultUnicodeRanges = UnicodeRanges{
{' ', '~'}, // ASCII characters
{'\u00a0', '\u02af'}, // Multi-byte encoded characters
{'\u4e00', '\u9fff'}, // Common CJK (even longer encodings)
}
+// CustomStringFuzzFunc constructs a FuzzFunc which produces random strings.
+// Each character is selected from one of the ranges of ur(UnicodeRanges).
+// Each range has an equal probability of being chosen. If there are no ranges,
+// or a selected range has no characters (.Last < .First), this will panic.
+// Do not modify any of the ranges in ur after calling this function.
+func (ur UnicodeRanges) CustomStringFuzzFunc() func(s *string, c Continue) {
+ // Check unicode ranges slice is empty.
+ if len(ur) == 0 {
+ panic("UnicodeRanges is empty.")
+ }
+ // if not empty, each range should be checked.
+ for i := range ur {
+ ur[i].check()
+ }
+ return func(s *string, c Continue) {
+ *s = ur.randString(c.Rand)
+ }
+}
+
+// randString of UnicodeRanges makes a random string up to 20 characters long.
+// Each character is selected form one of the ranges of ur(UnicodeRanges),
+// and each range has an equal probability of being chosen.
+func (ur UnicodeRanges) randString(r *rand.Rand) string {
+ n := r.Intn(20)
+ sb := strings.Builder{}
+ sb.Grow(n)
+ for i := 0; i < n; i++ {
+ sb.WriteRune(ur[r.Intn(len(ur))].choose(r))
+ }
+ return sb.String()
+}
+
// randString makes a random string up to 20 characters long. The returned string
// may include a variety of (valid) UTF-8 encodings.
func randString(r *rand.Rand) string {
- n := r.Intn(20)
- runes := make([]rune, n)
- for i := range runes {
- runes[i] = unicodeRanges[r.Intn(len(unicodeRanges))].choose(r)
- }
- return string(runes)
+ return defaultUnicodeRanges.randString(r)
}
// randUint64 makes random 64 bit numbers.
diff --git a/vendor/github.com/josharian/intern/README.md b/vendor/github.com/josharian/intern/README.md
new file mode 100644
index 000000000..ffc44b219
--- /dev/null
+++ b/vendor/github.com/josharian/intern/README.md
@@ -0,0 +1,5 @@
+Docs: https://godoc.org/github.com/josharian/intern
+
+See also [Go issue 5160](https://golang.org/issue/5160).
+
+License: MIT
diff --git a/vendor/github.com/josharian/intern/intern.go b/vendor/github.com/josharian/intern/intern.go
new file mode 100644
index 000000000..7acb1fe90
--- /dev/null
+++ b/vendor/github.com/josharian/intern/intern.go
@@ -0,0 +1,44 @@
+// Package intern interns strings.
+// Interning is best effort only.
+// Interned strings may be removed automatically
+// at any time without notification.
+// All functions may be called concurrently
+// with themselves and each other.
+package intern
+
+import "sync"
+
+var (
+ pool sync.Pool = sync.Pool{
+ New: func() interface{} {
+ return make(map[string]string)
+ },
+ }
+)
+
+// String returns s, interned.
+func String(s string) string {
+ m := pool.Get().(map[string]string)
+ c, ok := m[s]
+ if ok {
+ pool.Put(m)
+ return c
+ }
+ m[s] = s
+ pool.Put(m)
+ return s
+}
+
+// Bytes returns b converted to a string, interned.
+func Bytes(b []byte) string {
+ m := pool.Get().(map[string]string)
+ c, ok := m[string(b)]
+ if ok {
+ pool.Put(m)
+ return c
+ }
+ s := string(b)
+ m[s] = s
+ pool.Put(m)
+ return s
+}
diff --git a/vendor/github.com/josharian/intern/license.md b/vendor/github.com/josharian/intern/license.md
new file mode 100644
index 000000000..353d3055f
--- /dev/null
+++ b/vendor/github.com/josharian/intern/license.md
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2019 Josh Bleecher Snyder
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/vendor/github.com/mailru/easyjson/LICENSE b/vendor/github.com/mailru/easyjson/LICENSE
new file mode 100644
index 000000000..fbff658f7
--- /dev/null
+++ b/vendor/github.com/mailru/easyjson/LICENSE
@@ -0,0 +1,7 @@
+Copyright (c) 2016 Mail.Ru Group
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/github.com/mailru/easyjson/buffer/pool.go b/vendor/github.com/mailru/easyjson/buffer/pool.go
new file mode 100644
index 000000000..598a54af9
--- /dev/null
+++ b/vendor/github.com/mailru/easyjson/buffer/pool.go
@@ -0,0 +1,278 @@
+// Package buffer implements a buffer for serialization, consisting of a chain of []byte-s to
+// reduce copying and to allow reuse of individual chunks.
+package buffer
+
+import (
+ "io"
+ "net"
+ "sync"
+)
+
+// PoolConfig contains configuration for the allocation and reuse strategy.
+type PoolConfig struct {
+ StartSize int // Minimum chunk size that is allocated.
+ PooledSize int // Minimum chunk size that is reused, reusing chunks too small will result in overhead.
+ MaxSize int // Maximum chunk size that will be allocated.
+}
+
+var config = PoolConfig{
+ StartSize: 128,
+ PooledSize: 512,
+ MaxSize: 32768,
+}
+
+// Reuse pool: chunk size -> pool.
+var buffers = map[int]*sync.Pool{}
+
+func initBuffers() {
+ for l := config.PooledSize; l <= config.MaxSize; l *= 2 {
+ buffers[l] = new(sync.Pool)
+ }
+}
+
+func init() {
+ initBuffers()
+}
+
+// Init sets up a non-default pooling and allocation strategy. Should be run before serialization is done.
+func Init(cfg PoolConfig) {
+ config = cfg
+ initBuffers()
+}
+
+// putBuf puts a chunk to reuse pool if it can be reused.
+func putBuf(buf []byte) {
+ size := cap(buf)
+ if size < config.PooledSize {
+ return
+ }
+ if c := buffers[size]; c != nil {
+ c.Put(buf[:0])
+ }
+}
+
+// getBuf gets a chunk from reuse pool or creates a new one if reuse failed.
+func getBuf(size int) []byte {
+ if size >= config.PooledSize {
+ if c := buffers[size]; c != nil {
+ v := c.Get()
+ if v != nil {
+ return v.([]byte)
+ }
+ }
+ }
+ return make([]byte, 0, size)
+}
+
+// Buffer is a buffer optimized for serialization without extra copying.
+type Buffer struct {
+
+ // Buf is the current chunk that can be used for serialization.
+ Buf []byte
+
+ toPool []byte
+ bufs [][]byte
+}
+
+// EnsureSpace makes sure that the current chunk contains at least s free bytes,
+// possibly creating a new chunk.
+func (b *Buffer) EnsureSpace(s int) {
+ if cap(b.Buf)-len(b.Buf) < s {
+ b.ensureSpaceSlow(s)
+ }
+}
+
+func (b *Buffer) ensureSpaceSlow(s int) {
+ l := len(b.Buf)
+ if l > 0 {
+ if cap(b.toPool) != cap(b.Buf) {
+ // Chunk was reallocated, toPool can be pooled.
+ putBuf(b.toPool)
+ }
+ if cap(b.bufs) == 0 {
+ b.bufs = make([][]byte, 0, 8)
+ }
+ b.bufs = append(b.bufs, b.Buf)
+ l = cap(b.toPool) * 2
+ } else {
+ l = config.StartSize
+ }
+
+ if l > config.MaxSize {
+ l = config.MaxSize
+ }
+ b.Buf = getBuf(l)
+ b.toPool = b.Buf
+}
+
+// AppendByte appends a single byte to buffer.
+func (b *Buffer) AppendByte(data byte) {
+ b.EnsureSpace(1)
+ b.Buf = append(b.Buf, data)
+}
+
+// AppendBytes appends a byte slice to buffer.
+func (b *Buffer) AppendBytes(data []byte) {
+ if len(data) <= cap(b.Buf)-len(b.Buf) {
+ b.Buf = append(b.Buf, data...) // fast path
+ } else {
+ b.appendBytesSlow(data)
+ }
+}
+
+func (b *Buffer) appendBytesSlow(data []byte) {
+ for len(data) > 0 {
+ b.EnsureSpace(1)
+
+ sz := cap(b.Buf) - len(b.Buf)
+ if sz > len(data) {
+ sz = len(data)
+ }
+
+ b.Buf = append(b.Buf, data[:sz]...)
+ data = data[sz:]
+ }
+}
+
+// AppendString appends a string to buffer.
+func (b *Buffer) AppendString(data string) {
+ if len(data) <= cap(b.Buf)-len(b.Buf) {
+ b.Buf = append(b.Buf, data...) // fast path
+ } else {
+ b.appendStringSlow(data)
+ }
+}
+
+func (b *Buffer) appendStringSlow(data string) {
+ for len(data) > 0 {
+ b.EnsureSpace(1)
+
+ sz := cap(b.Buf) - len(b.Buf)
+ if sz > len(data) {
+ sz = len(data)
+ }
+
+ b.Buf = append(b.Buf, data[:sz]...)
+ data = data[sz:]
+ }
+}
+
+// Size computes the size of a buffer by adding sizes of every chunk.
+func (b *Buffer) Size() int {
+ size := len(b.Buf)
+ for _, buf := range b.bufs {
+ size += len(buf)
+ }
+ return size
+}
+
+// DumpTo outputs the contents of a buffer to a writer and resets the buffer.
+func (b *Buffer) DumpTo(w io.Writer) (written int, err error) {
+ bufs := net.Buffers(b.bufs)
+ if len(b.Buf) > 0 {
+ bufs = append(bufs, b.Buf)
+ }
+ n, err := bufs.WriteTo(w)
+
+ for _, buf := range b.bufs {
+ putBuf(buf)
+ }
+ putBuf(b.toPool)
+
+ b.bufs = nil
+ b.Buf = nil
+ b.toPool = nil
+
+ return int(n), err
+}
+
+// BuildBytes creates a single byte slice with all the contents of the buffer. Data is
+// copied if it does not fit in a single chunk. You can optionally provide one byte
+// slice as argument that it will try to reuse.
+func (b *Buffer) BuildBytes(reuse ...[]byte) []byte {
+ if len(b.bufs) == 0 {
+ ret := b.Buf
+ b.toPool = nil
+ b.Buf = nil
+ return ret
+ }
+
+ var ret []byte
+ size := b.Size()
+
+ // If we got a buffer as argument and it is big enough, reuse it.
+ if len(reuse) == 1 && cap(reuse[0]) >= size {
+ ret = reuse[0][:0]
+ } else {
+ ret = make([]byte, 0, size)
+ }
+ for _, buf := range b.bufs {
+ ret = append(ret, buf...)
+ putBuf(buf)
+ }
+
+ ret = append(ret, b.Buf...)
+ putBuf(b.toPool)
+
+ b.bufs = nil
+ b.toPool = nil
+ b.Buf = nil
+
+ return ret
+}
+
+type readCloser struct {
+ offset int
+ bufs [][]byte
+}
+
+func (r *readCloser) Read(p []byte) (n int, err error) {
+ for _, buf := range r.bufs {
+ // Copy as much as we can.
+ x := copy(p[n:], buf[r.offset:])
+ n += x // Increment how much we filled.
+
+ // Did we empty the whole buffer?
+ if r.offset+x == len(buf) {
+ // On to the next buffer.
+ r.offset = 0
+ r.bufs = r.bufs[1:]
+
+ // We can release this buffer.
+ putBuf(buf)
+ } else {
+ r.offset += x
+ }
+
+ if n == len(p) {
+ break
+ }
+ }
+ // No buffers left or nothing read?
+ if len(r.bufs) == 0 {
+ err = io.EOF
+ }
+ return
+}
+
+func (r *readCloser) Close() error {
+ // Release all remaining buffers.
+ for _, buf := range r.bufs {
+ putBuf(buf)
+ }
+ // In case Close gets called multiple times.
+ r.bufs = nil
+
+ return nil
+}
+
+// ReadCloser creates an io.ReadCloser with all the contents of the buffer.
+func (b *Buffer) ReadCloser() io.ReadCloser {
+ ret := &readCloser{0, append(b.bufs, b.Buf)}
+
+ b.bufs = nil
+ b.toPool = nil
+ b.Buf = nil
+
+ return ret
+}
diff --git a/vendor/github.com/mailru/easyjson/jlexer/bytestostr.go b/vendor/github.com/mailru/easyjson/jlexer/bytestostr.go
new file mode 100644
index 000000000..ff7b27c5b
--- /dev/null
+++ b/vendor/github.com/mailru/easyjson/jlexer/bytestostr.go
@@ -0,0 +1,24 @@
+// This file will only be included to the build if neither
+// easyjson_nounsafe nor appengine build tag is set. See README notes
+// for more details.
+
+//+build !easyjson_nounsafe
+//+build !appengine
+
+package jlexer
+
+import (
+ "reflect"
+ "unsafe"
+)
+
+// bytesToStr creates a string pointing at the slice to avoid copying.
+//
+// Warning: the string returned by the function should be used with care, as the whole input data
+// chunk may be either blocked from being freed by GC because of a single string or the buffer.Data
+// may be garbage-collected even when the string exists.
+func bytesToStr(data []byte) string {
+ h := (*reflect.SliceHeader)(unsafe.Pointer(&data))
+ shdr := reflect.StringHeader{Data: h.Data, Len: h.Len}
+ return *(*string)(unsafe.Pointer(&shdr))
+}
diff --git a/vendor/github.com/mailru/easyjson/jlexer/bytestostr_nounsafe.go b/vendor/github.com/mailru/easyjson/jlexer/bytestostr_nounsafe.go
new file mode 100644
index 000000000..864d1be67
--- /dev/null
+++ b/vendor/github.com/mailru/easyjson/jlexer/bytestostr_nounsafe.go
@@ -0,0 +1,13 @@
+// This file is included to the build if any of the buildtags below
+// are defined. Refer to README notes for more details.
+
+//+build easyjson_nounsafe appengine
+
+package jlexer
+
+// bytesToStr creates a string normally from []byte
+//
+// Note that this method is roughly 1.5x slower than using the 'unsafe' method.
+func bytesToStr(data []byte) string {
+ return string(data)
+}
diff --git a/vendor/github.com/mailru/easyjson/jlexer/error.go b/vendor/github.com/mailru/easyjson/jlexer/error.go
new file mode 100644
index 000000000..e90ec40d0
--- /dev/null
+++ b/vendor/github.com/mailru/easyjson/jlexer/error.go
@@ -0,0 +1,15 @@
+package jlexer
+
+import "fmt"
+
+// LexerError implements the error interface and represents all possible errors that can be
+// generated during parsing the JSON data.
+type LexerError struct {
+ Reason string
+ Offset int
+ Data string
+}
+
+func (l *LexerError) Error() string {
+ return fmt.Sprintf("parse error: %s near offset %d of '%s'", l.Reason, l.Offset, l.Data)
+}
diff --git a/vendor/github.com/mailru/easyjson/jlexer/lexer.go b/vendor/github.com/mailru/easyjson/jlexer/lexer.go
new file mode 100644
index 000000000..b5f5e2613
--- /dev/null
+++ b/vendor/github.com/mailru/easyjson/jlexer/lexer.go
@@ -0,0 +1,1244 @@
+// Package jlexer contains a JSON lexer implementation.
+//
+// It is expected that it is mostly used with generated parser code, so the interface is tuned
+// for a parser that knows what kind of data is expected.
+package jlexer
+
+import (
+ "bytes"
+ "encoding/base64"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "io"
+ "strconv"
+ "unicode"
+ "unicode/utf16"
+ "unicode/utf8"
+
+ "github.com/josharian/intern"
+)
+
+// tokenKind determines type of a token.
+type tokenKind byte
+
+const (
+ tokenUndef tokenKind = iota // No token.
+ tokenDelim // Delimiter: one of '{', '}', '[' or ']'.
+ tokenString // A string literal, e.g. "abc\u1234"
+ tokenNumber // Number literal, e.g. 1.5e5
+ tokenBool // Boolean literal: true or false.
+ tokenNull // null keyword.
+)
+
+// token describes a single token: type, position in the input and value.
+type token struct {
+ kind tokenKind // Type of a token.
+
+ boolValue bool // Value if a boolean literal token.
+ byteValueCloned bool // true if byteValue was allocated and does not refer to original json body
+ byteValue []byte // Raw value of a token.
+ delimValue byte
+}
+
+// Lexer is a JSON lexer: it iterates over JSON tokens in a byte slice.
+type Lexer struct {
+ Data []byte // Input data given to the lexer.
+
+ start int // Start of the current token.
+ pos int // Current unscanned position in the input stream.
+ token token // Last scanned token, if token.kind != tokenUndef.
+
+ firstElement bool // Whether current element is the first in array or an object.
+ wantSep byte // A comma or a colon character, which need to occur before a token.
+
+ UseMultipleErrors bool // If we want to use multiple errors.
+ fatalError error // Fatal error occurred during lexing. It is usually a syntax error.
+ multipleErrors []*LexerError // Semantic errors occurred during lexing. Marshalling will be continued after finding this errors.
+}
+
+// FetchToken scans the input for the next token.
+func (r *Lexer) FetchToken() {
+ r.token.kind = tokenUndef
+ r.start = r.pos
+
+ // Check if r.Data has r.pos element
+ // If it doesn't, it mean corrupted input data
+ if len(r.Data) < r.pos {
+ r.errParse("Unexpected end of data")
+ return
+ }
+ // Determine the type of a token by skipping whitespace and reading the
+ // first character.
+ for _, c := range r.Data[r.pos:] {
+ switch c {
+ case ':', ',':
+ if r.wantSep == c {
+ r.pos++
+ r.start++
+ r.wantSep = 0
+ } else {
+ r.errSyntax()
+ }
+
+ case ' ', '\t', '\r', '\n':
+ r.pos++
+ r.start++
+
+ case '"':
+ if r.wantSep != 0 {
+ r.errSyntax()
+ }
+
+ r.token.kind = tokenString
+ r.fetchString()
+ return
+
+ case '{', '[':
+ if r.wantSep != 0 {
+ r.errSyntax()
+ }
+ r.firstElement = true
+ r.token.kind = tokenDelim
+ r.token.delimValue = r.Data[r.pos]
+ r.pos++
+ return
+
+ case '}', ']':
+ if !r.firstElement && (r.wantSep != ',') {
+ r.errSyntax()
+ }
+ r.wantSep = 0
+ r.token.kind = tokenDelim
+ r.token.delimValue = r.Data[r.pos]
+ r.pos++
+ return
+
+ case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-':
+ if r.wantSep != 0 {
+ r.errSyntax()
+ }
+ r.token.kind = tokenNumber
+ r.fetchNumber()
+ return
+
+ case 'n':
+ if r.wantSep != 0 {
+ r.errSyntax()
+ }
+
+ r.token.kind = tokenNull
+ r.fetchNull()
+ return
+
+ case 't':
+ if r.wantSep != 0 {
+ r.errSyntax()
+ }
+
+ r.token.kind = tokenBool
+ r.token.boolValue = true
+ r.fetchTrue()
+ return
+
+ case 'f':
+ if r.wantSep != 0 {
+ r.errSyntax()
+ }
+
+ r.token.kind = tokenBool
+ r.token.boolValue = false
+ r.fetchFalse()
+ return
+
+ default:
+ r.errSyntax()
+ return
+ }
+ }
+ r.fatalError = io.EOF
+ return
+}
+
+// isTokenEnd returns true if the char can follow a non-delimiter token
+func isTokenEnd(c byte) bool {
+ return c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == '[' || c == ']' || c == '{' || c == '}' || c == ',' || c == ':'
+}
+
+// fetchNull fetches and checks remaining bytes of null keyword.
+func (r *Lexer) fetchNull() {
+ r.pos += 4
+ if r.pos > len(r.Data) ||
+ r.Data[r.pos-3] != 'u' ||
+ r.Data[r.pos-2] != 'l' ||
+ r.Data[r.pos-1] != 'l' ||
+ (r.pos != len(r.Data) && !isTokenEnd(r.Data[r.pos])) {
+
+ r.pos -= 4
+ r.errSyntax()
+ }
+}
+
+// fetchTrue fetches and checks remaining bytes of true keyword.
+func (r *Lexer) fetchTrue() {
+ r.pos += 4
+ if r.pos > len(r.Data) ||
+ r.Data[r.pos-3] != 'r' ||
+ r.Data[r.pos-2] != 'u' ||
+ r.Data[r.pos-1] != 'e' ||
+ (r.pos != len(r.Data) && !isTokenEnd(r.Data[r.pos])) {
+
+ r.pos -= 4
+ r.errSyntax()
+ }
+}
+
+// fetchFalse fetches and checks remaining bytes of false keyword.
+func (r *Lexer) fetchFalse() {
+ r.pos += 5
+ if r.pos > len(r.Data) ||
+ r.Data[r.pos-4] != 'a' ||
+ r.Data[r.pos-3] != 'l' ||
+ r.Data[r.pos-2] != 's' ||
+ r.Data[r.pos-1] != 'e' ||
+ (r.pos != len(r.Data) && !isTokenEnd(r.Data[r.pos])) {
+
+ r.pos -= 5
+ r.errSyntax()
+ }
+}
+
+// fetchNumber scans a number literal token.
+func (r *Lexer) fetchNumber() {
+ hasE := false
+ afterE := false
+ hasDot := false
+
+ r.pos++
+ for i, c := range r.Data[r.pos:] {
+ switch {
+ case c >= '0' && c <= '9':
+ afterE = false
+ case c == '.' && !hasDot:
+ hasDot = true
+ case (c == 'e' || c == 'E') && !hasE:
+ hasE = true
+ hasDot = true
+ afterE = true
+ case (c == '+' || c == '-') && afterE:
+ afterE = false
+ default:
+ r.pos += i
+ if !isTokenEnd(c) {
+ r.errSyntax()
+ } else {
+ r.token.byteValue = r.Data[r.start:r.pos]
+ }
+ return
+ }
+ }
+
+ r.pos = len(r.Data)
+ r.token.byteValue = r.Data[r.start:]
+}
+
+// findStringLen tries to scan into the string literal for ending quote char to determine required size.
+// The size will be exact if no escapes are present and may be inexact if there are escaped chars.
+func findStringLen(data []byte) (isValid bool, length int) {
+ for {
+ idx := bytes.IndexByte(data, '"')
+ if idx == -1 {
+ return false, len(data)
+ }
+ if idx == 0 || (idx > 0 && data[idx-1] != '\\') {
+ return true, length + idx
+ }
+
+ // count \\\\\\\ sequences. even number of slashes means quote is not really escaped
+ cnt := 1
+ for idx-cnt-1 >= 0 && data[idx-cnt-1] == '\\' {
+ cnt++
+ }
+ if cnt%2 == 0 {
+ return true, length + idx
+ }
+
+ length += idx + 1
+ data = data[idx+1:]
+ }
+}
+
+// unescapeStringToken performs unescaping of string token.
+// if no escaping is needed, original string is returned, otherwise - a new one allocated
+func (r *Lexer) unescapeStringToken() (err error) {
+ data := r.token.byteValue
+ var unescapedData []byte
+
+ for {
+ i := bytes.IndexByte(data, '\\')
+ if i == -1 {
+ break
+ }
+
+ escapedRune, escapedBytes, err := decodeEscape(data[i:])
+ if err != nil {
+ r.errParse(err.Error())
+ return err
+ }
+
+ if unescapedData == nil {
+ unescapedData = make([]byte, 0, len(r.token.byteValue))
+ }
+
+ var d [4]byte
+ s := utf8.EncodeRune(d[:], escapedRune)
+ unescapedData = append(unescapedData, data[:i]...)
+ unescapedData = append(unescapedData, d[:s]...)
+
+ data = data[i+escapedBytes:]
+ }
+
+ if unescapedData != nil {
+ r.token.byteValue = append(unescapedData, data...)
+ r.token.byteValueCloned = true
+ }
+ return
+}
+
+// getu4 decodes \uXXXX from the beginning of s, returning the hex value,
+// or it returns -1.
+func getu4(s []byte) rune {
+ if len(s) < 6 || s[0] != '\\' || s[1] != 'u' {
+ return -1
+ }
+ var val rune
+ for i := 2; i < len(s) && i < 6; i++ {
+ var v byte
+ c := s[i]
+ switch c {
+ case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
+ v = c - '0'
+ case 'a', 'b', 'c', 'd', 'e', 'f':
+ v = c - 'a' + 10
+ case 'A', 'B', 'C', 'D', 'E', 'F':
+ v = c - 'A' + 10
+ default:
+ return -1
+ }
+
+ val <<= 4
+ val |= rune(v)
+ }
+ return val
+}
+
+// decodeEscape processes a single escape sequence and returns number of bytes processed.
+func decodeEscape(data []byte) (decoded rune, bytesProcessed int, err error) {
+ if len(data) < 2 {
+ return 0, 0, errors.New("incorrect escape symbol \\ at the end of token")
+ }
+
+ c := data[1]
+ switch c {
+ case '"', '/', '\\':
+ return rune(c), 2, nil
+ case 'b':
+ return '\b', 2, nil
+ case 'f':
+ return '\f', 2, nil
+ case 'n':
+ return '\n', 2, nil
+ case 'r':
+ return '\r', 2, nil
+ case 't':
+ return '\t', 2, nil
+ case 'u':
+ rr := getu4(data)
+ if rr < 0 {
+ return 0, 0, errors.New("incorrectly escaped \\uXXXX sequence")
+ }
+
+ read := 6
+ if utf16.IsSurrogate(rr) {
+ rr1 := getu4(data[read:])
+ if dec := utf16.DecodeRune(rr, rr1); dec != unicode.ReplacementChar {
+ read += 6
+ rr = dec
+ } else {
+ rr = unicode.ReplacementChar
+ }
+ }
+ return rr, read, nil
+ }
+
+ return 0, 0, errors.New("incorrectly escaped bytes")
+}
+
+// fetchString scans a string literal token.
+func (r *Lexer) fetchString() {
+ r.pos++
+ data := r.Data[r.pos:]
+
+ isValid, length := findStringLen(data)
+ if !isValid {
+ r.pos += length
+ r.errParse("unterminated string literal")
+ return
+ }
+ r.token.byteValue = data[:length]
+ r.pos += length + 1 // skip closing '"' as well
+}
+
+// scanToken scans the next token if no token is currently available in the lexer.
+func (r *Lexer) scanToken() {
+ if r.token.kind != tokenUndef || r.fatalError != nil {
+ return
+ }
+
+ r.FetchToken()
+}
+
+// consume resets the current token to allow scanning the next one.
+func (r *Lexer) consume() {
+ r.token.kind = tokenUndef
+ r.token.byteValueCloned = false
+ r.token.delimValue = 0
+}
+
+// Ok returns true if no error (including io.EOF) was encountered during scanning.
+func (r *Lexer) Ok() bool {
+ return r.fatalError == nil
+}
+
+const maxErrorContextLen = 13
+
+func (r *Lexer) errParse(what string) {
+ if r.fatalError == nil {
+ var str string
+ if len(r.Data)-r.pos <= maxErrorContextLen {
+ str = string(r.Data)
+ } else {
+ str = string(r.Data[r.pos:r.pos+maxErrorContextLen-3]) + "..."
+ }
+ r.fatalError = &LexerError{
+ Reason: what,
+ Offset: r.pos,
+ Data: str,
+ }
+ }
+}
+
+func (r *Lexer) errSyntax() {
+ r.errParse("syntax error")
+}
+
+func (r *Lexer) errInvalidToken(expected string) {
+ if r.fatalError != nil {
+ return
+ }
+ if r.UseMultipleErrors {
+ r.pos = r.start
+ r.consume()
+ r.SkipRecursive()
+ switch expected {
+ case "[":
+ r.token.delimValue = ']'
+ r.token.kind = tokenDelim
+ case "{":
+ r.token.delimValue = '}'
+ r.token.kind = tokenDelim
+ }
+ r.addNonfatalError(&LexerError{
+ Reason: fmt.Sprintf("expected %s", expected),
+ Offset: r.start,
+ Data: string(r.Data[r.start:r.pos]),
+ })
+ return
+ }
+
+ var str string
+ if len(r.token.byteValue) <= maxErrorContextLen {
+ str = string(r.token.byteValue)
+ } else {
+ str = string(r.token.byteValue[:maxErrorContextLen-3]) + "..."
+ }
+ r.fatalError = &LexerError{
+ Reason: fmt.Sprintf("expected %s", expected),
+ Offset: r.pos,
+ Data: str,
+ }
+}
+
+func (r *Lexer) GetPos() int {
+ return r.pos
+}
+
+// Delim consumes a token and verifies that it is the given delimiter.
+func (r *Lexer) Delim(c byte) {
+ if r.token.kind == tokenUndef && r.Ok() {
+ r.FetchToken()
+ }
+
+ if !r.Ok() || r.token.delimValue != c {
+ r.consume() // errInvalidToken can change token if UseMultipleErrors is enabled.
+ r.errInvalidToken(string([]byte{c}))
+ } else {
+ r.consume()
+ }
+}
+
+// IsDelim returns true if there was no scanning error and next token is the given delimiter.
+func (r *Lexer) IsDelim(c byte) bool {
+ if r.token.kind == tokenUndef && r.Ok() {
+ r.FetchToken()
+ }
+ return !r.Ok() || r.token.delimValue == c
+}
+
+// Null verifies that the next token is null and consumes it.
+func (r *Lexer) Null() {
+ if r.token.kind == tokenUndef && r.Ok() {
+ r.FetchToken()
+ }
+ if !r.Ok() || r.token.kind != tokenNull {
+ r.errInvalidToken("null")
+ }
+ r.consume()
+}
+
+// IsNull returns true if the next token is a null keyword.
+func (r *Lexer) IsNull() bool {
+ if r.token.kind == tokenUndef && r.Ok() {
+ r.FetchToken()
+ }
+ return r.Ok() && r.token.kind == tokenNull
+}
+
+// Skip skips a single token.
+func (r *Lexer) Skip() {
+ if r.token.kind == tokenUndef && r.Ok() {
+ r.FetchToken()
+ }
+ r.consume()
+}
+
+// SkipRecursive skips next array or object completely, or just skips a single token if not
+// an array/object.
+//
+// Note: no syntax validation is performed on the skipped data.
+func (r *Lexer) SkipRecursive() {
+ r.scanToken()
+ var start, end byte
+ startPos := r.start
+
+ switch r.token.delimValue {
+ case '{':
+ start, end = '{', '}'
+ case '[':
+ start, end = '[', ']'
+ default:
+ r.consume()
+ return
+ }
+
+ r.consume()
+
+ level := 1
+ inQuotes := false
+ wasEscape := false
+
+ for i, c := range r.Data[r.pos:] {
+ switch {
+ case c == start && !inQuotes:
+ level++
+ case c == end && !inQuotes:
+ level--
+ if level == 0 {
+ r.pos += i + 1
+ if !json.Valid(r.Data[startPos:r.pos]) {
+ r.pos = len(r.Data)
+ r.fatalError = &LexerError{
+ Reason: "skipped array/object json value is invalid",
+ Offset: r.pos,
+ Data: string(r.Data[r.pos:]),
+ }
+ }
+ return
+ }
+ case c == '\\' && inQuotes:
+ wasEscape = !wasEscape
+ continue
+ case c == '"' && inQuotes:
+ inQuotes = wasEscape
+ case c == '"':
+ inQuotes = true
+ }
+ wasEscape = false
+ }
+ r.pos = len(r.Data)
+ r.fatalError = &LexerError{
+ Reason: "EOF reached while skipping array/object or token",
+ Offset: r.pos,
+ Data: string(r.Data[r.pos:]),
+ }
+}
+
+// Raw fetches the next item recursively as a data slice
+func (r *Lexer) Raw() []byte {
+ r.SkipRecursive()
+ if !r.Ok() {
+ return nil
+ }
+ return r.Data[r.start:r.pos]
+}
+
+// IsStart returns whether the lexer is positioned at the start
+// of an input string.
+func (r *Lexer) IsStart() bool {
+ return r.pos == 0
+}
+
+// Consumed reads all remaining bytes from the input, publishing an error if
+// there is anything but whitespace remaining.
+func (r *Lexer) Consumed() {
+ if r.pos > len(r.Data) || !r.Ok() {
+ return
+ }
+
+ for _, c := range r.Data[r.pos:] {
+ if c != ' ' && c != '\t' && c != '\r' && c != '\n' {
+ r.AddError(&LexerError{
+ Reason: "invalid character '" + string(c) + "' after top-level value",
+ Offset: r.pos,
+ Data: string(r.Data[r.pos:]),
+ })
+ return
+ }
+
+ r.pos++
+ r.start++
+ }
+}
+
+func (r *Lexer) unsafeString(skipUnescape bool) (string, []byte) {
+ if r.token.kind == tokenUndef && r.Ok() {
+ r.FetchToken()
+ }
+ if !r.Ok() || r.token.kind != tokenString {
+ r.errInvalidToken("string")
+ return "", nil
+ }
+ if !skipUnescape {
+ if err := r.unescapeStringToken(); err != nil {
+ r.errInvalidToken("string")
+ return "", nil
+ }
+ }
+
+ bytes := r.token.byteValue
+ ret := bytesToStr(r.token.byteValue)
+ r.consume()
+ return ret, bytes
+}
+
+// UnsafeString returns the string value if the token is a string literal.
+//
+// Warning: returned string may point to the input buffer, so the string should not outlive
+// the input buffer. Intended pattern of usage is as an argument to a switch statement.
+func (r *Lexer) UnsafeString() string {
+ ret, _ := r.unsafeString(false)
+ return ret
+}
+
+// UnsafeBytes returns the byte slice if the token is a string literal.
+func (r *Lexer) UnsafeBytes() []byte {
+ _, ret := r.unsafeString(false)
+ return ret
+}
+
+// UnsafeFieldName returns current member name string token
+func (r *Lexer) UnsafeFieldName(skipUnescape bool) string {
+ ret, _ := r.unsafeString(skipUnescape)
+ return ret
+}
+
+// String reads a string literal.
+func (r *Lexer) String() string {
+ if r.token.kind == tokenUndef && r.Ok() {
+ r.FetchToken()
+ }
+ if !r.Ok() || r.token.kind != tokenString {
+ r.errInvalidToken("string")
+ return ""
+ }
+ if err := r.unescapeStringToken(); err != nil {
+ r.errInvalidToken("string")
+ return ""
+ }
+ var ret string
+ if r.token.byteValueCloned {
+ ret = bytesToStr(r.token.byteValue)
+ } else {
+ ret = string(r.token.byteValue)
+ }
+ r.consume()
+ return ret
+}
+
+// StringIntern reads a string literal, and performs string interning on it.
+func (r *Lexer) StringIntern() string {
+ if r.token.kind == tokenUndef && r.Ok() {
+ r.FetchToken()
+ }
+ if !r.Ok() || r.token.kind != tokenString {
+ r.errInvalidToken("string")
+ return ""
+ }
+ if err := r.unescapeStringToken(); err != nil {
+ r.errInvalidToken("string")
+ return ""
+ }
+ ret := intern.Bytes(r.token.byteValue)
+ r.consume()
+ return ret
+}
+
+// Bytes reads a string literal and base64 decodes it into a byte slice.
+func (r *Lexer) Bytes() []byte {
+ if r.token.kind == tokenUndef && r.Ok() {
+ r.FetchToken()
+ }
+ if !r.Ok() || r.token.kind != tokenString {
+ r.errInvalidToken("string")
+ return nil
+ }
+ if err := r.unescapeStringToken(); err != nil {
+ r.errInvalidToken("string")
+ return nil
+ }
+ ret := make([]byte, base64.StdEncoding.DecodedLen(len(r.token.byteValue)))
+ n, err := base64.StdEncoding.Decode(ret, r.token.byteValue)
+ if err != nil {
+ r.fatalError = &LexerError{
+ Reason: err.Error(),
+ }
+ return nil
+ }
+
+ r.consume()
+ return ret[:n]
+}
+
+// Bool reads a true or false boolean keyword.
+func (r *Lexer) Bool() bool {
+ if r.token.kind == tokenUndef && r.Ok() {
+ r.FetchToken()
+ }
+ if !r.Ok() || r.token.kind != tokenBool {
+ r.errInvalidToken("bool")
+ return false
+ }
+ ret := r.token.boolValue
+ r.consume()
+ return ret
+}
+
+func (r *Lexer) number() string {
+ if r.token.kind == tokenUndef && r.Ok() {
+ r.FetchToken()
+ }
+ if !r.Ok() || r.token.kind != tokenNumber {
+ r.errInvalidToken("number")
+ return ""
+ }
+ ret := bytesToStr(r.token.byteValue)
+ r.consume()
+ return ret
+}
+
+func (r *Lexer) Uint8() uint8 {
+ s := r.number()
+ if !r.Ok() {
+ return 0
+ }
+
+ n, err := strconv.ParseUint(s, 10, 8)
+ if err != nil {
+ r.addNonfatalError(&LexerError{
+ Offset: r.start,
+ Reason: err.Error(),
+ Data: s,
+ })
+ }
+ return uint8(n)
+}
+
+func (r *Lexer) Uint16() uint16 {
+ s := r.number()
+ if !r.Ok() {
+ return 0
+ }
+
+ n, err := strconv.ParseUint(s, 10, 16)
+ if err != nil {
+ r.addNonfatalError(&LexerError{
+ Offset: r.start,
+ Reason: err.Error(),
+ Data: s,
+ })
+ }
+ return uint16(n)
+}
+
+func (r *Lexer) Uint32() uint32 {
+ s := r.number()
+ if !r.Ok() {
+ return 0
+ }
+
+ n, err := strconv.ParseUint(s, 10, 32)
+ if err != nil {
+ r.addNonfatalError(&LexerError{
+ Offset: r.start,
+ Reason: err.Error(),
+ Data: s,
+ })
+ }
+ return uint32(n)
+}
+
+func (r *Lexer) Uint64() uint64 {
+ s := r.number()
+ if !r.Ok() {
+ return 0
+ }
+
+ n, err := strconv.ParseUint(s, 10, 64)
+ if err != nil {
+ r.addNonfatalError(&LexerError{
+ Offset: r.start,
+ Reason: err.Error(),
+ Data: s,
+ })
+ }
+ return n
+}
+
+func (r *Lexer) Uint() uint {
+ return uint(r.Uint64())
+}
+
+func (r *Lexer) Int8() int8 {
+ s := r.number()
+ if !r.Ok() {
+ return 0
+ }
+
+ n, err := strconv.ParseInt(s, 10, 8)
+ if err != nil {
+ r.addNonfatalError(&LexerError{
+ Offset: r.start,
+ Reason: err.Error(),
+ Data: s,
+ })
+ }
+ return int8(n)
+}
+
+func (r *Lexer) Int16() int16 {
+ s := r.number()
+ if !r.Ok() {
+ return 0
+ }
+
+ n, err := strconv.ParseInt(s, 10, 16)
+ if err != nil {
+ r.addNonfatalError(&LexerError{
+ Offset: r.start,
+ Reason: err.Error(),
+ Data: s,
+ })
+ }
+ return int16(n)
+}
+
+func (r *Lexer) Int32() int32 {
+ s := r.number()
+ if !r.Ok() {
+ return 0
+ }
+
+ n, err := strconv.ParseInt(s, 10, 32)
+ if err != nil {
+ r.addNonfatalError(&LexerError{
+ Offset: r.start,
+ Reason: err.Error(),
+ Data: s,
+ })
+ }
+ return int32(n)
+}
+
+func (r *Lexer) Int64() int64 {
+ s := r.number()
+ if !r.Ok() {
+ return 0
+ }
+
+ n, err := strconv.ParseInt(s, 10, 64)
+ if err != nil {
+ r.addNonfatalError(&LexerError{
+ Offset: r.start,
+ Reason: err.Error(),
+ Data: s,
+ })
+ }
+ return n
+}
+
+func (r *Lexer) Int() int {
+ return int(r.Int64())
+}
+
+func (r *Lexer) Uint8Str() uint8 {
+ s, b := r.unsafeString(false)
+ if !r.Ok() {
+ return 0
+ }
+
+ n, err := strconv.ParseUint(s, 10, 8)
+ if err != nil {
+ r.addNonfatalError(&LexerError{
+ Offset: r.start,
+ Reason: err.Error(),
+ Data: string(b),
+ })
+ }
+ return uint8(n)
+}
+
+func (r *Lexer) Uint16Str() uint16 {
+ s, b := r.unsafeString(false)
+ if !r.Ok() {
+ return 0
+ }
+
+ n, err := strconv.ParseUint(s, 10, 16)
+ if err != nil {
+ r.addNonfatalError(&LexerError{
+ Offset: r.start,
+ Reason: err.Error(),
+ Data: string(b),
+ })
+ }
+ return uint16(n)
+}
+
+func (r *Lexer) Uint32Str() uint32 {
+ s, b := r.unsafeString(false)
+ if !r.Ok() {
+ return 0
+ }
+
+ n, err := strconv.ParseUint(s, 10, 32)
+ if err != nil {
+ r.addNonfatalError(&LexerError{
+ Offset: r.start,
+ Reason: err.Error(),
+ Data: string(b),
+ })
+ }
+ return uint32(n)
+}
+
+func (r *Lexer) Uint64Str() uint64 {
+ s, b := r.unsafeString(false)
+ if !r.Ok() {
+ return 0
+ }
+
+ n, err := strconv.ParseUint(s, 10, 64)
+ if err != nil {
+ r.addNonfatalError(&LexerError{
+ Offset: r.start,
+ Reason: err.Error(),
+ Data: string(b),
+ })
+ }
+ return n
+}
+
+func (r *Lexer) UintStr() uint {
+ return uint(r.Uint64Str())
+}
+
+func (r *Lexer) UintptrStr() uintptr {
+ return uintptr(r.Uint64Str())
+}
+
+func (r *Lexer) Int8Str() int8 {
+ s, b := r.unsafeString(false)
+ if !r.Ok() {
+ return 0
+ }
+
+ n, err := strconv.ParseInt(s, 10, 8)
+ if err != nil {
+ r.addNonfatalError(&LexerError{
+ Offset: r.start,
+ Reason: err.Error(),
+ Data: string(b),
+ })
+ }
+ return int8(n)
+}
+
+func (r *Lexer) Int16Str() int16 {
+ s, b := r.unsafeString(false)
+ if !r.Ok() {
+ return 0
+ }
+
+ n, err := strconv.ParseInt(s, 10, 16)
+ if err != nil {
+ r.addNonfatalError(&LexerError{
+ Offset: r.start,
+ Reason: err.Error(),
+ Data: string(b),
+ })
+ }
+ return int16(n)
+}
+
+func (r *Lexer) Int32Str() int32 {
+ s, b := r.unsafeString(false)
+ if !r.Ok() {
+ return 0
+ }
+
+ n, err := strconv.ParseInt(s, 10, 32)
+ if err != nil {
+ r.addNonfatalError(&LexerError{
+ Offset: r.start,
+ Reason: err.Error(),
+ Data: string(b),
+ })
+ }
+ return int32(n)
+}
+
+func (r *Lexer) Int64Str() int64 {
+ s, b := r.unsafeString(false)
+ if !r.Ok() {
+ return 0
+ }
+
+ n, err := strconv.ParseInt(s, 10, 64)
+ if err != nil {
+ r.addNonfatalError(&LexerError{
+ Offset: r.start,
+ Reason: err.Error(),
+ Data: string(b),
+ })
+ }
+ return n
+}
+
+func (r *Lexer) IntStr() int {
+ return int(r.Int64Str())
+}
+
+func (r *Lexer) Float32() float32 {
+ s := r.number()
+ if !r.Ok() {
+ return 0
+ }
+
+ n, err := strconv.ParseFloat(s, 32)
+ if err != nil {
+ r.addNonfatalError(&LexerError{
+ Offset: r.start,
+ Reason: err.Error(),
+ Data: s,
+ })
+ }
+ return float32(n)
+}
+
+func (r *Lexer) Float32Str() float32 {
+ s, b := r.unsafeString(false)
+ if !r.Ok() {
+ return 0
+ }
+ n, err := strconv.ParseFloat(s, 32)
+ if err != nil {
+ r.addNonfatalError(&LexerError{
+ Offset: r.start,
+ Reason: err.Error(),
+ Data: string(b),
+ })
+ }
+ return float32(n)
+}
+
+func (r *Lexer) Float64() float64 {
+ s := r.number()
+ if !r.Ok() {
+ return 0
+ }
+
+ n, err := strconv.ParseFloat(s, 64)
+ if err != nil {
+ r.addNonfatalError(&LexerError{
+ Offset: r.start,
+ Reason: err.Error(),
+ Data: s,
+ })
+ }
+ return n
+}
+
+func (r *Lexer) Float64Str() float64 {
+ s, b := r.unsafeString(false)
+ if !r.Ok() {
+ return 0
+ }
+ n, err := strconv.ParseFloat(s, 64)
+ if err != nil {
+ r.addNonfatalError(&LexerError{
+ Offset: r.start,
+ Reason: err.Error(),
+ Data: string(b),
+ })
+ }
+ return n
+}
+
+func (r *Lexer) Error() error {
+ return r.fatalError
+}
+
+func (r *Lexer) AddError(e error) {
+ if r.fatalError == nil {
+ r.fatalError = e
+ }
+}
+
+func (r *Lexer) AddNonFatalError(e error) {
+ r.addNonfatalError(&LexerError{
+ Offset: r.start,
+ Data: string(r.Data[r.start:r.pos]),
+ Reason: e.Error(),
+ })
+}
+
+func (r *Lexer) addNonfatalError(err *LexerError) {
+ if r.UseMultipleErrors {
+ // We don't want to add errors with the same offset.
+ if len(r.multipleErrors) != 0 && r.multipleErrors[len(r.multipleErrors)-1].Offset == err.Offset {
+ return
+ }
+ r.multipleErrors = append(r.multipleErrors, err)
+ return
+ }
+ r.fatalError = err
+}
+
+func (r *Lexer) GetNonFatalErrors() []*LexerError {
+ return r.multipleErrors
+}
+
+// JsonNumber fetches and json.Number from 'encoding/json' package.
+// Both int, float or string, contains them are valid values
+func (r *Lexer) JsonNumber() json.Number {
+ if r.token.kind == tokenUndef && r.Ok() {
+ r.FetchToken()
+ }
+ if !r.Ok() {
+ r.errInvalidToken("json.Number")
+ return json.Number("")
+ }
+
+ switch r.token.kind {
+ case tokenString:
+ return json.Number(r.String())
+ case tokenNumber:
+ return json.Number(r.Raw())
+ case tokenNull:
+ r.Null()
+ return json.Number("")
+ default:
+ r.errSyntax()
+ return json.Number("")
+ }
+}
+
+// Interface fetches an interface{} analogous to the 'encoding/json' package.
+func (r *Lexer) Interface() interface{} {
+ if r.token.kind == tokenUndef && r.Ok() {
+ r.FetchToken()
+ }
+
+ if !r.Ok() {
+ return nil
+ }
+ switch r.token.kind {
+ case tokenString:
+ return r.String()
+ case tokenNumber:
+ return r.Float64()
+ case tokenBool:
+ return r.Bool()
+ case tokenNull:
+ r.Null()
+ return nil
+ }
+
+ if r.token.delimValue == '{' {
+ r.consume()
+
+ ret := map[string]interface{}{}
+ for !r.IsDelim('}') {
+ key := r.String()
+ r.WantColon()
+ ret[key] = r.Interface()
+ r.WantComma()
+ }
+ r.Delim('}')
+
+ if r.Ok() {
+ return ret
+ } else {
+ return nil
+ }
+ } else if r.token.delimValue == '[' {
+ r.consume()
+
+ ret := []interface{}{}
+ for !r.IsDelim(']') {
+ ret = append(ret, r.Interface())
+ r.WantComma()
+ }
+ r.Delim(']')
+
+ if r.Ok() {
+ return ret
+ } else {
+ return nil
+ }
+ }
+ r.errSyntax()
+ return nil
+}
+
+// WantComma requires a comma to be present before fetching next token.
+func (r *Lexer) WantComma() {
+ r.wantSep = ','
+ r.firstElement = false
+}
+
+// WantColon requires a colon to be present before fetching next token.
+func (r *Lexer) WantColon() {
+ r.wantSep = ':'
+ r.firstElement = false
+}
diff --git a/vendor/github.com/mailru/easyjson/jwriter/writer.go b/vendor/github.com/mailru/easyjson/jwriter/writer.go
new file mode 100644
index 000000000..2c5b20105
--- /dev/null
+++ b/vendor/github.com/mailru/easyjson/jwriter/writer.go
@@ -0,0 +1,405 @@
+// Package jwriter contains a JSON writer.
+package jwriter
+
+import (
+ "io"
+ "strconv"
+ "unicode/utf8"
+
+ "github.com/mailru/easyjson/buffer"
+)
+
+// Flags describe various encoding options. The behavior may be actually implemented in the encoder, but
+// Flags field in Writer is used to set and pass them around.
+type Flags int
+
+const (
+ NilMapAsEmpty Flags = 1 << iota // Encode nil map as '{}' rather than 'null'.
+ NilSliceAsEmpty // Encode nil slice as '[]' rather than 'null'.
+)
+
+// Writer is a JSON writer.
+type Writer struct {
+ Flags Flags
+
+ Error error
+ Buffer buffer.Buffer
+ NoEscapeHTML bool
+}
+
+// Size returns the size of the data that was written out.
+func (w *Writer) Size() int {
+ return w.Buffer.Size()
+}
+
+// DumpTo outputs the data to given io.Writer, resetting the buffer.
+func (w *Writer) DumpTo(out io.Writer) (written int, err error) {
+ return w.Buffer.DumpTo(out)
+}
+
+// BuildBytes returns writer data as a single byte slice. You can optionally provide one byte slice
+// as argument that it will try to reuse.
+func (w *Writer) BuildBytes(reuse ...[]byte) ([]byte, error) {
+ if w.Error != nil {
+ return nil, w.Error
+ }
+
+ return w.Buffer.BuildBytes(reuse...), nil
+}
+
+// ReadCloser returns an io.ReadCloser that can be used to read the data.
+// ReadCloser also resets the buffer.
+func (w *Writer) ReadCloser() (io.ReadCloser, error) {
+ if w.Error != nil {
+ return nil, w.Error
+ }
+
+ return w.Buffer.ReadCloser(), nil
+}
+
+// RawByte appends raw binary data to the buffer.
+func (w *Writer) RawByte(c byte) {
+ w.Buffer.AppendByte(c)
+}
+
+// RawByte appends raw binary data to the buffer.
+func (w *Writer) RawString(s string) {
+ w.Buffer.AppendString(s)
+}
+
+// Raw appends raw binary data to the buffer or sets the error if it is given. Useful for
+// calling with results of MarshalJSON-like functions.
+func (w *Writer) Raw(data []byte, err error) {
+ switch {
+ case w.Error != nil:
+ return
+ case err != nil:
+ w.Error = err
+ case len(data) > 0:
+ w.Buffer.AppendBytes(data)
+ default:
+ w.RawString("null")
+ }
+}
+
+// RawText encloses raw binary data in quotes and appends in to the buffer.
+// Useful for calling with results of MarshalText-like functions.
+func (w *Writer) RawText(data []byte, err error) {
+ switch {
+ case w.Error != nil:
+ return
+ case err != nil:
+ w.Error = err
+ case len(data) > 0:
+ w.String(string(data))
+ default:
+ w.RawString("null")
+ }
+}
+
+// Base64Bytes appends data to the buffer after base64 encoding it
+func (w *Writer) Base64Bytes(data []byte) {
+ if data == nil {
+ w.Buffer.AppendString("null")
+ return
+ }
+ w.Buffer.AppendByte('"')
+ w.base64(data)
+ w.Buffer.AppendByte('"')
+}
+
+func (w *Writer) Uint8(n uint8) {
+ w.Buffer.EnsureSpace(3)
+ w.Buffer.Buf = strconv.AppendUint(w.Buffer.Buf, uint64(n), 10)
+}
+
+func (w *Writer) Uint16(n uint16) {
+ w.Buffer.EnsureSpace(5)
+ w.Buffer.Buf = strconv.AppendUint(w.Buffer.Buf, uint64(n), 10)
+}
+
+func (w *Writer) Uint32(n uint32) {
+ w.Buffer.EnsureSpace(10)
+ w.Buffer.Buf = strconv.AppendUint(w.Buffer.Buf, uint64(n), 10)
+}
+
+func (w *Writer) Uint(n uint) {
+ w.Buffer.EnsureSpace(20)
+ w.Buffer.Buf = strconv.AppendUint(w.Buffer.Buf, uint64(n), 10)
+}
+
+func (w *Writer) Uint64(n uint64) {
+ w.Buffer.EnsureSpace(20)
+ w.Buffer.Buf = strconv.AppendUint(w.Buffer.Buf, n, 10)
+}
+
+func (w *Writer) Int8(n int8) {
+ w.Buffer.EnsureSpace(4)
+ w.Buffer.Buf = strconv.AppendInt(w.Buffer.Buf, int64(n), 10)
+}
+
+func (w *Writer) Int16(n int16) {
+ w.Buffer.EnsureSpace(6)
+ w.Buffer.Buf = strconv.AppendInt(w.Buffer.Buf, int64(n), 10)
+}
+
+func (w *Writer) Int32(n int32) {
+ w.Buffer.EnsureSpace(11)
+ w.Buffer.Buf = strconv.AppendInt(w.Buffer.Buf, int64(n), 10)
+}
+
+func (w *Writer) Int(n int) {
+ w.Buffer.EnsureSpace(21)
+ w.Buffer.Buf = strconv.AppendInt(w.Buffer.Buf, int64(n), 10)
+}
+
+func (w *Writer) Int64(n int64) {
+ w.Buffer.EnsureSpace(21)
+ w.Buffer.Buf = strconv.AppendInt(w.Buffer.Buf, n, 10)
+}
+
+func (w *Writer) Uint8Str(n uint8) {
+ w.Buffer.EnsureSpace(3)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+ w.Buffer.Buf = strconv.AppendUint(w.Buffer.Buf, uint64(n), 10)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+}
+
+func (w *Writer) Uint16Str(n uint16) {
+ w.Buffer.EnsureSpace(5)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+ w.Buffer.Buf = strconv.AppendUint(w.Buffer.Buf, uint64(n), 10)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+}
+
+func (w *Writer) Uint32Str(n uint32) {
+ w.Buffer.EnsureSpace(10)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+ w.Buffer.Buf = strconv.AppendUint(w.Buffer.Buf, uint64(n), 10)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+}
+
+func (w *Writer) UintStr(n uint) {
+ w.Buffer.EnsureSpace(20)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+ w.Buffer.Buf = strconv.AppendUint(w.Buffer.Buf, uint64(n), 10)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+}
+
+func (w *Writer) Uint64Str(n uint64) {
+ w.Buffer.EnsureSpace(20)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+ w.Buffer.Buf = strconv.AppendUint(w.Buffer.Buf, n, 10)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+}
+
+func (w *Writer) UintptrStr(n uintptr) {
+ w.Buffer.EnsureSpace(20)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+ w.Buffer.Buf = strconv.AppendUint(w.Buffer.Buf, uint64(n), 10)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+}
+
+func (w *Writer) Int8Str(n int8) {
+ w.Buffer.EnsureSpace(4)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+ w.Buffer.Buf = strconv.AppendInt(w.Buffer.Buf, int64(n), 10)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+}
+
+func (w *Writer) Int16Str(n int16) {
+ w.Buffer.EnsureSpace(6)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+ w.Buffer.Buf = strconv.AppendInt(w.Buffer.Buf, int64(n), 10)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+}
+
+func (w *Writer) Int32Str(n int32) {
+ w.Buffer.EnsureSpace(11)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+ w.Buffer.Buf = strconv.AppendInt(w.Buffer.Buf, int64(n), 10)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+}
+
+func (w *Writer) IntStr(n int) {
+ w.Buffer.EnsureSpace(21)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+ w.Buffer.Buf = strconv.AppendInt(w.Buffer.Buf, int64(n), 10)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+}
+
+func (w *Writer) Int64Str(n int64) {
+ w.Buffer.EnsureSpace(21)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+ w.Buffer.Buf = strconv.AppendInt(w.Buffer.Buf, n, 10)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+}
+
+func (w *Writer) Float32(n float32) {
+ w.Buffer.EnsureSpace(20)
+ w.Buffer.Buf = strconv.AppendFloat(w.Buffer.Buf, float64(n), 'g', -1, 32)
+}
+
+func (w *Writer) Float32Str(n float32) {
+ w.Buffer.EnsureSpace(20)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+ w.Buffer.Buf = strconv.AppendFloat(w.Buffer.Buf, float64(n), 'g', -1, 32)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+}
+
+func (w *Writer) Float64(n float64) {
+ w.Buffer.EnsureSpace(20)
+ w.Buffer.Buf = strconv.AppendFloat(w.Buffer.Buf, n, 'g', -1, 64)
+}
+
+func (w *Writer) Float64Str(n float64) {
+ w.Buffer.EnsureSpace(20)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+ w.Buffer.Buf = strconv.AppendFloat(w.Buffer.Buf, float64(n), 'g', -1, 64)
+ w.Buffer.Buf = append(w.Buffer.Buf, '"')
+}
+
+func (w *Writer) Bool(v bool) {
+ w.Buffer.EnsureSpace(5)
+ if v {
+ w.Buffer.Buf = append(w.Buffer.Buf, "true"...)
+ } else {
+ w.Buffer.Buf = append(w.Buffer.Buf, "false"...)
+ }
+}
+
+const chars = "0123456789abcdef"
+
+func getTable(falseValues ...int) [128]bool {
+ table := [128]bool{}
+
+ for i := 0; i < 128; i++ {
+ table[i] = true
+ }
+
+ for _, v := range falseValues {
+ table[v] = false
+ }
+
+ return table
+}
+
+var (
+ htmlEscapeTable = getTable(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, '"', '&', '<', '>', '\\')
+ htmlNoEscapeTable = getTable(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, '"', '\\')
+)
+
+func (w *Writer) String(s string) {
+ w.Buffer.AppendByte('"')
+
+ // Portions of the string that contain no escapes are appended as
+ // byte slices.
+
+ p := 0 // last non-escape symbol
+
+ escapeTable := &htmlEscapeTable
+ if w.NoEscapeHTML {
+ escapeTable = &htmlNoEscapeTable
+ }
+
+ for i := 0; i < len(s); {
+ c := s[i]
+
+ if c < utf8.RuneSelf {
+ if escapeTable[c] {
+ // single-width character, no escaping is required
+ i++
+ continue
+ }
+
+ w.Buffer.AppendString(s[p:i])
+ switch c {
+ case '\t':
+ w.Buffer.AppendString(`\t`)
+ case '\r':
+ w.Buffer.AppendString(`\r`)
+ case '\n':
+ w.Buffer.AppendString(`\n`)
+ case '\\':
+ w.Buffer.AppendString(`\\`)
+ case '"':
+ w.Buffer.AppendString(`\"`)
+ default:
+ w.Buffer.AppendString(`\u00`)
+ w.Buffer.AppendByte(chars[c>>4])
+ w.Buffer.AppendByte(chars[c&0xf])
+ }
+
+ i++
+ p = i
+ continue
+ }
+
+ // broken utf
+ runeValue, runeWidth := utf8.DecodeRuneInString(s[i:])
+ if runeValue == utf8.RuneError && runeWidth == 1 {
+ w.Buffer.AppendString(s[p:i])
+ w.Buffer.AppendString(`\ufffd`)
+ i++
+ p = i
+ continue
+ }
+
+ // jsonp stuff - tab separator and line separator
+ if runeValue == '\u2028' || runeValue == '\u2029' {
+ w.Buffer.AppendString(s[p:i])
+ w.Buffer.AppendString(`\u202`)
+ w.Buffer.AppendByte(chars[runeValue&0xf])
+ i += runeWidth
+ p = i
+ continue
+ }
+ i += runeWidth
+ }
+ w.Buffer.AppendString(s[p:])
+ w.Buffer.AppendByte('"')
+}
+
+const encode = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
+const padChar = '='
+
+func (w *Writer) base64(in []byte) {
+
+ if len(in) == 0 {
+ return
+ }
+
+ w.Buffer.EnsureSpace(((len(in)-1)/3 + 1) * 4)
+
+ si := 0
+ n := (len(in) / 3) * 3
+
+ for si < n {
+ // Convert 3x 8bit source bytes into 4 bytes
+ val := uint(in[si+0])<<16 | uint(in[si+1])<<8 | uint(in[si+2])
+
+ w.Buffer.Buf = append(w.Buffer.Buf, encode[val>>18&0x3F], encode[val>>12&0x3F], encode[val>>6&0x3F], encode[val&0x3F])
+
+ si += 3
+ }
+
+ remain := len(in) - si
+ if remain == 0 {
+ return
+ }
+
+ // Add the remaining small block
+ val := uint(in[si+0]) << 16
+ if remain == 2 {
+ val |= uint(in[si+1]) << 8
+ }
+
+ w.Buffer.Buf = append(w.Buffer.Buf, encode[val>>18&0x3F], encode[val>>12&0x3F])
+
+ switch remain {
+ case 2:
+ w.Buffer.Buf = append(w.Buffer.Buf, encode[val>>6&0x3F], byte(padChar))
+ case 1:
+ w.Buffer.Buf = append(w.Buffer.Buf, byte(padChar), byte(padChar))
+ }
+}
diff --git a/vendor/github.com/x448/float16/.travis.yml b/vendor/github.com/x448/float16/.travis.yml
new file mode 100644
index 000000000..8902bdaaf
--- /dev/null
+++ b/vendor/github.com/x448/float16/.travis.yml
@@ -0,0 +1,13 @@
+language: go
+
+go:
+ - 1.11.x
+
+env:
+ - GO111MODULE=on
+
+script:
+ - go test -short -coverprofile=coverage.txt -covermode=count ./...
+
+after_success:
+ - bash <(curl -s https://codecov.io/bash)
diff --git a/vendor/github.com/x448/float16/LICENSE b/vendor/github.com/x448/float16/LICENSE
new file mode 100644
index 000000000..bf6e35785
--- /dev/null
+++ b/vendor/github.com/x448/float16/LICENSE
@@ -0,0 +1,22 @@
+MIT License
+
+Copyright (c) 2019 Montgomery Edwards⁴⁴⁸ and Faye Amacker
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
diff --git a/vendor/github.com/x448/float16/README.md b/vendor/github.com/x448/float16/README.md
new file mode 100644
index 000000000..b524b8135
--- /dev/null
+++ b/vendor/github.com/x448/float16/README.md
@@ -0,0 +1,133 @@
+# Float16 (Binary16) in Go/Golang
+[![Build Status](https://travis-ci.org/x448/float16.svg?branch=master)](https://travis-ci.org/x448/float16)
+[![codecov](https://codecov.io/gh/x448/float16/branch/master/graph/badge.svg?v=4)](https://codecov.io/gh/x448/float16)
+[![Go Report Card](https://goreportcard.com/badge/github.com/x448/float16)](https://goreportcard.com/report/github.com/x448/float16)
+[![Release](https://img.shields.io/github/release/x448/float16.svg?style=flat-square)](https://github.com/x448/float16/releases)
+[![License](http://img.shields.io/badge/license-mit-blue.svg?style=flat-square)](https://raw.githubusercontent.com/x448/float16/master/LICENSE)
+
+`float16` package provides [IEEE 754 half-precision floating-point format (binary16)](https://en.wikipedia.org/wiki/Half-precision_floating-point_format) with IEEE 754 default rounding for conversions. IEEE 754-2008 refers to this 16-bit floating-point format as binary16.
+
+IEEE 754 default rounding ("Round-to-Nearest RoundTiesToEven") is considered the most accurate and statistically unbiased estimate of the true result.
+
+All possible 4+ billion floating-point conversions with this library are verified to be correct.
+
+Lowercase "float16" refers to IEEE 754 binary16. And capitalized "Float16" refers to exported Go data type provided by this library.
+
+## Features
+Current features include:
+
+* float16 to float32 conversions use lossless conversion.
+* float32 to float16 conversions use IEEE 754-2008 "Round-to-Nearest RoundTiesToEven".
+* conversions using pure Go take about 2.65 ns/op on a desktop amd64.
+* unit tests provide 100% code coverage and check all possible 4+ billion conversions.
+* other functions include: IsInf(), IsNaN(), IsNormal(), PrecisionFromfloat32(), String(), etc.
+* all functions in this library use zero allocs except String().
+
+## Status
+This library is used by [fxamacker/cbor](https://github.com/fxamacker/cbor) and is ready for production use on supported platforms. The version number < 1.0 indicates more functions and options are planned but not yet published.
+
+Current status:
+
+* core API is done and breaking API changes are unlikely.
+* 100% of unit tests pass:
+ * short mode (`go test -short`) tests around 65765 conversions in 0.005s.
+ * normal mode (`go test`) tests all possible 4+ billion conversions in about 95s.
+* 100% code coverage with both short mode and normal mode.
+* tested on amd64 but it should work on all little-endian platforms supported by Go.
+
+Roadmap:
+
+* add functions for fast batch conversions leveraging SIMD when supported by hardware.
+* speed up unit test when verifying all possible 4+ billion conversions.
+* test on additional platforms.
+
+## Float16 to Float32 Conversion
+Conversions from float16 to float32 are lossless conversions. All 65536 possible float16 to float32 conversions (in pure Go) are confirmed to be correct.
+
+Unit tests take a fraction of a second to check all 65536 expected values for float16 to float32 conversions.
+
+## Float32 to Float16 Conversion
+Conversions from float32 to float16 use IEEE 754 default rounding ("Round-to-Nearest RoundTiesToEven"). All 4294967296 possible float32 to float16 conversions (in pure Go) are confirmed to be correct.
+
+Unit tests in normal mode take about 1-2 minutes to check all 4+ billion float32 input values and results for Fromfloat32(), FromNaN32ps(), and PrecisionFromfloat32().
+
+Unit tests in short mode use a small subset (around 229 float32 inputs) and finish in under 0.01 second while still reaching 100% code coverage.
+
+## Usage
+Install with `go get github.com/x448/float16`.
+```
+// Convert float32 to float16
+pi := float32(math.Pi)
+pi16 := float16.Fromfloat32(pi)
+
+// Convert float16 to float32
+pi32 := pi16.Float32()
+
+// PrecisionFromfloat32() is faster than the overhead of calling a function.
+// This example only converts if there's no data loss and input is not a subnormal.
+if float16.PrecisionFromfloat32(pi) == float16.PrecisionExact {
+ pi16 := float16.Fromfloat32(pi)
+}
+```
+
+## Float16 Type and API
+Float16 (capitalized) is a Go type with uint16 as the underlying state. There are 6 exported functions and 9 exported methods.
+```
+package float16 // import "github.com/x448/float16"
+
+// Exported types and consts
+type Float16 uint16
+const ErrInvalidNaNValue = float16Error("float16: invalid NaN value, expected IEEE 754 NaN")
+
+// Exported functions
+Fromfloat32(f32 float32) Float16 // Float16 number converted from f32 using IEEE 754 default rounding
+ with identical results to AMD and Intel F16C hardware. NaN inputs
+ are converted with quiet bit always set on, to be like F16C.
+
+FromNaN32ps(nan float32) (Float16, error) // Float16 NaN without modifying quiet bit.
+ // The "ps" suffix means "preserve signaling".
+ // Returns sNaN and ErrInvalidNaNValue if nan isn't a NaN.
+
+Frombits(b16 uint16) Float16 // Float16 number corresponding to b16 (IEEE 754 binary16 rep.)
+NaN() Float16 // Float16 of IEEE 754 binary16 not-a-number
+Inf(sign int) Float16 // Float16 of IEEE 754 binary16 infinity according to sign
+
+PrecisionFromfloat32(f32 float32) Precision // quickly indicates exact, ..., overflow, underflow
+ // (inline and < 1 ns/op)
+// Exported methods
+(f Float16) Float32() float32 // float32 number converted from f16 using lossless conversion
+(f Float16) Bits() uint16 // the IEEE 754 binary16 representation of f
+(f Float16) IsNaN() bool // true if f is not-a-number (NaN)
+(f Float16) IsQuietNaN() bool // true if f is a quiet not-a-number (NaN)
+(f Float16) IsInf(sign int) bool // true if f is infinite based on sign (-1=NegInf, 0=any, 1=PosInf)
+(f Float16) IsFinite() bool // true if f is not infinite or NaN
+(f Float16) IsNormal() bool // true if f is not zero, infinite, subnormal, or NaN.
+(f Float16) Signbit() bool // true if f is negative or negative zero
+(f Float16) String() string // string representation of f to satisfy fmt.Stringer interface
+```
+See [API](https://godoc.org/github.com/x448/float16) at godoc.org for more info.
+
+## Benchmarks
+Conversions (in pure Go) are around 2.65 ns/op for float16 -> float32 and float32 -> float16 on amd64. Speeds can vary depending on input value.
+
+```
+All functions have zero allocations except float16.String().
+
+FromFloat32pi-2 2.59ns ± 0% // speed using Fromfloat32() to convert a float32 of math.Pi to Float16
+ToFloat32pi-2 2.69ns ± 0% // speed using Float32() to convert a float16 of math.Pi to float32
+Frombits-2 0.29ns ± 5% // speed using Frombits() to cast a uint16 to Float16
+
+PrecisionFromFloat32-2 0.29ns ± 1% // speed using PrecisionFromfloat32() to check for overflows, etc.
+```
+
+## System Requirements
+* Tested on Go 1.11, 1.12, and 1.13 but it should also work with older versions.
+* Tested on amd64 but it should also work on all little-endian platforms supported by Go.
+
+## Special Thanks
+Special thanks to Kathryn Long (starkat99) for creating [half-rs](https://github.com/starkat99/half-rs), a very nice rust implementation of float16.
+
+## License
+Copyright (c) 2019 Montgomery Edwards⁴⁴⁸ and Faye Amacker
+
+Licensed under [MIT License](LICENSE)
diff --git a/vendor/github.com/x448/float16/float16.go b/vendor/github.com/x448/float16/float16.go
new file mode 100644
index 000000000..1a0e6dad0
--- /dev/null
+++ b/vendor/github.com/x448/float16/float16.go
@@ -0,0 +1,302 @@
+// Copyright 2019 Montgomery Edwards⁴⁴⁸ and Faye Amacker
+//
+// Special thanks to Kathryn Long for her Rust implementation
+// of float16 at github.com/starkat99/half-rs (MIT license)
+
+package float16
+
+import (
+ "math"
+ "strconv"
+)
+
+// Float16 represents IEEE 754 half-precision floating-point numbers (binary16).
+type Float16 uint16
+
+// Precision indicates whether the conversion to Float16 is
+// exact, subnormal without dropped bits, inexact, underflow, or overflow.
+type Precision int
+
+const (
+
+ // PrecisionExact is for non-subnormals that don't drop bits during conversion.
+ // All of these can round-trip. Should always convert to float16.
+ PrecisionExact Precision = iota
+
+ // PrecisionUnknown is for subnormals that don't drop bits during conversion but
+ // not all of these can round-trip so precision is unknown without more effort.
+ // Only 2046 of these can round-trip and the rest cannot round-trip.
+ PrecisionUnknown
+
+ // PrecisionInexact is for dropped significand bits and cannot round-trip.
+ // Some of these are subnormals. Cannot round-trip float32->float16->float32.
+ PrecisionInexact
+
+ // PrecisionUnderflow is for Underflows. Cannot round-trip float32->float16->float32.
+ PrecisionUnderflow
+
+ // PrecisionOverflow is for Overflows. Cannot round-trip float32->float16->float32.
+ PrecisionOverflow
+)
+
+// PrecisionFromfloat32 returns Precision without performing
+// the conversion. Conversions from both Infinity and NaN
+// values will always report PrecisionExact even if NaN payload
+// or NaN-Quiet-Bit is lost. This function is kept simple to
+// allow inlining and run < 0.5 ns/op, to serve as a fast filter.
+func PrecisionFromfloat32(f32 float32) Precision {
+ u32 := math.Float32bits(f32)
+
+ if u32 == 0 || u32 == 0x80000000 {
+ // +- zero will always be exact conversion
+ return PrecisionExact
+ }
+
+ const COEFMASK uint32 = 0x7fffff // 23 least significant bits
+ const EXPSHIFT uint32 = 23
+ const EXPBIAS uint32 = 127
+ const EXPMASK uint32 = uint32(0xff) << EXPSHIFT
+ const DROPMASK uint32 = COEFMASK >> 10
+
+ exp := int32(((u32 & EXPMASK) >> EXPSHIFT) - EXPBIAS)
+ coef := u32 & COEFMASK
+
+ if exp == 128 {
+ // +- infinity or NaN
+ // apps may want to do extra checks for NaN separately
+ return PrecisionExact
+ }
+
+ // https://en.wikipedia.org/wiki/Half-precision_floating-point_format says,
+ // "Decimals between 2^−24 (minimum positive subnormal) and 2^−14 (maximum subnormal): fixed interval 2^−24"
+ if exp < -24 {
+ return PrecisionUnderflow
+ }
+ if exp > 15 {
+ return PrecisionOverflow
+ }
+ if (coef & DROPMASK) != uint32(0) {
+ // these include subnormals and non-subnormals that dropped bits
+ return PrecisionInexact
+ }
+
+ if exp < -14 {
+ // Subnormals. Caller may want to test these further.
+ // There are 2046 subnormals that can successfully round-trip f32->f16->f32
+ // and 20 of those 2046 have 32-bit input coef == 0.
+ // RFC 7049 and 7049bis Draft 12 don't precisely define "preserves value"
+ // so some protocols and libraries will choose to handle subnormals differently
+ // when deciding to encode them to CBOR float32 vs float16.
+ return PrecisionUnknown
+ }
+
+ return PrecisionExact
+}
+
+// Frombits returns the float16 number corresponding to the IEEE 754 binary16
+// representation u16, with the sign bit of u16 and the result in the same bit
+// position. Frombits(Bits(x)) == x.
+func Frombits(u16 uint16) Float16 {
+ return Float16(u16)
+}
+
+// Fromfloat32 returns a Float16 value converted from f32. Conversion uses
+// IEEE default rounding (nearest int, with ties to even).
+func Fromfloat32(f32 float32) Float16 {
+ return Float16(f32bitsToF16bits(math.Float32bits(f32)))
+}
+
+// ErrInvalidNaNValue indicates a NaN was not received.
+const ErrInvalidNaNValue = float16Error("float16: invalid NaN value, expected IEEE 754 NaN")
+
+type float16Error string
+
+func (e float16Error) Error() string { return string(e) }
+
+// FromNaN32ps converts nan to IEEE binary16 NaN while preserving both
+// signaling and payload. Unlike Fromfloat32(), which can only return
+// qNaN because it sets quiet bit = 1, this can return both sNaN and qNaN.
+// If the result is infinity (sNaN with empty payload), then the
+// lowest bit of payload is set to make the result a NaN.
+// Returns ErrInvalidNaNValue and 0x7c01 (sNaN) if nan isn't IEEE 754 NaN.
+// This function was kept simple to be able to inline.
+func FromNaN32ps(nan float32) (Float16, error) {
+ const SNAN = Float16(uint16(0x7c01)) // signalling NaN
+
+ u32 := math.Float32bits(nan)
+ sign := u32 & 0x80000000
+ exp := u32 & 0x7f800000
+ coef := u32 & 0x007fffff
+
+ if (exp != 0x7f800000) || (coef == 0) {
+ return SNAN, ErrInvalidNaNValue
+ }
+
+ u16 := uint16((sign >> 16) | uint32(0x7c00) | (coef >> 13))
+
+ if (u16 & 0x03ff) == 0 {
+ // result became infinity, make it NaN by setting lowest bit in payload
+ u16 = u16 | 0x0001
+ }
+
+ return Float16(u16), nil
+}
+
+// NaN returns a Float16 of IEEE 754 binary16 not-a-number (NaN).
+// Returned NaN value 0x7e01 has all exponent bits = 1 with the
+// first and last bits = 1 in the significand. This is consistent
+// with Go's 64-bit math.NaN(). Canonical CBOR in RFC 7049 uses 0x7e00.
+func NaN() Float16 {
+ return Float16(0x7e01)
+}
+
+// Inf returns a Float16 with an infinity value with the specified sign.
+// A sign >= returns positive infinity.
+// A sign < 0 returns negative infinity.
+func Inf(sign int) Float16 {
+ if sign >= 0 {
+ return Float16(0x7c00)
+ }
+ return Float16(0x8000 | 0x7c00)
+}
+
+// Float32 returns a float32 converted from f (Float16).
+// This is a lossless conversion.
+func (f Float16) Float32() float32 {
+ u32 := f16bitsToF32bits(uint16(f))
+ return math.Float32frombits(u32)
+}
+
+// Bits returns the IEEE 754 binary16 representation of f, with the sign bit
+// of f and the result in the same bit position. Bits(Frombits(x)) == x.
+func (f Float16) Bits() uint16 {
+ return uint16(f)
+}
+
+// IsNaN reports whether f is an IEEE 754 binary16 “not-a-number” value.
+func (f Float16) IsNaN() bool {
+ return (f&0x7c00 == 0x7c00) && (f&0x03ff != 0)
+}
+
+// IsQuietNaN reports whether f is a quiet (non-signaling) IEEE 754 binary16
+// “not-a-number” value.
+func (f Float16) IsQuietNaN() bool {
+ return (f&0x7c00 == 0x7c00) && (f&0x03ff != 0) && (f&0x0200 != 0)
+}
+
+// IsInf reports whether f is an infinity (inf).
+// A sign > 0 reports whether f is positive inf.
+// A sign < 0 reports whether f is negative inf.
+// A sign == 0 reports whether f is either inf.
+func (f Float16) IsInf(sign int) bool {
+ return ((f == 0x7c00) && sign >= 0) ||
+ (f == 0xfc00 && sign <= 0)
+}
+
+// IsFinite returns true if f is neither infinite nor NaN.
+func (f Float16) IsFinite() bool {
+ return (uint16(f) & uint16(0x7c00)) != uint16(0x7c00)
+}
+
+// IsNormal returns true if f is neither zero, infinite, subnormal, or NaN.
+func (f Float16) IsNormal() bool {
+ exp := uint16(f) & uint16(0x7c00)
+ return (exp != uint16(0x7c00)) && (exp != 0)
+}
+
+// Signbit reports whether f is negative or negative zero.
+func (f Float16) Signbit() bool {
+ return (uint16(f) & uint16(0x8000)) != 0
+}
+
+// String satisfies the fmt.Stringer interface.
+func (f Float16) String() string {
+ return strconv.FormatFloat(float64(f.Float32()), 'f', -1, 32)
+}
+
+// f16bitsToF32bits returns uint32 (float32 bits) converted from specified uint16.
+func f16bitsToF32bits(in uint16) uint32 {
+ // All 65536 conversions with this were confirmed to be correct
+ // by Montgomery Edwards⁴⁴⁸ (github.com/x448).
+
+ sign := uint32(in&0x8000) << 16 // sign for 32-bit
+ exp := uint32(in&0x7c00) >> 10 // exponenent for 16-bit
+ coef := uint32(in&0x03ff) << 13 // significand for 32-bit
+
+ if exp == 0x1f {
+ if coef == 0 {
+ // infinity
+ return sign | 0x7f800000 | coef
+ }
+ // NaN
+ return sign | 0x7fc00000 | coef
+ }
+
+ if exp == 0 {
+ if coef == 0 {
+ // zero
+ return sign
+ }
+
+ // normalize subnormal numbers
+ exp++
+ for coef&0x7f800000 == 0 {
+ coef <<= 1
+ exp--
+ }
+ coef &= 0x007fffff
+ }
+
+ return sign | ((exp + (0x7f - 0xf)) << 23) | coef
+}
+
+// f32bitsToF16bits returns uint16 (Float16 bits) converted from the specified float32.
+// Conversion rounds to nearest integer with ties to even.
+func f32bitsToF16bits(u32 uint32) uint16 {
+ // Translated from Rust to Go by Montgomery Edwards⁴⁴⁸ (github.com/x448).
+ // All 4294967296 conversions with this were confirmed to be correct by x448.
+ // Original Rust implementation is by Kathryn Long (github.com/starkat99) with MIT license.
+
+ sign := u32 & 0x80000000
+ exp := u32 & 0x7f800000
+ coef := u32 & 0x007fffff
+
+ if exp == 0x7f800000 {
+ // NaN or Infinity
+ nanBit := uint32(0)
+ if coef != 0 {
+ nanBit = uint32(0x0200)
+ }
+ return uint16((sign >> 16) | uint32(0x7c00) | nanBit | (coef >> 13))
+ }
+
+ halfSign := sign >> 16
+
+ unbiasedExp := int32(exp>>23) - 127
+ halfExp := unbiasedExp + 15
+
+ if halfExp >= 0x1f {
+ return uint16(halfSign | uint32(0x7c00))
+ }
+
+ if halfExp <= 0 {
+ if 14-halfExp > 24 {
+ return uint16(halfSign)
+ }
+ coef := coef | uint32(0x00800000)
+ halfCoef := coef >> uint32(14-halfExp)
+ roundBit := uint32(1) << uint32(13-halfExp)
+ if (coef&roundBit) != 0 && (coef&(3*roundBit-1)) != 0 {
+ halfCoef++
+ }
+ return uint16(halfSign | halfCoef)
+ }
+
+ uHalfExp := uint32(halfExp) << 10
+ halfCoef := coef >> 13
+ roundBit := uint32(0x00001000)
+ if (coef&roundBit) != 0 && (coef&(3*roundBit-1)) != 0 {
+ return uint16((halfSign | uHalfExp | halfCoef) + 1)
+ }
+ return uint16(halfSign | uHalfExp | halfCoef)
+}
diff --git a/vendor/golang.org/x/net/http/httpguts/httplex.go b/vendor/golang.org/x/net/http/httpguts/httplex.go
index 6e071e852..9b4de9401 100644
--- a/vendor/golang.org/x/net/http/httpguts/httplex.go
+++ b/vendor/golang.org/x/net/http/httpguts/httplex.go
@@ -12,7 +12,7 @@ import (
"golang.org/x/net/idna"
)
-var isTokenTable = [127]bool{
+var isTokenTable = [256]bool{
'!': true,
'#': true,
'$': true,
@@ -93,12 +93,7 @@ var isTokenTable = [127]bool{
}
func IsTokenRune(r rune) bool {
- i := int(r)
- return i < len(isTokenTable) && isTokenTable[i]
-}
-
-func isNotToken(r rune) bool {
- return !IsTokenRune(r)
+ return r < utf8.RuneSelf && isTokenTable[byte(r)]
}
// HeaderValuesContainsToken reports whether any string in values
@@ -202,8 +197,8 @@ func ValidHeaderFieldName(v string) bool {
if len(v) == 0 {
return false
}
- for _, r := range v {
- if !IsTokenRune(r) {
+ for i := 0; i < len(v); i++ {
+ if !isTokenTable[v[i]] {
return false
}
}
diff --git a/vendor/golang.org/x/net/http2/frame.go b/vendor/golang.org/x/net/http2/frame.go
index 43557ab7e..105c3b279 100644
--- a/vendor/golang.org/x/net/http2/frame.go
+++ b/vendor/golang.org/x/net/http2/frame.go
@@ -490,6 +490,9 @@ func terminalReadFrameError(err error) bool {
// returned error is ErrFrameTooLarge. Other errors may be of type
// ConnectionError, StreamError, or anything else from the underlying
// reader.
+//
+// If ReadFrame returns an error and a non-nil Frame, the Frame's StreamID
+// indicates the stream responsible for the error.
func (fr *Framer) ReadFrame() (Frame, error) {
fr.errDetail = nil
if fr.lastFrame != nil {
@@ -1521,7 +1524,7 @@ func (fr *Framer) maxHeaderStringLen() int {
// readMetaFrame returns 0 or more CONTINUATION frames from fr and
// merge them into the provided hf and returns a MetaHeadersFrame
// with the decoded hpack values.
-func (fr *Framer) readMetaFrame(hf *HeadersFrame) (*MetaHeadersFrame, error) {
+func (fr *Framer) readMetaFrame(hf *HeadersFrame) (Frame, error) {
if fr.AllowIllegalReads {
return nil, errors.New("illegal use of AllowIllegalReads with ReadMetaHeaders")
}
@@ -1592,7 +1595,7 @@ func (fr *Framer) readMetaFrame(hf *HeadersFrame) (*MetaHeadersFrame, error) {
}
// It would be nice to send a RST_STREAM before sending the GOAWAY,
// but the structure of the server's frame writer makes this difficult.
- return nil, ConnectionError(ErrCodeProtocol)
+ return mh, ConnectionError(ErrCodeProtocol)
}
// Also close the connection after any CONTINUATION frame following an
@@ -1604,11 +1607,11 @@ func (fr *Framer) readMetaFrame(hf *HeadersFrame) (*MetaHeadersFrame, error) {
}
// It would be nice to send a RST_STREAM before sending the GOAWAY,
// but the structure of the server's frame writer makes this difficult.
- return nil, ConnectionError(ErrCodeProtocol)
+ return mh, ConnectionError(ErrCodeProtocol)
}
if _, err := hdec.Write(frag); err != nil {
- return nil, ConnectionError(ErrCodeCompression)
+ return mh, ConnectionError(ErrCodeCompression)
}
if hc.HeadersEnded() {
@@ -1625,7 +1628,7 @@ func (fr *Framer) readMetaFrame(hf *HeadersFrame) (*MetaHeadersFrame, error) {
mh.HeadersFrame.invalidate()
if err := hdec.Close(); err != nil {
- return nil, ConnectionError(ErrCodeCompression)
+ return mh, ConnectionError(ErrCodeCompression)
}
if invalid != nil {
fr.errDetail = invalid
diff --git a/vendor/golang.org/x/net/http2/http2.go b/vendor/golang.org/x/net/http2/http2.go
index 6f2df2818..003e649f3 100644
--- a/vendor/golang.org/x/net/http2/http2.go
+++ b/vendor/golang.org/x/net/http2/http2.go
@@ -17,6 +17,7 @@ package http2 // import "golang.org/x/net/http2"
import (
"bufio"
+ "context"
"crypto/tls"
"fmt"
"io"
@@ -26,6 +27,7 @@ import (
"strconv"
"strings"
"sync"
+ "time"
"golang.org/x/net/http/httpguts"
)
@@ -210,12 +212,6 @@ type stringWriter interface {
WriteString(s string) (n int, err error)
}
-// A gate lets two goroutines coordinate their activities.
-type gate chan struct{}
-
-func (g gate) Done() { g <- struct{}{} }
-func (g gate) Wait() { <-g }
-
// A closeWaiter is like a sync.WaitGroup but only goes 1 to 0 (open to closed).
type closeWaiter chan struct{}
@@ -383,3 +379,14 @@ func validPseudoPath(v string) bool {
// makes that struct also non-comparable, and generally doesn't add
// any size (as long as it's first).
type incomparable [0]func()
+
+// synctestGroupInterface is the methods of synctestGroup used by Server and Transport.
+// It's defined as an interface here to let us keep synctestGroup entirely test-only
+// and not a part of non-test builds.
+type synctestGroupInterface interface {
+ Join()
+ Now() time.Time
+ NewTimer(d time.Duration) timer
+ AfterFunc(d time.Duration, f func()) timer
+ ContextWithTimeout(ctx context.Context, d time.Duration) (context.Context, context.CancelFunc)
+}
diff --git a/vendor/golang.org/x/net/http2/server.go b/vendor/golang.org/x/net/http2/server.go
index ce2e8b40e..6c349f3ec 100644
--- a/vendor/golang.org/x/net/http2/server.go
+++ b/vendor/golang.org/x/net/http2/server.go
@@ -154,6 +154,39 @@ type Server struct {
// so that we don't embed a Mutex in this struct, which will make the
// struct non-copyable, which might break some callers.
state *serverInternalState
+
+ // Synchronization group used for testing.
+ // Outside of tests, this is nil.
+ group synctestGroupInterface
+}
+
+func (s *Server) markNewGoroutine() {
+ if s.group != nil {
+ s.group.Join()
+ }
+}
+
+func (s *Server) now() time.Time {
+ if s.group != nil {
+ return s.group.Now()
+ }
+ return time.Now()
+}
+
+// newTimer creates a new time.Timer, or a synthetic timer in tests.
+func (s *Server) newTimer(d time.Duration) timer {
+ if s.group != nil {
+ return s.group.NewTimer(d)
+ }
+ return timeTimer{time.NewTimer(d)}
+}
+
+// afterFunc creates a new time.AfterFunc timer, or a synthetic timer in tests.
+func (s *Server) afterFunc(d time.Duration, f func()) timer {
+ if s.group != nil {
+ return s.group.AfterFunc(d, f)
+ }
+ return timeTimer{time.AfterFunc(d, f)}
}
func (s *Server) initialConnRecvWindowSize() int32 {
@@ -400,6 +433,10 @@ func (o *ServeConnOpts) handler() http.Handler {
//
// The opts parameter is optional. If nil, default values are used.
func (s *Server) ServeConn(c net.Conn, opts *ServeConnOpts) {
+ s.serveConn(c, opts, nil)
+}
+
+func (s *Server) serveConn(c net.Conn, opts *ServeConnOpts, newf func(*serverConn)) {
baseCtx, cancel := serverConnBaseContext(c, opts)
defer cancel()
@@ -426,6 +463,9 @@ func (s *Server) ServeConn(c net.Conn, opts *ServeConnOpts) {
pushEnabled: true,
sawClientPreface: opts.SawClientPreface,
}
+ if newf != nil {
+ newf(sc)
+ }
s.state.registerConn(sc)
defer s.state.unregisterConn(sc)
@@ -599,8 +639,8 @@ type serverConn struct {
inFrameScheduleLoop bool // whether we're in the scheduleFrameWrite loop
needToSendGoAway bool // we need to schedule a GOAWAY frame write
goAwayCode ErrCode
- shutdownTimer *time.Timer // nil until used
- idleTimer *time.Timer // nil if unused
+ shutdownTimer timer // nil until used
+ idleTimer timer // nil if unused
// Owned by the writeFrameAsync goroutine:
headerWriteBuf bytes.Buffer
@@ -649,12 +689,12 @@ type stream struct {
flow outflow // limits writing from Handler to client
inflow inflow // what the client is allowed to POST/etc to us
state streamState
- resetQueued bool // RST_STREAM queued for write; set by sc.resetStream
- gotTrailerHeader bool // HEADER frame for trailers was seen
- wroteHeaders bool // whether we wrote headers (not status 100)
- readDeadline *time.Timer // nil if unused
- writeDeadline *time.Timer // nil if unused
- closeErr error // set before cw is closed
+ resetQueued bool // RST_STREAM queued for write; set by sc.resetStream
+ gotTrailerHeader bool // HEADER frame for trailers was seen
+ wroteHeaders bool // whether we wrote headers (not status 100)
+ readDeadline timer // nil if unused
+ writeDeadline timer // nil if unused
+ closeErr error // set before cw is closed
trailer http.Header // accumulated trailers
reqTrailer http.Header // handler's Request.Trailer
@@ -732,11 +772,7 @@ func isClosedConnError(err error) bool {
return false
}
- // TODO: remove this string search and be more like the Windows
- // case below. That might involve modifying the standard library
- // to return better error types.
- str := err.Error()
- if strings.Contains(str, "use of closed network connection") {
+ if errors.Is(err, net.ErrClosed) {
return true
}
@@ -815,8 +851,9 @@ type readFrameResult struct {
// consumer is done with the frame.
// It's run on its own goroutine.
func (sc *serverConn) readFrames() {
- gate := make(gate)
- gateDone := gate.Done
+ sc.srv.markNewGoroutine()
+ gate := make(chan struct{})
+ gateDone := func() { gate <- struct{}{} }
for {
f, err := sc.framer.ReadFrame()
select {
@@ -847,6 +884,7 @@ type frameWriteResult struct {
// At most one goroutine can be running writeFrameAsync at a time per
// serverConn.
func (sc *serverConn) writeFrameAsync(wr FrameWriteRequest, wd *writeData) {
+ sc.srv.markNewGoroutine()
var err error
if wd == nil {
err = wr.write.writeFrame(sc)
@@ -926,13 +964,13 @@ func (sc *serverConn) serve() {
sc.setConnState(http.StateIdle)
if sc.srv.IdleTimeout > 0 {
- sc.idleTimer = time.AfterFunc(sc.srv.IdleTimeout, sc.onIdleTimer)
+ sc.idleTimer = sc.srv.afterFunc(sc.srv.IdleTimeout, sc.onIdleTimer)
defer sc.idleTimer.Stop()
}
go sc.readFrames() // closed by defer sc.conn.Close above
- settingsTimer := time.AfterFunc(firstSettingsTimeout, sc.onSettingsTimer)
+ settingsTimer := sc.srv.afterFunc(firstSettingsTimeout, sc.onSettingsTimer)
defer settingsTimer.Stop()
loopNum := 0
@@ -1061,10 +1099,10 @@ func (sc *serverConn) readPreface() error {
errc <- nil
}
}()
- timer := time.NewTimer(prefaceTimeout) // TODO: configurable on *Server?
+ timer := sc.srv.newTimer(prefaceTimeout) // TODO: configurable on *Server?
defer timer.Stop()
select {
- case <-timer.C:
+ case <-timer.C():
return errPrefaceTimeout
case err := <-errc:
if err == nil {
@@ -1429,7 +1467,7 @@ func (sc *serverConn) goAway(code ErrCode) {
func (sc *serverConn) shutDownIn(d time.Duration) {
sc.serveG.check()
- sc.shutdownTimer = time.AfterFunc(d, sc.onShutdownTimer)
+ sc.shutdownTimer = sc.srv.afterFunc(d, sc.onShutdownTimer)
}
func (sc *serverConn) resetStream(se StreamError) {
@@ -1482,6 +1520,11 @@ func (sc *serverConn) processFrameFromReader(res readFrameResult) bool {
sc.goAway(ErrCodeFlowControl)
return true
case ConnectionError:
+ if res.f != nil {
+ if id := res.f.Header().StreamID; id > sc.maxClientStreamID {
+ sc.maxClientStreamID = id
+ }
+ }
sc.logf("http2: server connection error from %v: %v", sc.conn.RemoteAddr(), ev)
sc.goAway(ErrCode(ev))
return true // goAway will handle shutdown
@@ -1638,7 +1681,7 @@ func (sc *serverConn) closeStream(st *stream, err error) {
delete(sc.streams, st.id)
if len(sc.streams) == 0 {
sc.setConnState(http.StateIdle)
- if sc.srv.IdleTimeout > 0 {
+ if sc.srv.IdleTimeout > 0 && sc.idleTimer != nil {
sc.idleTimer.Reset(sc.srv.IdleTimeout)
}
if h1ServerKeepAlivesDisabled(sc.hs) {
@@ -1660,6 +1703,7 @@ func (sc *serverConn) closeStream(st *stream, err error) {
}
}
st.closeErr = err
+ st.cancelCtx()
st.cw.Close() // signals Handler's CloseNotifier, unblocks writes, etc
sc.writeSched.CloseStream(st.id)
}
@@ -2020,7 +2064,7 @@ func (sc *serverConn) processHeaders(f *MetaHeadersFrame) error {
// (in Go 1.8), though. That's a more sane option anyway.
if sc.hs.ReadTimeout > 0 {
sc.conn.SetReadDeadline(time.Time{})
- st.readDeadline = time.AfterFunc(sc.hs.ReadTimeout, st.onReadTimeout)
+ st.readDeadline = sc.srv.afterFunc(sc.hs.ReadTimeout, st.onReadTimeout)
}
return sc.scheduleHandler(id, rw, req, handler)
@@ -2118,7 +2162,7 @@ func (sc *serverConn) newStream(id, pusherID uint32, state streamState) *stream
st.flow.add(sc.initialStreamSendWindowSize)
st.inflow.init(sc.srv.initialStreamRecvWindowSize())
if sc.hs.WriteTimeout > 0 {
- st.writeDeadline = time.AfterFunc(sc.hs.WriteTimeout, st.onWriteTimeout)
+ st.writeDeadline = sc.srv.afterFunc(sc.hs.WriteTimeout, st.onWriteTimeout)
}
sc.streams[id] = st
@@ -2342,6 +2386,7 @@ func (sc *serverConn) handlerDone() {
// Run on its own goroutine.
func (sc *serverConn) runHandler(rw *responseWriter, req *http.Request, handler func(http.ResponseWriter, *http.Request)) {
+ sc.srv.markNewGoroutine()
defer sc.sendServeMsg(handlerDoneMsg)
didPanic := true
defer func() {
@@ -2638,7 +2683,7 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) {
var date string
if _, ok := rws.snapHeader["Date"]; !ok {
// TODO(bradfitz): be faster here, like net/http? measure.
- date = time.Now().UTC().Format(http.TimeFormat)
+ date = rws.conn.srv.now().UTC().Format(http.TimeFormat)
}
for _, v := range rws.snapHeader["Trailer"] {
@@ -2760,7 +2805,7 @@ func (rws *responseWriterState) promoteUndeclaredTrailers() {
func (w *responseWriter) SetReadDeadline(deadline time.Time) error {
st := w.rws.stream
- if !deadline.IsZero() && deadline.Before(time.Now()) {
+ if !deadline.IsZero() && deadline.Before(w.rws.conn.srv.now()) {
// If we're setting a deadline in the past, reset the stream immediately
// so writes after SetWriteDeadline returns will fail.
st.onReadTimeout()
@@ -2776,9 +2821,9 @@ func (w *responseWriter) SetReadDeadline(deadline time.Time) error {
if deadline.IsZero() {
st.readDeadline = nil
} else if st.readDeadline == nil {
- st.readDeadline = time.AfterFunc(deadline.Sub(time.Now()), st.onReadTimeout)
+ st.readDeadline = sc.srv.afterFunc(deadline.Sub(sc.srv.now()), st.onReadTimeout)
} else {
- st.readDeadline.Reset(deadline.Sub(time.Now()))
+ st.readDeadline.Reset(deadline.Sub(sc.srv.now()))
}
})
return nil
@@ -2786,7 +2831,7 @@ func (w *responseWriter) SetReadDeadline(deadline time.Time) error {
func (w *responseWriter) SetWriteDeadline(deadline time.Time) error {
st := w.rws.stream
- if !deadline.IsZero() && deadline.Before(time.Now()) {
+ if !deadline.IsZero() && deadline.Before(w.rws.conn.srv.now()) {
// If we're setting a deadline in the past, reset the stream immediately
// so writes after SetWriteDeadline returns will fail.
st.onWriteTimeout()
@@ -2802,9 +2847,9 @@ func (w *responseWriter) SetWriteDeadline(deadline time.Time) error {
if deadline.IsZero() {
st.writeDeadline = nil
} else if st.writeDeadline == nil {
- st.writeDeadline = time.AfterFunc(deadline.Sub(time.Now()), st.onWriteTimeout)
+ st.writeDeadline = sc.srv.afterFunc(deadline.Sub(sc.srv.now()), st.onWriteTimeout)
} else {
- st.writeDeadline.Reset(deadline.Sub(time.Now()))
+ st.writeDeadline.Reset(deadline.Sub(sc.srv.now()))
}
})
return nil
diff --git a/vendor/golang.org/x/net/http2/testsync.go b/vendor/golang.org/x/net/http2/testsync.go
deleted file mode 100644
index 61075bd16..000000000
--- a/vendor/golang.org/x/net/http2/testsync.go
+++ /dev/null
@@ -1,331 +0,0 @@
-// Copyright 2024 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-package http2
-
-import (
- "context"
- "sync"
- "time"
-)
-
-// testSyncHooks coordinates goroutines in tests.
-//
-// For example, a call to ClientConn.RoundTrip involves several goroutines, including:
-// - the goroutine running RoundTrip;
-// - the clientStream.doRequest goroutine, which writes the request; and
-// - the clientStream.readLoop goroutine, which reads the response.
-//
-// Using testSyncHooks, a test can start a RoundTrip and identify when all these goroutines
-// are blocked waiting for some condition such as reading the Request.Body or waiting for
-// flow control to become available.
-//
-// The testSyncHooks also manage timers and synthetic time in tests.
-// This permits us to, for example, start a request and cause it to time out waiting for
-// response headers without resorting to time.Sleep calls.
-type testSyncHooks struct {
- // active/inactive act as a mutex and condition variable.
- //
- // - neither chan contains a value: testSyncHooks is locked.
- // - active contains a value: unlocked, and at least one goroutine is not blocked
- // - inactive contains a value: unlocked, and all goroutines are blocked
- active chan struct{}
- inactive chan struct{}
-
- // goroutine counts
- total int // total goroutines
- condwait map[*sync.Cond]int // blocked in sync.Cond.Wait
- blocked []*testBlockedGoroutine // otherwise blocked
-
- // fake time
- now time.Time
- timers []*fakeTimer
-
- // Transport testing: Report various events.
- newclientconn func(*ClientConn)
- newstream func(*clientStream)
-}
-
-// testBlockedGoroutine is a blocked goroutine.
-type testBlockedGoroutine struct {
- f func() bool // blocked until f returns true
- ch chan struct{} // closed when unblocked
-}
-
-func newTestSyncHooks() *testSyncHooks {
- h := &testSyncHooks{
- active: make(chan struct{}, 1),
- inactive: make(chan struct{}, 1),
- condwait: map[*sync.Cond]int{},
- }
- h.inactive <- struct{}{}
- h.now = time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC)
- return h
-}
-
-// lock acquires the testSyncHooks mutex.
-func (h *testSyncHooks) lock() {
- select {
- case <-h.active:
- case <-h.inactive:
- }
-}
-
-// waitInactive waits for all goroutines to become inactive.
-func (h *testSyncHooks) waitInactive() {
- for {
- <-h.inactive
- if !h.unlock() {
- break
- }
- }
-}
-
-// unlock releases the testSyncHooks mutex.
-// It reports whether any goroutines are active.
-func (h *testSyncHooks) unlock() (active bool) {
- // Look for a blocked goroutine which can be unblocked.
- blocked := h.blocked[:0]
- unblocked := false
- for _, b := range h.blocked {
- if !unblocked && b.f() {
- unblocked = true
- close(b.ch)
- } else {
- blocked = append(blocked, b)
- }
- }
- h.blocked = blocked
-
- // Count goroutines blocked on condition variables.
- condwait := 0
- for _, count := range h.condwait {
- condwait += count
- }
-
- if h.total > condwait+len(blocked) {
- h.active <- struct{}{}
- return true
- } else {
- h.inactive <- struct{}{}
- return false
- }
-}
-
-// goRun starts a new goroutine.
-func (h *testSyncHooks) goRun(f func()) {
- h.lock()
- h.total++
- h.unlock()
- go func() {
- defer func() {
- h.lock()
- h.total--
- h.unlock()
- }()
- f()
- }()
-}
-
-// blockUntil indicates that a goroutine is blocked waiting for some condition to become true.
-// It waits until f returns true before proceeding.
-//
-// Example usage:
-//
-// h.blockUntil(func() bool {
-// // Is the context done yet?
-// select {
-// case <-ctx.Done():
-// default:
-// return false
-// }
-// return true
-// })
-// // Wait for the context to become done.
-// <-ctx.Done()
-//
-// The function f passed to blockUntil must be non-blocking and idempotent.
-func (h *testSyncHooks) blockUntil(f func() bool) {
- if f() {
- return
- }
- ch := make(chan struct{})
- h.lock()
- h.blocked = append(h.blocked, &testBlockedGoroutine{
- f: f,
- ch: ch,
- })
- h.unlock()
- <-ch
-}
-
-// broadcast is sync.Cond.Broadcast.
-func (h *testSyncHooks) condBroadcast(cond *sync.Cond) {
- h.lock()
- delete(h.condwait, cond)
- h.unlock()
- cond.Broadcast()
-}
-
-// broadcast is sync.Cond.Wait.
-func (h *testSyncHooks) condWait(cond *sync.Cond) {
- h.lock()
- h.condwait[cond]++
- h.unlock()
-}
-
-// newTimer creates a new fake timer.
-func (h *testSyncHooks) newTimer(d time.Duration) timer {
- h.lock()
- defer h.unlock()
- t := &fakeTimer{
- hooks: h,
- when: h.now.Add(d),
- c: make(chan time.Time),
- }
- h.timers = append(h.timers, t)
- return t
-}
-
-// afterFunc creates a new fake AfterFunc timer.
-func (h *testSyncHooks) afterFunc(d time.Duration, f func()) timer {
- h.lock()
- defer h.unlock()
- t := &fakeTimer{
- hooks: h,
- when: h.now.Add(d),
- f: f,
- }
- h.timers = append(h.timers, t)
- return t
-}
-
-func (h *testSyncHooks) contextWithTimeout(ctx context.Context, d time.Duration) (context.Context, context.CancelFunc) {
- ctx, cancel := context.WithCancel(ctx)
- t := h.afterFunc(d, cancel)
- return ctx, func() {
- t.Stop()
- cancel()
- }
-}
-
-func (h *testSyncHooks) timeUntilEvent() time.Duration {
- h.lock()
- defer h.unlock()
- var next time.Time
- for _, t := range h.timers {
- if next.IsZero() || t.when.Before(next) {
- next = t.when
- }
- }
- if d := next.Sub(h.now); d > 0 {
- return d
- }
- return 0
-}
-
-// advance advances time and causes synthetic timers to fire.
-func (h *testSyncHooks) advance(d time.Duration) {
- h.lock()
- defer h.unlock()
- h.now = h.now.Add(d)
- timers := h.timers[:0]
- for _, t := range h.timers {
- t := t // remove after go.mod depends on go1.22
- t.mu.Lock()
- switch {
- case t.when.After(h.now):
- timers = append(timers, t)
- case t.when.IsZero():
- // stopped timer
- default:
- t.when = time.Time{}
- if t.c != nil {
- close(t.c)
- }
- if t.f != nil {
- h.total++
- go func() {
- defer func() {
- h.lock()
- h.total--
- h.unlock()
- }()
- t.f()
- }()
- }
- }
- t.mu.Unlock()
- }
- h.timers = timers
-}
-
-// A timer wraps a time.Timer, or a synthetic equivalent in tests.
-// Unlike time.Timer, timer is single-use: The timer channel is closed when the timer expires.
-type timer interface {
- C() <-chan time.Time
- Stop() bool
- Reset(d time.Duration) bool
-}
-
-// timeTimer implements timer using real time.
-type timeTimer struct {
- t *time.Timer
- c chan time.Time
-}
-
-// newTimeTimer creates a new timer using real time.
-func newTimeTimer(d time.Duration) timer {
- ch := make(chan time.Time)
- t := time.AfterFunc(d, func() {
- close(ch)
- })
- return &timeTimer{t, ch}
-}
-
-// newTimeAfterFunc creates an AfterFunc timer using real time.
-func newTimeAfterFunc(d time.Duration, f func()) timer {
- return &timeTimer{
- t: time.AfterFunc(d, f),
- }
-}
-
-func (t timeTimer) C() <-chan time.Time { return t.c }
-func (t timeTimer) Stop() bool { return t.t.Stop() }
-func (t timeTimer) Reset(d time.Duration) bool { return t.t.Reset(d) }
-
-// fakeTimer implements timer using fake time.
-type fakeTimer struct {
- hooks *testSyncHooks
-
- mu sync.Mutex
- when time.Time // when the timer will fire
- c chan time.Time // closed when the timer fires; mutually exclusive with f
- f func() // called when the timer fires; mutually exclusive with c
-}
-
-func (t *fakeTimer) C() <-chan time.Time { return t.c }
-
-func (t *fakeTimer) Stop() bool {
- t.mu.Lock()
- defer t.mu.Unlock()
- stopped := t.when.IsZero()
- t.when = time.Time{}
- return stopped
-}
-
-func (t *fakeTimer) Reset(d time.Duration) bool {
- if t.c != nil || t.f == nil {
- panic("fakeTimer only supports Reset on AfterFunc timers")
- }
- t.mu.Lock()
- defer t.mu.Unlock()
- t.hooks.lock()
- defer t.hooks.unlock()
- active := !t.when.IsZero()
- t.when = t.hooks.now.Add(d)
- if !active {
- t.hooks.timers = append(t.hooks.timers, t)
- }
- return active
-}
diff --git a/vendor/golang.org/x/net/http2/timer.go b/vendor/golang.org/x/net/http2/timer.go
new file mode 100644
index 000000000..0b1c17b81
--- /dev/null
+++ b/vendor/golang.org/x/net/http2/timer.go
@@ -0,0 +1,20 @@
+// Copyright 2024 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+package http2
+
+import "time"
+
+// A timer is a time.Timer, as an interface which can be replaced in tests.
+type timer = interface {
+ C() <-chan time.Time
+ Reset(d time.Duration) bool
+ Stop() bool
+}
+
+// timeTimer adapts a time.Timer to the timer interface.
+type timeTimer struct {
+ *time.Timer
+}
+
+func (t timeTimer) C() <-chan time.Time { return t.Timer.C }
diff --git a/vendor/golang.org/x/net/http2/transport.go b/vendor/golang.org/x/net/http2/transport.go
index ce375c8c7..98a49c6b6 100644
--- a/vendor/golang.org/x/net/http2/transport.go
+++ b/vendor/golang.org/x/net/http2/transport.go
@@ -185,7 +185,45 @@ type Transport struct {
connPoolOnce sync.Once
connPoolOrDef ClientConnPool // non-nil version of ConnPool
- syncHooks *testSyncHooks
+ *transportTestHooks
+}
+
+// Hook points used for testing.
+// Outside of tests, t.transportTestHooks is nil and these all have minimal implementations.
+// Inside tests, see the testSyncHooks function docs.
+
+type transportTestHooks struct {
+ newclientconn func(*ClientConn)
+ group synctestGroupInterface
+}
+
+func (t *Transport) markNewGoroutine() {
+ if t != nil && t.transportTestHooks != nil {
+ t.transportTestHooks.group.Join()
+ }
+}
+
+// newTimer creates a new time.Timer, or a synthetic timer in tests.
+func (t *Transport) newTimer(d time.Duration) timer {
+ if t.transportTestHooks != nil {
+ return t.transportTestHooks.group.NewTimer(d)
+ }
+ return timeTimer{time.NewTimer(d)}
+}
+
+// afterFunc creates a new time.AfterFunc timer, or a synthetic timer in tests.
+func (t *Transport) afterFunc(d time.Duration, f func()) timer {
+ if t.transportTestHooks != nil {
+ return t.transportTestHooks.group.AfterFunc(d, f)
+ }
+ return timeTimer{time.AfterFunc(d, f)}
+}
+
+func (t *Transport) contextWithTimeout(ctx context.Context, d time.Duration) (context.Context, context.CancelFunc) {
+ if t.transportTestHooks != nil {
+ return t.transportTestHooks.group.ContextWithTimeout(ctx, d)
+ }
+ return context.WithTimeout(ctx, d)
}
func (t *Transport) maxHeaderListSize() uint32 {
@@ -352,60 +390,6 @@ type ClientConn struct {
werr error // first write error that has occurred
hbuf bytes.Buffer // HPACK encoder writes into this
henc *hpack.Encoder
-
- syncHooks *testSyncHooks // can be nil
-}
-
-// Hook points used for testing.
-// Outside of tests, cc.syncHooks is nil and these all have minimal implementations.
-// Inside tests, see the testSyncHooks function docs.
-
-// goRun starts a new goroutine.
-func (cc *ClientConn) goRun(f func()) {
- if cc.syncHooks != nil {
- cc.syncHooks.goRun(f)
- return
- }
- go f()
-}
-
-// condBroadcast is cc.cond.Broadcast.
-func (cc *ClientConn) condBroadcast() {
- if cc.syncHooks != nil {
- cc.syncHooks.condBroadcast(cc.cond)
- }
- cc.cond.Broadcast()
-}
-
-// condWait is cc.cond.Wait.
-func (cc *ClientConn) condWait() {
- if cc.syncHooks != nil {
- cc.syncHooks.condWait(cc.cond)
- }
- cc.cond.Wait()
-}
-
-// newTimer creates a new time.Timer, or a synthetic timer in tests.
-func (cc *ClientConn) newTimer(d time.Duration) timer {
- if cc.syncHooks != nil {
- return cc.syncHooks.newTimer(d)
- }
- return newTimeTimer(d)
-}
-
-// afterFunc creates a new time.AfterFunc timer, or a synthetic timer in tests.
-func (cc *ClientConn) afterFunc(d time.Duration, f func()) timer {
- if cc.syncHooks != nil {
- return cc.syncHooks.afterFunc(d, f)
- }
- return newTimeAfterFunc(d, f)
-}
-
-func (cc *ClientConn) contextWithTimeout(ctx context.Context, d time.Duration) (context.Context, context.CancelFunc) {
- if cc.syncHooks != nil {
- return cc.syncHooks.contextWithTimeout(ctx, d)
- }
- return context.WithTimeout(ctx, d)
}
// clientStream is the state for a single HTTP/2 stream. One of these
@@ -487,7 +471,7 @@ func (cs *clientStream) abortStreamLocked(err error) {
// TODO(dneil): Clean up tests where cs.cc.cond is nil.
if cs.cc.cond != nil {
// Wake up writeRequestBody if it is waiting on flow control.
- cs.cc.condBroadcast()
+ cs.cc.cond.Broadcast()
}
}
@@ -497,7 +481,7 @@ func (cs *clientStream) abortRequestBodyWrite() {
defer cc.mu.Unlock()
if cs.reqBody != nil && cs.reqBodyClosed == nil {
cs.closeReqBodyLocked()
- cc.condBroadcast()
+ cc.cond.Broadcast()
}
}
@@ -507,10 +491,11 @@ func (cs *clientStream) closeReqBodyLocked() {
}
cs.reqBodyClosed = make(chan struct{})
reqBodyClosed := cs.reqBodyClosed
- cs.cc.goRun(func() {
+ go func() {
+ cs.cc.t.markNewGoroutine()
cs.reqBody.Close()
close(reqBodyClosed)
- })
+ }()
}
type stickyErrWriter struct {
@@ -626,21 +611,7 @@ func (t *Transport) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Res
backoff := float64(uint(1) << (uint(retry) - 1))
backoff += backoff * (0.1 * mathrand.Float64())
d := time.Second * time.Duration(backoff)
- var tm timer
- if t.syncHooks != nil {
- tm = t.syncHooks.newTimer(d)
- t.syncHooks.blockUntil(func() bool {
- select {
- case <-tm.C():
- case <-req.Context().Done():
- default:
- return false
- }
- return true
- })
- } else {
- tm = newTimeTimer(d)
- }
+ tm := t.newTimer(d)
select {
case <-tm.C():
t.vlogf("RoundTrip retrying after failure: %v", roundTripErr)
@@ -725,8 +696,8 @@ func canRetryError(err error) bool {
}
func (t *Transport) dialClientConn(ctx context.Context, addr string, singleUse bool) (*ClientConn, error) {
- if t.syncHooks != nil {
- return t.newClientConn(nil, singleUse, t.syncHooks)
+ if t.transportTestHooks != nil {
+ return t.newClientConn(nil, singleUse)
}
host, _, err := net.SplitHostPort(addr)
if err != nil {
@@ -736,7 +707,7 @@ func (t *Transport) dialClientConn(ctx context.Context, addr string, singleUse b
if err != nil {
return nil, err
}
- return t.newClientConn(tconn, singleUse, nil)
+ return t.newClientConn(tconn, singleUse)
}
func (t *Transport) newTLSConfig(host string) *tls.Config {
@@ -802,10 +773,10 @@ func (t *Transport) maxEncoderHeaderTableSize() uint32 {
}
func (t *Transport) NewClientConn(c net.Conn) (*ClientConn, error) {
- return t.newClientConn(c, t.disableKeepAlives(), nil)
+ return t.newClientConn(c, t.disableKeepAlives())
}
-func (t *Transport) newClientConn(c net.Conn, singleUse bool, hooks *testSyncHooks) (*ClientConn, error) {
+func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, error) {
cc := &ClientConn{
t: t,
tconn: c,
@@ -820,16 +791,12 @@ func (t *Transport) newClientConn(c net.Conn, singleUse bool, hooks *testSyncHoo
wantSettingsAck: true,
pings: make(map[[8]byte]chan struct{}),
reqHeaderMu: make(chan struct{}, 1),
- syncHooks: hooks,
}
- if hooks != nil {
- hooks.newclientconn(cc)
+ if t.transportTestHooks != nil {
+ t.markNewGoroutine()
+ t.transportTestHooks.newclientconn(cc)
c = cc.tconn
}
- if d := t.idleConnTimeout(); d != 0 {
- cc.idleTimeout = d
- cc.idleTimer = cc.afterFunc(d, cc.onIdleTimeout)
- }
if VerboseLogs {
t.vlogf("http2: Transport creating client conn %p to %v", cc, c.RemoteAddr())
}
@@ -893,7 +860,13 @@ func (t *Transport) newClientConn(c net.Conn, singleUse bool, hooks *testSyncHoo
return nil, cc.werr
}
- cc.goRun(cc.readLoop)
+ // Start the idle timer after the connection is fully initialized.
+ if d := t.idleConnTimeout(); d != 0 {
+ cc.idleTimeout = d
+ cc.idleTimer = t.afterFunc(d, cc.onIdleTimeout)
+ }
+
+ go cc.readLoop()
return cc, nil
}
@@ -901,7 +874,7 @@ func (cc *ClientConn) healthCheck() {
pingTimeout := cc.t.pingTimeout()
// We don't need to periodically ping in the health check, because the readLoop of ClientConn will
// trigger the healthCheck again if there is no frame received.
- ctx, cancel := cc.contextWithTimeout(context.Background(), pingTimeout)
+ ctx, cancel := cc.t.contextWithTimeout(context.Background(), pingTimeout)
defer cancel()
cc.vlogf("http2: Transport sending health check")
err := cc.Ping(ctx)
@@ -936,7 +909,20 @@ func (cc *ClientConn) setGoAway(f *GoAwayFrame) {
}
last := f.LastStreamID
for streamID, cs := range cc.streams {
- if streamID > last {
+ if streamID <= last {
+ // The server's GOAWAY indicates that it received this stream.
+ // It will either finish processing it, or close the connection
+ // without doing so. Either way, leave the stream alone for now.
+ continue
+ }
+ if streamID == 1 && cc.goAway.ErrCode != ErrCodeNo {
+ // Don't retry the first stream on a connection if we get a non-NO error.
+ // If the server is sending an error on a new connection,
+ // retrying the request on a new one probably isn't going to work.
+ cs.abortStreamLocked(fmt.Errorf("http2: Transport received GOAWAY from server ErrCode:%v", cc.goAway.ErrCode))
+ } else {
+ // Aborting the stream with errClentConnGotGoAway indicates that
+ // the request should be retried on a new connection.
cs.abortStreamLocked(errClientConnGotGoAway)
}
}
@@ -1131,7 +1117,8 @@ func (cc *ClientConn) Shutdown(ctx context.Context) error {
// Wait for all in-flight streams to complete or connection to close
done := make(chan struct{})
cancelled := false // guarded by cc.mu
- cc.goRun(func() {
+ go func() {
+ cc.t.markNewGoroutine()
cc.mu.Lock()
defer cc.mu.Unlock()
for {
@@ -1143,9 +1130,9 @@ func (cc *ClientConn) Shutdown(ctx context.Context) error {
if cancelled {
break
}
- cc.condWait()
+ cc.cond.Wait()
}
- })
+ }()
shutdownEnterWaitStateHook()
select {
case <-done:
@@ -1155,7 +1142,7 @@ func (cc *ClientConn) Shutdown(ctx context.Context) error {
cc.mu.Lock()
// Free the goroutine above
cancelled = true
- cc.condBroadcast()
+ cc.cond.Broadcast()
cc.mu.Unlock()
return ctx.Err()
}
@@ -1193,7 +1180,7 @@ func (cc *ClientConn) closeForError(err error) {
for _, cs := range cc.streams {
cs.abortStreamLocked(err)
}
- cc.condBroadcast()
+ cc.cond.Broadcast()
cc.mu.Unlock()
cc.closeConn()
}
@@ -1308,23 +1295,30 @@ func (cc *ClientConn) roundTrip(req *http.Request, streamf func(*clientStream))
respHeaderRecv: make(chan struct{}),
donec: make(chan struct{}),
}
- cc.goRun(func() {
- cs.doRequest(req)
- })
+
+ // TODO(bradfitz): this is a copy of the logic in net/http. Unify somewhere?
+ if !cc.t.disableCompression() &&
+ req.Header.Get("Accept-Encoding") == "" &&
+ req.Header.Get("Range") == "" &&
+ !cs.isHead {
+ // Request gzip only, not deflate. Deflate is ambiguous and
+ // not as universally supported anyway.
+ // See: https://zlib.net/zlib_faq.html#faq39
+ //
+ // Note that we don't request this for HEAD requests,
+ // due to a bug in nginx:
+ // http://trac.nginx.org/nginx/ticket/358
+ // https://golang.org/issue/5522
+ //
+ // We don't request gzip if the request is for a range, since
+ // auto-decoding a portion of a gzipped document will just fail
+ // anyway. See https://golang.org/issue/8923
+ cs.requestedGzip = true
+ }
+
+ go cs.doRequest(req, streamf)
waitDone := func() error {
- if cc.syncHooks != nil {
- cc.syncHooks.blockUntil(func() bool {
- select {
- case <-cs.donec:
- case <-ctx.Done():
- case <-cs.reqCancel:
- default:
- return false
- }
- return true
- })
- }
select {
case <-cs.donec:
return nil
@@ -1385,24 +1379,7 @@ func (cc *ClientConn) roundTrip(req *http.Request, streamf func(*clientStream))
return err
}
- if streamf != nil {
- streamf(cs)
- }
-
for {
- if cc.syncHooks != nil {
- cc.syncHooks.blockUntil(func() bool {
- select {
- case <-cs.respHeaderRecv:
- case <-cs.abort:
- case <-ctx.Done():
- case <-cs.reqCancel:
- default:
- return false
- }
- return true
- })
- }
select {
case <-cs.respHeaderRecv:
return handleResponseHeaders()
@@ -1432,8 +1409,9 @@ func (cc *ClientConn) roundTrip(req *http.Request, streamf func(*clientStream))
// doRequest runs for the duration of the request lifetime.
//
// It sends the request and performs post-request cleanup (closing Request.Body, etc.).
-func (cs *clientStream) doRequest(req *http.Request) {
- err := cs.writeRequest(req)
+func (cs *clientStream) doRequest(req *http.Request, streamf func(*clientStream)) {
+ cs.cc.t.markNewGoroutine()
+ err := cs.writeRequest(req, streamf)
cs.cleanupWriteRequest(err)
}
@@ -1444,7 +1422,7 @@ func (cs *clientStream) doRequest(req *http.Request) {
//
// It returns non-nil if the request ends otherwise.
// If the returned error is StreamError, the error Code may be used in resetting the stream.
-func (cs *clientStream) writeRequest(req *http.Request) (err error) {
+func (cs *clientStream) writeRequest(req *http.Request, streamf func(*clientStream)) (err error) {
cc := cs.cc
ctx := cs.ctx
@@ -1458,21 +1436,6 @@ func (cs *clientStream) writeRequest(req *http.Request) (err error) {
if cc.reqHeaderMu == nil {
panic("RoundTrip on uninitialized ClientConn") // for tests
}
- var newStreamHook func(*clientStream)
- if cc.syncHooks != nil {
- newStreamHook = cc.syncHooks.newstream
- cc.syncHooks.blockUntil(func() bool {
- select {
- case cc.reqHeaderMu <- struct{}{}:
- <-cc.reqHeaderMu
- case <-cs.reqCancel:
- case <-ctx.Done():
- default:
- return false
- }
- return true
- })
- }
select {
case cc.reqHeaderMu <- struct{}{}:
case <-cs.reqCancel:
@@ -1497,28 +1460,8 @@ func (cs *clientStream) writeRequest(req *http.Request) (err error) {
}
cc.mu.Unlock()
- if newStreamHook != nil {
- newStreamHook(cs)
- }
-
- // TODO(bradfitz): this is a copy of the logic in net/http. Unify somewhere?
- if !cc.t.disableCompression() &&
- req.Header.Get("Accept-Encoding") == "" &&
- req.Header.Get("Range") == "" &&
- !cs.isHead {
- // Request gzip only, not deflate. Deflate is ambiguous and
- // not as universally supported anyway.
- // See: https://zlib.net/zlib_faq.html#faq39
- //
- // Note that we don't request this for HEAD requests,
- // due to a bug in nginx:
- // http://trac.nginx.org/nginx/ticket/358
- // https://golang.org/issue/5522
- //
- // We don't request gzip if the request is for a range, since
- // auto-decoding a portion of a gzipped document will just fail
- // anyway. See https://golang.org/issue/8923
- cs.requestedGzip = true
+ if streamf != nil {
+ streamf(cs)
}
continueTimeout := cc.t.expectContinueTimeout()
@@ -1581,7 +1524,7 @@ func (cs *clientStream) writeRequest(req *http.Request) (err error) {
var respHeaderTimer <-chan time.Time
var respHeaderRecv chan struct{}
if d := cc.responseHeaderTimeout(); d != 0 {
- timer := cc.newTimer(d)
+ timer := cc.t.newTimer(d)
defer timer.Stop()
respHeaderTimer = timer.C()
respHeaderRecv = cs.respHeaderRecv
@@ -1590,21 +1533,6 @@ func (cs *clientStream) writeRequest(req *http.Request) (err error) {
// or until the request is aborted (via context, error, or otherwise),
// whichever comes first.
for {
- if cc.syncHooks != nil {
- cc.syncHooks.blockUntil(func() bool {
- select {
- case <-cs.peerClosed:
- case <-respHeaderTimer:
- case <-respHeaderRecv:
- case <-cs.abort:
- case <-ctx.Done():
- case <-cs.reqCancel:
- default:
- return false
- }
- return true
- })
- }
select {
case <-cs.peerClosed:
return nil
@@ -1753,7 +1681,7 @@ func (cc *ClientConn) awaitOpenSlotForStreamLocked(cs *clientStream) error {
return nil
}
cc.pendingRequests++
- cc.condWait()
+ cc.cond.Wait()
cc.pendingRequests--
select {
case <-cs.abort:
@@ -2015,7 +1943,7 @@ func (cs *clientStream) awaitFlowControl(maxBytes int) (taken int32, err error)
cs.flow.take(take)
return take, nil
}
- cc.condWait()
+ cc.cond.Wait()
}
}
@@ -2298,7 +2226,7 @@ func (cc *ClientConn) forgetStreamID(id uint32) {
}
// Wake up writeRequestBody via clientStream.awaitFlowControl and
// wake up RoundTrip if there is a pending request.
- cc.condBroadcast()
+ cc.cond.Broadcast()
closeOnIdle := cc.singleUse || cc.doNotReuse || cc.t.disableKeepAlives() || cc.goAway != nil
if closeOnIdle && cc.streamsReserved == 0 && len(cc.streams) == 0 {
@@ -2320,6 +2248,7 @@ type clientConnReadLoop struct {
// readLoop runs in its own goroutine and reads and dispatches frames.
func (cc *ClientConn) readLoop() {
+ cc.t.markNewGoroutine()
rl := &clientConnReadLoop{cc: cc}
defer rl.cleanup()
cc.readerErr = rl.run()
@@ -2386,7 +2315,7 @@ func (rl *clientConnReadLoop) cleanup() {
cs.abortStreamLocked(err)
}
}
- cc.condBroadcast()
+ cc.cond.Broadcast()
cc.mu.Unlock()
}
@@ -2423,7 +2352,7 @@ func (rl *clientConnReadLoop) run() error {
readIdleTimeout := cc.t.ReadIdleTimeout
var t timer
if readIdleTimeout != 0 {
- t = cc.afterFunc(readIdleTimeout, cc.healthCheck)
+ t = cc.t.afterFunc(readIdleTimeout, cc.healthCheck)
}
for {
f, err := cc.fr.ReadFrame()
@@ -3021,7 +2950,7 @@ func (rl *clientConnReadLoop) processSettingsNoWrite(f *SettingsFrame) error {
for _, cs := range cc.streams {
cs.flow.add(delta)
}
- cc.condBroadcast()
+ cc.cond.Broadcast()
cc.initialWindowSize = s.Val
case SettingHeaderTableSize:
@@ -3076,7 +3005,7 @@ func (rl *clientConnReadLoop) processWindowUpdate(f *WindowUpdateFrame) error {
return ConnectionError(ErrCodeFlowControl)
}
- cc.condBroadcast()
+ cc.cond.Broadcast()
return nil
}
@@ -3120,7 +3049,8 @@ func (cc *ClientConn) Ping(ctx context.Context) error {
}
var pingError error
errc := make(chan struct{})
- cc.goRun(func() {
+ go func() {
+ cc.t.markNewGoroutine()
cc.wmu.Lock()
defer cc.wmu.Unlock()
if pingError = cc.fr.WritePing(false, p); pingError != nil {
@@ -3131,20 +3061,7 @@ func (cc *ClientConn) Ping(ctx context.Context) error {
close(errc)
return
}
- })
- if cc.syncHooks != nil {
- cc.syncHooks.blockUntil(func() bool {
- select {
- case <-c:
- case <-errc:
- case <-ctx.Done():
- case <-cc.readerDone:
- default:
- return false
- }
- return true
- })
- }
+ }()
select {
case <-c:
return nil
diff --git a/vendor/golang.org/x/net/http2/writesched_priority.go b/vendor/golang.org/x/net/http2/writesched_priority.go
index 0a242c669..f6783339d 100644
--- a/vendor/golang.org/x/net/http2/writesched_priority.go
+++ b/vendor/golang.org/x/net/http2/writesched_priority.go
@@ -443,8 +443,8 @@ func (ws *priorityWriteScheduler) addClosedOrIdleNode(list *[]*priorityNode, max
}
func (ws *priorityWriteScheduler) removeNode(n *priorityNode) {
- for k := n.kids; k != nil; k = k.next {
- k.setParent(n.parent)
+ for n.kids != nil {
+ n.kids.setParent(n.parent)
}
n.setParent(nil)
delete(ws.nodes, n.id)
diff --git a/vendor/golang.org/x/time/rate/rate.go b/vendor/golang.org/x/time/rate/rate.go
index b0b982e9c..f0e0cf3cb 100644
--- a/vendor/golang.org/x/time/rate/rate.go
+++ b/vendor/golang.org/x/time/rate/rate.go
@@ -80,6 +80,19 @@ func (lim *Limiter) Burst() int {
return lim.burst
}
+// TokensAt returns the number of tokens available at time t.
+func (lim *Limiter) TokensAt(t time.Time) float64 {
+ lim.mu.Lock()
+ _, tokens := lim.advance(t) // does not mutate lim
+ lim.mu.Unlock()
+ return tokens
+}
+
+// Tokens returns the number of tokens available now.
+func (lim *Limiter) Tokens() float64 {
+ return lim.TokensAt(time.Now())
+}
+
// NewLimiter returns a new Limiter that allows events up to rate r and permits
// bursts of at most b tokens.
func NewLimiter(r Limit, b int) *Limiter {
@@ -89,16 +102,16 @@ func NewLimiter(r Limit, b int) *Limiter {
}
}
-// Allow is shorthand for AllowN(time.Now(), 1).
+// Allow reports whether an event may happen now.
func (lim *Limiter) Allow() bool {
return lim.AllowN(time.Now(), 1)
}
-// AllowN reports whether n events may happen at time now.
+// AllowN reports whether n events may happen at time t.
// Use this method if you intend to drop / skip events that exceed the rate limit.
// Otherwise use Reserve or Wait.
-func (lim *Limiter) AllowN(now time.Time, n int) bool {
- return lim.reserveN(now, n, 0).ok
+func (lim *Limiter) AllowN(t time.Time, n int) bool {
+ return lim.reserveN(t, n, 0).ok
}
// A Reservation holds information about events that are permitted by a Limiter to happen after a delay.
@@ -125,17 +138,17 @@ func (r *Reservation) Delay() time.Duration {
}
// InfDuration is the duration returned by Delay when a Reservation is not OK.
-const InfDuration = time.Duration(1<<63 - 1)
+const InfDuration = time.Duration(math.MaxInt64)
// DelayFrom returns the duration for which the reservation holder must wait
// before taking the reserved action. Zero duration means act immediately.
// InfDuration means the limiter cannot grant the tokens requested in this
// Reservation within the maximum wait time.
-func (r *Reservation) DelayFrom(now time.Time) time.Duration {
+func (r *Reservation) DelayFrom(t time.Time) time.Duration {
if !r.ok {
return InfDuration
}
- delay := r.timeToAct.Sub(now)
+ delay := r.timeToAct.Sub(t)
if delay < 0 {
return 0
}
@@ -150,7 +163,7 @@ func (r *Reservation) Cancel() {
// CancelAt indicates that the reservation holder will not perform the reserved action
// and reverses the effects of this Reservation on the rate limit as much as possible,
// considering that other reservations may have already been made.
-func (r *Reservation) CancelAt(now time.Time) {
+func (r *Reservation) CancelAt(t time.Time) {
if !r.ok {
return
}
@@ -158,7 +171,7 @@ func (r *Reservation) CancelAt(now time.Time) {
r.lim.mu.Lock()
defer r.lim.mu.Unlock()
- if r.lim.limit == Inf || r.tokens == 0 || r.timeToAct.Before(now) {
+ if r.lim.limit == Inf || r.tokens == 0 || r.timeToAct.Before(t) {
return
}
@@ -170,18 +183,18 @@ func (r *Reservation) CancelAt(now time.Time) {
return
}
// advance time to now
- now, _, tokens := r.lim.advance(now)
+ t, tokens := r.lim.advance(t)
// calculate new number of tokens
tokens += restoreTokens
if burst := float64(r.lim.burst); tokens > burst {
tokens = burst
}
// update state
- r.lim.last = now
+ r.lim.last = t
r.lim.tokens = tokens
if r.timeToAct == r.lim.lastEvent {
prevEvent := r.timeToAct.Add(r.limit.durationFromTokens(float64(-r.tokens)))
- if !prevEvent.Before(now) {
+ if !prevEvent.Before(t) {
r.lim.lastEvent = prevEvent
}
}
@@ -196,18 +209,20 @@ func (lim *Limiter) Reserve() *Reservation {
// The Limiter takes this Reservation into account when allowing future events.
// The returned Reservation’s OK() method returns false if n exceeds the Limiter's burst size.
// Usage example:
-// r := lim.ReserveN(time.Now(), 1)
-// if !r.OK() {
-// // Not allowed to act! Did you remember to set lim.burst to be > 0 ?
-// return
-// }
-// time.Sleep(r.Delay())
-// Act()
+//
+// r := lim.ReserveN(time.Now(), 1)
+// if !r.OK() {
+// // Not allowed to act! Did you remember to set lim.burst to be > 0 ?
+// return
+// }
+// time.Sleep(r.Delay())
+// Act()
+//
// Use this method if you wish to wait and slow down in accordance with the rate limit without dropping events.
// If you need to respect a deadline or cancel the delay, use Wait instead.
// To drop or skip events exceeding rate limit, use Allow instead.
-func (lim *Limiter) ReserveN(now time.Time, n int) *Reservation {
- r := lim.reserveN(now, n, InfDuration)
+func (lim *Limiter) ReserveN(t time.Time, n int) *Reservation {
+ r := lim.reserveN(t, n, InfDuration)
return &r
}
@@ -221,6 +236,18 @@ func (lim *Limiter) Wait(ctx context.Context) (err error) {
// canceled, or the expected wait time exceeds the Context's Deadline.
// The burst limit is ignored if the rate limit is Inf.
func (lim *Limiter) WaitN(ctx context.Context, n int) (err error) {
+ // The test code calls lim.wait with a fake timer generator.
+ // This is the real timer generator.
+ newTimer := func(d time.Duration) (<-chan time.Time, func() bool, func()) {
+ timer := time.NewTimer(d)
+ return timer.C, timer.Stop, func() {}
+ }
+
+ return lim.wait(ctx, n, time.Now(), newTimer)
+}
+
+// wait is the internal implementation of WaitN.
+func (lim *Limiter) wait(ctx context.Context, n int, t time.Time, newTimer func(d time.Duration) (<-chan time.Time, func() bool, func())) error {
lim.mu.Lock()
burst := lim.burst
limit := lim.limit
@@ -236,25 +263,25 @@ func (lim *Limiter) WaitN(ctx context.Context, n int) (err error) {
default:
}
// Determine wait limit
- now := time.Now()
waitLimit := InfDuration
if deadline, ok := ctx.Deadline(); ok {
- waitLimit = deadline.Sub(now)
+ waitLimit = deadline.Sub(t)
}
// Reserve
- r := lim.reserveN(now, n, waitLimit)
+ r := lim.reserveN(t, n, waitLimit)
if !r.ok {
return fmt.Errorf("rate: Wait(n=%d) would exceed context deadline", n)
}
// Wait if necessary
- delay := r.DelayFrom(now)
+ delay := r.DelayFrom(t)
if delay == 0 {
return nil
}
- t := time.NewTimer(delay)
- defer t.Stop()
+ ch, stop, advance := newTimer(delay)
+ defer stop()
+ advance() // only has an effect when testing
select {
- case <-t.C:
+ case <-ch:
// We can proceed.
return nil
case <-ctx.Done():
@@ -273,13 +300,13 @@ func (lim *Limiter) SetLimit(newLimit Limit) {
// SetLimitAt sets a new Limit for the limiter. The new Limit, and Burst, may be violated
// or underutilized by those which reserved (using Reserve or Wait) but did not yet act
// before SetLimitAt was called.
-func (lim *Limiter) SetLimitAt(now time.Time, newLimit Limit) {
+func (lim *Limiter) SetLimitAt(t time.Time, newLimit Limit) {
lim.mu.Lock()
defer lim.mu.Unlock()
- now, _, tokens := lim.advance(now)
+ t, tokens := lim.advance(t)
- lim.last = now
+ lim.last = t
lim.tokens = tokens
lim.limit = newLimit
}
@@ -290,13 +317,13 @@ func (lim *Limiter) SetBurst(newBurst int) {
}
// SetBurstAt sets a new burst size for the limiter.
-func (lim *Limiter) SetBurstAt(now time.Time, newBurst int) {
+func (lim *Limiter) SetBurstAt(t time.Time, newBurst int) {
lim.mu.Lock()
defer lim.mu.Unlock()
- now, _, tokens := lim.advance(now)
+ t, tokens := lim.advance(t)
- lim.last = now
+ lim.last = t
lim.tokens = tokens
lim.burst = newBurst
}
@@ -304,7 +331,7 @@ func (lim *Limiter) SetBurstAt(now time.Time, newBurst int) {
// reserveN is a helper method for AllowN, ReserveN, and WaitN.
// maxFutureReserve specifies the maximum reservation wait duration allowed.
// reserveN returns Reservation, not *Reservation, to avoid allocation in AllowN and WaitN.
-func (lim *Limiter) reserveN(now time.Time, n int, maxFutureReserve time.Duration) Reservation {
+func (lim *Limiter) reserveN(t time.Time, n int, maxFutureReserve time.Duration) Reservation {
lim.mu.Lock()
defer lim.mu.Unlock()
@@ -313,7 +340,7 @@ func (lim *Limiter) reserveN(now time.Time, n int, maxFutureReserve time.Duratio
ok: true,
lim: lim,
tokens: n,
- timeToAct: now,
+ timeToAct: t,
}
} else if lim.limit == 0 {
var ok bool
@@ -325,11 +352,11 @@ func (lim *Limiter) reserveN(now time.Time, n int, maxFutureReserve time.Duratio
ok: ok,
lim: lim,
tokens: lim.burst,
- timeToAct: now,
+ timeToAct: t,
}
}
- now, last, tokens := lim.advance(now)
+ t, tokens := lim.advance(t)
// Calculate the remaining number of tokens resulting from the request.
tokens -= float64(n)
@@ -351,16 +378,12 @@ func (lim *Limiter) reserveN(now time.Time, n int, maxFutureReserve time.Duratio
}
if ok {
r.tokens = n
- r.timeToAct = now.Add(waitDuration)
- }
+ r.timeToAct = t.Add(waitDuration)
- // Update state
- if ok {
- lim.last = now
+ // Update state
+ lim.last = t
lim.tokens = tokens
lim.lastEvent = r.timeToAct
- } else {
- lim.last = last
}
return r
@@ -369,20 +392,20 @@ func (lim *Limiter) reserveN(now time.Time, n int, maxFutureReserve time.Duratio
// advance calculates and returns an updated state for lim resulting from the passage of time.
// lim is not changed.
// advance requires that lim.mu is held.
-func (lim *Limiter) advance(now time.Time) (newNow time.Time, newLast time.Time, newTokens float64) {
+func (lim *Limiter) advance(t time.Time) (newT time.Time, newTokens float64) {
last := lim.last
- if now.Before(last) {
- last = now
+ if t.Before(last) {
+ last = t
}
// Calculate the new number of tokens, due to time that passed.
- elapsed := now.Sub(last)
+ elapsed := t.Sub(last)
delta := lim.limit.tokensFromDuration(elapsed)
tokens := lim.tokens + delta
if burst := float64(lim.burst); tokens > burst {
tokens = burst
}
- return now, last, tokens
+ return t, tokens
}
// durationFromTokens is a unit conversion function from the number of tokens to the duration
diff --git a/vendor/golang.org/x/time/rate/sometimes.go b/vendor/golang.org/x/time/rate/sometimes.go
new file mode 100644
index 000000000..6ba99ddb6
--- /dev/null
+++ b/vendor/golang.org/x/time/rate/sometimes.go
@@ -0,0 +1,67 @@
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package rate
+
+import (
+ "sync"
+ "time"
+)
+
+// Sometimes will perform an action occasionally. The First, Every, and
+// Interval fields govern the behavior of Do, which performs the action.
+// A zero Sometimes value will perform an action exactly once.
+//
+// # Example: logging with rate limiting
+//
+// var sometimes = rate.Sometimes{First: 3, Interval: 10*time.Second}
+// func Spammy() {
+// sometimes.Do(func() { log.Info("here I am!") })
+// }
+type Sometimes struct {
+ First int // if non-zero, the first N calls to Do will run f.
+ Every int // if non-zero, every Nth call to Do will run f.
+ Interval time.Duration // if non-zero and Interval has elapsed since f's last run, Do will run f.
+
+ mu sync.Mutex
+ count int // number of Do calls
+ last time.Time // last time f was run
+}
+
+// Do runs the function f as allowed by First, Every, and Interval.
+//
+// The model is a union (not intersection) of filters. The first call to Do
+// always runs f. Subsequent calls to Do run f if allowed by First or Every or
+// Interval.
+//
+// A non-zero First:N causes the first N Do(f) calls to run f.
+//
+// A non-zero Every:M causes every Mth Do(f) call, starting with the first, to
+// run f.
+//
+// A non-zero Interval causes Do(f) to run f if Interval has elapsed since
+// Do last ran f.
+//
+// Specifying multiple filters produces the union of these execution streams.
+// For example, specifying both First:N and Every:M causes the first N Do(f)
+// calls and every Mth Do(f) call, starting with the first, to run f. See
+// Examples for more.
+//
+// If Do is called multiple times simultaneously, the calls will block and run
+// serially. Therefore, Do is intended for lightweight operations.
+//
+// Because a call to Do may block until f returns, if f causes Do to be called,
+// it will deadlock.
+func (s *Sometimes) Do(f func()) {
+ s.mu.Lock()
+ defer s.mu.Unlock()
+ if s.count == 0 ||
+ (s.First > 0 && s.count < s.First) ||
+ (s.Every > 0 && s.count%s.Every == 0) ||
+ (s.Interval > 0 && time.Since(s.last) >= s.Interval) {
+ f()
+ s.last = time.Now()
+ }
+ s.count++
+}
diff --git a/vendor/google.golang.org/protobuf/encoding/prototext/decode.go b/vendor/google.golang.org/protobuf/encoding/prototext/decode.go
index a45f112bc..24bc98ac4 100644
--- a/vendor/google.golang.org/protobuf/encoding/prototext/decode.go
+++ b/vendor/google.golang.org/protobuf/encoding/prototext/decode.go
@@ -84,7 +84,7 @@ type decoder struct {
}
// newError returns an error object with position info.
-func (d decoder) newError(pos int, f string, x ...interface{}) error {
+func (d decoder) newError(pos int, f string, x ...any) error {
line, column := d.Position(pos)
head := fmt.Sprintf("(line %d:%d): ", line, column)
return errors.New(head+f, x...)
@@ -96,7 +96,7 @@ func (d decoder) unexpectedTokenError(tok text.Token) error {
}
// syntaxError returns a syntax error for given position.
-func (d decoder) syntaxError(pos int, f string, x ...interface{}) error {
+func (d decoder) syntaxError(pos int, f string, x ...any) error {
line, column := d.Position(pos)
head := fmt.Sprintf("syntax error (line %d:%d): ", line, column)
return errors.New(head+f, x...)
diff --git a/vendor/google.golang.org/protobuf/encoding/prototext/encode.go b/vendor/google.golang.org/protobuf/encoding/prototext/encode.go
index 95967e811..1f57e6610 100644
--- a/vendor/google.golang.org/protobuf/encoding/prototext/encode.go
+++ b/vendor/google.golang.org/protobuf/encoding/prototext/encode.go
@@ -27,15 +27,17 @@ const defaultIndent = " "
// Format formats the message as a multiline string.
// This function is only intended for human consumption and ignores errors.
-// Do not depend on the output being stable. It may change over time across
-// different versions of the program.
+// Do not depend on the output being stable. Its output will change across
+// different builds of your program, even when using the same version of the
+// protobuf module.
func Format(m proto.Message) string {
return MarshalOptions{Multiline: true}.Format(m)
}
// Marshal writes the given [proto.Message] in textproto format using default
-// options. Do not depend on the output being stable. It may change over time
-// across different versions of the program.
+// options. Do not depend on the output being stable. Its output will change
+// across different builds of your program, even when using the same version of
+// the protobuf module.
func Marshal(m proto.Message) ([]byte, error) {
return MarshalOptions{}.Marshal(m)
}
@@ -84,8 +86,9 @@ type MarshalOptions struct {
// Format formats the message as a string.
// This method is only intended for human consumption and ignores errors.
-// Do not depend on the output being stable. It may change over time across
-// different versions of the program.
+// Do not depend on the output being stable. Its output will change across
+// different builds of your program, even when using the same version of the
+// protobuf module.
func (o MarshalOptions) Format(m proto.Message) string {
if m == nil || !m.ProtoReflect().IsValid() {
return "" // invalid syntax, but okay since this is for debugging
@@ -98,8 +101,9 @@ func (o MarshalOptions) Format(m proto.Message) string {
}
// Marshal writes the given [proto.Message] in textproto format using options in
-// MarshalOptions object. Do not depend on the output being stable. It may
-// change over time across different versions of the program.
+// MarshalOptions object. Do not depend on the output being stable. Its output
+// will change across different builds of your program, even when using the
+// same version of the protobuf module.
func (o MarshalOptions) Marshal(m proto.Message) ([]byte, error) {
return o.marshal(nil, m)
}
diff --git a/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go b/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go
index a45625c8d..87e46bd4d 100644
--- a/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go
+++ b/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go
@@ -252,6 +252,7 @@ func formatDescOpt(t protoreflect.Descriptor, isRoot, allowMulti bool, record fu
{rv.MethodByName("Values"), "Values"},
{rv.MethodByName("ReservedNames"), "ReservedNames"},
{rv.MethodByName("ReservedRanges"), "ReservedRanges"},
+ {rv.MethodByName("IsClosed"), "IsClosed"},
}...)
case protoreflect.EnumValueDescriptor:
diff --git a/vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb b/vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb
index 18f075687..ff6a38360 100644
Binary files a/vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb and b/vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb differ
diff --git a/vendor/google.golang.org/protobuf/internal/editionssupport/editions.go b/vendor/google.golang.org/protobuf/internal/editionssupport/editions.go
new file mode 100644
index 000000000..029a6a12d
--- /dev/null
+++ b/vendor/google.golang.org/protobuf/internal/editionssupport/editions.go
@@ -0,0 +1,13 @@
+// Copyright 2024 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Package editionssupport defines constants for editions that are supported.
+package editionssupport
+
+import descriptorpb "google.golang.org/protobuf/types/descriptorpb"
+
+const (
+ Minimum = descriptorpb.Edition_EDITION_PROTO2
+ Maximum = descriptorpb.Edition_EDITION_2023
+)
diff --git a/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go b/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go
index 373d20837..7e87c7604 100644
--- a/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go
+++ b/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go
@@ -32,6 +32,7 @@ var byteType = reflect.TypeOf(byte(0))
func Unmarshal(tag string, goType reflect.Type, evs protoreflect.EnumValueDescriptors) protoreflect.FieldDescriptor {
f := new(filedesc.Field)
f.L0.ParentFile = filedesc.SurrogateProto2
+ f.L1.EditionFeatures = f.L0.ParentFile.L1.EditionFeatures
for len(tag) > 0 {
i := strings.IndexByte(tag, ',')
if i < 0 {
@@ -107,8 +108,7 @@ func Unmarshal(tag string, goType reflect.Type, evs protoreflect.EnumValueDescri
f.L1.StringName.InitJSON(jsonName)
}
case s == "packed":
- f.L1.HasPacked = true
- f.L1.IsPacked = true
+ f.L1.EditionFeatures.IsPacked = true
case strings.HasPrefix(s, "weak="):
f.L1.IsWeak = true
f.L1.Message = filedesc.PlaceholderMessage(protoreflect.FullName(s[len("weak="):]))
diff --git a/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go b/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go
index 87853e786..099b2bf45 100644
--- a/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go
+++ b/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go
@@ -601,7 +601,7 @@ func (d *Decoder) consumeToken(kind Kind, size int, attrs uint8) Token {
// newSyntaxError returns a syntax error with line and column information for
// current position.
-func (d *Decoder) newSyntaxError(f string, x ...interface{}) error {
+func (d *Decoder) newSyntaxError(f string, x ...any) error {
e := errors.New(f, x...)
line, column := d.Position(len(d.orig) - len(d.in))
return errors.New("syntax error (line %d:%d): %v", line, column, e)
diff --git a/vendor/google.golang.org/protobuf/internal/errors/errors.go b/vendor/google.golang.org/protobuf/internal/errors/errors.go
index 20c17b35e..c2d6bd526 100644
--- a/vendor/google.golang.org/protobuf/internal/errors/errors.go
+++ b/vendor/google.golang.org/protobuf/internal/errors/errors.go
@@ -17,7 +17,7 @@ var Error = errors.New("protobuf error")
// New formats a string according to the format specifier and arguments and
// returns an error that has a "proto" prefix.
-func New(f string, x ...interface{}) error {
+func New(f string, x ...any) error {
return &prefixError{s: format(f, x...)}
}
@@ -43,7 +43,7 @@ func (e *prefixError) Unwrap() error {
// Wrap returns an error that has a "proto" prefix, the formatted string described
// by the format specifier and arguments, and a suffix of err. The error wraps err.
-func Wrap(err error, f string, x ...interface{}) error {
+func Wrap(err error, f string, x ...any) error {
return &wrapError{
s: format(f, x...),
err: err,
@@ -67,7 +67,7 @@ func (e *wrapError) Is(target error) bool {
return target == Error
}
-func format(f string, x ...interface{}) string {
+func format(f string, x ...any) string {
// avoid "proto: " prefix when chaining
for i := 0; i < len(x); i++ {
switch e := x[i].(type) {
@@ -87,3 +87,18 @@ func InvalidUTF8(name string) error {
func RequiredNotSet(name string) error {
return New("required field %v not set", name)
}
+
+type SizeMismatchError struct {
+ Calculated, Measured int
+}
+
+func (e *SizeMismatchError) Error() string {
+ return fmt.Sprintf("size mismatch (see https://github.com/golang/protobuf/issues/1609): calculated=%d, measured=%d", e.Calculated, e.Measured)
+}
+
+func MismatchedSizeCalculation(calculated, measured int) error {
+ return &SizeMismatchError{
+ Calculated: calculated,
+ Measured: measured,
+ }
+}
diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc.go
index 8826bcf40..df53ff40b 100644
--- a/vendor/google.golang.org/protobuf/internal/filedesc/desc.go
+++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc.go
@@ -7,6 +7,7 @@ package filedesc
import (
"bytes"
"fmt"
+ "strings"
"sync"
"sync/atomic"
@@ -108,9 +109,12 @@ func (fd *File) ParentFile() protoreflect.FileDescriptor { return fd }
func (fd *File) Parent() protoreflect.Descriptor { return nil }
func (fd *File) Index() int { return 0 }
func (fd *File) Syntax() protoreflect.Syntax { return fd.L1.Syntax }
-func (fd *File) Name() protoreflect.Name { return fd.L1.Package.Name() }
-func (fd *File) FullName() protoreflect.FullName { return fd.L1.Package }
-func (fd *File) IsPlaceholder() bool { return false }
+
+// Not exported and just used to reconstruct the original FileDescriptor proto
+func (fd *File) Edition() int32 { return int32(fd.L1.Edition) }
+func (fd *File) Name() protoreflect.Name { return fd.L1.Package.Name() }
+func (fd *File) FullName() protoreflect.FullName { return fd.L1.Package }
+func (fd *File) IsPlaceholder() bool { return false }
func (fd *File) Options() protoreflect.ProtoMessage {
if f := fd.lazyInit().Options; f != nil {
return f()
@@ -202,6 +206,9 @@ func (ed *Enum) lazyInit() *EnumL2 {
ed.L0.ParentFile.lazyInit() // implicitly initializes L2
return ed.L2
}
+func (ed *Enum) IsClosed() bool {
+ return !ed.L1.EditionFeatures.IsOpenEnum
+}
func (ed *EnumValue) Options() protoreflect.ProtoMessage {
if f := ed.L1.Options; f != nil {
@@ -251,10 +258,6 @@ type (
StringName stringName
IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto
IsWeak bool // promoted from google.protobuf.FieldOptions
- HasPacked bool // promoted from google.protobuf.FieldOptions
- IsPacked bool // promoted from google.protobuf.FieldOptions
- HasEnforceUTF8 bool // promoted from google.protobuf.FieldOptions
- EnforceUTF8 bool // promoted from google.protobuf.FieldOptions
Default defaultValue
ContainingOneof protoreflect.OneofDescriptor // must be consistent with Message.Oneofs.Fields
Enum protoreflect.EnumDescriptor
@@ -331,8 +334,7 @@ func (fd *Field) HasPresence() bool {
if fd.L1.Cardinality == protoreflect.Repeated {
return false
}
- explicitFieldPresence := fd.Syntax() == protoreflect.Editions && fd.L1.EditionFeatures.IsFieldPresence
- return fd.Syntax() == protoreflect.Proto2 || explicitFieldPresence || fd.L1.Message != nil || fd.L1.ContainingOneof != nil
+ return fd.IsExtension() || fd.L1.EditionFeatures.IsFieldPresence || fd.L1.Message != nil || fd.L1.ContainingOneof != nil
}
func (fd *Field) HasOptionalKeyword() bool {
return (fd.L0.ParentFile.L1.Syntax == protoreflect.Proto2 && fd.L1.Cardinality == protoreflect.Optional && fd.L1.ContainingOneof == nil) || fd.L1.IsProto3Optional
@@ -345,14 +347,7 @@ func (fd *Field) IsPacked() bool {
case protoreflect.StringKind, protoreflect.BytesKind, protoreflect.MessageKind, protoreflect.GroupKind:
return false
}
- if fd.L0.ParentFile.L1.Syntax == protoreflect.Editions {
- return fd.L1.EditionFeatures.IsPacked
- }
- if fd.L0.ParentFile.L1.Syntax == protoreflect.Proto3 {
- // proto3 repeated fields are packed by default.
- return !fd.L1.HasPacked || fd.L1.IsPacked
- }
- return fd.L1.IsPacked
+ return fd.L1.EditionFeatures.IsPacked
}
func (fd *Field) IsExtension() bool { return false }
func (fd *Field) IsWeak() bool { return fd.L1.IsWeak }
@@ -388,6 +383,10 @@ func (fd *Field) Message() protoreflect.MessageDescriptor {
}
return fd.L1.Message
}
+func (fd *Field) IsMapEntry() bool {
+ parent, ok := fd.L0.Parent.(protoreflect.MessageDescriptor)
+ return ok && parent.IsMapEntry()
+}
func (fd *Field) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, fd) }
func (fd *Field) ProtoType(protoreflect.FieldDescriptor) {}
@@ -399,13 +398,7 @@ func (fd *Field) ProtoType(protoreflect.FieldDescriptor) {}
// WARNING: This method is exempt from the compatibility promise and may be
// removed in the future without warning.
func (fd *Field) EnforceUTF8() bool {
- if fd.L0.ParentFile.L1.Syntax == protoreflect.Editions {
- return fd.L1.EditionFeatures.IsUTF8Validated
- }
- if fd.L1.HasEnforceUTF8 {
- return fd.L1.EnforceUTF8
- }
- return fd.L0.ParentFile.L1.Syntax == protoreflect.Proto3
+ return fd.L1.EditionFeatures.IsUTF8Validated
}
func (od *Oneof) IsSynthetic() bool {
@@ -438,7 +431,6 @@ type (
Options func() protoreflect.ProtoMessage
StringName stringName
IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto
- IsPacked bool // promoted from google.protobuf.FieldOptions
Default defaultValue
Enum protoreflect.EnumDescriptor
Message protoreflect.MessageDescriptor
@@ -461,7 +453,16 @@ func (xd *Extension) HasPresence() bool { return xd.L1.Cardi
func (xd *Extension) HasOptionalKeyword() bool {
return (xd.L0.ParentFile.L1.Syntax == protoreflect.Proto2 && xd.L1.Cardinality == protoreflect.Optional) || xd.lazyInit().IsProto3Optional
}
-func (xd *Extension) IsPacked() bool { return xd.lazyInit().IsPacked }
+func (xd *Extension) IsPacked() bool {
+ if xd.L1.Cardinality != protoreflect.Repeated {
+ return false
+ }
+ switch xd.L1.Kind {
+ case protoreflect.StringKind, protoreflect.BytesKind, protoreflect.MessageKind, protoreflect.GroupKind:
+ return false
+ }
+ return xd.L1.EditionFeatures.IsPacked
+}
func (xd *Extension) IsExtension() bool { return true }
func (xd *Extension) IsWeak() bool { return false }
func (xd *Extension) IsList() bool { return xd.Cardinality() == protoreflect.Repeated }
@@ -542,8 +543,9 @@ func (md *Method) ProtoInternal(pragma.DoNotImplement) {}
// Surrogate files are can be used to create standalone descriptors
// where the syntax is only information derived from the parent file.
var (
- SurrogateProto2 = &File{L1: FileL1{Syntax: protoreflect.Proto2}, L2: &FileL2{}}
- SurrogateProto3 = &File{L1: FileL1{Syntax: protoreflect.Proto3}, L2: &FileL2{}}
+ SurrogateProto2 = &File{L1: FileL1{Syntax: protoreflect.Proto2}, L2: &FileL2{}}
+ SurrogateProto3 = &File{L1: FileL1{Syntax: protoreflect.Proto3}, L2: &FileL2{}}
+ SurrogateEdition2023 = &File{L1: FileL1{Syntax: protoreflect.Editions, Edition: Edition2023}, L2: &FileL2{}}
)
type (
@@ -585,6 +587,34 @@ func (s *stringName) InitJSON(name string) {
s.nameJSON = name
}
+// Returns true if this field is structured like the synthetic field of a proto2
+// group. This allows us to expand our treatment of delimited fields without
+// breaking proto2 files that have been upgraded to editions.
+func isGroupLike(fd protoreflect.FieldDescriptor) bool {
+ // Groups are always group types.
+ if fd.Kind() != protoreflect.GroupKind {
+ return false
+ }
+
+ // Group fields are always the lowercase type name.
+ if strings.ToLower(string(fd.Message().Name())) != string(fd.Name()) {
+ return false
+ }
+
+ // Groups could only be defined in the same file they're used.
+ if fd.Message().ParentFile() != fd.ParentFile() {
+ return false
+ }
+
+ // Group messages are always defined in the same scope as the field. File
+ // level extensions will compare NULL == NULL here, which is why the file
+ // comparison above is necessary to ensure both come from the same file.
+ if fd.IsExtension() {
+ return fd.Parent() == fd.Message().Parent()
+ }
+ return fd.ContainingMessage() == fd.Message().Parent()
+}
+
func (s *stringName) lazyInit(fd protoreflect.FieldDescriptor) *stringName {
s.once.Do(func() {
if fd.IsExtension() {
@@ -605,7 +635,7 @@ func (s *stringName) lazyInit(fd protoreflect.FieldDescriptor) *stringName {
// Format the text name.
s.nameText = string(fd.Name())
- if fd.Kind() == protoreflect.GroupKind {
+ if isGroupLike(fd) {
s.nameText = string(fd.Message().Name())
}
}
diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go
index 237e64fd2..8a57d60b0 100644
--- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go
+++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go
@@ -113,8 +113,10 @@ func (fd *File) unmarshalSeed(b []byte) {
switch string(v) {
case "proto2":
fd.L1.Syntax = protoreflect.Proto2
+ fd.L1.Edition = EditionProto2
case "proto3":
fd.L1.Syntax = protoreflect.Proto3
+ fd.L1.Edition = EditionProto3
case "editions":
fd.L1.Syntax = protoreflect.Editions
default:
@@ -177,11 +179,10 @@ func (fd *File) unmarshalSeed(b []byte) {
// If syntax is missing, it is assumed to be proto2.
if fd.L1.Syntax == 0 {
fd.L1.Syntax = protoreflect.Proto2
+ fd.L1.Edition = EditionProto2
}
- if fd.L1.Syntax == protoreflect.Editions {
- fd.L1.EditionFeatures = getFeaturesFor(fd.L1.Edition)
- }
+ fd.L1.EditionFeatures = getFeaturesFor(fd.L1.Edition)
// Parse editions features from options if any
if options != nil {
@@ -267,6 +268,7 @@ func (ed *Enum) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protorefl
ed.L0.ParentFile = pf
ed.L0.Parent = pd
ed.L0.Index = i
+ ed.L1.EditionFeatures = featuresFromParentDesc(ed.Parent())
var numValues int
for b := b; len(b) > 0; {
@@ -443,6 +445,7 @@ func (xd *Extension) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd prot
xd.L0.ParentFile = pf
xd.L0.Parent = pd
xd.L0.Index = i
+ xd.L1.EditionFeatures = featuresFromParentDesc(pd)
for len(b) > 0 {
num, typ, n := protowire.ConsumeTag(b)
@@ -467,6 +470,38 @@ func (xd *Extension) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd prot
xd.L0.FullName = appendFullName(sb, pd.FullName(), v)
case genid.FieldDescriptorProto_Extendee_field_number:
xd.L1.Extendee = PlaceholderMessage(makeFullName(sb, v))
+ case genid.FieldDescriptorProto_Options_field_number:
+ xd.unmarshalOptions(v)
+ }
+ default:
+ m := protowire.ConsumeFieldValue(num, typ, b)
+ b = b[m:]
+ }
+ }
+
+ if xd.L1.Kind == protoreflect.MessageKind && xd.L1.EditionFeatures.IsDelimitedEncoded {
+ xd.L1.Kind = protoreflect.GroupKind
+ }
+}
+
+func (xd *Extension) unmarshalOptions(b []byte) {
+ for len(b) > 0 {
+ num, typ, n := protowire.ConsumeTag(b)
+ b = b[n:]
+ switch typ {
+ case protowire.VarintType:
+ v, m := protowire.ConsumeVarint(b)
+ b = b[m:]
+ switch num {
+ case genid.FieldOptions_Packed_field_number:
+ xd.L1.EditionFeatures.IsPacked = protowire.DecodeBool(v)
+ }
+ case protowire.BytesType:
+ v, m := protowire.ConsumeBytes(b)
+ b = b[m:]
+ switch num {
+ case genid.FieldOptions_Features_field_number:
+ xd.L1.EditionFeatures = unmarshalFeatureSet(v, xd.L1.EditionFeatures)
}
default:
m := protowire.ConsumeFieldValue(num, typ, b)
@@ -499,7 +534,7 @@ func (sd *Service) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protor
}
var nameBuilderPool = sync.Pool{
- New: func() interface{} { return new(strs.Builder) },
+ New: func() any { return new(strs.Builder) },
}
func getBuilder() *strs.Builder {
diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go
index 482a61cc1..e56c91a8d 100644
--- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go
+++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go
@@ -45,6 +45,11 @@ func (file *File) resolveMessages() {
case protoreflect.MessageKind, protoreflect.GroupKind:
fd.L1.Message = file.resolveMessageDependency(fd.L1.Message, listFieldDeps, depIdx)
depIdx++
+ if fd.L1.Kind == protoreflect.GroupKind && (fd.IsMap() || fd.IsMapEntry()) {
+ // A map field might inherit delimited encoding from a file-wide default feature.
+ // But maps never actually use delimited encoding. (At least for now...)
+ fd.L1.Kind = protoreflect.MessageKind
+ }
}
// Default is resolved here since it depends on Enum being resolved.
@@ -466,10 +471,10 @@ func (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoref
b = b[m:]
}
}
- if fd.Syntax() == protoreflect.Editions && fd.L1.Kind == protoreflect.MessageKind && fd.L1.EditionFeatures.IsDelimitedEncoded {
+ if fd.L1.Kind == protoreflect.MessageKind && fd.L1.EditionFeatures.IsDelimitedEncoded {
fd.L1.Kind = protoreflect.GroupKind
}
- if fd.Syntax() == protoreflect.Editions && fd.L1.EditionFeatures.IsLegacyRequired {
+ if fd.L1.EditionFeatures.IsLegacyRequired {
fd.L1.Cardinality = protoreflect.Required
}
if rawTypeName != nil {
@@ -496,13 +501,11 @@ func (fd *Field) unmarshalOptions(b []byte) {
b = b[m:]
switch num {
case genid.FieldOptions_Packed_field_number:
- fd.L1.HasPacked = true
- fd.L1.IsPacked = protowire.DecodeBool(v)
+ fd.L1.EditionFeatures.IsPacked = protowire.DecodeBool(v)
case genid.FieldOptions_Weak_field_number:
fd.L1.IsWeak = protowire.DecodeBool(v)
case FieldOptions_EnforceUTF8:
- fd.L1.HasEnforceUTF8 = true
- fd.L1.EnforceUTF8 = protowire.DecodeBool(v)
+ fd.L1.EditionFeatures.IsUTF8Validated = protowire.DecodeBool(v)
}
case protowire.BytesType:
v, m := protowire.ConsumeBytes(b)
@@ -548,7 +551,6 @@ func (od *Oneof) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoref
func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) {
var rawTypeName []byte
var rawOptions []byte
- xd.L1.EditionFeatures = featuresFromParentDesc(xd.L1.Extendee)
xd.L2 = new(ExtensionL2)
for len(b) > 0 {
num, typ, n := protowire.ConsumeTag(b)
@@ -572,7 +574,6 @@ func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) {
case genid.FieldDescriptorProto_TypeName_field_number:
rawTypeName = v
case genid.FieldDescriptorProto_Options_field_number:
- xd.unmarshalOptions(v)
rawOptions = appendOptions(rawOptions, v)
}
default:
@@ -580,12 +581,6 @@ func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) {
b = b[m:]
}
}
- if xd.Syntax() == protoreflect.Editions && xd.L1.Kind == protoreflect.MessageKind && xd.L1.EditionFeatures.IsDelimitedEncoded {
- xd.L1.Kind = protoreflect.GroupKind
- }
- if xd.Syntax() == protoreflect.Editions && xd.L1.EditionFeatures.IsLegacyRequired {
- xd.L1.Cardinality = protoreflect.Required
- }
if rawTypeName != nil {
name := makeFullName(sb, rawTypeName)
switch xd.L1.Kind {
@@ -598,32 +593,6 @@ func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) {
xd.L2.Options = xd.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Field, rawOptions)
}
-func (xd *Extension) unmarshalOptions(b []byte) {
- for len(b) > 0 {
- num, typ, n := protowire.ConsumeTag(b)
- b = b[n:]
- switch typ {
- case protowire.VarintType:
- v, m := protowire.ConsumeVarint(b)
- b = b[m:]
- switch num {
- case genid.FieldOptions_Packed_field_number:
- xd.L2.IsPacked = protowire.DecodeBool(v)
- }
- case protowire.BytesType:
- v, m := protowire.ConsumeBytes(b)
- b = b[m:]
- switch num {
- case genid.FieldOptions_Features_field_number:
- xd.L1.EditionFeatures = unmarshalFeatureSet(v, xd.L1.EditionFeatures)
- }
- default:
- m := protowire.ConsumeFieldValue(num, typ, b)
- b = b[m:]
- }
- }
-}
-
func (sd *Service) unmarshalFull(b []byte, sb *strs.Builder) {
var rawMethods [][]byte
var rawOptions []byte
diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go
index 30db19fdc..f4107c05f 100644
--- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go
+++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go
@@ -8,6 +8,7 @@ package filedesc
import (
"fmt"
+ "strings"
"sync"
"google.golang.org/protobuf/internal/descfmt"
@@ -198,6 +199,16 @@ func (p *Fields) lazyInit() *Fields {
if _, ok := p.byText[d.TextName()]; !ok {
p.byText[d.TextName()] = d
}
+ if isGroupLike(d) {
+ lowerJSONName := strings.ToLower(d.JSONName())
+ if _, ok := p.byJSON[lowerJSONName]; !ok {
+ p.byJSON[lowerJSONName] = d
+ }
+ lowerTextName := strings.ToLower(d.TextName())
+ if _, ok := p.byText[lowerTextName]; !ok {
+ p.byText[lowerTextName] = d
+ }
+ }
if _, ok := p.byNum[d.Number()]; !ok {
p.byNum[d.Number()] = d
}
diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/editions.go b/vendor/google.golang.org/protobuf/internal/filedesc/editions.go
index 0375a49d4..11f5f356b 100644
--- a/vendor/google.golang.org/protobuf/internal/filedesc/editions.go
+++ b/vendor/google.golang.org/protobuf/internal/filedesc/editions.go
@@ -14,9 +14,13 @@ import (
)
var defaultsCache = make(map[Edition]EditionFeatures)
+var defaultsKeys = []Edition{}
func init() {
unmarshalEditionDefaults(editiondefaults.Defaults)
+ SurrogateProto2.L1.EditionFeatures = getFeaturesFor(EditionProto2)
+ SurrogateProto3.L1.EditionFeatures = getFeaturesFor(EditionProto3)
+ SurrogateEdition2023.L1.EditionFeatures = getFeaturesFor(Edition2023)
}
func unmarshalGoFeature(b []byte, parent EditionFeatures) EditionFeatures {
@@ -104,12 +108,15 @@ func unmarshalEditionDefault(b []byte) {
v, m := protowire.ConsumeBytes(b)
b = b[m:]
switch num {
- case genid.FeatureSetDefaults_FeatureSetEditionDefault_Features_field_number:
+ case genid.FeatureSetDefaults_FeatureSetEditionDefault_FixedFeatures_field_number:
+ fs = unmarshalFeatureSet(v, fs)
+ case genid.FeatureSetDefaults_FeatureSetEditionDefault_OverridableFeatures_field_number:
fs = unmarshalFeatureSet(v, fs)
}
}
}
defaultsCache[ed] = fs
+ defaultsKeys = append(defaultsKeys, ed)
}
func unmarshalEditionDefaults(b []byte) {
@@ -135,8 +142,15 @@ func unmarshalEditionDefaults(b []byte) {
}
func getFeaturesFor(ed Edition) EditionFeatures {
- if def, ok := defaultsCache[ed]; ok {
- return def
+ match := EditionUnknown
+ for _, key := range defaultsKeys {
+ if key > ed {
+ break
+ }
+ match = key
+ }
+ if match == EditionUnknown {
+ panic(fmt.Sprintf("unsupported edition: %v", ed))
}
- panic(fmt.Sprintf("unsupported edition: %v", ed))
+ return defaultsCache[match]
}
diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go b/vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go
index 28240ebc5..bfb3b8417 100644
--- a/vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go
+++ b/vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go
@@ -63,6 +63,7 @@ func (e PlaceholderEnum) Options() protoreflect.ProtoMessage { return des
func (e PlaceholderEnum) Values() protoreflect.EnumValueDescriptors { return emptyEnumValues }
func (e PlaceholderEnum) ReservedNames() protoreflect.Names { return emptyNames }
func (e PlaceholderEnum) ReservedRanges() protoreflect.EnumRanges { return emptyEnumRanges }
+func (e PlaceholderEnum) IsClosed() bool { return false }
func (e PlaceholderEnum) ProtoType(protoreflect.EnumDescriptor) { return }
func (e PlaceholderEnum) ProtoInternal(pragma.DoNotImplement) { return }
diff --git a/vendor/google.golang.org/protobuf/internal/filetype/build.go b/vendor/google.golang.org/protobuf/internal/filetype/build.go
index f0e38c4ef..ba83fea44 100644
--- a/vendor/google.golang.org/protobuf/internal/filetype/build.go
+++ b/vendor/google.golang.org/protobuf/internal/filetype/build.go
@@ -68,7 +68,7 @@ type Builder struct {
// and for input and output messages referenced by service methods.
// Dependencies must come after declarations, but the ordering of
// dependencies themselves is unspecified.
- GoTypes []interface{}
+ GoTypes []any
// DependencyIndexes is an ordered list of indexes into GoTypes for the
// dependencies of messages, extensions, or services.
@@ -268,7 +268,7 @@ func (x depIdxs) Get(i, j int32) int32 {
type (
resolverByIndex struct {
- goTypes []interface{}
+ goTypes []any
depIdxs depIdxs
fileRegistry
}
diff --git a/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go b/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go
index 40272c893..f30ab6b58 100644
--- a/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go
+++ b/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go
@@ -21,6 +21,7 @@ const (
// Enum values for google.protobuf.Edition.
const (
Edition_EDITION_UNKNOWN_enum_value = 0
+ Edition_EDITION_LEGACY_enum_value = 900
Edition_EDITION_PROTO2_enum_value = 998
Edition_EDITION_PROTO3_enum_value = 999
Edition_EDITION_2023_enum_value = 1000
@@ -653,6 +654,7 @@ const (
FieldOptions_Targets_field_name protoreflect.Name = "targets"
FieldOptions_EditionDefaults_field_name protoreflect.Name = "edition_defaults"
FieldOptions_Features_field_name protoreflect.Name = "features"
+ FieldOptions_FeatureSupport_field_name protoreflect.Name = "feature_support"
FieldOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
FieldOptions_Ctype_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.ctype"
@@ -667,6 +669,7 @@ const (
FieldOptions_Targets_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.targets"
FieldOptions_EditionDefaults_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.edition_defaults"
FieldOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.features"
+ FieldOptions_FeatureSupport_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.feature_support"
FieldOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.uninterpreted_option"
)
@@ -684,6 +687,7 @@ const (
FieldOptions_Targets_field_number protoreflect.FieldNumber = 19
FieldOptions_EditionDefaults_field_number protoreflect.FieldNumber = 20
FieldOptions_Features_field_number protoreflect.FieldNumber = 21
+ FieldOptions_FeatureSupport_field_number protoreflect.FieldNumber = 22
FieldOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
)
@@ -767,6 +771,33 @@ const (
FieldOptions_EditionDefault_Value_field_number protoreflect.FieldNumber = 2
)
+// Names for google.protobuf.FieldOptions.FeatureSupport.
+const (
+ FieldOptions_FeatureSupport_message_name protoreflect.Name = "FeatureSupport"
+ FieldOptions_FeatureSupport_message_fullname protoreflect.FullName = "google.protobuf.FieldOptions.FeatureSupport"
+)
+
+// Field names for google.protobuf.FieldOptions.FeatureSupport.
+const (
+ FieldOptions_FeatureSupport_EditionIntroduced_field_name protoreflect.Name = "edition_introduced"
+ FieldOptions_FeatureSupport_EditionDeprecated_field_name protoreflect.Name = "edition_deprecated"
+ FieldOptions_FeatureSupport_DeprecationWarning_field_name protoreflect.Name = "deprecation_warning"
+ FieldOptions_FeatureSupport_EditionRemoved_field_name protoreflect.Name = "edition_removed"
+
+ FieldOptions_FeatureSupport_EditionIntroduced_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.FeatureSupport.edition_introduced"
+ FieldOptions_FeatureSupport_EditionDeprecated_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.FeatureSupport.edition_deprecated"
+ FieldOptions_FeatureSupport_DeprecationWarning_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.FeatureSupport.deprecation_warning"
+ FieldOptions_FeatureSupport_EditionRemoved_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.FeatureSupport.edition_removed"
+)
+
+// Field numbers for google.protobuf.FieldOptions.FeatureSupport.
+const (
+ FieldOptions_FeatureSupport_EditionIntroduced_field_number protoreflect.FieldNumber = 1
+ FieldOptions_FeatureSupport_EditionDeprecated_field_number protoreflect.FieldNumber = 2
+ FieldOptions_FeatureSupport_DeprecationWarning_field_number protoreflect.FieldNumber = 3
+ FieldOptions_FeatureSupport_EditionRemoved_field_number protoreflect.FieldNumber = 4
+)
+
// Names for google.protobuf.OneofOptions.
const (
OneofOptions_message_name protoreflect.Name = "OneofOptions"
@@ -829,11 +860,13 @@ const (
EnumValueOptions_Deprecated_field_name protoreflect.Name = "deprecated"
EnumValueOptions_Features_field_name protoreflect.Name = "features"
EnumValueOptions_DebugRedact_field_name protoreflect.Name = "debug_redact"
+ EnumValueOptions_FeatureSupport_field_name protoreflect.Name = "feature_support"
EnumValueOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
EnumValueOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.deprecated"
EnumValueOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.features"
EnumValueOptions_DebugRedact_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.debug_redact"
+ EnumValueOptions_FeatureSupport_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.feature_support"
EnumValueOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.uninterpreted_option"
)
@@ -842,6 +875,7 @@ const (
EnumValueOptions_Deprecated_field_number protoreflect.FieldNumber = 1
EnumValueOptions_Features_field_number protoreflect.FieldNumber = 2
EnumValueOptions_DebugRedact_field_number protoreflect.FieldNumber = 3
+ EnumValueOptions_FeatureSupport_field_number protoreflect.FieldNumber = 4
EnumValueOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
)
@@ -1110,17 +1144,20 @@ const (
// Field names for google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.
const (
- FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_name protoreflect.Name = "edition"
- FeatureSetDefaults_FeatureSetEditionDefault_Features_field_name protoreflect.Name = "features"
+ FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_name protoreflect.Name = "edition"
+ FeatureSetDefaults_FeatureSetEditionDefault_OverridableFeatures_field_name protoreflect.Name = "overridable_features"
+ FeatureSetDefaults_FeatureSetEditionDefault_FixedFeatures_field_name protoreflect.Name = "fixed_features"
- FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.edition"
- FeatureSetDefaults_FeatureSetEditionDefault_Features_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features"
+ FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.edition"
+ FeatureSetDefaults_FeatureSetEditionDefault_OverridableFeatures_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridable_features"
+ FeatureSetDefaults_FeatureSetEditionDefault_FixedFeatures_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixed_features"
)
// Field numbers for google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.
const (
- FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_number protoreflect.FieldNumber = 3
- FeatureSetDefaults_FeatureSetEditionDefault_Features_field_number protoreflect.FieldNumber = 2
+ FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_number protoreflect.FieldNumber = 3
+ FeatureSetDefaults_FeatureSetEditionDefault_OverridableFeatures_field_number protoreflect.FieldNumber = 4
+ FeatureSetDefaults_FeatureSetEditionDefault_FixedFeatures_field_number protoreflect.FieldNumber = 5
)
// Names for google.protobuf.SourceCodeInfo.
diff --git a/vendor/google.golang.org/protobuf/internal/genid/go_features_gen.go b/vendor/google.golang.org/protobuf/internal/genid/go_features_gen.go
index fd9015e8e..9a652a2b4 100644
--- a/vendor/google.golang.org/protobuf/internal/genid/go_features_gen.go
+++ b/vendor/google.golang.org/protobuf/internal/genid/go_features_gen.go
@@ -10,7 +10,7 @@ import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
)
-const File_reflect_protodesc_proto_go_features_proto = "reflect/protodesc/proto/go_features.proto"
+const File_google_protobuf_go_features_proto = "google/protobuf/go_features.proto"
// Names for google.protobuf.GoFeatures.
const (
diff --git a/vendor/google.golang.org/protobuf/internal/impl/api_export.go b/vendor/google.golang.org/protobuf/internal/impl/api_export.go
index a371f98de..5d5771c2e 100644
--- a/vendor/google.golang.org/protobuf/internal/impl/api_export.go
+++ b/vendor/google.golang.org/protobuf/internal/impl/api_export.go
@@ -22,13 +22,13 @@ type Export struct{}
// NewError formats a string according to the format specifier and arguments and
// returns an error that has a "proto" prefix.
-func (Export) NewError(f string, x ...interface{}) error {
+func (Export) NewError(f string, x ...any) error {
return errors.New(f, x...)
}
// enum is any enum type generated by protoc-gen-go
// and must be a named int32 type.
-type enum = interface{}
+type enum = any
// EnumOf returns the protoreflect.Enum interface over e.
// It returns nil if e is nil.
@@ -81,7 +81,7 @@ func (Export) EnumStringOf(ed protoreflect.EnumDescriptor, n protoreflect.EnumNu
// message is any message type generated by protoc-gen-go
// and must be a pointer to a named struct type.
-type message = interface{}
+type message = any
// legacyMessageWrapper wraps a v2 message as a v1 message.
type legacyMessageWrapper struct{ m protoreflect.ProtoMessage }
diff --git a/vendor/google.golang.org/protobuf/internal/impl/checkinit.go b/vendor/google.golang.org/protobuf/internal/impl/checkinit.go
index bff041edc..f29e6a8fa 100644
--- a/vendor/google.golang.org/protobuf/internal/impl/checkinit.go
+++ b/vendor/google.golang.org/protobuf/internal/impl/checkinit.go
@@ -68,7 +68,7 @@ func (mi *MessageInfo) isInitExtensions(ext *map[int32]ExtensionField) error {
}
for _, x := range *ext {
ei := getExtensionFieldInfo(x.Type())
- if ei.funcs.isInit == nil {
+ if ei.funcs.isInit == nil || x.isUnexpandedLazy() {
continue
}
v := x.Value()
diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go b/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go
index 2b8f122c2..4bb0a7a20 100644
--- a/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go
+++ b/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go
@@ -99,6 +99,28 @@ func (f *ExtensionField) canLazy(xt protoreflect.ExtensionType) bool {
return false
}
+// isUnexpandedLazy returns true if the ExensionField is lazy and not
+// yet expanded, which means it's present and already checked for
+// initialized required fields.
+func (f *ExtensionField) isUnexpandedLazy() bool {
+ return f.lazy != nil && atomic.LoadUint32(&f.lazy.atomicOnce) == 0
+}
+
+// lazyBuffer retrieves the buffer for a lazy extension if it's not yet expanded.
+//
+// The returned buffer has to be kept over whatever operation we're planning,
+// as re-retrieving it will fail after the message is lazily decoded.
+func (f *ExtensionField) lazyBuffer() []byte {
+ // This function might be in the critical path, so check the atomic without
+ // taking a look first, then only take the lock if needed.
+ if !f.isUnexpandedLazy() {
+ return nil
+ }
+ f.lazy.mu.Lock()
+ defer f.lazy.mu.Unlock()
+ return f.lazy.b
+}
+
func (f *ExtensionField) lazyInit() {
f.lazy.mu.Lock()
defer f.lazy.mu.Unlock()
diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_field.go b/vendor/google.golang.org/protobuf/internal/impl/codec_field.go
index 3fadd241e..78ee47e44 100644
--- a/vendor/google.golang.org/protobuf/internal/impl/codec_field.go
+++ b/vendor/google.golang.org/protobuf/internal/impl/codec_field.go
@@ -233,9 +233,15 @@ func sizeMessageInfo(p pointer, f *coderFieldInfo, opts marshalOptions) int {
}
func appendMessageInfo(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
+ calculatedSize := f.mi.sizePointer(p.Elem(), opts)
b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, uint64(f.mi.sizePointer(p.Elem(), opts)))
- return f.mi.marshalAppendPointer(b, p.Elem(), opts)
+ b = protowire.AppendVarint(b, uint64(calculatedSize))
+ before := len(b)
+ b, err := f.mi.marshalAppendPointer(b, p.Elem(), opts)
+ if measuredSize := len(b) - before; calculatedSize != measuredSize && err == nil {
+ return nil, errors.MismatchedSizeCalculation(calculatedSize, measuredSize)
+ }
+ return b, err
}
func consumeMessageInfo(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
@@ -262,14 +268,21 @@ func isInitMessageInfo(p pointer, f *coderFieldInfo) error {
return f.mi.checkInitializedPointer(p.Elem())
}
-func sizeMessage(m proto.Message, tagsize int, _ marshalOptions) int {
- return protowire.SizeBytes(proto.Size(m)) + tagsize
+func sizeMessage(m proto.Message, tagsize int, opts marshalOptions) int {
+ return protowire.SizeBytes(opts.Options().Size(m)) + tagsize
}
func appendMessage(b []byte, m proto.Message, wiretag uint64, opts marshalOptions) ([]byte, error) {
+ mopts := opts.Options()
+ calculatedSize := mopts.Size(m)
b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendVarint(b, uint64(proto.Size(m)))
- return opts.Options().MarshalAppend(b, m)
+ b = protowire.AppendVarint(b, uint64(calculatedSize))
+ before := len(b)
+ b, err := mopts.MarshalAppend(b, m)
+ if measuredSize := len(b) - before; calculatedSize != measuredSize && err == nil {
+ return nil, errors.MismatchedSizeCalculation(calculatedSize, measuredSize)
+ }
+ return b, err
}
func consumeMessage(b []byte, m proto.Message, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, err error) {
@@ -405,8 +418,8 @@ func consumeGroupType(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInf
return f.mi.unmarshalPointer(b, p.Elem(), f.num, opts)
}
-func sizeGroup(m proto.Message, tagsize int, _ marshalOptions) int {
- return 2*tagsize + proto.Size(m)
+func sizeGroup(m proto.Message, tagsize int, opts marshalOptions) int {
+ return 2*tagsize + opts.Options().Size(m)
}
func appendGroup(b []byte, m proto.Message, wiretag uint64, opts marshalOptions) ([]byte, error) {
@@ -482,10 +495,14 @@ func appendMessageSliceInfo(b []byte, p pointer, f *coderFieldInfo, opts marshal
b = protowire.AppendVarint(b, f.wiretag)
siz := f.mi.sizePointer(v, opts)
b = protowire.AppendVarint(b, uint64(siz))
+ before := len(b)
b, err = f.mi.marshalAppendPointer(b, v, opts)
if err != nil {
return b, err
}
+ if measuredSize := len(b) - before; siz != measuredSize {
+ return nil, errors.MismatchedSizeCalculation(siz, measuredSize)
+ }
}
return b, nil
}
@@ -520,28 +537,34 @@ func isInitMessageSliceInfo(p pointer, f *coderFieldInfo) error {
return nil
}
-func sizeMessageSlice(p pointer, goType reflect.Type, tagsize int, _ marshalOptions) int {
+func sizeMessageSlice(p pointer, goType reflect.Type, tagsize int, opts marshalOptions) int {
+ mopts := opts.Options()
s := p.PointerSlice()
n := 0
for _, v := range s {
m := asMessage(v.AsValueOf(goType.Elem()))
- n += protowire.SizeBytes(proto.Size(m)) + tagsize
+ n += protowire.SizeBytes(mopts.Size(m)) + tagsize
}
return n
}
func appendMessageSlice(b []byte, p pointer, wiretag uint64, goType reflect.Type, opts marshalOptions) ([]byte, error) {
+ mopts := opts.Options()
s := p.PointerSlice()
var err error
for _, v := range s {
m := asMessage(v.AsValueOf(goType.Elem()))
b = protowire.AppendVarint(b, wiretag)
- siz := proto.Size(m)
+ siz := mopts.Size(m)
b = protowire.AppendVarint(b, uint64(siz))
- b, err = opts.Options().MarshalAppend(b, m)
+ before := len(b)
+ b, err = mopts.MarshalAppend(b, m)
if err != nil {
return b, err
}
+ if measuredSize := len(b) - before; siz != measuredSize {
+ return nil, errors.MismatchedSizeCalculation(siz, measuredSize)
+ }
}
return b, nil
}
@@ -582,11 +605,12 @@ func isInitMessageSlice(p pointer, goType reflect.Type) error {
// Slices of messages
func sizeMessageSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) int {
+ mopts := opts.Options()
list := listv.List()
n := 0
for i, llen := 0, list.Len(); i < llen; i++ {
m := list.Get(i).Message().Interface()
- n += protowire.SizeBytes(proto.Size(m)) + tagsize
+ n += protowire.SizeBytes(mopts.Size(m)) + tagsize
}
return n
}
@@ -597,13 +621,17 @@ func appendMessageSliceValue(b []byte, listv protoreflect.Value, wiretag uint64,
for i, llen := 0, list.Len(); i < llen; i++ {
m := list.Get(i).Message().Interface()
b = protowire.AppendVarint(b, wiretag)
- siz := proto.Size(m)
+ siz := mopts.Size(m)
b = protowire.AppendVarint(b, uint64(siz))
+ before := len(b)
var err error
b, err = mopts.MarshalAppend(b, m)
if err != nil {
return b, err
}
+ if measuredSize := len(b) - before; siz != measuredSize {
+ return nil, errors.MismatchedSizeCalculation(siz, measuredSize)
+ }
}
return b, nil
}
@@ -651,11 +679,12 @@ var coderMessageSliceValue = valueCoderFuncs{
}
func sizeGroupSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) int {
+ mopts := opts.Options()
list := listv.List()
n := 0
for i, llen := 0, list.Len(); i < llen; i++ {
m := list.Get(i).Message().Interface()
- n += 2*tagsize + proto.Size(m)
+ n += 2*tagsize + mopts.Size(m)
}
return n
}
@@ -738,12 +767,13 @@ func makeGroupSliceFieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type)
}
}
-func sizeGroupSlice(p pointer, messageType reflect.Type, tagsize int, _ marshalOptions) int {
+func sizeGroupSlice(p pointer, messageType reflect.Type, tagsize int, opts marshalOptions) int {
+ mopts := opts.Options()
s := p.PointerSlice()
n := 0
for _, v := range s {
m := asMessage(v.AsValueOf(messageType.Elem()))
- n += 2*tagsize + proto.Size(m)
+ n += 2*tagsize + mopts.Size(m)
}
return n
}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_map.go b/vendor/google.golang.org/protobuf/internal/impl/codec_map.go
index 111b9d16f..fb35f0bae 100644
--- a/vendor/google.golang.org/protobuf/internal/impl/codec_map.go
+++ b/vendor/google.golang.org/protobuf/internal/impl/codec_map.go
@@ -9,6 +9,7 @@ import (
"sort"
"google.golang.org/protobuf/encoding/protowire"
+ "google.golang.org/protobuf/internal/errors"
"google.golang.org/protobuf/internal/genid"
"google.golang.org/protobuf/reflect/protoreflect"
)
@@ -240,11 +241,16 @@ func appendMapItem(b []byte, keyrv, valrv reflect.Value, mapi *mapInfo, f *coder
size += mapi.keyFuncs.size(key.Value(), mapKeyTagSize, opts)
size += mapi.valFuncs.size(val, mapValTagSize, opts)
b = protowire.AppendVarint(b, uint64(size))
+ before := len(b)
b, err := mapi.keyFuncs.marshal(b, key.Value(), mapi.keyWiretag, opts)
if err != nil {
return nil, err
}
- return mapi.valFuncs.marshal(b, val, mapi.valWiretag, opts)
+ b, err = mapi.valFuncs.marshal(b, val, mapi.valWiretag, opts)
+ if measuredSize := len(b) - before; size != measuredSize && err == nil {
+ return nil, errors.MismatchedSizeCalculation(size, measuredSize)
+ }
+ return b, err
} else {
key := mapi.conv.keyConv.PBValueOf(keyrv).MapKey()
val := pointerOfValue(valrv)
@@ -259,7 +265,12 @@ func appendMapItem(b []byte, keyrv, valrv reflect.Value, mapi *mapInfo, f *coder
}
b = protowire.AppendVarint(b, mapi.valWiretag)
b = protowire.AppendVarint(b, uint64(valSize))
- return f.mi.marshalAppendPointer(b, val, opts)
+ before := len(b)
+ b, err = f.mi.marshalAppendPointer(b, val, opts)
+ if measuredSize := len(b) - before; valSize != measuredSize && err == nil {
+ return nil, errors.MismatchedSizeCalculation(valSize, measuredSize)
+ }
+ return b, err
}
}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go b/vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go
index b7a23faf1..7a16ec13d 100644
--- a/vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go
+++ b/vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go
@@ -26,6 +26,15 @@ func sizeMessageSet(mi *MessageInfo, p pointer, opts marshalOptions) (size int)
}
num, _ := protowire.DecodeTag(xi.wiretag)
size += messageset.SizeField(num)
+ if fullyLazyExtensions(opts) {
+ // Don't expand the extension, instead use the buffer to calculate size
+ if lb := x.lazyBuffer(); lb != nil {
+ // We got hold of the buffer, so it's still lazy.
+ // Don't count the tag size in the extension buffer, it's already added.
+ size += protowire.SizeTag(messageset.FieldMessage) + len(lb) - xi.tagsize
+ continue
+ }
+ }
size += xi.funcs.size(x.Value(), protowire.SizeTag(messageset.FieldMessage), opts)
}
@@ -85,6 +94,19 @@ func marshalMessageSetField(mi *MessageInfo, b []byte, x ExtensionField, opts ma
xi := getExtensionFieldInfo(x.Type())
num, _ := protowire.DecodeTag(xi.wiretag)
b = messageset.AppendFieldStart(b, num)
+
+ if fullyLazyExtensions(opts) {
+ // Don't expand the extension if it's still in wire format, instead use the buffer content.
+ if lb := x.lazyBuffer(); lb != nil {
+ // The tag inside the lazy buffer is a different tag (the extension
+ // number), but what we need here is the tag for FieldMessage:
+ b = protowire.AppendVarint(b, protowire.EncodeTag(messageset.FieldMessage, protowire.BytesType))
+ b = append(b, lb[xi.tagsize:]...)
+ b = messageset.AppendFieldEnd(b)
+ return b, nil
+ }
+ }
+
b, err := xi.funcs.marshal(b, x.Value(), protowire.EncodeTag(messageset.FieldMessage, protowire.BytesType), opts)
if err != nil {
return b, err
diff --git a/vendor/google.golang.org/protobuf/internal/impl/convert.go b/vendor/google.golang.org/protobuf/internal/impl/convert.go
index 185ef2efa..e06ece55a 100644
--- a/vendor/google.golang.org/protobuf/internal/impl/convert.go
+++ b/vendor/google.golang.org/protobuf/internal/impl/convert.go
@@ -14,7 +14,7 @@ import (
// unwrapper unwraps the value to the underlying value.
// This is implemented by List and Map.
type unwrapper interface {
- protoUnwrap() interface{}
+ protoUnwrap() any
}
// A Converter coverts to/from Go reflect.Value types and protobuf protoreflect.Value types.
diff --git a/vendor/google.golang.org/protobuf/internal/impl/convert_list.go b/vendor/google.golang.org/protobuf/internal/impl/convert_list.go
index f89136516..18cb96fd7 100644
--- a/vendor/google.golang.org/protobuf/internal/impl/convert_list.go
+++ b/vendor/google.golang.org/protobuf/internal/impl/convert_list.go
@@ -136,6 +136,6 @@ func (ls *listReflect) NewElement() protoreflect.Value {
func (ls *listReflect) IsValid() bool {
return !ls.v.IsNil()
}
-func (ls *listReflect) protoUnwrap() interface{} {
+func (ls *listReflect) protoUnwrap() any {
return ls.v.Interface()
}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/convert_map.go b/vendor/google.golang.org/protobuf/internal/impl/convert_map.go
index f30b0a057..304244a65 100644
--- a/vendor/google.golang.org/protobuf/internal/impl/convert_map.go
+++ b/vendor/google.golang.org/protobuf/internal/impl/convert_map.go
@@ -116,6 +116,6 @@ func (ms *mapReflect) NewValue() protoreflect.Value {
func (ms *mapReflect) IsValid() bool {
return !ms.v.IsNil()
}
-func (ms *mapReflect) protoUnwrap() interface{} {
+func (ms *mapReflect) protoUnwrap() any {
return ms.v.Interface()
}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/encode.go b/vendor/google.golang.org/protobuf/internal/impl/encode.go
index 845c67d6e..febd21224 100644
--- a/vendor/google.golang.org/protobuf/internal/impl/encode.go
+++ b/vendor/google.golang.org/protobuf/internal/impl/encode.go
@@ -49,8 +49,11 @@ func (mi *MessageInfo) sizePointer(p pointer, opts marshalOptions) (size int) {
return 0
}
if opts.UseCachedSize() && mi.sizecacheOffset.IsValid() {
- if size := atomic.LoadInt32(p.Apply(mi.sizecacheOffset).Int32()); size >= 0 {
- return int(size)
+ // The size cache contains the size + 1, to allow the
+ // zero value to be invalid, while also allowing for a
+ // 0 size to be cached.
+ if size := atomic.LoadInt32(p.Apply(mi.sizecacheOffset).Int32()); size > 0 {
+ return int(size - 1)
}
}
return mi.sizePointerSlow(p, opts)
@@ -60,7 +63,7 @@ func (mi *MessageInfo) sizePointerSlow(p pointer, opts marshalOptions) (size int
if flags.ProtoLegacy && mi.isMessageSet {
size = sizeMessageSet(mi, p, opts)
if mi.sizecacheOffset.IsValid() {
- atomic.StoreInt32(p.Apply(mi.sizecacheOffset).Int32(), int32(size))
+ atomic.StoreInt32(p.Apply(mi.sizecacheOffset).Int32(), int32(size+1))
}
return size
}
@@ -84,13 +87,16 @@ func (mi *MessageInfo) sizePointerSlow(p pointer, opts marshalOptions) (size int
}
}
if mi.sizecacheOffset.IsValid() {
- if size > math.MaxInt32 {
+ if size > (math.MaxInt32 - 1) {
// The size is too large for the int32 sizecache field.
// We will need to recompute the size when encoding;
// unfortunately expensive, but better than invalid output.
- atomic.StoreInt32(p.Apply(mi.sizecacheOffset).Int32(), -1)
+ atomic.StoreInt32(p.Apply(mi.sizecacheOffset).Int32(), 0)
} else {
- atomic.StoreInt32(p.Apply(mi.sizecacheOffset).Int32(), int32(size))
+ // The size cache contains the size + 1, to allow the
+ // zero value to be invalid, while also allowing for a
+ // 0 size to be cached.
+ atomic.StoreInt32(p.Apply(mi.sizecacheOffset).Int32(), int32(size+1))
}
}
return size
@@ -149,6 +155,14 @@ func (mi *MessageInfo) marshalAppendPointer(b []byte, p pointer, opts marshalOpt
return b, nil
}
+// fullyLazyExtensions returns true if we should attempt to keep extensions lazy over size and marshal.
+func fullyLazyExtensions(opts marshalOptions) bool {
+ // When deterministic marshaling is requested, force an unmarshal for lazy
+ // extensions to produce a deterministic result, instead of passing through
+ // bytes lazily that may or may not match what Go Protobuf would produce.
+ return opts.flags&piface.MarshalDeterministic == 0
+}
+
func (mi *MessageInfo) sizeExtensions(ext *map[int32]ExtensionField, opts marshalOptions) (n int) {
if ext == nil {
return 0
@@ -158,6 +172,14 @@ func (mi *MessageInfo) sizeExtensions(ext *map[int32]ExtensionField, opts marsha
if xi.funcs.size == nil {
continue
}
+ if fullyLazyExtensions(opts) {
+ // Don't expand the extension, instead use the buffer to calculate size
+ if lb := x.lazyBuffer(); lb != nil {
+ // We got hold of the buffer, so it's still lazy.
+ n += len(lb)
+ continue
+ }
+ }
n += xi.funcs.size(x.Value(), xi.tagsize, opts)
}
return n
@@ -176,6 +198,13 @@ func (mi *MessageInfo) appendExtensions(b []byte, ext *map[int32]ExtensionField,
var err error
for _, x := range *ext {
xi := getExtensionFieldInfo(x.Type())
+ if fullyLazyExtensions(opts) {
+ // Don't expand the extension if it's still in wire format, instead use the buffer content.
+ if lb := x.lazyBuffer(); lb != nil {
+ b = append(b, lb...)
+ continue
+ }
+ }
b, err = xi.funcs.marshal(b, x.Value(), xi.wiretag, opts)
}
return b, err
@@ -191,6 +220,13 @@ func (mi *MessageInfo) appendExtensions(b []byte, ext *map[int32]ExtensionField,
for _, k := range keys {
x := (*ext)[int32(k)]
xi := getExtensionFieldInfo(x.Type())
+ if fullyLazyExtensions(opts) {
+ // Don't expand the extension if it's still in wire format, instead use the buffer content.
+ if lb := x.lazyBuffer(); lb != nil {
+ b = append(b, lb...)
+ continue
+ }
+ }
b, err = xi.funcs.marshal(b, x.Value(), xi.wiretag, opts)
if err != nil {
return b, err
diff --git a/vendor/google.golang.org/protobuf/internal/impl/extension.go b/vendor/google.golang.org/protobuf/internal/impl/extension.go
index cb25b0bae..e31249f64 100644
--- a/vendor/google.golang.org/protobuf/internal/impl/extension.go
+++ b/vendor/google.golang.org/protobuf/internal/impl/extension.go
@@ -53,7 +53,7 @@ type ExtensionInfo struct {
// type returned by InterfaceOf may not be identical.
//
// Deprecated: Use InterfaceOf(xt.Zero()) instead.
- ExtensionType interface{}
+ ExtensionType any
// Field is the field number of the extension.
//
@@ -95,16 +95,16 @@ func (xi *ExtensionInfo) New() protoreflect.Value {
func (xi *ExtensionInfo) Zero() protoreflect.Value {
return xi.lazyInit().Zero()
}
-func (xi *ExtensionInfo) ValueOf(v interface{}) protoreflect.Value {
+func (xi *ExtensionInfo) ValueOf(v any) protoreflect.Value {
return xi.lazyInit().PBValueOf(reflect.ValueOf(v))
}
-func (xi *ExtensionInfo) InterfaceOf(v protoreflect.Value) interface{} {
+func (xi *ExtensionInfo) InterfaceOf(v protoreflect.Value) any {
return xi.lazyInit().GoValueOf(v).Interface()
}
func (xi *ExtensionInfo) IsValidValue(v protoreflect.Value) bool {
return xi.lazyInit().IsValidPB(v)
}
-func (xi *ExtensionInfo) IsValidInterface(v interface{}) bool {
+func (xi *ExtensionInfo) IsValidInterface(v any) bool {
return xi.lazyInit().IsValidGo(reflect.ValueOf(v))
}
func (xi *ExtensionInfo) TypeDescriptor() protoreflect.ExtensionTypeDescriptor {
diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go
index c2a803bb2..81b2b1a76 100644
--- a/vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go
+++ b/vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go
@@ -97,7 +97,7 @@ func (e *legacyEnumWrapper) Number() protoreflect.EnumNumber {
func (e *legacyEnumWrapper) ProtoReflect() protoreflect.Enum {
return e
}
-func (e *legacyEnumWrapper) protoUnwrap() interface{} {
+func (e *legacyEnumWrapper) protoUnwrap() any {
v := reflect.New(e.goTyp).Elem()
v.SetInt(int64(e.num))
return v.Interface()
@@ -167,6 +167,7 @@ func aberrantLoadEnumDesc(t reflect.Type) protoreflect.EnumDescriptor {
ed := &filedesc.Enum{L2: new(filedesc.EnumL2)}
ed.L0.FullName = AberrantDeriveFullName(t) // e.g., github_com.user.repo.MyEnum
ed.L0.ParentFile = filedesc.SurrogateProto3
+ ed.L1.EditionFeatures = ed.L0.ParentFile.L1.EditionFeatures
ed.L2.Values.List = append(ed.L2.Values.List, filedesc.EnumValue{})
// TODO: Use the presence of a UnmarshalJSON method to determine proto2?
diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go
index 87b30d050..6e8677ee6 100644
--- a/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go
+++ b/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go
@@ -118,7 +118,7 @@ func (xi *ExtensionInfo) initFromLegacy() {
xd.L1.Number = protoreflect.FieldNumber(xi.Field)
xd.L1.Cardinality = fd.L1.Cardinality
xd.L1.Kind = fd.L1.Kind
- xd.L2.IsPacked = fd.L1.IsPacked
+ xd.L1.EditionFeatures = fd.L1.EditionFeatures
xd.L2.Default = fd.L1.Default
xd.L1.Extendee = Export{}.MessageDescriptorOf(xi.ExtendedType)
xd.L2.Enum = ed
diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_file.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_file.go
index 9ab091086..b649f1124 100644
--- a/vendor/google.golang.org/protobuf/internal/impl/legacy_file.go
+++ b/vendor/google.golang.org/protobuf/internal/impl/legacy_file.go
@@ -7,7 +7,7 @@ package impl
import (
"bytes"
"compress/gzip"
- "io/ioutil"
+ "io"
"sync"
"google.golang.org/protobuf/internal/filedesc"
@@ -51,7 +51,7 @@ func legacyLoadFileDesc(b []byte) protoreflect.FileDescriptor {
if err != nil {
panic(err)
}
- b2, err := ioutil.ReadAll(zr)
+ b2, err := io.ReadAll(zr)
if err != nil {
panic(err)
}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go
index 2ab2c6297..bf0b6049b 100644
--- a/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go
+++ b/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go
@@ -204,6 +204,7 @@ func aberrantLoadMessageDescReentrant(t reflect.Type, name protoreflect.FullName
}
}
+ md.L1.EditionFeatures = md.L0.ParentFile.L1.EditionFeatures
// Obtain a list of oneof wrapper types.
var oneofWrappers []reflect.Type
methods := make([]reflect.Method, 0, 2)
@@ -215,7 +216,7 @@ func aberrantLoadMessageDescReentrant(t reflect.Type, name protoreflect.FullName
}
for _, fn := range methods {
for _, v := range fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))}) {
- if vs, ok := v.Interface().([]interface{}); ok {
+ if vs, ok := v.Interface().([]any); ok {
for _, v := range vs {
oneofWrappers = append(oneofWrappers, reflect.TypeOf(v))
}
@@ -250,6 +251,7 @@ func aberrantLoadMessageDescReentrant(t reflect.Type, name protoreflect.FullName
od := &md.L2.Oneofs.List[n]
od.L0.FullName = md.FullName().Append(protoreflect.Name(tag))
od.L0.ParentFile = md.L0.ParentFile
+ od.L1.EditionFeatures = md.L1.EditionFeatures
od.L0.Parent = md
od.L0.Index = n
@@ -260,6 +262,7 @@ func aberrantLoadMessageDescReentrant(t reflect.Type, name protoreflect.FullName
aberrantAppendField(md, f.Type, tag, "", "")
fd := &md.L2.Fields.List[len(md.L2.Fields.List)-1]
fd.L1.ContainingOneof = od
+ fd.L1.EditionFeatures = od.L1.EditionFeatures
od.L1.Fields.List = append(od.L1.Fields.List, fd)
}
}
@@ -307,14 +310,14 @@ func aberrantAppendField(md *filedesc.Message, goType reflect.Type, tag, tagKey,
fd.L0.Parent = md
fd.L0.Index = n
- if fd.L1.IsWeak || fd.L1.HasPacked {
+ if fd.L1.IsWeak || fd.L1.EditionFeatures.IsPacked {
fd.L1.Options = func() protoreflect.ProtoMessage {
opts := descopts.Field.ProtoReflect().New()
if fd.L1.IsWeak {
opts.Set(opts.Descriptor().Fields().ByName("weak"), protoreflect.ValueOfBool(true))
}
- if fd.L1.HasPacked {
- opts.Set(opts.Descriptor().Fields().ByName("packed"), protoreflect.ValueOfBool(fd.L1.IsPacked))
+ if fd.L1.EditionFeatures.IsPacked {
+ opts.Set(opts.Descriptor().Fields().ByName("packed"), protoreflect.ValueOfBool(fd.L1.EditionFeatures.IsPacked))
}
return opts.Interface()
}
@@ -344,6 +347,7 @@ func aberrantAppendField(md *filedesc.Message, goType reflect.Type, tag, tagKey,
md2.L0.ParentFile = md.L0.ParentFile
md2.L0.Parent = md
md2.L0.Index = n
+ md2.L1.EditionFeatures = md.L1.EditionFeatures
md2.L1.IsMapEntry = true
md2.L2.Options = func() protoreflect.ProtoMessage {
@@ -563,6 +567,6 @@ func (m aberrantMessage) IsValid() bool {
func (m aberrantMessage) ProtoMethods() *protoiface.Methods {
return aberrantProtoMethods
}
-func (m aberrantMessage) protoUnwrap() interface{} {
+func (m aberrantMessage) protoUnwrap() any {
return m.v.Interface()
}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/message.go b/vendor/google.golang.org/protobuf/internal/impl/message.go
index 629bacdce..019399d45 100644
--- a/vendor/google.golang.org/protobuf/internal/impl/message.go
+++ b/vendor/google.golang.org/protobuf/internal/impl/message.go
@@ -35,7 +35,7 @@ type MessageInfo struct {
Exporter exporter
// OneofWrappers is list of pointers to oneof wrapper struct types.
- OneofWrappers []interface{}
+ OneofWrappers []any
initMu sync.Mutex // protects all unexported fields
initDone uint32
@@ -47,7 +47,7 @@ type MessageInfo struct {
// exporter is a function that returns a reference to the ith field of v,
// where v is a pointer to a struct. It returns nil if it does not support
// exporting the requested field (e.g., already exported).
-type exporter func(v interface{}, i int) interface{}
+type exporter func(v any, i int) any
// getMessageInfo returns the MessageInfo for any message type that
// is generated by our implementation of protoc-gen-go (for v2 and on).
@@ -201,7 +201,7 @@ fieldLoop:
}
for _, fn := range methods {
for _, v := range fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))}) {
- if vs, ok := v.Interface().([]interface{}); ok {
+ if vs, ok := v.Interface().([]any); ok {
oneofWrappers = vs
}
}
@@ -256,7 +256,7 @@ func (mi *MessageInfo) Message(i int) protoreflect.MessageType {
type mapEntryType struct {
desc protoreflect.MessageDescriptor
- valType interface{} // zero value of enum or message type
+ valType any // zero value of enum or message type
}
func (mt mapEntryType) New() protoreflect.Message {
diff --git a/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go b/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go
index d9ea010be..ecb4623d7 100644
--- a/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go
+++ b/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go
@@ -20,7 +20,7 @@ type reflectMessageInfo struct {
// fieldTypes contains the zero value of an enum or message field.
// For lists, it contains the element type.
// For maps, it contains the entry value type.
- fieldTypes map[protoreflect.FieldNumber]interface{}
+ fieldTypes map[protoreflect.FieldNumber]any
// denseFields is a subset of fields where:
// 0 < fieldDesc.Number() < len(denseFields)
@@ -28,7 +28,7 @@ type reflectMessageInfo struct {
denseFields []*fieldInfo
// rangeInfos is a list of all fields (not belonging to a oneof) and oneofs.
- rangeInfos []interface{} // either *fieldInfo or *oneofInfo
+ rangeInfos []any // either *fieldInfo or *oneofInfo
getUnknown func(pointer) protoreflect.RawFields
setUnknown func(pointer, protoreflect.RawFields)
@@ -224,7 +224,7 @@ func (mi *MessageInfo) makeFieldTypes(si structInfo) {
}
if ft != nil {
if mi.fieldTypes == nil {
- mi.fieldTypes = make(map[protoreflect.FieldNumber]interface{})
+ mi.fieldTypes = make(map[protoreflect.FieldNumber]any)
}
mi.fieldTypes[fd.Number()] = reflect.Zero(ft).Interface()
}
@@ -247,39 +247,39 @@ func (m *extensionMap) Range(f func(protoreflect.FieldDescriptor, protoreflect.V
}
}
}
-func (m *extensionMap) Has(xt protoreflect.ExtensionType) (ok bool) {
+func (m *extensionMap) Has(xd protoreflect.ExtensionTypeDescriptor) (ok bool) {
if m == nil {
return false
}
- xd := xt.TypeDescriptor()
x, ok := (*m)[int32(xd.Number())]
if !ok {
return false
}
+ if x.isUnexpandedLazy() {
+ // Avoid calling x.Value(), which triggers a lazy unmarshal.
+ return true
+ }
switch {
case xd.IsList():
return x.Value().List().Len() > 0
case xd.IsMap():
return x.Value().Map().Len() > 0
- case xd.Message() != nil:
- return x.Value().Message().IsValid()
}
return true
}
-func (m *extensionMap) Clear(xt protoreflect.ExtensionType) {
- delete(*m, int32(xt.TypeDescriptor().Number()))
+func (m *extensionMap) Clear(xd protoreflect.ExtensionTypeDescriptor) {
+ delete(*m, int32(xd.Number()))
}
-func (m *extensionMap) Get(xt protoreflect.ExtensionType) protoreflect.Value {
- xd := xt.TypeDescriptor()
+func (m *extensionMap) Get(xd protoreflect.ExtensionTypeDescriptor) protoreflect.Value {
if m != nil {
if x, ok := (*m)[int32(xd.Number())]; ok {
return x.Value()
}
}
- return xt.Zero()
+ return xd.Type().Zero()
}
-func (m *extensionMap) Set(xt protoreflect.ExtensionType, v protoreflect.Value) {
- xd := xt.TypeDescriptor()
+func (m *extensionMap) Set(xd protoreflect.ExtensionTypeDescriptor, v protoreflect.Value) {
+ xt := xd.Type()
isValid := true
switch {
case !xt.IsValidValue(v):
@@ -292,7 +292,7 @@ func (m *extensionMap) Set(xt protoreflect.ExtensionType, v protoreflect.Value)
isValid = v.Message().IsValid()
}
if !isValid {
- panic(fmt.Sprintf("%v: assigning invalid value", xt.TypeDescriptor().FullName()))
+ panic(fmt.Sprintf("%v: assigning invalid value", xd.FullName()))
}
if *m == nil {
@@ -302,16 +302,15 @@ func (m *extensionMap) Set(xt protoreflect.ExtensionType, v protoreflect.Value)
x.Set(xt, v)
(*m)[int32(xd.Number())] = x
}
-func (m *extensionMap) Mutable(xt protoreflect.ExtensionType) protoreflect.Value {
- xd := xt.TypeDescriptor()
+func (m *extensionMap) Mutable(xd protoreflect.ExtensionTypeDescriptor) protoreflect.Value {
if xd.Kind() != protoreflect.MessageKind && xd.Kind() != protoreflect.GroupKind && !xd.IsList() && !xd.IsMap() {
panic("invalid Mutable on field with non-composite type")
}
if x, ok := (*m)[int32(xd.Number())]; ok {
return x.Value()
}
- v := xt.New()
- m.Set(xt, v)
+ v := xd.Type().New()
+ m.Set(xd, v)
return v
}
@@ -394,7 +393,7 @@ var (
// MessageOf returns a reflective view over a message. The input must be a
// pointer to a named Go struct. If the provided type has a ProtoReflect method,
// it must be implemented by calling this method.
-func (mi *MessageInfo) MessageOf(m interface{}) protoreflect.Message {
+func (mi *MessageInfo) MessageOf(m any) protoreflect.Message {
if reflect.TypeOf(m) != mi.GoReflectType {
panic(fmt.Sprintf("type mismatch: got %T, want %v", m, mi.GoReflectType))
}
@@ -422,13 +421,13 @@ func (m *messageIfaceWrapper) Reset() {
func (m *messageIfaceWrapper) ProtoReflect() protoreflect.Message {
return (*messageReflectWrapper)(m)
}
-func (m *messageIfaceWrapper) protoUnwrap() interface{} {
+func (m *messageIfaceWrapper) protoUnwrap() any {
return m.p.AsIfaceOf(m.mi.GoReflectType.Elem())
}
// checkField verifies that the provided field descriptor is valid.
// Exactly one of the returned values is populated.
-func (mi *MessageInfo) checkField(fd protoreflect.FieldDescriptor) (*fieldInfo, protoreflect.ExtensionType) {
+func (mi *MessageInfo) checkField(fd protoreflect.FieldDescriptor) (*fieldInfo, protoreflect.ExtensionTypeDescriptor) {
var fi *fieldInfo
if n := fd.Number(); 0 < n && int(n) < len(mi.denseFields) {
fi = mi.denseFields[n]
@@ -457,7 +456,7 @@ func (mi *MessageInfo) checkField(fd protoreflect.FieldDescriptor) (*fieldInfo,
if !ok {
panic(fmt.Sprintf("extension %v does not implement protoreflect.ExtensionTypeDescriptor", fd.FullName()))
}
- return nil, xtd.Type()
+ return nil, xtd
}
panic(fmt.Sprintf("field %v is invalid", fd.FullName()))
}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go b/vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go
index 741d6e5b6..99dc23c6f 100644
--- a/vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go
+++ b/vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go
@@ -23,12 +23,13 @@ func (m *messageState) New() protoreflect.Message {
func (m *messageState) Interface() protoreflect.ProtoMessage {
return m.protoUnwrap().(protoreflect.ProtoMessage)
}
-func (m *messageState) protoUnwrap() interface{} {
+func (m *messageState) protoUnwrap() any {
return m.pointer().AsIfaceOf(m.messageInfo().GoReflectType.Elem())
}
func (m *messageState) ProtoMethods() *protoiface.Methods {
- m.messageInfo().init()
- return &m.messageInfo().methods
+ mi := m.messageInfo()
+ mi.init()
+ return &mi.methods
}
// ProtoMessageInfo is a pseudo-internal API for allowing the v1 code
@@ -41,8 +42,9 @@ func (m *messageState) ProtoMessageInfo() *MessageInfo {
}
func (m *messageState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
- m.messageInfo().init()
- for _, ri := range m.messageInfo().rangeInfos {
+ mi := m.messageInfo()
+ mi.init()
+ for _, ri := range mi.rangeInfos {
switch ri := ri.(type) {
case *fieldInfo:
if ri.has(m.pointer()) {
@@ -52,77 +54,86 @@ func (m *messageState) Range(f func(protoreflect.FieldDescriptor, protoreflect.V
}
case *oneofInfo:
if n := ri.which(m.pointer()); n > 0 {
- fi := m.messageInfo().fields[n]
+ fi := mi.fields[n]
if !f(fi.fieldDesc, fi.get(m.pointer())) {
return
}
}
}
}
- m.messageInfo().extensionMap(m.pointer()).Range(f)
+ mi.extensionMap(m.pointer()).Range(f)
}
func (m *messageState) Has(fd protoreflect.FieldDescriptor) bool {
- m.messageInfo().init()
- if fi, xt := m.messageInfo().checkField(fd); fi != nil {
+ mi := m.messageInfo()
+ mi.init()
+ if fi, xd := mi.checkField(fd); fi != nil {
return fi.has(m.pointer())
} else {
- return m.messageInfo().extensionMap(m.pointer()).Has(xt)
+ return mi.extensionMap(m.pointer()).Has(xd)
}
}
func (m *messageState) Clear(fd protoreflect.FieldDescriptor) {
- m.messageInfo().init()
- if fi, xt := m.messageInfo().checkField(fd); fi != nil {
+ mi := m.messageInfo()
+ mi.init()
+ if fi, xd := mi.checkField(fd); fi != nil {
fi.clear(m.pointer())
} else {
- m.messageInfo().extensionMap(m.pointer()).Clear(xt)
+ mi.extensionMap(m.pointer()).Clear(xd)
}
}
func (m *messageState) Get(fd protoreflect.FieldDescriptor) protoreflect.Value {
- m.messageInfo().init()
- if fi, xt := m.messageInfo().checkField(fd); fi != nil {
+ mi := m.messageInfo()
+ mi.init()
+ if fi, xd := mi.checkField(fd); fi != nil {
return fi.get(m.pointer())
} else {
- return m.messageInfo().extensionMap(m.pointer()).Get(xt)
+ return mi.extensionMap(m.pointer()).Get(xd)
}
}
func (m *messageState) Set(fd protoreflect.FieldDescriptor, v protoreflect.Value) {
- m.messageInfo().init()
- if fi, xt := m.messageInfo().checkField(fd); fi != nil {
+ mi := m.messageInfo()
+ mi.init()
+ if fi, xd := mi.checkField(fd); fi != nil {
fi.set(m.pointer(), v)
} else {
- m.messageInfo().extensionMap(m.pointer()).Set(xt, v)
+ mi.extensionMap(m.pointer()).Set(xd, v)
}
}
func (m *messageState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
- m.messageInfo().init()
- if fi, xt := m.messageInfo().checkField(fd); fi != nil {
+ mi := m.messageInfo()
+ mi.init()
+ if fi, xd := mi.checkField(fd); fi != nil {
return fi.mutable(m.pointer())
} else {
- return m.messageInfo().extensionMap(m.pointer()).Mutable(xt)
+ return mi.extensionMap(m.pointer()).Mutable(xd)
}
}
func (m *messageState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
- m.messageInfo().init()
- if fi, xt := m.messageInfo().checkField(fd); fi != nil {
+ mi := m.messageInfo()
+ mi.init()
+ if fi, xd := mi.checkField(fd); fi != nil {
return fi.newField()
} else {
- return xt.New()
+ return xd.Type().New()
}
}
func (m *messageState) WhichOneof(od protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
- m.messageInfo().init()
- if oi := m.messageInfo().oneofs[od.Name()]; oi != nil && oi.oneofDesc == od {
+ mi := m.messageInfo()
+ mi.init()
+ if oi := mi.oneofs[od.Name()]; oi != nil && oi.oneofDesc == od {
return od.Fields().ByNumber(oi.which(m.pointer()))
}
panic("invalid oneof descriptor " + string(od.FullName()) + " for message " + string(m.Descriptor().FullName()))
}
func (m *messageState) GetUnknown() protoreflect.RawFields {
- m.messageInfo().init()
- return m.messageInfo().getUnknown(m.pointer())
+ mi := m.messageInfo()
+ mi.init()
+ return mi.getUnknown(m.pointer())
}
func (m *messageState) SetUnknown(b protoreflect.RawFields) {
- m.messageInfo().init()
- m.messageInfo().setUnknown(m.pointer(), b)
+ mi := m.messageInfo()
+ mi.init()
+ mi.setUnknown(m.pointer(), b)
}
func (m *messageState) IsValid() bool {
return !m.pointer().IsNil()
@@ -143,12 +154,13 @@ func (m *messageReflectWrapper) Interface() protoreflect.ProtoMessage {
}
return (*messageIfaceWrapper)(m)
}
-func (m *messageReflectWrapper) protoUnwrap() interface{} {
+func (m *messageReflectWrapper) protoUnwrap() any {
return m.pointer().AsIfaceOf(m.messageInfo().GoReflectType.Elem())
}
func (m *messageReflectWrapper) ProtoMethods() *protoiface.Methods {
- m.messageInfo().init()
- return &m.messageInfo().methods
+ mi := m.messageInfo()
+ mi.init()
+ return &mi.methods
}
// ProtoMessageInfo is a pseudo-internal API for allowing the v1 code
@@ -161,8 +173,9 @@ func (m *messageReflectWrapper) ProtoMessageInfo() *MessageInfo {
}
func (m *messageReflectWrapper) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
- m.messageInfo().init()
- for _, ri := range m.messageInfo().rangeInfos {
+ mi := m.messageInfo()
+ mi.init()
+ for _, ri := range mi.rangeInfos {
switch ri := ri.(type) {
case *fieldInfo:
if ri.has(m.pointer()) {
@@ -172,77 +185,86 @@ func (m *messageReflectWrapper) Range(f func(protoreflect.FieldDescriptor, proto
}
case *oneofInfo:
if n := ri.which(m.pointer()); n > 0 {
- fi := m.messageInfo().fields[n]
+ fi := mi.fields[n]
if !f(fi.fieldDesc, fi.get(m.pointer())) {
return
}
}
}
}
- m.messageInfo().extensionMap(m.pointer()).Range(f)
+ mi.extensionMap(m.pointer()).Range(f)
}
func (m *messageReflectWrapper) Has(fd protoreflect.FieldDescriptor) bool {
- m.messageInfo().init()
- if fi, xt := m.messageInfo().checkField(fd); fi != nil {
+ mi := m.messageInfo()
+ mi.init()
+ if fi, xd := mi.checkField(fd); fi != nil {
return fi.has(m.pointer())
} else {
- return m.messageInfo().extensionMap(m.pointer()).Has(xt)
+ return mi.extensionMap(m.pointer()).Has(xd)
}
}
func (m *messageReflectWrapper) Clear(fd protoreflect.FieldDescriptor) {
- m.messageInfo().init()
- if fi, xt := m.messageInfo().checkField(fd); fi != nil {
+ mi := m.messageInfo()
+ mi.init()
+ if fi, xd := mi.checkField(fd); fi != nil {
fi.clear(m.pointer())
} else {
- m.messageInfo().extensionMap(m.pointer()).Clear(xt)
+ mi.extensionMap(m.pointer()).Clear(xd)
}
}
func (m *messageReflectWrapper) Get(fd protoreflect.FieldDescriptor) protoreflect.Value {
- m.messageInfo().init()
- if fi, xt := m.messageInfo().checkField(fd); fi != nil {
+ mi := m.messageInfo()
+ mi.init()
+ if fi, xd := mi.checkField(fd); fi != nil {
return fi.get(m.pointer())
} else {
- return m.messageInfo().extensionMap(m.pointer()).Get(xt)
+ return mi.extensionMap(m.pointer()).Get(xd)
}
}
func (m *messageReflectWrapper) Set(fd protoreflect.FieldDescriptor, v protoreflect.Value) {
- m.messageInfo().init()
- if fi, xt := m.messageInfo().checkField(fd); fi != nil {
+ mi := m.messageInfo()
+ mi.init()
+ if fi, xd := mi.checkField(fd); fi != nil {
fi.set(m.pointer(), v)
} else {
- m.messageInfo().extensionMap(m.pointer()).Set(xt, v)
+ mi.extensionMap(m.pointer()).Set(xd, v)
}
}
func (m *messageReflectWrapper) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
- m.messageInfo().init()
- if fi, xt := m.messageInfo().checkField(fd); fi != nil {
+ mi := m.messageInfo()
+ mi.init()
+ if fi, xd := mi.checkField(fd); fi != nil {
return fi.mutable(m.pointer())
} else {
- return m.messageInfo().extensionMap(m.pointer()).Mutable(xt)
+ return mi.extensionMap(m.pointer()).Mutable(xd)
}
}
func (m *messageReflectWrapper) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
- m.messageInfo().init()
- if fi, xt := m.messageInfo().checkField(fd); fi != nil {
+ mi := m.messageInfo()
+ mi.init()
+ if fi, xd := mi.checkField(fd); fi != nil {
return fi.newField()
} else {
- return xt.New()
+ return xd.Type().New()
}
}
func (m *messageReflectWrapper) WhichOneof(od protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
- m.messageInfo().init()
- if oi := m.messageInfo().oneofs[od.Name()]; oi != nil && oi.oneofDesc == od {
+ mi := m.messageInfo()
+ mi.init()
+ if oi := mi.oneofs[od.Name()]; oi != nil && oi.oneofDesc == od {
return od.Fields().ByNumber(oi.which(m.pointer()))
}
panic("invalid oneof descriptor " + string(od.FullName()) + " for message " + string(m.Descriptor().FullName()))
}
func (m *messageReflectWrapper) GetUnknown() protoreflect.RawFields {
- m.messageInfo().init()
- return m.messageInfo().getUnknown(m.pointer())
+ mi := m.messageInfo()
+ mi.init()
+ return mi.getUnknown(m.pointer())
}
func (m *messageReflectWrapper) SetUnknown(b protoreflect.RawFields) {
- m.messageInfo().init()
- m.messageInfo().setUnknown(m.pointer(), b)
+ mi := m.messageInfo()
+ mi.init()
+ mi.setUnknown(m.pointer(), b)
}
func (m *messageReflectWrapper) IsValid() bool {
return !m.pointer().IsNil()
diff --git a/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go b/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go
index 517e94434..da685e8a2 100644
--- a/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go
+++ b/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go
@@ -16,7 +16,7 @@ import (
const UnsafeEnabled = false
// Pointer is an opaque pointer type.
-type Pointer interface{}
+type Pointer any
// offset represents the offset to a struct field, accessible from a pointer.
// The offset is the field index into a struct.
@@ -62,7 +62,7 @@ func pointerOfValue(v reflect.Value) pointer {
}
// pointerOfIface returns the pointer portion of an interface.
-func pointerOfIface(v interface{}) pointer {
+func pointerOfIface(v any) pointer {
return pointer{v: reflect.ValueOf(v)}
}
@@ -93,7 +93,7 @@ func (p pointer) AsValueOf(t reflect.Type) reflect.Value {
// AsIfaceOf treats p as a pointer to an object of type t and returns the value.
// It is equivalent to p.AsValueOf(t).Interface()
-func (p pointer) AsIfaceOf(t reflect.Type) interface{} {
+func (p pointer) AsIfaceOf(t reflect.Type) any {
return p.AsValueOf(t).Interface()
}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go b/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go
index 4b020e311..5f20ca5d8 100644
--- a/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go
+++ b/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go
@@ -50,7 +50,7 @@ func pointerOfValue(v reflect.Value) pointer {
}
// pointerOfIface returns the pointer portion of an interface.
-func pointerOfIface(v interface{}) pointer {
+func pointerOfIface(v any) pointer {
type ifaceHeader struct {
Type unsafe.Pointer
Data unsafe.Pointer
@@ -80,7 +80,7 @@ func (p pointer) AsValueOf(t reflect.Type) reflect.Value {
// AsIfaceOf treats p as a pointer to an object of type t and returns the value.
// It is equivalent to p.AsValueOf(t).Interface()
-func (p pointer) AsIfaceOf(t reflect.Type) interface{} {
+func (p pointer) AsIfaceOf(t reflect.Type) any {
// TODO: Use tricky unsafe magic to directly create ifaceHeader.
return p.AsValueOf(t).Interface()
}
diff --git a/vendor/google.golang.org/protobuf/internal/order/range.go b/vendor/google.golang.org/protobuf/internal/order/range.go
index 1665a68e5..a1f09162d 100644
--- a/vendor/google.golang.org/protobuf/internal/order/range.go
+++ b/vendor/google.golang.org/protobuf/internal/order/range.go
@@ -18,7 +18,7 @@ type messageField struct {
}
var messageFieldPool = sync.Pool{
- New: func() interface{} { return new([]messageField) },
+ New: func() any { return new([]messageField) },
}
type (
@@ -69,7 +69,7 @@ type mapEntry struct {
}
var mapEntryPool = sync.Pool{
- New: func() interface{} { return new([]mapEntry) },
+ New: func() any { return new([]mapEntry) },
}
type (
diff --git a/vendor/google.golang.org/protobuf/internal/version/version.go b/vendor/google.golang.org/protobuf/internal/version/version.go
index a50fcfb49..dbbf1f686 100644
--- a/vendor/google.golang.org/protobuf/internal/version/version.go
+++ b/vendor/google.golang.org/protobuf/internal/version/version.go
@@ -51,8 +51,8 @@ import (
// 10. Send out the CL for review and submit it.
const (
Major = 1
- Minor = 33
- Patch = 0
+ Minor = 34
+ Patch = 2
PreRelease = ""
)
diff --git a/vendor/google.golang.org/protobuf/proto/decode.go b/vendor/google.golang.org/protobuf/proto/decode.go
index e5b03b567..d75a6534c 100644
--- a/vendor/google.golang.org/protobuf/proto/decode.go
+++ b/vendor/google.golang.org/protobuf/proto/decode.go
@@ -51,6 +51,8 @@ type UnmarshalOptions struct {
// Unmarshal parses the wire-format message in b and places the result in m.
// The provided message must be mutable (e.g., a non-nil pointer to a message).
+//
+// See the [UnmarshalOptions] type if you need more control.
func Unmarshal(b []byte, m Message) error {
_, err := UnmarshalOptions{RecursionLimit: protowire.DefaultRecursionLimit}.unmarshal(b, m.ProtoReflect())
return err
diff --git a/vendor/google.golang.org/protobuf/proto/encode.go b/vendor/google.golang.org/protobuf/proto/encode.go
index 4fed202f9..1f847bcc3 100644
--- a/vendor/google.golang.org/protobuf/proto/encode.go
+++ b/vendor/google.golang.org/protobuf/proto/encode.go
@@ -5,12 +5,17 @@
package proto
import (
+ "errors"
+ "fmt"
+
"google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/encoding/messageset"
"google.golang.org/protobuf/internal/order"
"google.golang.org/protobuf/internal/pragma"
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/runtime/protoiface"
+
+ protoerrors "google.golang.org/protobuf/internal/errors"
)
// MarshalOptions configures the marshaler.
@@ -70,7 +75,32 @@ type MarshalOptions struct {
UseCachedSize bool
}
+// flags turns the specified MarshalOptions (user-facing) into
+// protoiface.MarshalInputFlags (used internally by the marshaler).
+//
+// See impl.marshalOptions.Options for the inverse operation.
+func (o MarshalOptions) flags() protoiface.MarshalInputFlags {
+ var flags protoiface.MarshalInputFlags
+
+ // Note: o.AllowPartial is always forced to true by MarshalOptions.marshal,
+ // which is why it is not a part of MarshalInputFlags.
+
+ if o.Deterministic {
+ flags |= protoiface.MarshalDeterministic
+ }
+
+ if o.UseCachedSize {
+ flags |= protoiface.MarshalUseCachedSize
+ }
+
+ return flags
+}
+
// Marshal returns the wire-format encoding of m.
+//
+// This is the most common entry point for encoding a Protobuf message.
+//
+// See the [MarshalOptions] type if you need more control.
func Marshal(m Message) ([]byte, error) {
// Treat nil message interface as an empty message; nothing to output.
if m == nil {
@@ -116,6 +146,9 @@ func emptyBytesForMessage(m Message) []byte {
// MarshalAppend appends the wire-format encoding of m to b,
// returning the result.
+//
+// This is a less common entry point than [Marshal], which is only needed if you
+// need to supply your own buffers for performance reasons.
func (o MarshalOptions) MarshalAppend(b []byte, m Message) ([]byte, error) {
// Treat nil message interface as an empty message; nothing to append.
if m == nil {
@@ -145,12 +178,7 @@ func (o MarshalOptions) marshal(b []byte, m protoreflect.Message) (out protoifac
in := protoiface.MarshalInput{
Message: m,
Buf: b,
- }
- if o.Deterministic {
- in.Flags |= protoiface.MarshalDeterministic
- }
- if o.UseCachedSize {
- in.Flags |= protoiface.MarshalUseCachedSize
+ Flags: o.flags(),
}
if methods.Size != nil {
sout := methods.Size(protoiface.SizeInput{
@@ -168,6 +196,10 @@ func (o MarshalOptions) marshal(b []byte, m protoreflect.Message) (out protoifac
out.Buf, err = o.marshalMessageSlow(b, m)
}
if err != nil {
+ var mismatch *protoerrors.SizeMismatchError
+ if errors.As(err, &mismatch) {
+ return out, fmt.Errorf("marshaling %s: %v", string(m.Descriptor().FullName()), err)
+ }
return out, err
}
if allowPartial {
diff --git a/vendor/google.golang.org/protobuf/proto/extension.go b/vendor/google.golang.org/protobuf/proto/extension.go
index 17899a3a7..d248f2928 100644
--- a/vendor/google.golang.org/protobuf/proto/extension.go
+++ b/vendor/google.golang.org/protobuf/proto/extension.go
@@ -11,18 +11,21 @@ import (
// HasExtension reports whether an extension field is populated.
// It returns false if m is invalid or if xt does not extend m.
func HasExtension(m Message, xt protoreflect.ExtensionType) bool {
- // Treat nil message interface as an empty message; no populated fields.
- if m == nil {
+ // Treat nil message interface or descriptor as an empty message; no populated
+ // fields.
+ if m == nil || xt == nil {
return false
}
// As a special-case, we reports invalid or mismatching descriptors
// as always not being populated (since they aren't).
- if xt == nil || m.ProtoReflect().Descriptor() != xt.TypeDescriptor().ContainingMessage() {
+ mr := m.ProtoReflect()
+ xd := xt.TypeDescriptor()
+ if mr.Descriptor() != xd.ContainingMessage() {
return false
}
- return m.ProtoReflect().Has(xt.TypeDescriptor())
+ return mr.Has(xd)
}
// ClearExtension clears an extension field such that subsequent
@@ -36,7 +39,7 @@ func ClearExtension(m Message, xt protoreflect.ExtensionType) {
// If the field is unpopulated, it returns the default value for
// scalars and an immutable, empty value for lists or messages.
// It panics if xt does not extend m.
-func GetExtension(m Message, xt protoreflect.ExtensionType) interface{} {
+func GetExtension(m Message, xt protoreflect.ExtensionType) any {
// Treat nil message interface as an empty message; return the default.
if m == nil {
return xt.InterfaceOf(xt.Zero())
@@ -48,7 +51,7 @@ func GetExtension(m Message, xt protoreflect.ExtensionType) interface{} {
// SetExtension stores the value of an extension field.
// It panics if m is invalid, xt does not extend m, or if type of v
// is invalid for the specified extension field.
-func SetExtension(m Message, xt protoreflect.ExtensionType, v interface{}) {
+func SetExtension(m Message, xt protoreflect.ExtensionType, v any) {
xd := xt.TypeDescriptor()
pv := xt.ValueOf(v)
@@ -75,7 +78,7 @@ func SetExtension(m Message, xt protoreflect.ExtensionType, v interface{}) {
// It returns immediately if f returns false.
// While iterating, mutating operations may only be performed
// on the current extension field.
-func RangeExtensions(m Message, f func(protoreflect.ExtensionType, interface{}) bool) {
+func RangeExtensions(m Message, f func(protoreflect.ExtensionType, any) bool) {
// Treat nil message interface as an empty message; nothing to range over.
if m == nil {
return
diff --git a/vendor/google.golang.org/protobuf/proto/messageset.go b/vendor/google.golang.org/protobuf/proto/messageset.go
index 312d5d45c..575d14831 100644
--- a/vendor/google.golang.org/protobuf/proto/messageset.go
+++ b/vendor/google.golang.org/protobuf/proto/messageset.go
@@ -47,11 +47,16 @@ func (o MarshalOptions) marshalMessageSet(b []byte, m protoreflect.Message) ([]b
func (o MarshalOptions) marshalMessageSetField(b []byte, fd protoreflect.FieldDescriptor, value protoreflect.Value) ([]byte, error) {
b = messageset.AppendFieldStart(b, fd.Number())
b = protowire.AppendTag(b, messageset.FieldMessage, protowire.BytesType)
- b = protowire.AppendVarint(b, uint64(o.Size(value.Message().Interface())))
+ calculatedSize := o.Size(value.Message().Interface())
+ b = protowire.AppendVarint(b, uint64(calculatedSize))
+ before := len(b)
b, err := o.marshalMessage(b, value.Message())
if err != nil {
return b, err
}
+ if measuredSize := len(b) - before; calculatedSize != measuredSize {
+ return nil, errors.MismatchedSizeCalculation(calculatedSize, measuredSize)
+ }
b = messageset.AppendFieldEnd(b)
return b, nil
}
diff --git a/vendor/google.golang.org/protobuf/proto/size.go b/vendor/google.golang.org/protobuf/proto/size.go
index f1692b49b..052fb5ae3 100644
--- a/vendor/google.golang.org/protobuf/proto/size.go
+++ b/vendor/google.golang.org/protobuf/proto/size.go
@@ -34,6 +34,7 @@ func (o MarshalOptions) size(m protoreflect.Message) (size int) {
if methods != nil && methods.Size != nil {
out := methods.Size(protoiface.SizeInput{
Message: m,
+ Flags: o.flags(),
})
return out.Size
}
@@ -42,6 +43,7 @@ func (o MarshalOptions) size(m protoreflect.Message) (size int) {
// This case is mainly used for legacy types with a Marshal method.
out, _ := methods.Marshal(protoiface.MarshalInput{
Message: m,
+ Flags: o.flags(),
})
return len(out.Buf)
}
diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go b/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go
index baa0cc621..8fbecb4f5 100644
--- a/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go
+++ b/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go
@@ -13,6 +13,7 @@
package protodesc
import (
+ "google.golang.org/protobuf/internal/editionssupport"
"google.golang.org/protobuf/internal/errors"
"google.golang.org/protobuf/internal/filedesc"
"google.golang.org/protobuf/internal/pragma"
@@ -91,15 +92,17 @@ func (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (prot
switch fd.GetSyntax() {
case "proto2", "":
f.L1.Syntax = protoreflect.Proto2
+ f.L1.Edition = filedesc.EditionProto2
case "proto3":
f.L1.Syntax = protoreflect.Proto3
+ f.L1.Edition = filedesc.EditionProto3
case "editions":
f.L1.Syntax = protoreflect.Editions
f.L1.Edition = fromEditionProto(fd.GetEdition())
default:
return nil, errors.New("invalid syntax: %q", fd.GetSyntax())
}
- if f.L1.Syntax == protoreflect.Editions && (fd.GetEdition() < SupportedEditionsMinimum || fd.GetEdition() > SupportedEditionsMaximum) {
+ if f.L1.Syntax == protoreflect.Editions && (fd.GetEdition() < editionssupport.Minimum || fd.GetEdition() > editionssupport.Maximum) {
return nil, errors.New("use of edition %v not yet supported by the Go Protobuf runtime", fd.GetEdition())
}
f.L1.Path = fd.GetName()
@@ -114,9 +117,7 @@ func (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (prot
opts = proto.Clone(opts).(*descriptorpb.FileOptions)
f.L2.Options = func() protoreflect.ProtoMessage { return opts }
}
- if f.L1.Syntax == protoreflect.Editions {
- initFileDescFromFeatureSet(f, fd.GetOptions().GetFeatures())
- }
+ initFileDescFromFeatureSet(f, fd.GetOptions().GetFeatures())
f.L2.Imports = make(filedesc.FileImports, len(fd.GetDependency()))
for _, i := range fd.GetPublicDependency() {
@@ -219,10 +220,10 @@ func (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (prot
if err := validateEnumDeclarations(f.L1.Enums.List, fd.GetEnumType()); err != nil {
return nil, err
}
- if err := validateMessageDeclarations(f.L1.Messages.List, fd.GetMessageType()); err != nil {
+ if err := validateMessageDeclarations(f, f.L1.Messages.List, fd.GetMessageType()); err != nil {
return nil, err
}
- if err := validateExtensionDeclarations(f.L1.Extensions.List, fd.GetExtension()); err != nil {
+ if err := validateExtensionDeclarations(f, f.L1.Extensions.List, fd.GetExtension()); err != nil {
return nil, err
}
diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go
index b3278163c..856175542 100644
--- a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go
+++ b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go
@@ -69,9 +69,7 @@ func (r descsByName) initMessagesDeclarations(mds []*descriptorpb.DescriptorProt
if m.L0, err = r.makeBase(m, parent, md.GetName(), i, sb); err != nil {
return nil, err
}
- if m.Base.L0.ParentFile.Syntax() == protoreflect.Editions {
- m.L1.EditionFeatures = mergeEditionFeatures(parent, md.GetOptions().GetFeatures())
- }
+ m.L1.EditionFeatures = mergeEditionFeatures(parent, md.GetOptions().GetFeatures())
if opts := md.GetOptions(); opts != nil {
opts = proto.Clone(opts).(*descriptorpb.MessageOptions)
m.L2.Options = func() protoreflect.ProtoMessage { return opts }
@@ -146,13 +144,15 @@ func (r descsByName) initFieldsFromDescriptorProto(fds []*descriptorpb.FieldDesc
if f.L0, err = r.makeBase(f, parent, fd.GetName(), i, sb); err != nil {
return nil, err
}
+ f.L1.EditionFeatures = mergeEditionFeatures(parent, fd.GetOptions().GetFeatures())
f.L1.IsProto3Optional = fd.GetProto3Optional()
if opts := fd.GetOptions(); opts != nil {
opts = proto.Clone(opts).(*descriptorpb.FieldOptions)
f.L1.Options = func() protoreflect.ProtoMessage { return opts }
f.L1.IsWeak = opts.GetWeak()
- f.L1.HasPacked = opts.Packed != nil
- f.L1.IsPacked = opts.GetPacked()
+ if opts.Packed != nil {
+ f.L1.EditionFeatures.IsPacked = opts.GetPacked()
+ }
}
f.L1.Number = protoreflect.FieldNumber(fd.GetNumber())
f.L1.Cardinality = protoreflect.Cardinality(fd.GetLabel())
@@ -163,32 +163,12 @@ func (r descsByName) initFieldsFromDescriptorProto(fds []*descriptorpb.FieldDesc
f.L1.StringName.InitJSON(fd.GetJsonName())
}
- if f.Base.L0.ParentFile.Syntax() == protoreflect.Editions {
- f.L1.EditionFeatures = mergeEditionFeatures(parent, fd.GetOptions().GetFeatures())
-
- if f.L1.EditionFeatures.IsLegacyRequired {
- f.L1.Cardinality = protoreflect.Required
- }
- // We reuse the existing field because the old option `[packed =
- // true]` is mutually exclusive with the editions feature.
- if canBePacked(fd) {
- f.L1.HasPacked = true
- f.L1.IsPacked = f.L1.EditionFeatures.IsPacked
- }
-
- // We pretend this option is always explicitly set because the only
- // use of HasEnforceUTF8 is to determine whether to use EnforceUTF8
- // or to return the appropriate default.
- // When using editions we either parse the option or resolve the
- // appropriate default here (instead of later when this option is
- // requested from the descriptor).
- // In proto2/proto3 syntax HasEnforceUTF8 might be false.
- f.L1.HasEnforceUTF8 = true
- f.L1.EnforceUTF8 = f.L1.EditionFeatures.IsUTF8Validated
+ if f.L1.EditionFeatures.IsLegacyRequired {
+ f.L1.Cardinality = protoreflect.Required
+ }
- if f.L1.Kind == protoreflect.MessageKind && f.L1.EditionFeatures.IsDelimitedEncoded {
- f.L1.Kind = protoreflect.GroupKind
- }
+ if f.L1.Kind == protoreflect.MessageKind && f.L1.EditionFeatures.IsDelimitedEncoded {
+ f.L1.Kind = protoreflect.GroupKind
}
}
return fs, nil
@@ -201,12 +181,10 @@ func (r descsByName) initOneofsFromDescriptorProto(ods []*descriptorpb.OneofDesc
if o.L0, err = r.makeBase(o, parent, od.GetName(), i, sb); err != nil {
return nil, err
}
+ o.L1.EditionFeatures = mergeEditionFeatures(parent, od.GetOptions().GetFeatures())
if opts := od.GetOptions(); opts != nil {
opts = proto.Clone(opts).(*descriptorpb.OneofOptions)
o.L1.Options = func() protoreflect.ProtoMessage { return opts }
- if parent.Syntax() == protoreflect.Editions {
- o.L1.EditionFeatures = mergeEditionFeatures(parent, opts.GetFeatures())
- }
}
}
return os, nil
@@ -220,10 +198,13 @@ func (r descsByName) initExtensionDeclarations(xds []*descriptorpb.FieldDescript
if x.L0, err = r.makeBase(x, parent, xd.GetName(), i, sb); err != nil {
return nil, err
}
+ x.L1.EditionFeatures = mergeEditionFeatures(parent, xd.GetOptions().GetFeatures())
if opts := xd.GetOptions(); opts != nil {
opts = proto.Clone(opts).(*descriptorpb.FieldOptions)
x.L2.Options = func() protoreflect.ProtoMessage { return opts }
- x.L2.IsPacked = opts.GetPacked()
+ if opts.Packed != nil {
+ x.L1.EditionFeatures.IsPacked = opts.GetPacked()
+ }
}
x.L1.Number = protoreflect.FieldNumber(xd.GetNumber())
x.L1.Cardinality = protoreflect.Cardinality(xd.GetLabel())
diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_resolve.go b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_resolve.go
index 254ca5854..f3cebab29 100644
--- a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_resolve.go
+++ b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_resolve.go
@@ -46,6 +46,11 @@ func (r *resolver) resolveMessageDependencies(ms []filedesc.Message, mds []*desc
if f.L1.Kind, f.L1.Enum, f.L1.Message, err = r.findTarget(f.Kind(), f.Parent().FullName(), partialName(fd.GetTypeName()), f.IsWeak()); err != nil {
return errors.New("message field %q cannot resolve type: %v", f.FullName(), err)
}
+ if f.L1.Kind == protoreflect.GroupKind && (f.IsMap() || f.IsMapEntry()) {
+ // A map field might inherit delimited encoding from a file-wide default feature.
+ // But maps never actually use delimited encoding. (At least for now...)
+ f.L1.Kind = protoreflect.MessageKind
+ }
if fd.DefaultValue != nil {
v, ev, err := unmarshalDefault(fd.GetDefaultValue(), f, r.allowUnresolvable)
if err != nil {
diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go
index e4dcaf876..6de31c2eb 100644
--- a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go
+++ b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go
@@ -45,11 +45,11 @@ func validateEnumDeclarations(es []filedesc.Enum, eds []*descriptorpb.EnumDescri
if allowAlias && !foundAlias {
return errors.New("enum %q allows aliases, but none were found", e.FullName())
}
- if e.Syntax() == protoreflect.Proto3 {
+ if !e.IsClosed() {
if v := e.Values().Get(0); v.Number() != 0 {
- return errors.New("enum %q using proto3 semantics must have zero number for the first value", v.FullName())
+ return errors.New("enum %q using open semantics must have zero number for the first value", v.FullName())
}
- // Verify that value names in proto3 do not conflict if the
+ // Verify that value names in open enums do not conflict if the
// case-insensitive prefix is removed.
// See protoc v3.8.0: src/google/protobuf/descriptor.cc:4991-5055
names := map[string]protoreflect.EnumValueDescriptor{}
@@ -58,7 +58,7 @@ func validateEnumDeclarations(es []filedesc.Enum, eds []*descriptorpb.EnumDescri
v1 := e.Values().Get(i)
s := strs.EnumValueName(strs.TrimEnumPrefix(string(v1.Name()), prefix))
if v2, ok := names[s]; ok && v1.Number() != v2.Number() {
- return errors.New("enum %q using proto3 semantics has conflict: %q with %q", e.FullName(), v1.Name(), v2.Name())
+ return errors.New("enum %q using open semantics has conflict: %q with %q", e.FullName(), v1.Name(), v2.Name())
}
names[s] = v1
}
@@ -80,7 +80,9 @@ func validateEnumDeclarations(es []filedesc.Enum, eds []*descriptorpb.EnumDescri
return nil
}
-func validateMessageDeclarations(ms []filedesc.Message, mds []*descriptorpb.DescriptorProto) error {
+func validateMessageDeclarations(file *filedesc.File, ms []filedesc.Message, mds []*descriptorpb.DescriptorProto) error {
+ // There are a few limited exceptions only for proto3
+ isProto3 := file.L1.Edition == fromEditionProto(descriptorpb.Edition_EDITION_PROTO3)
for i, md := range mds {
m := &ms[i]
@@ -107,25 +109,13 @@ func validateMessageDeclarations(ms []filedesc.Message, mds []*descriptorpb.Desc
if isMessageSet && !flags.ProtoLegacy {
return errors.New("message %q is a MessageSet, which is a legacy proto1 feature that is no longer supported", m.FullName())
}
- if isMessageSet && (m.Syntax() == protoreflect.Proto3 || m.Fields().Len() > 0 || m.ExtensionRanges().Len() == 0) {
+ if isMessageSet && (isProto3 || m.Fields().Len() > 0 || m.ExtensionRanges().Len() == 0) {
return errors.New("message %q is an invalid proto1 MessageSet", m.FullName())
}
- if m.Syntax() == protoreflect.Proto3 {
+ if isProto3 {
if m.ExtensionRanges().Len() > 0 {
return errors.New("message %q using proto3 semantics cannot have extension ranges", m.FullName())
}
- // Verify that field names in proto3 do not conflict if lowercased
- // with all underscores removed.
- // See protoc v3.8.0: src/google/protobuf/descriptor.cc:5830-5847
- names := map[string]protoreflect.FieldDescriptor{}
- for i := 0; i < m.Fields().Len(); i++ {
- f1 := m.Fields().Get(i)
- s := strings.Replace(strings.ToLower(string(f1.Name())), "_", "", -1)
- if f2, ok := names[s]; ok {
- return errors.New("message %q using proto3 semantics has conflict: %q with %q", m.FullName(), f1.Name(), f2.Name())
- }
- names[s] = f1
- }
}
for j, fd := range md.GetField() {
@@ -149,7 +139,7 @@ func validateMessageDeclarations(ms []filedesc.Message, mds []*descriptorpb.Desc
return errors.New("message field %q may not have extendee: %q", f.FullName(), fd.GetExtendee())
}
if f.L1.IsProto3Optional {
- if f.Syntax() != protoreflect.Proto3 {
+ if !isProto3 {
return errors.New("message field %q under proto3 optional semantics must be specified in the proto3 syntax", f.FullName())
}
if f.Cardinality() != protoreflect.Optional {
@@ -162,26 +152,29 @@ func validateMessageDeclarations(ms []filedesc.Message, mds []*descriptorpb.Desc
if f.IsWeak() && !flags.ProtoLegacy {
return errors.New("message field %q is a weak field, which is a legacy proto1 feature that is no longer supported", f.FullName())
}
- if f.IsWeak() && (f.Syntax() != protoreflect.Proto2 || !isOptionalMessage(f) || f.ContainingOneof() != nil) {
+ if f.IsWeak() && (!f.HasPresence() || !isOptionalMessage(f) || f.ContainingOneof() != nil) {
return errors.New("message field %q may only be weak for an optional message", f.FullName())
}
if f.IsPacked() && !isPackable(f) {
return errors.New("message field %q is not packable", f.FullName())
}
- if err := checkValidGroup(f); err != nil {
+ if err := checkValidGroup(file, f); err != nil {
return errors.New("message field %q is an invalid group: %v", f.FullName(), err)
}
if err := checkValidMap(f); err != nil {
return errors.New("message field %q is an invalid map: %v", f.FullName(), err)
}
- if f.Syntax() == protoreflect.Proto3 {
+ if isProto3 {
if f.Cardinality() == protoreflect.Required {
return errors.New("message field %q using proto3 semantics cannot be required", f.FullName())
}
- if f.Enum() != nil && !f.Enum().IsPlaceholder() && f.Enum().Syntax() != protoreflect.Proto3 {
- return errors.New("message field %q using proto3 semantics may only depend on a proto3 enum", f.FullName())
+ if f.Enum() != nil && !f.Enum().IsPlaceholder() && f.Enum().IsClosed() {
+ return errors.New("message field %q using proto3 semantics may only depend on open enums", f.FullName())
}
}
+ if f.Cardinality() == protoreflect.Optional && !f.HasPresence() && f.Enum() != nil && !f.Enum().IsPlaceholder() && f.Enum().IsClosed() {
+ return errors.New("message field %q with implicit presence may only use open enums", f.FullName())
+ }
}
seenSynthetic := false // synthetic oneofs for proto3 optional must come after real oneofs
for j := range md.GetOneofDecl() {
@@ -215,17 +208,17 @@ func validateMessageDeclarations(ms []filedesc.Message, mds []*descriptorpb.Desc
if err := validateEnumDeclarations(m.L1.Enums.List, md.GetEnumType()); err != nil {
return err
}
- if err := validateMessageDeclarations(m.L1.Messages.List, md.GetNestedType()); err != nil {
+ if err := validateMessageDeclarations(file, m.L1.Messages.List, md.GetNestedType()); err != nil {
return err
}
- if err := validateExtensionDeclarations(m.L1.Extensions.List, md.GetExtension()); err != nil {
+ if err := validateExtensionDeclarations(file, m.L1.Extensions.List, md.GetExtension()); err != nil {
return err
}
}
return nil
}
-func validateExtensionDeclarations(xs []filedesc.Extension, xds []*descriptorpb.FieldDescriptorProto) error {
+func validateExtensionDeclarations(f *filedesc.File, xs []filedesc.Extension, xds []*descriptorpb.FieldDescriptorProto) error {
for i, xd := range xds {
x := &xs[i]
// NOTE: Avoid using the IsValid method since extensions to MessageSet
@@ -267,13 +260,13 @@ func validateExtensionDeclarations(xs []filedesc.Extension, xds []*descriptorpb.
if x.IsPacked() && !isPackable(x) {
return errors.New("extension field %q is not packable", x.FullName())
}
- if err := checkValidGroup(x); err != nil {
+ if err := checkValidGroup(f, x); err != nil {
return errors.New("extension field %q is an invalid group: %v", x.FullName(), err)
}
if md := x.Message(); md != nil && md.IsMapEntry() {
return errors.New("extension field %q cannot be a map entry", x.FullName())
}
- if x.Syntax() == protoreflect.Proto3 {
+ if f.L1.Edition == fromEditionProto(descriptorpb.Edition_EDITION_PROTO3) {
switch x.ContainingMessage().FullName() {
case (*descriptorpb.FileOptions)(nil).ProtoReflect().Descriptor().FullName():
case (*descriptorpb.EnumOptions)(nil).ProtoReflect().Descriptor().FullName():
@@ -309,21 +302,25 @@ func isPackable(fd protoreflect.FieldDescriptor) bool {
// checkValidGroup reports whether fd is a valid group according to the same
// rules that protoc imposes.
-func checkValidGroup(fd protoreflect.FieldDescriptor) error {
+func checkValidGroup(f *filedesc.File, fd protoreflect.FieldDescriptor) error {
md := fd.Message()
switch {
case fd.Kind() != protoreflect.GroupKind:
return nil
- case fd.Syntax() == protoreflect.Proto3:
+ case f.L1.Edition == fromEditionProto(descriptorpb.Edition_EDITION_PROTO3):
return errors.New("invalid under proto3 semantics")
case md == nil || md.IsPlaceholder():
return errors.New("message must be resolvable")
- case fd.FullName().Parent() != md.FullName().Parent():
- return errors.New("message and field must be declared in the same scope")
- case !unicode.IsUpper(rune(md.Name()[0])):
- return errors.New("message name must start with an uppercase")
- case fd.Name() != protoreflect.Name(strings.ToLower(string(md.Name()))):
- return errors.New("field name must be lowercased form of the message name")
+ }
+ if f.L1.Edition < fromEditionProto(descriptorpb.Edition_EDITION_2023) {
+ switch {
+ case fd.FullName().Parent() != md.FullName().Parent():
+ return errors.New("message and field must be declared in the same scope")
+ case !unicode.IsUpper(rune(md.Name()[0])):
+ return errors.New("message name must start with an uppercase")
+ case fd.Name() != protoreflect.Name(strings.ToLower(string(md.Name()))):
+ return errors.New("field name must be lowercased form of the message name")
+ }
}
return nil
}
diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/editions.go b/vendor/google.golang.org/protobuf/reflect/protodesc/editions.go
index 2a6b29d17..804830eda 100644
--- a/vendor/google.golang.org/protobuf/reflect/protodesc/editions.go
+++ b/vendor/google.golang.org/protobuf/reflect/protodesc/editions.go
@@ -17,11 +17,6 @@ import (
gofeaturespb "google.golang.org/protobuf/types/gofeaturespb"
)
-const (
- SupportedEditionsMinimum = descriptorpb.Edition_EDITION_PROTO2
- SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2023
-)
-
var defaults = &descriptorpb.FeatureSetDefaults{}
var defaultsCacheMu sync.Mutex
var defaultsCache = make(map[filedesc.Edition]*descriptorpb.FeatureSet)
@@ -67,18 +62,20 @@ func getFeatureSetFor(ed filedesc.Edition) *descriptorpb.FeatureSet {
fmt.Fprintf(os.Stderr, "internal error: unsupported edition %v (did you forget to update the embedded defaults (i.e. the bootstrap descriptor proto)?)\n", edpb)
os.Exit(1)
}
- fs := defaults.GetDefaults()[0].GetFeatures()
+ fsed := defaults.GetDefaults()[0]
// Using a linear search for now.
// Editions are guaranteed to be sorted and thus we could use a binary search.
// Given that there are only a handful of editions (with one more per year)
// there is not much reason to use a binary search.
for _, def := range defaults.GetDefaults() {
if def.GetEdition() <= edpb {
- fs = def.GetFeatures()
+ fsed = def
} else {
break
}
}
+ fs := proto.Clone(fsed.GetFixedFeatures()).(*descriptorpb.FeatureSet)
+ proto.Merge(fs, fsed.GetOverridableFeatures())
defaultsCache[ed] = fs
return fs
}
diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go b/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go
index 9d6e05420..a5de8d400 100644
--- a/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go
+++ b/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go
@@ -73,6 +73,16 @@ func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileD
if syntax := file.Syntax(); syntax != protoreflect.Proto2 && syntax.IsValid() {
p.Syntax = proto.String(file.Syntax().String())
}
+ if file.Syntax() == protoreflect.Editions {
+ desc := file
+ if fileImportDesc, ok := file.(protoreflect.FileImport); ok {
+ desc = fileImportDesc.FileDescriptor
+ }
+
+ if editionsInterface, ok := desc.(interface{ Edition() int32 }); ok {
+ p.Edition = descriptorpb.Edition(editionsInterface.Edition()).Enum()
+ }
+ }
return p
}
@@ -153,6 +163,18 @@ func ToFieldDescriptorProto(field protoreflect.FieldDescriptor) *descriptorpb.Fi
if field.Syntax() == protoreflect.Proto3 && field.HasOptionalKeyword() {
p.Proto3Optional = proto.Bool(true)
}
+ if field.Syntax() == protoreflect.Editions {
+ // Editions have no group keyword, this type is only set so that downstream users continue
+ // treating this as delimited encoding.
+ if p.GetType() == descriptorpb.FieldDescriptorProto_TYPE_GROUP {
+ p.Type = descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum()
+ }
+ // Editions have no required keyword, this label is only set so that downstream users continue
+ // treating it as required.
+ if p.GetLabel() == descriptorpb.FieldDescriptorProto_LABEL_REQUIRED {
+ p.Label = descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum()
+ }
+ }
if field.HasDefault() {
def, err := defval.Marshal(field.Default(), field.DefaultEnumValue(), field.Kind(), defval.Descriptor)
if err != nil && field.DefaultEnumValue() != nil {
diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go
index 00b01fbd8..c85bfaa5b 100644
--- a/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go
+++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go
@@ -161,7 +161,7 @@ const (
// IsValid reports whether the syntax is valid.
func (s Syntax) IsValid() bool {
switch s {
- case Proto2, Proto3:
+ case Proto2, Proto3, Editions:
return true
default:
return false
diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go
index 7dcc2ff09..ea154eec4 100644
--- a/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go
+++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go
@@ -373,6 +373,8 @@ func (p *SourcePath) appendFieldOptions(b []byte) []byte {
b = p.appendRepeatedField(b, "edition_defaults", (*SourcePath).appendFieldOptions_EditionDefault)
case 21:
b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
+ case 22:
+ b = p.appendSingularField(b, "feature_support", (*SourcePath).appendFieldOptions_FeatureSupport)
case 999:
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
}
@@ -483,6 +485,8 @@ func (p *SourcePath) appendEnumValueOptions(b []byte) []byte {
b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
case 3:
b = p.appendSingularField(b, "debug_redact", nil)
+ case 4:
+ b = p.appendSingularField(b, "feature_support", (*SourcePath).appendFieldOptions_FeatureSupport)
case 999:
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
}
@@ -519,6 +523,23 @@ func (p *SourcePath) appendFieldOptions_EditionDefault(b []byte) []byte {
return b
}
+func (p *SourcePath) appendFieldOptions_FeatureSupport(b []byte) []byte {
+ if len(*p) == 0 {
+ return b
+ }
+ switch (*p)[0] {
+ case 1:
+ b = p.appendSingularField(b, "edition_introduced", nil)
+ case 2:
+ b = p.appendSingularField(b, "edition_deprecated", nil)
+ case 3:
+ b = p.appendSingularField(b, "deprecation_warning", nil)
+ case 4:
+ b = p.appendSingularField(b, "edition_removed", nil)
+ }
+ return b
+}
+
func (p *SourcePath) appendUninterpretedOption_NamePart(b []byte) []byte {
if len(*p) == 0 {
return b
diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go
index 60ff62b4c..cd8fadbaf 100644
--- a/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go
+++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go
@@ -510,7 +510,7 @@ type ExtensionType interface {
//
// ValueOf is more extensive than protoreflect.ValueOf for a given field's
// value as it has more type information available.
- ValueOf(interface{}) Value
+ ValueOf(any) Value
// InterfaceOf completely unwraps the Value to the underlying Go type.
// InterfaceOf panics if the input is nil or does not represent the
@@ -519,13 +519,13 @@ type ExtensionType interface {
//
// InterfaceOf is able to unwrap the Value further than Value.Interface
// as it has more type information available.
- InterfaceOf(Value) interface{}
+ InterfaceOf(Value) any
// IsValidValue reports whether the Value is valid to assign to the field.
IsValidValue(Value) bool
// IsValidInterface reports whether the input is valid to assign to the field.
- IsValidInterface(interface{}) bool
+ IsValidInterface(any) bool
}
// EnumDescriptor describes an enum and
@@ -544,6 +544,12 @@ type EnumDescriptor interface {
// ReservedRanges is a list of reserved ranges of enum numbers.
ReservedRanges() EnumRanges
+ // IsClosed reports whether this enum uses closed semantics.
+ // See https://protobuf.dev/programming-guides/enum/#definitions.
+ // Note: the Go protobuf implementation is not spec compliant and treats
+ // all enums as open enums.
+ IsClosed() bool
+
isEnumDescriptor
}
type isEnumDescriptor interface{ ProtoType(EnumDescriptor) }
diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go
index 7ced876f4..75f83a2af 100644
--- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go
+++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go
@@ -32,11 +32,11 @@ const (
type value struct {
pragma.DoNotCompare // 0B
- typ valueType // 8B
- num uint64 // 8B
- str string // 16B
- bin []byte // 24B
- iface interface{} // 16B
+ typ valueType // 8B
+ num uint64 // 8B
+ str string // 16B
+ bin []byte // 24B
+ iface any // 16B
}
func valueOfString(v string) Value {
@@ -45,7 +45,7 @@ func valueOfString(v string) Value {
func valueOfBytes(v []byte) Value {
return Value{typ: bytesType, bin: v}
}
-func valueOfIface(v interface{}) Value {
+func valueOfIface(v any) Value {
return Value{typ: ifaceType, iface: v}
}
@@ -55,6 +55,6 @@ func (v Value) getString() string {
func (v Value) getBytes() []byte {
return v.bin
}
-func (v Value) getIface() interface{} {
+func (v Value) getIface() any {
return v.iface
}
diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go
index 160309731..9fe83cef5 100644
--- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go
+++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go
@@ -69,8 +69,8 @@ import (
// composite Value. Modifying an empty, read-only value panics.
type Value value
-// The protoreflect API uses a custom Value union type instead of interface{}
-// to keep the future open for performance optimizations. Using an interface{}
+// The protoreflect API uses a custom Value union type instead of any
+// to keep the future open for performance optimizations. Using an any
// always incurs an allocation for primitives (e.g., int64) since it needs to
// be boxed on the heap (as interfaces can only contain pointers natively).
// Instead, we represent the Value union as a flat struct that internally keeps
@@ -85,7 +85,7 @@ type Value value
// ValueOf returns a Value initialized with the concrete value stored in v.
// This panics if the type does not match one of the allowed types in the
// Value union.
-func ValueOf(v interface{}) Value {
+func ValueOf(v any) Value {
switch v := v.(type) {
case nil:
return Value{}
@@ -192,10 +192,10 @@ func (v Value) IsValid() bool {
return v.typ != nilType
}
-// Interface returns v as an interface{}.
+// Interface returns v as an any.
//
// Invariant: v == ValueOf(v).Interface()
-func (v Value) Interface() interface{} {
+func (v Value) Interface() any {
switch v.typ {
case nilType:
return nil
@@ -406,8 +406,8 @@ func (k MapKey) IsValid() bool {
return Value(k).IsValid()
}
-// Interface returns k as an interface{}.
-func (k MapKey) Interface() interface{} {
+// Interface returns k as an any.
+func (k MapKey) Interface() any {
return Value(k).Interface()
}
diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go120.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go120.go
index b1fdbe3e8..7f3583ead 100644
--- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go120.go
+++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go120.go
@@ -45,7 +45,7 @@ var (
// typeOf returns a pointer to the Go type information.
// The pointer is comparable and equal if and only if the types are identical.
-func typeOf(t interface{}) unsafe.Pointer {
+func typeOf(t any) unsafe.Pointer {
return (*ifaceHeader)(unsafe.Pointer(&t)).Type
}
@@ -80,7 +80,7 @@ func valueOfBytes(v []byte) Value {
p := (*sliceHeader)(unsafe.Pointer(&v))
return Value{typ: bytesType, ptr: p.Data, num: uint64(len(v))}
}
-func valueOfIface(v interface{}) Value {
+func valueOfIface(v any) Value {
p := (*ifaceHeader)(unsafe.Pointer(&v))
return Value{typ: p.Type, ptr: p.Data}
}
@@ -93,7 +93,7 @@ func (v Value) getBytes() (x []byte) {
*(*sliceHeader)(unsafe.Pointer(&x)) = sliceHeader{Data: v.ptr, Len: int(v.num), Cap: int(v.num)}
return x
}
-func (v Value) getIface() (x interface{}) {
+func (v Value) getIface() (x any) {
*(*ifaceHeader)(unsafe.Pointer(&x)) = ifaceHeader{Type: v.typ, Data: v.ptr}
return x
}
diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go
index 435470111..f7d386990 100644
--- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go
+++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go
@@ -15,7 +15,7 @@ import (
type (
ifaceHeader struct {
- _ [0]interface{} // if interfaces have greater alignment than unsafe.Pointer, this will enforce it.
+ _ [0]any // if interfaces have greater alignment than unsafe.Pointer, this will enforce it.
Type unsafe.Pointer
Data unsafe.Pointer
}
@@ -37,7 +37,7 @@ var (
// typeOf returns a pointer to the Go type information.
// The pointer is comparable and equal if and only if the types are identical.
-func typeOf(t interface{}) unsafe.Pointer {
+func typeOf(t any) unsafe.Pointer {
return (*ifaceHeader)(unsafe.Pointer(&t)).Type
}
@@ -70,7 +70,7 @@ func valueOfString(v string) Value {
func valueOfBytes(v []byte) Value {
return Value{typ: bytesType, ptr: unsafe.Pointer(unsafe.SliceData(v)), num: uint64(len(v))}
}
-func valueOfIface(v interface{}) Value {
+func valueOfIface(v any) Value {
p := (*ifaceHeader)(unsafe.Pointer(&v))
return Value{typ: p.Type, ptr: p.Data}
}
@@ -81,7 +81,7 @@ func (v Value) getString() string {
func (v Value) getBytes() []byte {
return unsafe.Slice((*byte)(v.ptr), v.num)
}
-func (v Value) getIface() (x interface{}) {
+func (v Value) getIface() (x any) {
*(*ifaceHeader)(unsafe.Pointer(&x)) = ifaceHeader{Type: v.typ, Data: v.ptr}
return x
}
diff --git a/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go b/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go
index 6267dc52a..de1777339 100644
--- a/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go
+++ b/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go
@@ -95,7 +95,7 @@ type Files struct {
// multiple files. Only top-level declarations are registered.
// Note that enum values are in the top-level since that are in the same
// scope as the parent enum.
- descsByName map[protoreflect.FullName]interface{}
+ descsByName map[protoreflect.FullName]any
filesByPath map[string][]protoreflect.FileDescriptor
numFiles int
}
@@ -117,7 +117,7 @@ func (r *Files) RegisterFile(file protoreflect.FileDescriptor) error {
defer globalMutex.Unlock()
}
if r.descsByName == nil {
- r.descsByName = map[protoreflect.FullName]interface{}{
+ r.descsByName = map[protoreflect.FullName]any{
"": &packageDescriptor{},
}
r.filesByPath = make(map[string][]protoreflect.FileDescriptor)
@@ -485,7 +485,7 @@ type Types struct {
}
type (
- typesByName map[protoreflect.FullName]interface{}
+ typesByName map[protoreflect.FullName]any
extensionsByMessage map[protoreflect.FullName]extensionsByNumber
extensionsByNumber map[protoreflect.FieldNumber]protoreflect.ExtensionType
)
@@ -570,7 +570,7 @@ func (r *Types) RegisterExtension(xt protoreflect.ExtensionType) error {
return nil
}
-func (r *Types) register(kind string, desc protoreflect.Descriptor, typ interface{}) error {
+func (r *Types) register(kind string, desc protoreflect.Descriptor, typ any) error {
name := desc.FullName()
prev := r.typesByName[name]
if prev != nil {
@@ -841,7 +841,7 @@ func (r *Types) RangeExtensionsByMessage(message protoreflect.FullName, f func(p
}
}
-func typeName(t interface{}) string {
+func typeName(t any) string {
switch t.(type) {
case protoreflect.EnumType:
return "enum"
@@ -854,7 +854,7 @@ func typeName(t interface{}) string {
}
}
-func amendErrorWithCaller(err error, prev, curr interface{}) error {
+func amendErrorWithCaller(err error, prev, curr any) error {
prevPkg := goPackage(prev)
currPkg := goPackage(curr)
if prevPkg == "" || currPkg == "" || prevPkg == currPkg {
@@ -863,7 +863,7 @@ func amendErrorWithCaller(err error, prev, curr interface{}) error {
return errors.New("%s\n\tpreviously from: %q\n\tcurrently from: %q", err, prevPkg, currPkg)
}
-func goPackage(v interface{}) string {
+func goPackage(v any) string {
switch d := v.(type) {
case protoreflect.EnumType:
v = d.Descriptor()
diff --git a/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go b/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go
index 78624cf60..9403eb075 100644
--- a/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go
+++ b/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go
@@ -54,6 +54,9 @@ type Edition int32
const (
// A placeholder for an unknown edition value.
Edition_EDITION_UNKNOWN Edition = 0
+ // A placeholder edition for specifying default behaviors *before* a feature
+ // was first introduced. This is effectively an "infinite past".
+ Edition_EDITION_LEGACY Edition = 900
// Legacy syntax "editions". These pre-date editions, but behave much like
// distinct editions. These can't be used to specify the edition of proto
// files, but feature definitions must supply proto2/proto3 defaults for
@@ -82,6 +85,7 @@ const (
var (
Edition_name = map[int32]string{
0: "EDITION_UNKNOWN",
+ 900: "EDITION_LEGACY",
998: "EDITION_PROTO2",
999: "EDITION_PROTO3",
1000: "EDITION_2023",
@@ -95,6 +99,7 @@ var (
}
Edition_value = map[string]int32{
"EDITION_UNKNOWN": 0,
+ "EDITION_LEGACY": 900,
"EDITION_PROTO2": 998,
"EDITION_PROTO3": 999,
"EDITION_2023": 1000,
@@ -2177,12 +2182,16 @@ type FileOptions struct {
//
// Deprecated: Marked as deprecated in google/protobuf/descriptor.proto.
JavaGenerateEqualsAndHash *bool `protobuf:"varint,20,opt,name=java_generate_equals_and_hash,json=javaGenerateEqualsAndHash" json:"java_generate_equals_and_hash,omitempty"`
- // If set true, then the Java2 code generator will generate code that
- // throws an exception whenever an attempt is made to assign a non-UTF-8
- // byte sequence to a string field.
- // Message reflection will do the same.
- // However, an extension field still accepts non-UTF-8 byte sequences.
- // This option has no effect on when used with the lite runtime.
+ // A proto2 file can set this to true to opt in to UTF-8 checking for Java,
+ // which will throw an exception if invalid UTF-8 is parsed from the wire or
+ // assigned to a string field.
+ //
+ // TODO: clarify exactly what kinds of field types this option
+ // applies to, and update these docs accordingly.
+ //
+ // Proto3 files already perform these checks. Setting the option explicitly to
+ // false has no effect: it cannot be used to opt proto3 files out of UTF-8
+ // checks.
JavaStringCheckUtf8 *bool `protobuf:"varint,27,opt,name=java_string_check_utf8,json=javaStringCheckUtf8,def=0" json:"java_string_check_utf8,omitempty"`
OptimizeFor *FileOptions_OptimizeMode `protobuf:"varint,9,opt,name=optimize_for,json=optimizeFor,enum=google.protobuf.FileOptions_OptimizeMode,def=1" json:"optimize_for,omitempty"`
// Sets the Go package where structs generated from this .proto will be
@@ -2679,7 +2688,8 @@ type FieldOptions struct {
Targets []FieldOptions_OptionTargetType `protobuf:"varint,19,rep,name=targets,enum=google.protobuf.FieldOptions_OptionTargetType" json:"targets,omitempty"`
EditionDefaults []*FieldOptions_EditionDefault `protobuf:"bytes,20,rep,name=edition_defaults,json=editionDefaults" json:"edition_defaults,omitempty"`
// Any features defined in the specific edition.
- Features *FeatureSet `protobuf:"bytes,21,opt,name=features" json:"features,omitempty"`
+ Features *FeatureSet `protobuf:"bytes,21,opt,name=features" json:"features,omitempty"`
+ FeatureSupport *FieldOptions_FeatureSupport `protobuf:"bytes,22,opt,name=feature_support,json=featureSupport" json:"feature_support,omitempty"`
// The parser stores options it doesn't recognize here. See above.
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
}
@@ -2811,6 +2821,13 @@ func (x *FieldOptions) GetFeatures() *FeatureSet {
return nil
}
+func (x *FieldOptions) GetFeatureSupport() *FieldOptions_FeatureSupport {
+ if x != nil {
+ return x.FeatureSupport
+ }
+ return nil
+}
+
func (x *FieldOptions) GetUninterpretedOption() []*UninterpretedOption {
if x != nil {
return x.UninterpretedOption
@@ -2995,6 +3012,8 @@ type EnumValueOptions struct {
// out when using debug formats, e.g. when the field contains sensitive
// credentials.
DebugRedact *bool `protobuf:"varint,3,opt,name=debug_redact,json=debugRedact,def=0" json:"debug_redact,omitempty"`
+ // Information about the support window of a feature value.
+ FeatureSupport *FieldOptions_FeatureSupport `protobuf:"bytes,4,opt,name=feature_support,json=featureSupport" json:"feature_support,omitempty"`
// The parser stores options it doesn't recognize here. See above.
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
}
@@ -3058,6 +3077,13 @@ func (x *EnumValueOptions) GetDebugRedact() bool {
return Default_EnumValueOptions_DebugRedact
}
+func (x *EnumValueOptions) GetFeatureSupport() *FieldOptions_FeatureSupport {
+ if x != nil {
+ return x.FeatureSupport
+ }
+ return nil
+}
+
func (x *EnumValueOptions) GetUninterpretedOption() []*UninterpretedOption {
if x != nil {
return x.UninterpretedOption
@@ -3968,6 +3994,88 @@ func (x *FieldOptions_EditionDefault) GetValue() string {
return ""
}
+// Information about the support window of a feature.
+type FieldOptions_FeatureSupport struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The edition that this feature was first available in. In editions
+ // earlier than this one, the default assigned to EDITION_LEGACY will be
+ // used, and proto files will not be able to override it.
+ EditionIntroduced *Edition `protobuf:"varint,1,opt,name=edition_introduced,json=editionIntroduced,enum=google.protobuf.Edition" json:"edition_introduced,omitempty"`
+ // The edition this feature becomes deprecated in. Using this after this
+ // edition may trigger warnings.
+ EditionDeprecated *Edition `protobuf:"varint,2,opt,name=edition_deprecated,json=editionDeprecated,enum=google.protobuf.Edition" json:"edition_deprecated,omitempty"`
+ // The deprecation warning text if this feature is used after the edition it
+ // was marked deprecated in.
+ DeprecationWarning *string `protobuf:"bytes,3,opt,name=deprecation_warning,json=deprecationWarning" json:"deprecation_warning,omitempty"`
+ // The edition this feature is no longer available in. In editions after
+ // this one, the last default assigned will be used, and proto files will
+ // not be able to override it.
+ EditionRemoved *Edition `protobuf:"varint,4,opt,name=edition_removed,json=editionRemoved,enum=google.protobuf.Edition" json:"edition_removed,omitempty"`
+}
+
+func (x *FieldOptions_FeatureSupport) Reset() {
+ *x = FieldOptions_FeatureSupport{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_google_protobuf_descriptor_proto_msgTypes[28]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *FieldOptions_FeatureSupport) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*FieldOptions_FeatureSupport) ProtoMessage() {}
+
+func (x *FieldOptions_FeatureSupport) ProtoReflect() protoreflect.Message {
+ mi := &file_google_protobuf_descriptor_proto_msgTypes[28]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use FieldOptions_FeatureSupport.ProtoReflect.Descriptor instead.
+func (*FieldOptions_FeatureSupport) Descriptor() ([]byte, []int) {
+ return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{12, 1}
+}
+
+func (x *FieldOptions_FeatureSupport) GetEditionIntroduced() Edition {
+ if x != nil && x.EditionIntroduced != nil {
+ return *x.EditionIntroduced
+ }
+ return Edition_EDITION_UNKNOWN
+}
+
+func (x *FieldOptions_FeatureSupport) GetEditionDeprecated() Edition {
+ if x != nil && x.EditionDeprecated != nil {
+ return *x.EditionDeprecated
+ }
+ return Edition_EDITION_UNKNOWN
+}
+
+func (x *FieldOptions_FeatureSupport) GetDeprecationWarning() string {
+ if x != nil && x.DeprecationWarning != nil {
+ return *x.DeprecationWarning
+ }
+ return ""
+}
+
+func (x *FieldOptions_FeatureSupport) GetEditionRemoved() Edition {
+ if x != nil && x.EditionRemoved != nil {
+ return *x.EditionRemoved
+ }
+ return Edition_EDITION_UNKNOWN
+}
+
// The name of the uninterpreted option. Each string represents a segment in
// a dot-separated name. is_extension is true iff a segment represents an
// extension (denoted with parentheses in options specs in .proto files).
@@ -3985,7 +4093,7 @@ type UninterpretedOption_NamePart struct {
func (x *UninterpretedOption_NamePart) Reset() {
*x = UninterpretedOption_NamePart{}
if protoimpl.UnsafeEnabled {
- mi := &file_google_protobuf_descriptor_proto_msgTypes[28]
+ mi := &file_google_protobuf_descriptor_proto_msgTypes[29]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -3998,7 +4106,7 @@ func (x *UninterpretedOption_NamePart) String() string {
func (*UninterpretedOption_NamePart) ProtoMessage() {}
func (x *UninterpretedOption_NamePart) ProtoReflect() protoreflect.Message {
- mi := &file_google_protobuf_descriptor_proto_msgTypes[28]
+ mi := &file_google_protobuf_descriptor_proto_msgTypes[29]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -4037,14 +4145,17 @@ type FeatureSetDefaults_FeatureSetEditionDefault struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
- Edition *Edition `protobuf:"varint,3,opt,name=edition,enum=google.protobuf.Edition" json:"edition,omitempty"`
- Features *FeatureSet `protobuf:"bytes,2,opt,name=features" json:"features,omitempty"`
+ Edition *Edition `protobuf:"varint,3,opt,name=edition,enum=google.protobuf.Edition" json:"edition,omitempty"`
+ // Defaults of features that can be overridden in this edition.
+ OverridableFeatures *FeatureSet `protobuf:"bytes,4,opt,name=overridable_features,json=overridableFeatures" json:"overridable_features,omitempty"`
+ // Defaults of features that can't be overridden in this edition.
+ FixedFeatures *FeatureSet `protobuf:"bytes,5,opt,name=fixed_features,json=fixedFeatures" json:"fixed_features,omitempty"`
}
func (x *FeatureSetDefaults_FeatureSetEditionDefault) Reset() {
*x = FeatureSetDefaults_FeatureSetEditionDefault{}
if protoimpl.UnsafeEnabled {
- mi := &file_google_protobuf_descriptor_proto_msgTypes[29]
+ mi := &file_google_protobuf_descriptor_proto_msgTypes[30]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -4057,7 +4168,7 @@ func (x *FeatureSetDefaults_FeatureSetEditionDefault) String() string {
func (*FeatureSetDefaults_FeatureSetEditionDefault) ProtoMessage() {}
func (x *FeatureSetDefaults_FeatureSetEditionDefault) ProtoReflect() protoreflect.Message {
- mi := &file_google_protobuf_descriptor_proto_msgTypes[29]
+ mi := &file_google_protobuf_descriptor_proto_msgTypes[30]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -4080,9 +4191,16 @@ func (x *FeatureSetDefaults_FeatureSetEditionDefault) GetEdition() Edition {
return Edition_EDITION_UNKNOWN
}
-func (x *FeatureSetDefaults_FeatureSetEditionDefault) GetFeatures() *FeatureSet {
+func (x *FeatureSetDefaults_FeatureSetEditionDefault) GetOverridableFeatures() *FeatureSet {
if x != nil {
- return x.Features
+ return x.OverridableFeatures
+ }
+ return nil
+}
+
+func (x *FeatureSetDefaults_FeatureSetEditionDefault) GetFixedFeatures() *FeatureSet {
+ if x != nil {
+ return x.FixedFeatures
}
return nil
}
@@ -4188,7 +4306,7 @@ type SourceCodeInfo_Location struct {
func (x *SourceCodeInfo_Location) Reset() {
*x = SourceCodeInfo_Location{}
if protoimpl.UnsafeEnabled {
- mi := &file_google_protobuf_descriptor_proto_msgTypes[30]
+ mi := &file_google_protobuf_descriptor_proto_msgTypes[31]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -4201,7 +4319,7 @@ func (x *SourceCodeInfo_Location) String() string {
func (*SourceCodeInfo_Location) ProtoMessage() {}
func (x *SourceCodeInfo_Location) ProtoReflect() protoreflect.Message {
- mi := &file_google_protobuf_descriptor_proto_msgTypes[30]
+ mi := &file_google_protobuf_descriptor_proto_msgTypes[31]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -4275,7 +4393,7 @@ type GeneratedCodeInfo_Annotation struct {
func (x *GeneratedCodeInfo_Annotation) Reset() {
*x = GeneratedCodeInfo_Annotation{}
if protoimpl.UnsafeEnabled {
- mi := &file_google_protobuf_descriptor_proto_msgTypes[31]
+ mi := &file_google_protobuf_descriptor_proto_msgTypes[32]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -4288,7 +4406,7 @@ func (x *GeneratedCodeInfo_Annotation) String() string {
func (*GeneratedCodeInfo_Annotation) ProtoMessage() {}
func (x *GeneratedCodeInfo_Annotation) ProtoReflect() protoreflect.Message {
- mi := &file_google_protobuf_descriptor_proto_msgTypes[31]
+ mi := &file_google_protobuf_descriptor_proto_msgTypes[32]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -4597,7 +4715,7 @@ var file_google_protobuf_descriptor_proto_rawDesc = []byte{
0x67, 0x12, 0x30, 0x0a, 0x10, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x72, 0x65,
0x61, 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c,
0x73, 0x65, 0x52, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d,
- 0x69, 0x6e, 0x67, 0x22, 0x97, 0x09, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69,
+ 0x69, 0x6e, 0x67, 0x22, 0xad, 0x09, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, 0x63, 0x6b,
0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6a, 0x61, 0x76, 0x61, 0x50,
0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f,
@@ -4670,405 +4788,445 @@ var file_google_protobuf_descriptor_proto_rawDesc = []byte{
0x45, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x53, 0x49,
0x5a, 0x45, 0x10, 0x02, 0x12, 0x10, 0x0a, 0x0c, 0x4c, 0x49, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4e,
0x54, 0x49, 0x4d, 0x45, 0x10, 0x03, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80,
- 0x02, 0x4a, 0x04, 0x08, 0x2a, 0x10, 0x2b, 0x4a, 0x04, 0x08, 0x26, 0x10, 0x27, 0x22, 0xf4, 0x03,
- 0x0a, 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73,
- 0x12, 0x3c, 0x0a, 0x17, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x65, 0x74, 0x5f,
- 0x77, 0x69, 0x72, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,
- 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x14, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
- 0x65, 0x53, 0x65, 0x74, 0x57, 0x69, 0x72, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x4c,
- 0x0a, 0x1f, 0x6e, 0x6f, 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x5f, 0x64, 0x65,
- 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f,
- 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x1c,
- 0x6e, 0x6f, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69,
- 0x70, 0x74, 0x6f, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x12, 0x25, 0x0a, 0x0a,
- 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08,
- 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61,
- 0x74, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79,
- 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79,
- 0x12, 0x56, 0x0a, 0x26, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6c,
- 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64,
- 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08,
- 0x42, 0x02, 0x18, 0x01, 0x52, 0x22, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64,
- 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x43,
- 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74,
- 0x75, 0x72, 0x65, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f,
- 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61,
- 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65,
- 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74,
- 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b,
- 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
- 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64,
- 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70,
- 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07,
- 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x4a, 0x04, 0x08, 0x05,
- 0x10, 0x06, 0x4a, 0x04, 0x08, 0x06, 0x10, 0x07, 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x4a, 0x04,
- 0x08, 0x09, 0x10, 0x0a, 0x22, 0xad, 0x0a, 0x0a, 0x0c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70,
- 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x41, 0x0a, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01,
- 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
- 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69,
- 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e,
- 0x47, 0x52, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x63, 0x6b,
- 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64,
- 0x12, 0x47, 0x0a, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e,
- 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
- 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e,
- 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41,
- 0x4c, 0x52, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x04, 0x6c, 0x61, 0x7a,
- 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x04,
- 0x6c, 0x61, 0x7a, 0x79, 0x12, 0x2e, 0x0a, 0x0f, 0x75, 0x6e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69,
- 0x65, 0x64, 0x5f, 0x6c, 0x61, 0x7a, 0x79, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66,
- 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0e, 0x75, 0x6e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64,
- 0x4c, 0x61, 0x7a, 0x79, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74,
- 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52,
- 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x04, 0x77,
- 0x65, 0x61, 0x6b, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65,
- 0x52, 0x04, 0x77, 0x65, 0x61, 0x6b, 0x12, 0x28, 0x0a, 0x0c, 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f,
- 0x72, 0x65, 0x64, 0x61, 0x63, 0x74, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61,
- 0x6c, 0x73, 0x65, 0x52, 0x0b, 0x64, 0x65, 0x62, 0x75, 0x67, 0x52, 0x65, 0x64, 0x61, 0x63, 0x74,
- 0x12, 0x4b, 0x0a, 0x09, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x11, 0x20,
- 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
- 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f,
- 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69,
- 0x6f, 0x6e, 0x52, 0x09, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x48, 0x0a,
- 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x18, 0x13, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x2e,
- 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
- 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70,
- 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07,
- 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x12, 0x57, 0x0a, 0x10, 0x65, 0x64, 0x69, 0x74, 0x69,
- 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x14, 0x20, 0x03, 0x28,
- 0x0b, 0x32, 0x2c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
- 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73,
- 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x52,
- 0x0f, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73,
- 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x15, 0x20, 0x01,
- 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
- 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52,
- 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69,
- 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f,
- 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
- 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74,
- 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13,
- 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74,
- 0x69, 0x6f, 0x6e, 0x1a, 0x5a, 0x0a, 0x0e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65,
- 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x32, 0x0a, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e,
- 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
- 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e,
- 0x52, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c,
- 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22,
- 0x2f, 0x0a, 0x05, 0x43, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x54, 0x52, 0x49,
- 0x4e, 0x47, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x4f, 0x52, 0x44, 0x10, 0x01, 0x12, 0x10,
- 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x50, 0x49, 0x45, 0x43, 0x45, 0x10, 0x02,
- 0x22, 0x35, 0x0a, 0x06, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x53,
- 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x53, 0x5f,
- 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x4e,
- 0x55, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x02, 0x22, 0x55, 0x0a, 0x0f, 0x4f, 0x70, 0x74, 0x69, 0x6f,
- 0x6e, 0x52, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x15, 0x0a, 0x11, 0x52, 0x45,
- 0x54, 0x45, 0x4e, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10,
- 0x00, 0x12, 0x15, 0x0a, 0x11, 0x52, 0x45, 0x54, 0x45, 0x4e, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52,
- 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x45, 0x54, 0x45,
- 0x4e, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x10, 0x02, 0x22, 0x8c,
- 0x02, 0x0a, 0x10, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54,
- 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59,
- 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10,
- 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x4c, 0x45,
- 0x10, 0x01, 0x12, 0x1f, 0x0a, 0x1b, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50,
- 0x45, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x4e, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x41, 0x4e, 0x47,
- 0x45, 0x10, 0x02, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59,
- 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11,
- 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x45, 0x4c,
- 0x44, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59,
- 0x50, 0x45, 0x5f, 0x4f, 0x4e, 0x45, 0x4f, 0x46, 0x10, 0x05, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x41,
- 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x10, 0x06,
- 0x12, 0x1a, 0x0a, 0x16, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f,
- 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x4e, 0x54, 0x52, 0x59, 0x10, 0x07, 0x12, 0x17, 0x0a, 0x13,
- 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x45, 0x52, 0x56,
- 0x49, 0x43, 0x45, 0x10, 0x08, 0x12, 0x16, 0x0a, 0x12, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f,
- 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, 0x44, 0x10, 0x09, 0x2a, 0x09, 0x08,
- 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x4a, 0x04,
- 0x08, 0x12, 0x10, 0x13, 0x22, 0xac, 0x01, 0x0a, 0x0c, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70,
- 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65,
- 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
- 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72,
- 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x58,
- 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f,
- 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e,
- 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
- 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74,
- 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74,
- 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80,
- 0x80, 0x80, 0x02, 0x22, 0xd1, 0x02, 0x0a, 0x0b, 0x45, 0x6e, 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69,
- 0x6f, 0x6e, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x61, 0x6c, 0x69,
- 0x61, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x41,
- 0x6c, 0x69, 0x61, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74,
- 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52,
- 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x56, 0x0a, 0x26, 0x64,
- 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79,
- 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66,
- 0x6c, 0x69, 0x63, 0x74, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x42, 0x02, 0x18, 0x01, 0x52,
- 0x22, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x4c, 0x65, 0x67, 0x61, 0x63,
- 0x79, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x6c, 0x69,
- 0x63, 0x74, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18,
- 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
- 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53,
- 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x14,
- 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70,
- 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f,
- 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e,
+ 0x02, 0x4a, 0x04, 0x08, 0x2a, 0x10, 0x2b, 0x4a, 0x04, 0x08, 0x26, 0x10, 0x27, 0x52, 0x14, 0x70,
+ 0x68, 0x70, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69,
+ 0x63, 0x65, 0x73, 0x22, 0xf4, 0x03, 0x0a, 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f,
+ 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3c, 0x0a, 0x17, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
+ 0x65, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x77, 0x69, 0x72, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61,
+ 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x14,
+ 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x57, 0x69, 0x72, 0x65, 0x46, 0x6f,
+ 0x72, 0x6d, 0x61, 0x74, 0x12, 0x4c, 0x0a, 0x1f, 0x6e, 0x6f, 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64,
+ 0x61, 0x72, 0x64, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x5f, 0x61,
+ 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66,
+ 0x61, 0x6c, 0x73, 0x65, 0x52, 0x1c, 0x6e, 0x6f, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64,
+ 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73,
+ 0x6f, 0x72, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64,
+ 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64,
+ 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x70,
+ 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6d, 0x61,
+ 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x56, 0x0a, 0x26, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63,
+ 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x6a, 0x73, 0x6f, 0x6e,
+ 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73,
+ 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x22, 0x64, 0x65, 0x70, 0x72,
+ 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x4a, 0x73, 0x6f, 0x6e,
+ 0x46, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x12, 0x37,
+ 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b,
+ 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
+ 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66,
+ 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74,
+ 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18,
+ 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72,
+ 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e,
0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f,
- 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64,
- 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80,
- 0x02, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x22, 0x81, 0x02, 0x0a, 0x10, 0x45, 0x6e, 0x75, 0x6d,
- 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a,
- 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08,
- 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61,
- 0x74, 0x65, 0x64, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18,
- 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
- 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53,
- 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x28, 0x0a, 0x0c,
- 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, 0x72, 0x65, 0x64, 0x61, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01,
+ 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x04,
+ 0x10, 0x05, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x4a, 0x04, 0x08, 0x06, 0x10, 0x07, 0x4a, 0x04,
+ 0x08, 0x08, 0x10, 0x09, 0x4a, 0x04, 0x08, 0x09, 0x10, 0x0a, 0x22, 0x9d, 0x0d, 0x0a, 0x0c, 0x46,
+ 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x41, 0x0a, 0x05, 0x63,
+ 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x67, 0x6f, 0x6f,
+ 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65,
+ 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x54, 0x79, 0x70, 0x65, 0x3a,
+ 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x52, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16,
+ 0x0a, 0x06, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06,
+ 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x47, 0x0a, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65,
+ 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70,
+ 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x09, 0x4a, 0x53,
+ 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x52, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x12,
+ 0x19, 0x0a, 0x04, 0x6c, 0x61, 0x7a, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66,
+ 0x61, 0x6c, 0x73, 0x65, 0x52, 0x04, 0x6c, 0x61, 0x7a, 0x79, 0x12, 0x2e, 0x0a, 0x0f, 0x75, 0x6e,
+ 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x5f, 0x6c, 0x61, 0x7a, 0x79, 0x18, 0x0f, 0x20,
+ 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0e, 0x75, 0x6e, 0x76, 0x65,
+ 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x4c, 0x61, 0x7a, 0x79, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65,
+ 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05,
+ 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65,
+ 0x64, 0x12, 0x19, 0x0a, 0x04, 0x77, 0x65, 0x61, 0x6b, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x3a,
+ 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x04, 0x77, 0x65, 0x61, 0x6b, 0x12, 0x28, 0x0a, 0x0c,
+ 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, 0x72, 0x65, 0x64, 0x61, 0x63, 0x74, 0x18, 0x10, 0x20, 0x01,
0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0b, 0x64, 0x65, 0x62, 0x75, 0x67,
- 0x52, 0x65, 0x64, 0x61, 0x63, 0x74, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65,
+ 0x52, 0x65, 0x64, 0x61, 0x63, 0x74, 0x12, 0x4b, 0x0a, 0x09, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74,
+ 0x69, 0x6f, 0x6e, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
+ 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c,
+ 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52,
+ 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74,
+ 0x69, 0x6f, 0x6e, 0x12, 0x48, 0x0a, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x18, 0x13,
+ 0x20, 0x03, 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
+ 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69,
+ 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74,
+ 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x12, 0x57, 0x0a,
+ 0x10, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74,
+ 0x73, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
+ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f,
+ 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65,
+ 0x66, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x0f, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65,
+ 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72,
+ 0x65, 0x73, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
+ 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75,
+ 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12,
+ 0x55, 0x0a, 0x0f, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x75, 0x70, 0x70, 0x6f,
+ 0x72, 0x74, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
+ 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64,
+ 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53,
+ 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x0e, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53,
+ 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65,
0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7,
0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70,
0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69,
0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e,
- 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0xd5, 0x01, 0x0a, 0x0e,
- 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x37,
- 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0b,
- 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
- 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66,
- 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65,
- 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x21, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c,
- 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x58,
- 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f,
- 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e,
+ 0x1a, 0x5a, 0x0a, 0x0e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x61, 0x75,
+ 0x6c, 0x74, 0x12, 0x32, 0x0a, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20,
+ 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
+ 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x65,
+ 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x96, 0x02, 0x0a,
+ 0x0e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x12,
+ 0x47, 0x0a, 0x12, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x74, 0x72, 0x6f,
+ 0x64, 0x75, 0x63, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f,
+ 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64,
+ 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e,
+ 0x74, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x64, 0x12, 0x47, 0x0a, 0x12, 0x65, 0x64, 0x69, 0x74,
+ 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x02,
+ 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
+ 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x11,
+ 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65,
+ 0x64, 0x12, 0x2f, 0x0a, 0x13, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
+ 0x5f, 0x77, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12,
+ 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x57, 0x61, 0x72, 0x6e, 0x69,
+ 0x6e, 0x67, 0x12, 0x41, 0x0a, 0x0f, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65,
+ 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f,
+ 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64,
+ 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65,
+ 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x22, 0x2f, 0x0a, 0x05, 0x43, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a,
+ 0x0a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x4f,
+ 0x52, 0x44, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x50,
+ 0x49, 0x45, 0x43, 0x45, 0x10, 0x02, 0x22, 0x35, 0x0a, 0x06, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65,
+ 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x00, 0x12,
+ 0x0d, 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0d,
+ 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x02, 0x22, 0x55, 0x0a,
+ 0x0f, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e,
+ 0x12, 0x15, 0x0a, 0x11, 0x52, 0x45, 0x54, 0x45, 0x4e, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e,
+ 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x52, 0x45, 0x54, 0x45, 0x4e,
+ 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x14,
+ 0x0a, 0x10, 0x52, 0x45, 0x54, 0x45, 0x4e, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x4f, 0x55, 0x52,
+ 0x43, 0x45, 0x10, 0x02, 0x22, 0x8c, 0x02, 0x0a, 0x10, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54,
+ 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x41, 0x52,
+ 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e,
+ 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50,
+ 0x45, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x10, 0x01, 0x12, 0x1f, 0x0a, 0x1b, 0x54, 0x41, 0x52, 0x47,
+ 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x4e, 0x53, 0x49, 0x4f,
+ 0x4e, 0x5f, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x02, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x41, 0x52,
+ 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45,
+ 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50,
+ 0x45, 0x5f, 0x46, 0x49, 0x45, 0x4c, 0x44, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x54, 0x41, 0x52,
+ 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4f, 0x4e, 0x45, 0x4f, 0x46, 0x10, 0x05,
+ 0x12, 0x14, 0x0a, 0x10, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f,
+ 0x45, 0x4e, 0x55, 0x4d, 0x10, 0x06, 0x12, 0x1a, 0x0a, 0x16, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54,
+ 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x4e, 0x54, 0x52, 0x59,
+ 0x10, 0x07, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50,
+ 0x45, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x10, 0x08, 0x12, 0x16, 0x0a, 0x12, 0x54,
+ 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f,
+ 0x44, 0x10, 0x09, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04,
+ 0x08, 0x04, 0x10, 0x05, 0x4a, 0x04, 0x08, 0x12, 0x10, 0x13, 0x22, 0xac, 0x01, 0x0a, 0x0c, 0x4f,
+ 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x66,
+ 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e,
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
- 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74,
- 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74,
- 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80,
- 0x80, 0x80, 0x02, 0x22, 0x99, 0x03, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70,
- 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61,
- 0x74, 0x65, 0x64, 0x18, 0x21, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65,
- 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x71, 0x0a, 0x11,
- 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x6c, 0x65, 0x76, 0x65,
- 0x6c, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
- 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64,
- 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65,
- 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x3a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f,
- 0x54, 0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x52, 0x10, 0x69,
- 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12,
- 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x23, 0x20, 0x01, 0x28,
- 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
- 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08,
- 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e,
- 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e,
- 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
- 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65,
- 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75,
- 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69,
- 0x6f, 0x6e, 0x22, 0x50, 0x0a, 0x10, 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63,
- 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x17, 0x0a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f,
- 0x54, 0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12,
- 0x13, 0x0a, 0x0f, 0x4e, 0x4f, 0x5f, 0x53, 0x49, 0x44, 0x45, 0x5f, 0x45, 0x46, 0x46, 0x45, 0x43,
- 0x54, 0x53, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45,
- 0x4e, 0x54, 0x10, 0x02, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22,
- 0x9a, 0x03, 0x0a, 0x13, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65,
- 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
- 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
- 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70,
- 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4e, 0x61, 0x6d, 0x65,
- 0x50, 0x61, 0x72, 0x74, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x64,
- 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03,
- 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72,
- 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76,
- 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28,
- 0x04, 0x52, 0x10, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61,
- 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f,
- 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52,
- 0x10, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75,
- 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75,
- 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56,
- 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76,
- 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69,
- 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65,
- 0x67, 0x61, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09,
- 0x52, 0x0e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65,
- 0x1a, 0x4a, 0x0a, 0x08, 0x4e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x12, 0x1b, 0x0a, 0x09,
- 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52,
- 0x08, 0x6e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x73, 0x5f,
- 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x02, 0x28, 0x08, 0x52,
- 0x0b, 0x69, 0x73, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x8c, 0x0a, 0x0a,
- 0x0a, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x12, 0x8b, 0x01, 0x0a, 0x0e,
- 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01,
- 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
- 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65,
- 0x74, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x42,
- 0x39, 0x88, 0x01, 0x01, 0x98, 0x01, 0x04, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x45,
- 0x58, 0x50, 0x4c, 0x49, 0x43, 0x49, 0x54, 0x18, 0xe6, 0x07, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x49,
- 0x4d, 0x50, 0x4c, 0x49, 0x43, 0x49, 0x54, 0x18, 0xe7, 0x07, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x45,
- 0x58, 0x50, 0x4c, 0x49, 0x43, 0x49, 0x54, 0x18, 0xe8, 0x07, 0x52, 0x0d, 0x66, 0x69, 0x65, 0x6c,
- 0x64, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x66, 0x0a, 0x09, 0x65, 0x6e, 0x75,
- 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x67,
+ 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74,
+ 0x75, 0x72, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70,
+ 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20,
+ 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
+ 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65,
+ 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74,
+ 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09,
+ 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0xd1, 0x02, 0x0a, 0x0b, 0x45, 0x6e,
+ 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6c, 0x6c,
+ 0x6f, 0x77, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a,
+ 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65,
+ 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05,
+ 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65,
+ 0x64, 0x12, 0x56, 0x0a, 0x26, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x5f,
+ 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x66, 0x69, 0x65, 0x6c,
+ 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28,
+ 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x22, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65,
+ 0x64, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64,
+ 0x43, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61,
+ 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f,
+ 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65,
+ 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72,
+ 0x65, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65,
+ 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28,
+ 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+ 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65,
+ 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72,
+ 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8,
+ 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x22, 0xd8, 0x02,
+ 0x0a, 0x10, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f,
+ 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64,
+ 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61,
+ 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f,
+ 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65,
+ 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72,
+ 0x65, 0x73, 0x12, 0x28, 0x0a, 0x0c, 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, 0x72, 0x65, 0x64, 0x61,
+ 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52,
+ 0x0b, 0x64, 0x65, 0x62, 0x75, 0x67, 0x52, 0x65, 0x64, 0x61, 0x63, 0x74, 0x12, 0x55, 0x0a, 0x0f,
+ 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x18,
+ 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
+ 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74,
+ 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x75, 0x70, 0x70,
+ 0x6f, 0x72, 0x74, 0x52, 0x0e, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x75, 0x70, 0x70,
+ 0x6f, 0x72, 0x74, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72,
+ 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03,
+ 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
+ 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74,
+ 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65,
+ 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08,
+ 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0xd5, 0x01, 0x0a, 0x0e, 0x53, 0x65, 0x72,
+ 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x66,
+ 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e,
+ 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
+ 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74,
+ 0x75, 0x72, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74,
+ 0x65, 0x64, 0x18, 0x21, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52,
+ 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x58, 0x0a, 0x14, 0x75,
+ 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74,
+ 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f,
+ 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69,
+ 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e,
+ 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f,
+ 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02,
+ 0x22, 0x99, 0x03, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f,
+ 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64,
+ 0x18, 0x21, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64,
+ 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x71, 0x0a, 0x11, 0x69, 0x64, 0x65,
+ 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x22,
+ 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
+ 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74,
+ 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79,
+ 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x3a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e,
+ 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x52, 0x10, 0x69, 0x64, 0x65, 0x6d,
+ 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x37, 0x0a, 0x08,
+ 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x23, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b,
+ 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
+ 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61,
+ 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72,
+ 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07,
+ 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
+ 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72,
+ 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e,
+ 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22,
+ 0x50, 0x0a, 0x10, 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65,
+ 0x76, 0x65, 0x6c, 0x12, 0x17, 0x0a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e,
+ 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f,
+ 0x4e, 0x4f, 0x5f, 0x53, 0x49, 0x44, 0x45, 0x5f, 0x45, 0x46, 0x46, 0x45, 0x43, 0x54, 0x53, 0x10,
+ 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, 0x54, 0x10,
+ 0x02, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x9a, 0x03, 0x0a,
+ 0x13, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70,
+ 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x03,
+ 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
+ 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74,
+ 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72,
+ 0x74, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x64, 0x65, 0x6e, 0x74,
+ 0x69, 0x66, 0x69, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x0f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x56, 0x61, 0x6c,
+ 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69,
+ 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10,
+ 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65,
+ 0x12, 0x2c, 0x0a, 0x12, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x74,
+ 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x6e, 0x65,
+ 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21,
+ 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06,
+ 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75,
+ 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75,
+ 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56,
+ 0x61, 0x6c, 0x75, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74,
+ 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61,
+ 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x4a, 0x0a,
+ 0x08, 0x4e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x61, 0x6d,
+ 0x65, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x61,
+ 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x65, 0x78, 0x74,
+ 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x02, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73,
+ 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xa7, 0x0a, 0x0a, 0x0a, 0x46, 0x65,
+ 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x12, 0x91, 0x01, 0x0a, 0x0e, 0x66, 0x69, 0x65,
+ 0x6c, 0x64, 0x5f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x0e, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+ 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x46,
+ 0x69, 0x65, 0x6c, 0x64, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x3f, 0x88, 0x01,
+ 0x01, 0x98, 0x01, 0x04, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x45, 0x58, 0x50, 0x4c,
+ 0x49, 0x43, 0x49, 0x54, 0x18, 0xe6, 0x07, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x49, 0x4d, 0x50, 0x4c,
+ 0x49, 0x43, 0x49, 0x54, 0x18, 0xe7, 0x07, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x45, 0x58, 0x50, 0x4c,
+ 0x49, 0x43, 0x49, 0x54, 0x18, 0xe8, 0x07, 0xb2, 0x01, 0x03, 0x08, 0xe8, 0x07, 0x52, 0x0d, 0x66,
+ 0x69, 0x65, 0x6c, 0x64, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x6c, 0x0a, 0x09,
+ 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32,
+ 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
+ 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x45, 0x6e, 0x75,
+ 0x6d, 0x54, 0x79, 0x70, 0x65, 0x42, 0x29, 0x88, 0x01, 0x01, 0x98, 0x01, 0x06, 0x98, 0x01, 0x01,
+ 0xa2, 0x01, 0x0b, 0x12, 0x06, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0x18, 0xe6, 0x07, 0xa2, 0x01,
+ 0x09, 0x12, 0x04, 0x4f, 0x50, 0x45, 0x4e, 0x18, 0xe7, 0x07, 0xb2, 0x01, 0x03, 0x08, 0xe8, 0x07,
+ 0x52, 0x08, 0x65, 0x6e, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x98, 0x01, 0x0a, 0x17, 0x72,
+ 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65, 0x6e,
+ 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46,
- 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x54, 0x79,
- 0x70, 0x65, 0x42, 0x23, 0x88, 0x01, 0x01, 0x98, 0x01, 0x06, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x0b,
- 0x12, 0x06, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0x18, 0xe6, 0x07, 0xa2, 0x01, 0x09, 0x12, 0x04,
- 0x4f, 0x50, 0x45, 0x4e, 0x18, 0xe7, 0x07, 0x52, 0x08, 0x65, 0x6e, 0x75, 0x6d, 0x54, 0x79, 0x70,
- 0x65, 0x12, 0x92, 0x01, 0x0a, 0x17, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x66,
- 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20,
- 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
- 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74,
- 0x2e, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e,
- 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x42, 0x27, 0x88, 0x01, 0x01, 0x98, 0x01, 0x04, 0x98, 0x01,
- 0x01, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x45, 0x58, 0x50, 0x41, 0x4e, 0x44, 0x45, 0x44, 0x18, 0xe6,
- 0x07, 0xa2, 0x01, 0x0b, 0x12, 0x06, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x44, 0x18, 0xe7, 0x07, 0x52,
- 0x15, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e,
- 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x78, 0x0a, 0x0f, 0x75, 0x74, 0x66, 0x38, 0x5f, 0x76,
- 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32,
- 0x2a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
- 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x55, 0x74, 0x66,
- 0x38, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x23, 0x88, 0x01, 0x01,
- 0x98, 0x01, 0x04, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x09, 0x12, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x18,
- 0xe6, 0x07, 0xa2, 0x01, 0x0b, 0x12, 0x06, 0x56, 0x45, 0x52, 0x49, 0x46, 0x59, 0x18, 0xe7, 0x07,
- 0x52, 0x0e, 0x75, 0x74, 0x66, 0x38, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e,
- 0x12, 0x78, 0x0a, 0x10, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x65, 0x6e, 0x63, 0x6f,
- 0x64, 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x67, 0x6f, 0x6f,
- 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61,
- 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45,
- 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x42, 0x20, 0x88, 0x01, 0x01, 0x98, 0x01, 0x04, 0x98,
- 0x01, 0x01, 0xa2, 0x01, 0x14, 0x12, 0x0f, 0x4c, 0x45, 0x4e, 0x47, 0x54, 0x48, 0x5f, 0x50, 0x52,
- 0x45, 0x46, 0x49, 0x58, 0x45, 0x44, 0x18, 0xe6, 0x07, 0x52, 0x0f, 0x6d, 0x65, 0x73, 0x73, 0x61,
- 0x67, 0x65, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x7c, 0x0a, 0x0b, 0x6a, 0x73,
- 0x6f, 0x6e, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32,
- 0x26, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
- 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x4a, 0x73, 0x6f,
- 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x42, 0x33, 0x88, 0x01, 0x01, 0x98, 0x01, 0x03, 0x98,
- 0x01, 0x06, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x17, 0x12, 0x12, 0x4c, 0x45, 0x47, 0x41, 0x43, 0x59,
- 0x5f, 0x42, 0x45, 0x53, 0x54, 0x5f, 0x45, 0x46, 0x46, 0x4f, 0x52, 0x54, 0x18, 0xe6, 0x07, 0xa2,
- 0x01, 0x0a, 0x12, 0x05, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x18, 0xe7, 0x07, 0x52, 0x0a, 0x6a, 0x73,
- 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x22, 0x5c, 0x0a, 0x0d, 0x46, 0x69, 0x65, 0x6c,
- 0x64, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x46, 0x49, 0x45,
- 0x4c, 0x44, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x43, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e,
- 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x45, 0x58, 0x50, 0x4c, 0x49, 0x43, 0x49,
- 0x54, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x43, 0x49, 0x54, 0x10,
- 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x45, 0x47, 0x41, 0x43, 0x59, 0x5f, 0x52, 0x45, 0x51, 0x55,
- 0x49, 0x52, 0x45, 0x44, 0x10, 0x03, 0x22, 0x37, 0x0a, 0x08, 0x45, 0x6e, 0x75, 0x6d, 0x54, 0x79,
- 0x70, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f,
- 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x4f, 0x50, 0x45,
- 0x4e, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0x10, 0x02, 0x22,
- 0x56, 0x0a, 0x15, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64,
- 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x23, 0x0a, 0x1f, 0x52, 0x45, 0x50, 0x45,
- 0x41, 0x54, 0x45, 0x44, 0x5f, 0x46, 0x49, 0x45, 0x4c, 0x44, 0x5f, 0x45, 0x4e, 0x43, 0x4f, 0x44,
- 0x49, 0x4e, 0x47, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a,
- 0x06, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x45, 0x58, 0x50,
- 0x41, 0x4e, 0x44, 0x45, 0x44, 0x10, 0x02, 0x22, 0x43, 0x0a, 0x0e, 0x55, 0x74, 0x66, 0x38, 0x56,
- 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x17, 0x55, 0x54, 0x46,
- 0x38, 0x5f, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b,
- 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x56, 0x45, 0x52, 0x49, 0x46, 0x59,
- 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x03, 0x22, 0x53, 0x0a, 0x0f,
- 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12,
- 0x1c, 0x0a, 0x18, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x5f, 0x45, 0x4e, 0x43, 0x4f, 0x44,
- 0x49, 0x4e, 0x47, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a,
- 0x0f, 0x4c, 0x45, 0x4e, 0x47, 0x54, 0x48, 0x5f, 0x50, 0x52, 0x45, 0x46, 0x49, 0x58, 0x45, 0x44,
- 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x45, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x10,
- 0x02, 0x22, 0x48, 0x0a, 0x0a, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12,
- 0x17, 0x0a, 0x13, 0x4a, 0x53, 0x4f, 0x4e, 0x5f, 0x46, 0x4f, 0x52, 0x4d, 0x41, 0x54, 0x5f, 0x55,
- 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, 0x4c, 0x4f,
- 0x57, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x4c, 0x45, 0x47, 0x41, 0x43, 0x59, 0x5f, 0x42, 0x45,
- 0x53, 0x54, 0x5f, 0x45, 0x46, 0x46, 0x4f, 0x52, 0x54, 0x10, 0x02, 0x2a, 0x06, 0x08, 0xe8, 0x07,
- 0x10, 0xe9, 0x07, 0x2a, 0x06, 0x08, 0xe9, 0x07, 0x10, 0xea, 0x07, 0x2a, 0x06, 0x08, 0xea, 0x07,
- 0x10, 0xeb, 0x07, 0x2a, 0x06, 0x08, 0x8b, 0x4e, 0x10, 0x90, 0x4e, 0x2a, 0x06, 0x08, 0x90, 0x4e,
- 0x10, 0x91, 0x4e, 0x4a, 0x06, 0x08, 0xe7, 0x07, 0x10, 0xe8, 0x07, 0x22, 0xfe, 0x02, 0x0a, 0x12,
- 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c,
- 0x74, 0x73, 0x12, 0x58, 0x0a, 0x08, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01,
- 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
- 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65,
- 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72,
- 0x65, 0x53, 0x65, 0x74, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x61, 0x75,
- 0x6c, 0x74, 0x52, 0x08, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x41, 0x0a, 0x0f,
- 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x5f, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18,
- 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
- 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52,
- 0x0e, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12,
- 0x41, 0x0a, 0x0f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x5f, 0x65, 0x64, 0x69, 0x74, 0x69,
- 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
- 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69,
- 0x6f, 0x6e, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x45, 0x64, 0x69, 0x74, 0x69,
- 0x6f, 0x6e, 0x1a, 0x87, 0x01, 0x0a, 0x18, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65,
- 0x74, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12,
- 0x32, 0x0a, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e,
- 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
- 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x65, 0x64, 0x69, 0x74,
- 0x69, 0x6f, 0x6e, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18,
- 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
- 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53,
- 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x22, 0xa7, 0x02, 0x0a,
- 0x0e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12,
- 0x44, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28,
- 0x0b, 0x32, 0x28, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
- 0x62, 0x75, 0x66, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e,
- 0x66, 0x6f, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x6c, 0x6f, 0x63,
- 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xce, 0x01, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69,
- 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05,
- 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x04, 0x73, 0x70,
- 0x61, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x73, 0x70,
- 0x61, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f,
- 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c, 0x65,
- 0x61, 0x64, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2b, 0x0a,
- 0x11, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e,
- 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69,
- 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x3a, 0x0a, 0x19, 0x6c, 0x65,
- 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x63,
- 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x17, 0x6c,
- 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x44, 0x65, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x43, 0x6f,
- 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xd0, 0x02, 0x0a, 0x11, 0x47, 0x65, 0x6e, 0x65, 0x72,
- 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x4d, 0x0a, 0x0a,
- 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
- 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
- 0x75, 0x66, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65,
- 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52,
- 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xeb, 0x01, 0x0a, 0x0a,
- 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x04, 0x70, 0x61,
- 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, 0x61,
- 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c,
- 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46,
- 0x69, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01,
- 0x28, 0x05, 0x52, 0x05, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64,
- 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x12, 0x52, 0x0a, 0x08, 0x73,
- 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x36, 0x2e,
+ 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74,
+ 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x42,
+ 0x2d, 0x88, 0x01, 0x01, 0x98, 0x01, 0x04, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x45,
+ 0x58, 0x50, 0x41, 0x4e, 0x44, 0x45, 0x44, 0x18, 0xe6, 0x07, 0xa2, 0x01, 0x0b, 0x12, 0x06, 0x50,
+ 0x41, 0x43, 0x4b, 0x45, 0x44, 0x18, 0xe7, 0x07, 0xb2, 0x01, 0x03, 0x08, 0xe8, 0x07, 0x52, 0x15,
+ 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e, 0x63,
+ 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x7e, 0x0a, 0x0f, 0x75, 0x74, 0x66, 0x38, 0x5f, 0x76, 0x61,
+ 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a,
+ 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
+ 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x55, 0x74, 0x66, 0x38,
+ 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x29, 0x88, 0x01, 0x01, 0x98,
+ 0x01, 0x04, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x09, 0x12, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x18, 0xe6,
+ 0x07, 0xa2, 0x01, 0x0b, 0x12, 0x06, 0x56, 0x45, 0x52, 0x49, 0x46, 0x59, 0x18, 0xe7, 0x07, 0xb2,
+ 0x01, 0x03, 0x08, 0xe8, 0x07, 0x52, 0x0e, 0x75, 0x74, 0x66, 0x38, 0x56, 0x61, 0x6c, 0x69, 0x64,
+ 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x7e, 0x0a, 0x10, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
+ 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32,
+ 0x2b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
+ 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x4d, 0x65, 0x73,
+ 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x42, 0x26, 0x88, 0x01,
+ 0x01, 0x98, 0x01, 0x04, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x14, 0x12, 0x0f, 0x4c, 0x45, 0x4e, 0x47,
+ 0x54, 0x48, 0x5f, 0x50, 0x52, 0x45, 0x46, 0x49, 0x58, 0x45, 0x44, 0x18, 0xe6, 0x07, 0xb2, 0x01,
+ 0x03, 0x08, 0xe8, 0x07, 0x52, 0x0f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x63,
+ 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x82, 0x01, 0x0a, 0x0b, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x66,
+ 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x67, 0x6f,
+ 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65,
+ 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x6f, 0x72,
+ 0x6d, 0x61, 0x74, 0x42, 0x39, 0x88, 0x01, 0x01, 0x98, 0x01, 0x03, 0x98, 0x01, 0x06, 0x98, 0x01,
+ 0x01, 0xa2, 0x01, 0x17, 0x12, 0x12, 0x4c, 0x45, 0x47, 0x41, 0x43, 0x59, 0x5f, 0x42, 0x45, 0x53,
+ 0x54, 0x5f, 0x45, 0x46, 0x46, 0x4f, 0x52, 0x54, 0x18, 0xe6, 0x07, 0xa2, 0x01, 0x0a, 0x12, 0x05,
+ 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x18, 0xe7, 0x07, 0xb2, 0x01, 0x03, 0x08, 0xe8, 0x07, 0x52, 0x0a,
+ 0x6a, 0x73, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x22, 0x5c, 0x0a, 0x0d, 0x46, 0x69,
+ 0x65, 0x6c, 0x64, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x46,
+ 0x49, 0x45, 0x4c, 0x44, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x43, 0x45, 0x5f, 0x55, 0x4e,
+ 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x45, 0x58, 0x50, 0x4c, 0x49,
+ 0x43, 0x49, 0x54, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x43, 0x49,
+ 0x54, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x45, 0x47, 0x41, 0x43, 0x59, 0x5f, 0x52, 0x45,
+ 0x51, 0x55, 0x49, 0x52, 0x45, 0x44, 0x10, 0x03, 0x22, 0x37, 0x0a, 0x08, 0x45, 0x6e, 0x75, 0x6d,
+ 0x54, 0x79, 0x70, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x54, 0x59, 0x50,
+ 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x4f,
+ 0x50, 0x45, 0x4e, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0x10,
+ 0x02, 0x22, 0x56, 0x0a, 0x15, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x65,
+ 0x6c, 0x64, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x23, 0x0a, 0x1f, 0x52, 0x45,
+ 0x50, 0x45, 0x41, 0x54, 0x45, 0x44, 0x5f, 0x46, 0x49, 0x45, 0x4c, 0x44, 0x5f, 0x45, 0x4e, 0x43,
+ 0x4f, 0x44, 0x49, 0x4e, 0x47, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12,
+ 0x0a, 0x0a, 0x06, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x45,
+ 0x58, 0x50, 0x41, 0x4e, 0x44, 0x45, 0x44, 0x10, 0x02, 0x22, 0x49, 0x0a, 0x0e, 0x55, 0x74, 0x66,
+ 0x38, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x17, 0x55,
+ 0x54, 0x46, 0x38, 0x5f, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55,
+ 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x56, 0x45, 0x52, 0x49,
+ 0x46, 0x59, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x03, 0x22, 0x04,
+ 0x08, 0x01, 0x10, 0x01, 0x22, 0x53, 0x0a, 0x0f, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45,
+ 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x1c, 0x0a, 0x18, 0x4d, 0x45, 0x53, 0x53, 0x41,
+ 0x47, 0x45, 0x5f, 0x45, 0x4e, 0x43, 0x4f, 0x44, 0x49, 0x4e, 0x47, 0x5f, 0x55, 0x4e, 0x4b, 0x4e,
+ 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x45, 0x4e, 0x47, 0x54, 0x48, 0x5f,
+ 0x50, 0x52, 0x45, 0x46, 0x49, 0x58, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x45,
+ 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x10, 0x02, 0x22, 0x48, 0x0a, 0x0a, 0x4a, 0x73, 0x6f,
+ 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x17, 0x0a, 0x13, 0x4a, 0x53, 0x4f, 0x4e, 0x5f,
+ 0x46, 0x4f, 0x52, 0x4d, 0x41, 0x54, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00,
+ 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x4c,
+ 0x45, 0x47, 0x41, 0x43, 0x59, 0x5f, 0x42, 0x45, 0x53, 0x54, 0x5f, 0x45, 0x46, 0x46, 0x4f, 0x52,
+ 0x54, 0x10, 0x02, 0x2a, 0x06, 0x08, 0xe8, 0x07, 0x10, 0x8b, 0x4e, 0x2a, 0x06, 0x08, 0x8b, 0x4e,
+ 0x10, 0x90, 0x4e, 0x2a, 0x06, 0x08, 0x90, 0x4e, 0x10, 0x91, 0x4e, 0x4a, 0x06, 0x08, 0xe7, 0x07,
+ 0x10, 0xe8, 0x07, 0x22, 0xef, 0x03, 0x0a, 0x12, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53,
+ 0x65, 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x58, 0x0a, 0x08, 0x64, 0x65,
+ 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x67,
+ 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46,
+ 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74,
+ 0x73, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x45, 0x64, 0x69, 0x74,
+ 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x08, 0x64, 0x65, 0x66, 0x61,
+ 0x75, 0x6c, 0x74, 0x73, 0x12, 0x41, 0x0a, 0x0f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x5f,
+ 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e,
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
- 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66,
- 0x6f, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6d,
- 0x61, 0x6e, 0x74, 0x69, 0x63, 0x52, 0x08, 0x73, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x22,
- 0x28, 0x0a, 0x08, 0x53, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x12, 0x08, 0x0a, 0x04, 0x4e,
- 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x53, 0x45, 0x54, 0x10, 0x01, 0x12, 0x09,
- 0x0a, 0x05, 0x41, 0x4c, 0x49, 0x41, 0x53, 0x10, 0x02, 0x2a, 0x92, 0x02, 0x0a, 0x07, 0x45, 0x64,
- 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, 0x0f, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e,
- 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0e, 0x45, 0x44,
- 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x32, 0x10, 0xe6, 0x07, 0x12,
- 0x13, 0x0a, 0x0e, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f,
- 0x33, 0x10, 0xe7, 0x07, 0x12, 0x11, 0x0a, 0x0c, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f,
- 0x32, 0x30, 0x32, 0x33, 0x10, 0xe8, 0x07, 0x12, 0x11, 0x0a, 0x0c, 0x45, 0x44, 0x49, 0x54, 0x49,
- 0x4f, 0x4e, 0x5f, 0x32, 0x30, 0x32, 0x34, 0x10, 0xe9, 0x07, 0x12, 0x17, 0x0a, 0x13, 0x45, 0x44,
- 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x31, 0x5f, 0x54, 0x45, 0x53, 0x54, 0x5f, 0x4f, 0x4e, 0x4c,
- 0x59, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x32,
- 0x5f, 0x54, 0x45, 0x53, 0x54, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x02, 0x12, 0x1d, 0x0a, 0x17,
- 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x39, 0x39, 0x39, 0x39, 0x37, 0x5f, 0x54, 0x45,
- 0x53, 0x54, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x9d, 0x8d, 0x06, 0x12, 0x1d, 0x0a, 0x17, 0x45,
- 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x39, 0x39, 0x39, 0x39, 0x38, 0x5f, 0x54, 0x45, 0x53,
- 0x54, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x9e, 0x8d, 0x06, 0x12, 0x1d, 0x0a, 0x17, 0x45, 0x44,
- 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x39, 0x39, 0x39, 0x39, 0x39, 0x5f, 0x54, 0x45, 0x53, 0x54,
- 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x9f, 0x8d, 0x06, 0x12, 0x13, 0x0a, 0x0b, 0x45, 0x44, 0x49,
- 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x41, 0x58, 0x10, 0xff, 0xff, 0xff, 0xff, 0x07, 0x42, 0x7e,
- 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
- 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x10, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f,
- 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x48, 0x01, 0x5a, 0x2d, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
- 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f,
- 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x64, 0x65, 0x73, 0x63,
- 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x70, 0x62, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50,
- 0x42, 0xaa, 0x02, 0x1a, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f,
- 0x62, 0x75, 0x66, 0x2e, 0x52, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
+ 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d,
+ 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x0f, 0x6d, 0x61, 0x78, 0x69, 0x6d,
+ 0x75, 0x6d, 0x5f, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e,
+ 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
+ 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x69,
+ 0x6d, 0x75, 0x6d, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xf8, 0x01, 0x0a, 0x18, 0x46,
+ 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e,
+ 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x32, 0x0a, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69,
+ 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
+ 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69,
+ 0x6f, 0x6e, 0x52, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4e, 0x0a, 0x14, 0x6f,
+ 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x66, 0x65, 0x61, 0x74, 0x75,
+ 0x72, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
+ 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74,
+ 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x13, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x61,
+ 0x62, 0x6c, 0x65, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x42, 0x0a, 0x0e, 0x66,
+ 0x69, 0x78, 0x65, 0x64, 0x5f, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x05, 0x20,
+ 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
+ 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74,
+ 0x52, 0x0d, 0x66, 0x69, 0x78, 0x65, 0x64, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x4a,
+ 0x04, 0x08, 0x01, 0x10, 0x02, 0x4a, 0x04, 0x08, 0x02, 0x10, 0x03, 0x52, 0x08, 0x66, 0x65, 0x61,
+ 0x74, 0x75, 0x72, 0x65, 0x73, 0x22, 0xa7, 0x02, 0x0a, 0x0e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65,
+ 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x44, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x67, 0x6f, 0x6f,
+ 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x6f, 0x75,
+ 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4c, 0x6f, 0x63, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xce,
+ 0x01, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x04, 0x70,
+ 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x70,
+ 0x61, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28,
+ 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x6c,
+ 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18,
+ 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x43, 0x6f,
+ 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69,
+ 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x10, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x65,
+ 0x6e, 0x74, 0x73, 0x12, 0x3a, 0x0a, 0x19, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x64,
+ 0x65, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73,
+ 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x17, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x44,
+ 0x65, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22,
+ 0xd0, 0x02, 0x0a, 0x11, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64,
+ 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x4d, 0x0a, 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74,
+ 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
+ 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x47, 0x65, 0x6e, 0x65,
+ 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x6e,
+ 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xeb, 0x01, 0x0a, 0x0a, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74,
+ 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28,
+ 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x73,
+ 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05,
+ 0x62, 0x65, 0x67, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x62, 0x65, 0x67,
+ 0x69, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52,
+ 0x03, 0x65, 0x6e, 0x64, 0x12, 0x52, 0x0a, 0x08, 0x73, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63,
+ 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x36, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74,
+ 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74,
+ 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x52, 0x08,
+ 0x73, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x22, 0x28, 0x0a, 0x08, 0x53, 0x65, 0x6d, 0x61,
+ 0x6e, 0x74, 0x69, 0x63, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x07,
+ 0x0a, 0x03, 0x53, 0x45, 0x54, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, 0x49, 0x41, 0x53,
+ 0x10, 0x02, 0x2a, 0xa7, 0x02, 0x0a, 0x07, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x13,
+ 0x0a, 0x0f, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57,
+ 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0e, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4c,
+ 0x45, 0x47, 0x41, 0x43, 0x59, 0x10, 0x84, 0x07, 0x12, 0x13, 0x0a, 0x0e, 0x45, 0x44, 0x49, 0x54,
+ 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x32, 0x10, 0xe6, 0x07, 0x12, 0x13, 0x0a,
+ 0x0e, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x33, 0x10,
+ 0xe7, 0x07, 0x12, 0x11, 0x0a, 0x0c, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x32, 0x30,
+ 0x32, 0x33, 0x10, 0xe8, 0x07, 0x12, 0x11, 0x0a, 0x0c, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e,
+ 0x5f, 0x32, 0x30, 0x32, 0x34, 0x10, 0xe9, 0x07, 0x12, 0x17, 0x0a, 0x13, 0x45, 0x44, 0x49, 0x54,
+ 0x49, 0x4f, 0x4e, 0x5f, 0x31, 0x5f, 0x54, 0x45, 0x53, 0x54, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10,
+ 0x01, 0x12, 0x17, 0x0a, 0x13, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x32, 0x5f, 0x54,
+ 0x45, 0x53, 0x54, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x02, 0x12, 0x1d, 0x0a, 0x17, 0x45, 0x44,
+ 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x39, 0x39, 0x39, 0x39, 0x37, 0x5f, 0x54, 0x45, 0x53, 0x54,
+ 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x9d, 0x8d, 0x06, 0x12, 0x1d, 0x0a, 0x17, 0x45, 0x44, 0x49,
+ 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x39, 0x39, 0x39, 0x39, 0x38, 0x5f, 0x54, 0x45, 0x53, 0x54, 0x5f,
+ 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x9e, 0x8d, 0x06, 0x12, 0x1d, 0x0a, 0x17, 0x45, 0x44, 0x49, 0x54,
+ 0x49, 0x4f, 0x4e, 0x5f, 0x39, 0x39, 0x39, 0x39, 0x39, 0x5f, 0x54, 0x45, 0x53, 0x54, 0x5f, 0x4f,
+ 0x4e, 0x4c, 0x59, 0x10, 0x9f, 0x8d, 0x06, 0x12, 0x13, 0x0a, 0x0b, 0x45, 0x44, 0x49, 0x54, 0x49,
+ 0x4f, 0x4e, 0x5f, 0x4d, 0x41, 0x58, 0x10, 0xff, 0xff, 0xff, 0xff, 0x07, 0x42, 0x7e, 0x0a, 0x13,
+ 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+ 0x62, 0x75, 0x66, 0x42, 0x10, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50,
+ 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x48, 0x01, 0x5a, 0x2d, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
+ 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+ 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
+ 0x70, 0x74, 0x6f, 0x72, 0x70, 0x62, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa,
+ 0x02, 0x1a, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
+ 0x66, 0x2e, 0x52, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
}
var (
@@ -5084,8 +5242,8 @@ func file_google_protobuf_descriptor_proto_rawDescGZIP() []byte {
}
var file_google_protobuf_descriptor_proto_enumTypes = make([]protoimpl.EnumInfo, 17)
-var file_google_protobuf_descriptor_proto_msgTypes = make([]protoimpl.MessageInfo, 32)
-var file_google_protobuf_descriptor_proto_goTypes = []interface{}{
+var file_google_protobuf_descriptor_proto_msgTypes = make([]protoimpl.MessageInfo, 33)
+var file_google_protobuf_descriptor_proto_goTypes = []any{
(Edition)(0), // 0: google.protobuf.Edition
(ExtensionRangeOptions_VerificationState)(0), // 1: google.protobuf.ExtensionRangeOptions.VerificationState
(FieldDescriptorProto_Type)(0), // 2: google.protobuf.FieldDescriptorProto.Type
@@ -5131,10 +5289,11 @@ var file_google_protobuf_descriptor_proto_goTypes = []interface{}{
(*ExtensionRangeOptions_Declaration)(nil), // 42: google.protobuf.ExtensionRangeOptions.Declaration
(*EnumDescriptorProto_EnumReservedRange)(nil), // 43: google.protobuf.EnumDescriptorProto.EnumReservedRange
(*FieldOptions_EditionDefault)(nil), // 44: google.protobuf.FieldOptions.EditionDefault
- (*UninterpretedOption_NamePart)(nil), // 45: google.protobuf.UninterpretedOption.NamePart
- (*FeatureSetDefaults_FeatureSetEditionDefault)(nil), // 46: google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault
- (*SourceCodeInfo_Location)(nil), // 47: google.protobuf.SourceCodeInfo.Location
- (*GeneratedCodeInfo_Annotation)(nil), // 48: google.protobuf.GeneratedCodeInfo.Annotation
+ (*FieldOptions_FeatureSupport)(nil), // 45: google.protobuf.FieldOptions.FeatureSupport
+ (*UninterpretedOption_NamePart)(nil), // 46: google.protobuf.UninterpretedOption.NamePart
+ (*FeatureSetDefaults_FeatureSetEditionDefault)(nil), // 47: google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault
+ (*SourceCodeInfo_Location)(nil), // 48: google.protobuf.SourceCodeInfo.Location
+ (*GeneratedCodeInfo_Annotation)(nil), // 49: google.protobuf.GeneratedCodeInfo.Annotation
}
var file_google_protobuf_descriptor_proto_depIdxs = []int32{
18, // 0: google.protobuf.FileDescriptorSet.file:type_name -> google.protobuf.FileDescriptorProto
@@ -5179,40 +5338,46 @@ var file_google_protobuf_descriptor_proto_depIdxs = []int32{
8, // 39: google.protobuf.FieldOptions.targets:type_name -> google.protobuf.FieldOptions.OptionTargetType
44, // 40: google.protobuf.FieldOptions.edition_defaults:type_name -> google.protobuf.FieldOptions.EditionDefault
36, // 41: google.protobuf.FieldOptions.features:type_name -> google.protobuf.FeatureSet
- 35, // 42: google.protobuf.FieldOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption
- 36, // 43: google.protobuf.OneofOptions.features:type_name -> google.protobuf.FeatureSet
- 35, // 44: google.protobuf.OneofOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption
- 36, // 45: google.protobuf.EnumOptions.features:type_name -> google.protobuf.FeatureSet
- 35, // 46: google.protobuf.EnumOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption
- 36, // 47: google.protobuf.EnumValueOptions.features:type_name -> google.protobuf.FeatureSet
- 35, // 48: google.protobuf.EnumValueOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption
- 36, // 49: google.protobuf.ServiceOptions.features:type_name -> google.protobuf.FeatureSet
- 35, // 50: google.protobuf.ServiceOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption
- 9, // 51: google.protobuf.MethodOptions.idempotency_level:type_name -> google.protobuf.MethodOptions.IdempotencyLevel
- 36, // 52: google.protobuf.MethodOptions.features:type_name -> google.protobuf.FeatureSet
- 35, // 53: google.protobuf.MethodOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption
- 45, // 54: google.protobuf.UninterpretedOption.name:type_name -> google.protobuf.UninterpretedOption.NamePart
- 10, // 55: google.protobuf.FeatureSet.field_presence:type_name -> google.protobuf.FeatureSet.FieldPresence
- 11, // 56: google.protobuf.FeatureSet.enum_type:type_name -> google.protobuf.FeatureSet.EnumType
- 12, // 57: google.protobuf.FeatureSet.repeated_field_encoding:type_name -> google.protobuf.FeatureSet.RepeatedFieldEncoding
- 13, // 58: google.protobuf.FeatureSet.utf8_validation:type_name -> google.protobuf.FeatureSet.Utf8Validation
- 14, // 59: google.protobuf.FeatureSet.message_encoding:type_name -> google.protobuf.FeatureSet.MessageEncoding
- 15, // 60: google.protobuf.FeatureSet.json_format:type_name -> google.protobuf.FeatureSet.JsonFormat
- 46, // 61: google.protobuf.FeatureSetDefaults.defaults:type_name -> google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault
- 0, // 62: google.protobuf.FeatureSetDefaults.minimum_edition:type_name -> google.protobuf.Edition
- 0, // 63: google.protobuf.FeatureSetDefaults.maximum_edition:type_name -> google.protobuf.Edition
- 47, // 64: google.protobuf.SourceCodeInfo.location:type_name -> google.protobuf.SourceCodeInfo.Location
- 48, // 65: google.protobuf.GeneratedCodeInfo.annotation:type_name -> google.protobuf.GeneratedCodeInfo.Annotation
- 20, // 66: google.protobuf.DescriptorProto.ExtensionRange.options:type_name -> google.protobuf.ExtensionRangeOptions
- 0, // 67: google.protobuf.FieldOptions.EditionDefault.edition:type_name -> google.protobuf.Edition
- 0, // 68: google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.edition:type_name -> google.protobuf.Edition
- 36, // 69: google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features:type_name -> google.protobuf.FeatureSet
- 16, // 70: google.protobuf.GeneratedCodeInfo.Annotation.semantic:type_name -> google.protobuf.GeneratedCodeInfo.Annotation.Semantic
- 71, // [71:71] is the sub-list for method output_type
- 71, // [71:71] is the sub-list for method input_type
- 71, // [71:71] is the sub-list for extension type_name
- 71, // [71:71] is the sub-list for extension extendee
- 0, // [0:71] is the sub-list for field type_name
+ 45, // 42: google.protobuf.FieldOptions.feature_support:type_name -> google.protobuf.FieldOptions.FeatureSupport
+ 35, // 43: google.protobuf.FieldOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption
+ 36, // 44: google.protobuf.OneofOptions.features:type_name -> google.protobuf.FeatureSet
+ 35, // 45: google.protobuf.OneofOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption
+ 36, // 46: google.protobuf.EnumOptions.features:type_name -> google.protobuf.FeatureSet
+ 35, // 47: google.protobuf.EnumOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption
+ 36, // 48: google.protobuf.EnumValueOptions.features:type_name -> google.protobuf.FeatureSet
+ 45, // 49: google.protobuf.EnumValueOptions.feature_support:type_name -> google.protobuf.FieldOptions.FeatureSupport
+ 35, // 50: google.protobuf.EnumValueOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption
+ 36, // 51: google.protobuf.ServiceOptions.features:type_name -> google.protobuf.FeatureSet
+ 35, // 52: google.protobuf.ServiceOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption
+ 9, // 53: google.protobuf.MethodOptions.idempotency_level:type_name -> google.protobuf.MethodOptions.IdempotencyLevel
+ 36, // 54: google.protobuf.MethodOptions.features:type_name -> google.protobuf.FeatureSet
+ 35, // 55: google.protobuf.MethodOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption
+ 46, // 56: google.protobuf.UninterpretedOption.name:type_name -> google.protobuf.UninterpretedOption.NamePart
+ 10, // 57: google.protobuf.FeatureSet.field_presence:type_name -> google.protobuf.FeatureSet.FieldPresence
+ 11, // 58: google.protobuf.FeatureSet.enum_type:type_name -> google.protobuf.FeatureSet.EnumType
+ 12, // 59: google.protobuf.FeatureSet.repeated_field_encoding:type_name -> google.protobuf.FeatureSet.RepeatedFieldEncoding
+ 13, // 60: google.protobuf.FeatureSet.utf8_validation:type_name -> google.protobuf.FeatureSet.Utf8Validation
+ 14, // 61: google.protobuf.FeatureSet.message_encoding:type_name -> google.protobuf.FeatureSet.MessageEncoding
+ 15, // 62: google.protobuf.FeatureSet.json_format:type_name -> google.protobuf.FeatureSet.JsonFormat
+ 47, // 63: google.protobuf.FeatureSetDefaults.defaults:type_name -> google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault
+ 0, // 64: google.protobuf.FeatureSetDefaults.minimum_edition:type_name -> google.protobuf.Edition
+ 0, // 65: google.protobuf.FeatureSetDefaults.maximum_edition:type_name -> google.protobuf.Edition
+ 48, // 66: google.protobuf.SourceCodeInfo.location:type_name -> google.protobuf.SourceCodeInfo.Location
+ 49, // 67: google.protobuf.GeneratedCodeInfo.annotation:type_name -> google.protobuf.GeneratedCodeInfo.Annotation
+ 20, // 68: google.protobuf.DescriptorProto.ExtensionRange.options:type_name -> google.protobuf.ExtensionRangeOptions
+ 0, // 69: google.protobuf.FieldOptions.EditionDefault.edition:type_name -> google.protobuf.Edition
+ 0, // 70: google.protobuf.FieldOptions.FeatureSupport.edition_introduced:type_name -> google.protobuf.Edition
+ 0, // 71: google.protobuf.FieldOptions.FeatureSupport.edition_deprecated:type_name -> google.protobuf.Edition
+ 0, // 72: google.protobuf.FieldOptions.FeatureSupport.edition_removed:type_name -> google.protobuf.Edition
+ 0, // 73: google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.edition:type_name -> google.protobuf.Edition
+ 36, // 74: google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridable_features:type_name -> google.protobuf.FeatureSet
+ 36, // 75: google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixed_features:type_name -> google.protobuf.FeatureSet
+ 16, // 76: google.protobuf.GeneratedCodeInfo.Annotation.semantic:type_name -> google.protobuf.GeneratedCodeInfo.Annotation.Semantic
+ 77, // [77:77] is the sub-list for method output_type
+ 77, // [77:77] is the sub-list for method input_type
+ 77, // [77:77] is the sub-list for extension type_name
+ 77, // [77:77] is the sub-list for extension extendee
+ 0, // [0:77] is the sub-list for field type_name
}
func init() { file_google_protobuf_descriptor_proto_init() }
@@ -5221,7 +5386,7 @@ func file_google_protobuf_descriptor_proto_init() {
return
}
if !protoimpl.UnsafeEnabled {
- file_google_protobuf_descriptor_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*FileDescriptorSet); i {
case 0:
return &v.state
@@ -5233,7 +5398,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[1].Exporter = func(v any, i int) any {
switch v := v.(*FileDescriptorProto); i {
case 0:
return &v.state
@@ -5245,7 +5410,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[2].Exporter = func(v any, i int) any {
switch v := v.(*DescriptorProto); i {
case 0:
return &v.state
@@ -5257,7 +5422,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[3].Exporter = func(v any, i int) any {
switch v := v.(*ExtensionRangeOptions); i {
case 0:
return &v.state
@@ -5271,7 +5436,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[4].Exporter = func(v any, i int) any {
switch v := v.(*FieldDescriptorProto); i {
case 0:
return &v.state
@@ -5283,7 +5448,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[5].Exporter = func(v any, i int) any {
switch v := v.(*OneofDescriptorProto); i {
case 0:
return &v.state
@@ -5295,7 +5460,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[6].Exporter = func(v any, i int) any {
switch v := v.(*EnumDescriptorProto); i {
case 0:
return &v.state
@@ -5307,7 +5472,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[7].Exporter = func(v any, i int) any {
switch v := v.(*EnumValueDescriptorProto); i {
case 0:
return &v.state
@@ -5319,7 +5484,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[8].Exporter = func(v any, i int) any {
switch v := v.(*ServiceDescriptorProto); i {
case 0:
return &v.state
@@ -5331,7 +5496,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[9].Exporter = func(v any, i int) any {
switch v := v.(*MethodDescriptorProto); i {
case 0:
return &v.state
@@ -5343,7 +5508,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[10].Exporter = func(v any, i int) any {
switch v := v.(*FileOptions); i {
case 0:
return &v.state
@@ -5357,7 +5522,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[11].Exporter = func(v any, i int) any {
switch v := v.(*MessageOptions); i {
case 0:
return &v.state
@@ -5371,7 +5536,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[12].Exporter = func(v any, i int) any {
switch v := v.(*FieldOptions); i {
case 0:
return &v.state
@@ -5385,7 +5550,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[13].Exporter = func(v any, i int) any {
switch v := v.(*OneofOptions); i {
case 0:
return &v.state
@@ -5399,7 +5564,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[14].Exporter = func(v any, i int) any {
switch v := v.(*EnumOptions); i {
case 0:
return &v.state
@@ -5413,7 +5578,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[15].Exporter = func(v any, i int) any {
switch v := v.(*EnumValueOptions); i {
case 0:
return &v.state
@@ -5427,7 +5592,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[16].Exporter = func(v any, i int) any {
switch v := v.(*ServiceOptions); i {
case 0:
return &v.state
@@ -5441,7 +5606,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[17].Exporter = func(v any, i int) any {
switch v := v.(*MethodOptions); i {
case 0:
return &v.state
@@ -5455,7 +5620,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[18].Exporter = func(v any, i int) any {
switch v := v.(*UninterpretedOption); i {
case 0:
return &v.state
@@ -5467,7 +5632,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[19].Exporter = func(v any, i int) any {
switch v := v.(*FeatureSet); i {
case 0:
return &v.state
@@ -5481,7 +5646,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[20].Exporter = func(v any, i int) any {
switch v := v.(*FeatureSetDefaults); i {
case 0:
return &v.state
@@ -5493,7 +5658,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[21].Exporter = func(v any, i int) any {
switch v := v.(*SourceCodeInfo); i {
case 0:
return &v.state
@@ -5505,7 +5670,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[22].Exporter = func(v any, i int) any {
switch v := v.(*GeneratedCodeInfo); i {
case 0:
return &v.state
@@ -5517,7 +5682,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[23].Exporter = func(v any, i int) any {
switch v := v.(*DescriptorProto_ExtensionRange); i {
case 0:
return &v.state
@@ -5529,7 +5694,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[24].Exporter = func(v any, i int) any {
switch v := v.(*DescriptorProto_ReservedRange); i {
case 0:
return &v.state
@@ -5541,7 +5706,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[25].Exporter = func(v any, i int) any {
switch v := v.(*ExtensionRangeOptions_Declaration); i {
case 0:
return &v.state
@@ -5553,7 +5718,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[26].Exporter = func(v any, i int) any {
switch v := v.(*EnumDescriptorProto_EnumReservedRange); i {
case 0:
return &v.state
@@ -5565,7 +5730,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[27].Exporter = func(v any, i int) any {
switch v := v.(*FieldOptions_EditionDefault); i {
case 0:
return &v.state
@@ -5577,7 +5742,19 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[28].Exporter = func(v any, i int) any {
+ switch v := v.(*FieldOptions_FeatureSupport); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_google_protobuf_descriptor_proto_msgTypes[29].Exporter = func(v any, i int) any {
switch v := v.(*UninterpretedOption_NamePart); i {
case 0:
return &v.state
@@ -5589,7 +5766,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[30].Exporter = func(v any, i int) any {
switch v := v.(*FeatureSetDefaults_FeatureSetEditionDefault); i {
case 0:
return &v.state
@@ -5601,7 +5778,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[31].Exporter = func(v any, i int) any {
switch v := v.(*SourceCodeInfo_Location); i {
case 0:
return &v.state
@@ -5613,7 +5790,7 @@ func file_google_protobuf_descriptor_proto_init() {
return nil
}
}
- file_google_protobuf_descriptor_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_descriptor_proto_msgTypes[32].Exporter = func(v any, i int) any {
switch v := v.(*GeneratedCodeInfo_Annotation); i {
case 0:
return &v.state
@@ -5632,7 +5809,7 @@ func file_google_protobuf_descriptor_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_google_protobuf_descriptor_proto_rawDesc,
NumEnums: 17,
- NumMessages: 32,
+ NumMessages: 33,
NumExtensions: 0,
NumServices: 0,
},
diff --git a/vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.pb.go b/vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.pb.go
index 25de5ae00..a2ca940c5 100644
--- a/vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.pb.go
+++ b/vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.pb.go
@@ -6,9 +6,9 @@
// https://developers.google.com/open-source/licenses/bsd
// Code generated by protoc-gen-go. DO NOT EDIT.
-// source: reflect/protodesc/proto/go_features.proto
+// source: google/protobuf/go_features.proto
-package proto
+package gofeaturespb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
@@ -30,7 +30,7 @@ type GoFeatures struct {
func (x *GoFeatures) Reset() {
*x = GoFeatures{}
if protoimpl.UnsafeEnabled {
- mi := &file_reflect_protodesc_proto_go_features_proto_msgTypes[0]
+ mi := &file_google_protobuf_go_features_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -43,7 +43,7 @@ func (x *GoFeatures) String() string {
func (*GoFeatures) ProtoMessage() {}
func (x *GoFeatures) ProtoReflect() protoreflect.Message {
- mi := &file_reflect_protodesc_proto_go_features_proto_msgTypes[0]
+ mi := &file_google_protobuf_go_features_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -56,7 +56,7 @@ func (x *GoFeatures) ProtoReflect() protoreflect.Message {
// Deprecated: Use GoFeatures.ProtoReflect.Descriptor instead.
func (*GoFeatures) Descriptor() ([]byte, []int) {
- return file_reflect_protodesc_proto_go_features_proto_rawDescGZIP(), []int{0}
+ return file_google_protobuf_go_features_proto_rawDescGZIP(), []int{0}
}
func (x *GoFeatures) GetLegacyUnmarshalJsonEnum() bool {
@@ -66,69 +66,73 @@ func (x *GoFeatures) GetLegacyUnmarshalJsonEnum() bool {
return false
}
-var file_reflect_protodesc_proto_go_features_proto_extTypes = []protoimpl.ExtensionInfo{
+var file_google_protobuf_go_features_proto_extTypes = []protoimpl.ExtensionInfo{
{
ExtendedType: (*descriptorpb.FeatureSet)(nil),
ExtensionType: (*GoFeatures)(nil),
Field: 1002,
- Name: "google.protobuf.go",
+ Name: "pb.go",
Tag: "bytes,1002,opt,name=go",
- Filename: "reflect/protodesc/proto/go_features.proto",
+ Filename: "google/protobuf/go_features.proto",
},
}
// Extension fields to descriptorpb.FeatureSet.
var (
- // optional google.protobuf.GoFeatures go = 1002;
- E_Go = &file_reflect_protodesc_proto_go_features_proto_extTypes[0]
+ // optional pb.GoFeatures go = 1002;
+ E_Go = &file_google_protobuf_go_features_proto_extTypes[0]
)
-var File_reflect_protodesc_proto_go_features_proto protoreflect.FileDescriptor
-
-var file_reflect_protodesc_proto_go_features_proto_rawDesc = []byte{
- 0x0a, 0x29, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x64,
- 0x65, 0x73, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x5f, 0x66, 0x65, 0x61,
- 0x74, 0x75, 0x72, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f,
- 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x1a, 0x20, 0x67, 0x6f,
- 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65,
- 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6a,
- 0x0a, 0x0a, 0x47, 0x6f, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x5c, 0x0a, 0x1a,
- 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x75, 0x6e, 0x6d, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6c,
- 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08,
- 0x42, 0x1f, 0x88, 0x01, 0x01, 0x98, 0x01, 0x06, 0xa2, 0x01, 0x09, 0x12, 0x04, 0x74, 0x72, 0x75,
- 0x65, 0x18, 0xe6, 0x07, 0xa2, 0x01, 0x0a, 0x12, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x18, 0xe7,
- 0x07, 0x52, 0x17, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x55, 0x6e, 0x6d, 0x61, 0x72, 0x73, 0x68,
- 0x61, 0x6c, 0x4a, 0x73, 0x6f, 0x6e, 0x45, 0x6e, 0x75, 0x6d, 0x3a, 0x49, 0x0a, 0x02, 0x67, 0x6f,
- 0x12, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
- 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x18, 0xea, 0x07,
- 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
- 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x47, 0x6f, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65,
- 0x73, 0x52, 0x02, 0x67, 0x6f, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
- 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
- 0x62, 0x75, 0x66, 0x2f, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74,
- 0x6f, 0x64, 0x65, 0x73, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+var File_google_protobuf_go_features_proto protoreflect.FileDescriptor
+
+var file_google_protobuf_go_features_proto_rawDesc = []byte{
+ 0x0a, 0x21, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
+ 0x66, 0x2f, 0x67, 0x6f, 0x5f, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x2e, 0x70, 0x72,
+ 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,
+ 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcd, 0x01, 0x0a, 0x0a, 0x47, 0x6f,
+ 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0xbe, 0x01, 0x0a, 0x1a, 0x6c, 0x65, 0x67,
+ 0x61, 0x63, 0x79, 0x5f, 0x75, 0x6e, 0x6d, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6c, 0x5f, 0x6a, 0x73,
+ 0x6f, 0x6e, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x42, 0x80, 0x01,
+ 0x88, 0x01, 0x01, 0x98, 0x01, 0x06, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x09, 0x12, 0x04, 0x74, 0x72,
+ 0x75, 0x65, 0x18, 0x84, 0x07, 0xa2, 0x01, 0x0a, 0x12, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x18,
+ 0xe7, 0x07, 0xb2, 0x01, 0x5b, 0x08, 0xe8, 0x07, 0x10, 0xe8, 0x07, 0x1a, 0x53, 0x54, 0x68, 0x65,
+ 0x20, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x20, 0x55, 0x6e, 0x6d, 0x61, 0x72, 0x73, 0x68, 0x61,
+ 0x6c, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x41, 0x50, 0x49, 0x20, 0x69, 0x73, 0x20, 0x64, 0x65, 0x70,
+ 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x77, 0x69, 0x6c, 0x6c,
+ 0x20, 0x62, 0x65, 0x20, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x61,
+ 0x20, 0x66, 0x75, 0x74, 0x75, 0x72, 0x65, 0x20, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e,
+ 0x52, 0x17, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x55, 0x6e, 0x6d, 0x61, 0x72, 0x73, 0x68, 0x61,
+ 0x6c, 0x4a, 0x73, 0x6f, 0x6e, 0x45, 0x6e, 0x75, 0x6d, 0x3a, 0x3c, 0x0a, 0x02, 0x67, 0x6f, 0x12,
+ 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
+ 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x18, 0xea, 0x07, 0x20,
+ 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x6f, 0x46, 0x65, 0x61, 0x74, 0x75,
+ 0x72, 0x65, 0x73, 0x52, 0x02, 0x67, 0x6f, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
+ 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f,
+ 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x67, 0x6f, 0x66, 0x65,
+ 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x70, 0x62,
}
var (
- file_reflect_protodesc_proto_go_features_proto_rawDescOnce sync.Once
- file_reflect_protodesc_proto_go_features_proto_rawDescData = file_reflect_protodesc_proto_go_features_proto_rawDesc
+ file_google_protobuf_go_features_proto_rawDescOnce sync.Once
+ file_google_protobuf_go_features_proto_rawDescData = file_google_protobuf_go_features_proto_rawDesc
)
-func file_reflect_protodesc_proto_go_features_proto_rawDescGZIP() []byte {
- file_reflect_protodesc_proto_go_features_proto_rawDescOnce.Do(func() {
- file_reflect_protodesc_proto_go_features_proto_rawDescData = protoimpl.X.CompressGZIP(file_reflect_protodesc_proto_go_features_proto_rawDescData)
+func file_google_protobuf_go_features_proto_rawDescGZIP() []byte {
+ file_google_protobuf_go_features_proto_rawDescOnce.Do(func() {
+ file_google_protobuf_go_features_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_protobuf_go_features_proto_rawDescData)
})
- return file_reflect_protodesc_proto_go_features_proto_rawDescData
+ return file_google_protobuf_go_features_proto_rawDescData
}
-var file_reflect_protodesc_proto_go_features_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
-var file_reflect_protodesc_proto_go_features_proto_goTypes = []interface{}{
- (*GoFeatures)(nil), // 0: google.protobuf.GoFeatures
+var file_google_protobuf_go_features_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
+var file_google_protobuf_go_features_proto_goTypes = []any{
+ (*GoFeatures)(nil), // 0: pb.GoFeatures
(*descriptorpb.FeatureSet)(nil), // 1: google.protobuf.FeatureSet
}
-var file_reflect_protodesc_proto_go_features_proto_depIdxs = []int32{
- 1, // 0: google.protobuf.go:extendee -> google.protobuf.FeatureSet
- 0, // 1: google.protobuf.go:type_name -> google.protobuf.GoFeatures
+var file_google_protobuf_go_features_proto_depIdxs = []int32{
+ 1, // 0: pb.go:extendee -> google.protobuf.FeatureSet
+ 0, // 1: pb.go:type_name -> pb.GoFeatures
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
1, // [1:2] is the sub-list for extension type_name
@@ -136,13 +140,13 @@ var file_reflect_protodesc_proto_go_features_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for field type_name
}
-func init() { file_reflect_protodesc_proto_go_features_proto_init() }
-func file_reflect_protodesc_proto_go_features_proto_init() {
- if File_reflect_protodesc_proto_go_features_proto != nil {
+func init() { file_google_protobuf_go_features_proto_init() }
+func file_google_protobuf_go_features_proto_init() {
+ if File_google_protobuf_go_features_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
- file_reflect_protodesc_proto_go_features_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_go_features_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*GoFeatures); i {
case 0:
return &v.state
@@ -159,19 +163,19 @@ func file_reflect_protodesc_proto_go_features_proto_init() {
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
- RawDescriptor: file_reflect_protodesc_proto_go_features_proto_rawDesc,
+ RawDescriptor: file_google_protobuf_go_features_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 1,
NumServices: 0,
},
- GoTypes: file_reflect_protodesc_proto_go_features_proto_goTypes,
- DependencyIndexes: file_reflect_protodesc_proto_go_features_proto_depIdxs,
- MessageInfos: file_reflect_protodesc_proto_go_features_proto_msgTypes,
- ExtensionInfos: file_reflect_protodesc_proto_go_features_proto_extTypes,
+ GoTypes: file_google_protobuf_go_features_proto_goTypes,
+ DependencyIndexes: file_google_protobuf_go_features_proto_depIdxs,
+ MessageInfos: file_google_protobuf_go_features_proto_msgTypes,
+ ExtensionInfos: file_google_protobuf_go_features_proto_extTypes,
}.Build()
- File_reflect_protodesc_proto_go_features_proto = out.File
- file_reflect_protodesc_proto_go_features_proto_rawDesc = nil
- file_reflect_protodesc_proto_go_features_proto_goTypes = nil
- file_reflect_protodesc_proto_go_features_proto_depIdxs = nil
+ File_google_protobuf_go_features_proto = out.File
+ file_google_protobuf_go_features_proto_rawDesc = nil
+ file_google_protobuf_go_features_proto_goTypes = nil
+ file_google_protobuf_go_features_proto_depIdxs = nil
}
diff --git a/vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.proto b/vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.proto
deleted file mode 100644
index d24657129..000000000
--- a/vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.proto
+++ /dev/null
@@ -1,28 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2023 Google Inc. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file or at
-// https://developers.google.com/open-source/licenses/bsd
-
-syntax = "proto2";
-
-package google.protobuf;
-
-import "google/protobuf/descriptor.proto";
-
-option go_package = "google.golang.org/protobuf/types/gofeaturespb";
-
-extend google.protobuf.FeatureSet {
- optional GoFeatures go = 1002;
-}
-
-message GoFeatures {
- // Whether or not to generate the deprecated UnmarshalJSON method for enums.
- optional bool legacy_unmarshal_json_enum = 1 [
- retention = RETENTION_RUNTIME,
- targets = TARGET_TYPE_ENUM,
- edition_defaults = { edition: EDITION_PROTO2, value: "true" },
- edition_defaults = { edition: EDITION_PROTO3, value: "false" }
- ];
-}
diff --git a/vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go b/vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go
index 9de51be54..7172b43d3 100644
--- a/vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go
+++ b/vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go
@@ -445,7 +445,7 @@ func file_google_protobuf_any_proto_rawDescGZIP() []byte {
}
var file_google_protobuf_any_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
-var file_google_protobuf_any_proto_goTypes = []interface{}{
+var file_google_protobuf_any_proto_goTypes = []any{
(*Any)(nil), // 0: google.protobuf.Any
}
var file_google_protobuf_any_proto_depIdxs = []int32{
@@ -462,7 +462,7 @@ func file_google_protobuf_any_proto_init() {
return
}
if !protoimpl.UnsafeEnabled {
- file_google_protobuf_any_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_any_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*Any); i {
case 0:
return &v.state
diff --git a/vendor/google.golang.org/protobuf/types/known/durationpb/duration.pb.go b/vendor/google.golang.org/protobuf/types/known/durationpb/duration.pb.go
index df709a8dd..1b71bcd91 100644
--- a/vendor/google.golang.org/protobuf/types/known/durationpb/duration.pb.go
+++ b/vendor/google.golang.org/protobuf/types/known/durationpb/duration.pb.go
@@ -323,7 +323,7 @@ func file_google_protobuf_duration_proto_rawDescGZIP() []byte {
}
var file_google_protobuf_duration_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
-var file_google_protobuf_duration_proto_goTypes = []interface{}{
+var file_google_protobuf_duration_proto_goTypes = []any{
(*Duration)(nil), // 0: google.protobuf.Duration
}
var file_google_protobuf_duration_proto_depIdxs = []int32{
@@ -340,7 +340,7 @@ func file_google_protobuf_duration_proto_init() {
return
}
if !protoimpl.UnsafeEnabled {
- file_google_protobuf_duration_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_duration_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*Duration); i {
case 0:
return &v.state
diff --git a/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go b/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go
index 81511a336..83a5a645b 100644
--- a/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go
+++ b/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go
@@ -332,7 +332,7 @@ func file_google_protobuf_timestamp_proto_rawDescGZIP() []byte {
}
var file_google_protobuf_timestamp_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
-var file_google_protobuf_timestamp_proto_goTypes = []interface{}{
+var file_google_protobuf_timestamp_proto_goTypes = []any{
(*Timestamp)(nil), // 0: google.protobuf.Timestamp
}
var file_google_protobuf_timestamp_proto_depIdxs = []int32{
@@ -349,7 +349,7 @@ func file_google_protobuf_timestamp_proto_init() {
return
}
if !protoimpl.UnsafeEnabled {
- file_google_protobuf_timestamp_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ file_google_protobuf_timestamp_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*Timestamp); i {
case 0:
return &v.state
diff --git a/vendor/k8s.io/apimachinery/pkg/api/equality/semantic.go b/vendor/k8s.io/apimachinery/pkg/api/equality/semantic.go
new file mode 100644
index 000000000..f02fa8e43
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/api/equality/semantic.go
@@ -0,0 +1,49 @@
+/*
+Copyright 2014 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package equality
+
+import (
+ "k8s.io/apimachinery/pkg/api/resource"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/conversion"
+ "k8s.io/apimachinery/pkg/fields"
+ "k8s.io/apimachinery/pkg/labels"
+)
+
+// Semantic can do semantic deep equality checks for api objects.
+// Example: apiequality.Semantic.DeepEqual(aPod, aPodWithNonNilButEmptyMaps) == true
+var Semantic = conversion.EqualitiesOrDie(
+ func(a, b resource.Quantity) bool {
+ // Ignore formatting, only care that numeric value stayed the same.
+ // TODO: if we decide it's important, it should be safe to start comparing the format.
+ //
+ // Uninitialized quantities are equivalent to 0 quantities.
+ return a.Cmp(b) == 0
+ },
+ func(a, b metav1.MicroTime) bool {
+ return a.UTC() == b.UTC()
+ },
+ func(a, b metav1.Time) bool {
+ return a.UTC() == b.UTC()
+ },
+ func(a, b labels.Selector) bool {
+ return a.String() == b.String()
+ },
+ func(a, b fields.Selector) bool {
+ return a.String() == b.String()
+ },
+)
diff --git a/vendor/k8s.io/apimachinery/pkg/api/errors/OWNERS b/vendor/k8s.io/apimachinery/pkg/api/errors/OWNERS
index d4c73022f..1a9f5e770 100644
--- a/vendor/k8s.io/apimachinery/pkg/api/errors/OWNERS
+++ b/vendor/k8s.io/apimachinery/pkg/api/errors/OWNERS
@@ -1,20 +1,16 @@
# See the OWNERS docs at https://go.k8s.io/owners
reviewers:
-- thockin
-- lavalamp
-- smarterclayton
-- wojtek-t
-- deads2k
-- brendandburns
-- derekwaynecarr
-- caesarxuchao
-- mikedanese
-- liggitt
-- saad-ali
-- janetkuo
-- tallclair
-- dims
-- hongchaodeng
-- krousey
-- cjcullen
+ - thockin
+ - smarterclayton
+ - wojtek-t
+ - deads2k
+ - derekwaynecarr
+ - caesarxuchao
+ - mikedanese
+ - liggitt
+ - saad-ali
+ - janetkuo
+ - tallclair
+ - dims
+ - cjcullen
diff --git a/vendor/k8s.io/apimachinery/pkg/api/errors/errors.go b/vendor/k8s.io/apimachinery/pkg/api/errors/errors.go
index 97e17be39..57e0e71f6 100644
--- a/vendor/k8s.io/apimachinery/pkg/api/errors/errors.go
+++ b/vendor/k8s.io/apimachinery/pkg/api/errors/errors.go
@@ -87,21 +87,21 @@ func (e *StatusError) DebugError() (string, []interface{}) {
// HasStatusCause returns true if the provided error has a details cause
// with the provided type name.
+// It supports wrapped errors and returns false when the error is nil.
func HasStatusCause(err error, name metav1.CauseType) bool {
_, ok := StatusCause(err, name)
return ok
}
// StatusCause returns the named cause from the provided error if it exists and
-// the error is of the type APIStatus. Otherwise it returns false.
+// the error unwraps to the type APIStatus. Otherwise it returns false.
func StatusCause(err error, name metav1.CauseType) (metav1.StatusCause, bool) {
- apierr, ok := err.(APIStatus)
- if !ok || apierr == nil || apierr.Status().Details == nil {
- return metav1.StatusCause{}, false
- }
- for _, cause := range apierr.Status().Details.Causes {
- if cause.Type == name {
- return cause, true
+ status, ok := err.(APIStatus)
+ if (ok || errors.As(err, &status)) && status.Status().Details != nil {
+ for _, cause := range status.Status().Details.Causes {
+ if cause.Type == name {
+ return cause, true
+ }
}
}
return metav1.StatusCause{}, false
@@ -523,7 +523,7 @@ func NewGenericServerResponse(code int, verb string, qualifiedResource schema.Gr
}
// IsNotFound returns true if the specified error was created by NewNotFound.
-// It supports wrapped errors.
+// It supports wrapped errors and returns false when the error is nil.
func IsNotFound(err error) bool {
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonNotFound {
@@ -536,13 +536,13 @@ func IsNotFound(err error) bool {
}
// IsAlreadyExists determines if the err is an error which indicates that a specified resource already exists.
-// It supports wrapped errors.
+// It supports wrapped errors and returns false when the error is nil.
func IsAlreadyExists(err error) bool {
return ReasonForError(err) == metav1.StatusReasonAlreadyExists
}
// IsConflict determines if the err is an error which indicates the provided update conflicts.
-// It supports wrapped errors.
+// It supports wrapped errors and returns false when the error is nil.
func IsConflict(err error) bool {
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonConflict {
@@ -555,7 +555,7 @@ func IsConflict(err error) bool {
}
// IsInvalid determines if the err is an error which indicates the provided resource is not valid.
-// It supports wrapped errors.
+// It supports wrapped errors and returns false when the error is nil.
func IsInvalid(err error) bool {
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonInvalid {
@@ -568,7 +568,7 @@ func IsInvalid(err error) bool {
}
// IsGone is true if the error indicates the requested resource is no longer available.
-// It supports wrapped errors.
+// It supports wrapped errors and returns false when the error is nil.
func IsGone(err error) bool {
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonGone {
@@ -582,13 +582,13 @@ func IsGone(err error) bool {
// IsResourceExpired is true if the error indicates the resource has expired and the current action is
// no longer possible.
-// It supports wrapped errors.
+// It supports wrapped errors and returns false when the error is nil.
func IsResourceExpired(err error) bool {
return ReasonForError(err) == metav1.StatusReasonExpired
}
// IsNotAcceptable determines if err is an error which indicates that the request failed due to an invalid Accept header
-// It supports wrapped errors.
+// It supports wrapped errors and returns false when the error is nil.
func IsNotAcceptable(err error) bool {
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonNotAcceptable {
@@ -601,7 +601,7 @@ func IsNotAcceptable(err error) bool {
}
// IsUnsupportedMediaType determines if err is an error which indicates that the request failed due to an invalid Content-Type header
-// It supports wrapped errors.
+// It supports wrapped errors and returns false when the error is nil.
func IsUnsupportedMediaType(err error) bool {
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonUnsupportedMediaType {
@@ -615,7 +615,7 @@ func IsUnsupportedMediaType(err error) bool {
// IsMethodNotSupported determines if the err is an error which indicates the provided action could not
// be performed because it is not supported by the server.
-// It supports wrapped errors.
+// It supports wrapped errors and returns false when the error is nil.
func IsMethodNotSupported(err error) bool {
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonMethodNotAllowed {
@@ -628,7 +628,7 @@ func IsMethodNotSupported(err error) bool {
}
// IsServiceUnavailable is true if the error indicates the underlying service is no longer available.
-// It supports wrapped errors.
+// It supports wrapped errors and returns false when the error is nil.
func IsServiceUnavailable(err error) bool {
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonServiceUnavailable {
@@ -641,7 +641,7 @@ func IsServiceUnavailable(err error) bool {
}
// IsBadRequest determines if err is an error which indicates that the request is invalid.
-// It supports wrapped errors.
+// It supports wrapped errors and returns false when the error is nil.
func IsBadRequest(err error) bool {
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonBadRequest {
@@ -655,7 +655,7 @@ func IsBadRequest(err error) bool {
// IsUnauthorized determines if err is an error which indicates that the request is unauthorized and
// requires authentication by the user.
-// It supports wrapped errors.
+// It supports wrapped errors and returns false when the error is nil.
func IsUnauthorized(err error) bool {
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonUnauthorized {
@@ -669,7 +669,7 @@ func IsUnauthorized(err error) bool {
// IsForbidden determines if err is an error which indicates that the request is forbidden and cannot
// be completed as requested.
-// It supports wrapped errors.
+// It supports wrapped errors and returns false when the error is nil.
func IsForbidden(err error) bool {
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonForbidden {
@@ -683,7 +683,7 @@ func IsForbidden(err error) bool {
// IsTimeout determines if err is an error which indicates that request times out due to long
// processing.
-// It supports wrapped errors.
+// It supports wrapped errors and returns false when the error is nil.
func IsTimeout(err error) bool {
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonTimeout {
@@ -697,7 +697,7 @@ func IsTimeout(err error) bool {
// IsServerTimeout determines if err is an error which indicates that the request needs to be retried
// by the client.
-// It supports wrapped errors.
+// It supports wrapped errors and returns false when the error is nil.
func IsServerTimeout(err error) bool {
// do not check the status code, because no https status code exists that can
// be scoped to retryable timeouts.
@@ -705,7 +705,7 @@ func IsServerTimeout(err error) bool {
}
// IsInternalError determines if err is an error which indicates an internal server error.
-// It supports wrapped errors.
+// It supports wrapped errors and returns false when the error is nil.
func IsInternalError(err error) bool {
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonInternalError {
@@ -719,7 +719,7 @@ func IsInternalError(err error) bool {
// IsTooManyRequests determines if err is an error which indicates that there are too many requests
// that the server cannot handle.
-// It supports wrapped errors.
+// It supports wrapped errors and returns false when the error is nil.
func IsTooManyRequests(err error) bool {
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonTooManyRequests {
@@ -737,7 +737,7 @@ func IsTooManyRequests(err error) bool {
// IsRequestEntityTooLargeError determines if err is an error which indicates
// the request entity is too large.
-// It supports wrapped errors.
+// It supports wrapped errors and returns false when the error is nil.
func IsRequestEntityTooLargeError(err error) bool {
reason, code := reasonAndCodeForError(err)
if reason == metav1.StatusReasonRequestEntityTooLarge {
@@ -755,9 +755,10 @@ func IsRequestEntityTooLargeError(err error) bool {
// IsUnexpectedServerError returns true if the server response was not in the expected API format,
// and may be the result of another HTTP actor.
-// It supports wrapped errors.
+// It supports wrapped errors and returns false when the error is nil.
func IsUnexpectedServerError(err error) bool {
- if status := APIStatus(nil); errors.As(err, &status) && status.Status().Details != nil {
+ status, ok := err.(APIStatus)
+ if (ok || errors.As(err, &status)) && status.Status().Details != nil {
for _, cause := range status.Status().Details.Causes {
if cause.Type == metav1.CauseTypeUnexpectedServerResponse {
return true
@@ -768,19 +769,20 @@ func IsUnexpectedServerError(err error) bool {
}
// IsUnexpectedObjectError determines if err is due to an unexpected object from the master.
-// It supports wrapped errors.
+// It supports wrapped errors and returns false when the error is nil.
func IsUnexpectedObjectError(err error) bool {
- uoe := &UnexpectedObjectError{}
- return err != nil && errors.As(err, &uoe)
+ uoe, ok := err.(*UnexpectedObjectError)
+ return err != nil && (ok || errors.As(err, &uoe))
}
// SuggestsClientDelay returns true if this error suggests a client delay as well as the
// suggested seconds to wait, or false if the error does not imply a wait. It does not
// address whether the error *should* be retried, since some errors (like a 3xx) may
// request delay without retry.
-// It supports wrapped errors.
+// It supports wrapped errors and returns false when the error is nil.
func SuggestsClientDelay(err error) (int, bool) {
- if t := APIStatus(nil); errors.As(err, &t) && t.Status().Details != nil {
+ t, ok := err.(APIStatus)
+ if (ok || errors.As(err, &t)) && t.Status().Details != nil {
switch t.Status().Reason {
// this StatusReason explicitly requests the caller to delay the action
case metav1.StatusReasonServerTimeout:
@@ -795,16 +797,17 @@ func SuggestsClientDelay(err error) (int, bool) {
}
// ReasonForError returns the HTTP status for a particular error.
-// It supports wrapped errors.
+// It supports wrapped errors and returns StatusReasonUnknown when
+// the error is nil or doesn't have a status.
func ReasonForError(err error) metav1.StatusReason {
- if status := APIStatus(nil); errors.As(err, &status) {
+ if status, ok := err.(APIStatus); ok || errors.As(err, &status) {
return status.Status().Reason
}
return metav1.StatusReasonUnknown
}
func reasonAndCodeForError(err error) (metav1.StatusReason, int32) {
- if status := APIStatus(nil); errors.As(err, &status) {
+ if status, ok := err.(APIStatus); ok || errors.As(err, &status) {
return status.Status().Reason, status.Status().Code
}
return metav1.StatusReasonUnknown, 0
diff --git a/vendor/k8s.io/apimachinery/pkg/api/meta/OWNERS b/vendor/k8s.io/apimachinery/pkg/api/meta/OWNERS
index f929e061d..1e1330fff 100644
--- a/vendor/k8s.io/apimachinery/pkg/api/meta/OWNERS
+++ b/vendor/k8s.io/apimachinery/pkg/api/meta/OWNERS
@@ -1,18 +1,14 @@
# See the OWNERS docs at https://go.k8s.io/owners
reviewers:
-- thockin
-- smarterclayton
-- wojtek-t
-- deads2k
-- brendandburns
-- derekwaynecarr
-- caesarxuchao
-- mikedanese
-- liggitt
-- janetkuo
-- ncdc
-- dims
-- krousey
-- resouer
-- mfojtik
+ - thockin
+ - smarterclayton
+ - wojtek-t
+ - deads2k
+ - derekwaynecarr
+ - caesarxuchao
+ - mikedanese
+ - liggitt
+ - janetkuo
+ - ncdc
+ - dims
diff --git a/vendor/k8s.io/apimachinery/pkg/api/meta/conditions.go b/vendor/k8s.io/apimachinery/pkg/api/meta/conditions.go
index 60c8209de..cbdf2eeb8 100644
--- a/vendor/k8s.io/apimachinery/pkg/api/meta/conditions.go
+++ b/vendor/k8s.io/apimachinery/pkg/api/meta/conditions.go
@@ -22,14 +22,15 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
-// SetStatusCondition sets the corresponding condition in conditions to newCondition.
+// SetStatusCondition sets the corresponding condition in conditions to newCondition and returns true
+// if the conditions are changed by this call.
// conditions must be non-nil.
// 1. if the condition of the specified type already exists (all fields of the existing condition are updated to
// newCondition, LastTransitionTime is set to now if the new status differs from the old status)
// 2. if a condition of the specified type does not exist (LastTransitionTime is set to now() if unset, and newCondition is appended)
-func SetStatusCondition(conditions *[]metav1.Condition, newCondition metav1.Condition) {
+func SetStatusCondition(conditions *[]metav1.Condition, newCondition metav1.Condition) (changed bool) {
if conditions == nil {
- return
+ return false
}
existingCondition := FindStatusCondition(*conditions, newCondition.Type)
if existingCondition == nil {
@@ -37,7 +38,7 @@ func SetStatusCondition(conditions *[]metav1.Condition, newCondition metav1.Cond
newCondition.LastTransitionTime = metav1.NewTime(time.Now())
}
*conditions = append(*conditions, newCondition)
- return
+ return true
}
if existingCondition.Status != newCondition.Status {
@@ -47,18 +48,31 @@ func SetStatusCondition(conditions *[]metav1.Condition, newCondition metav1.Cond
} else {
existingCondition.LastTransitionTime = metav1.NewTime(time.Now())
}
+ changed = true
}
- existingCondition.Reason = newCondition.Reason
- existingCondition.Message = newCondition.Message
- existingCondition.ObservedGeneration = newCondition.ObservedGeneration
+ if existingCondition.Reason != newCondition.Reason {
+ existingCondition.Reason = newCondition.Reason
+ changed = true
+ }
+ if existingCondition.Message != newCondition.Message {
+ existingCondition.Message = newCondition.Message
+ changed = true
+ }
+ if existingCondition.ObservedGeneration != newCondition.ObservedGeneration {
+ existingCondition.ObservedGeneration = newCondition.ObservedGeneration
+ changed = true
+ }
+
+ return changed
}
-// RemoveStatusCondition removes the corresponding conditionType from conditions.
+// RemoveStatusCondition removes the corresponding conditionType from conditions if present. Returns
+// true if it was present and got removed.
// conditions must be non-nil.
-func RemoveStatusCondition(conditions *[]metav1.Condition, conditionType string) {
+func RemoveStatusCondition(conditions *[]metav1.Condition, conditionType string) (removed bool) {
if conditions == nil || len(*conditions) == 0 {
- return
+ return false
}
newConditions := make([]metav1.Condition, 0, len(*conditions)-1)
for _, condition := range *conditions {
@@ -67,7 +81,10 @@ func RemoveStatusCondition(conditions *[]metav1.Condition, conditionType string)
}
}
+ removed = len(*conditions) != len(newConditions)
*conditions = newConditions
+
+ return removed
}
// FindStatusCondition finds the conditionType in conditions.
diff --git a/vendor/k8s.io/apimachinery/pkg/api/meta/errors.go b/vendor/k8s.io/apimachinery/pkg/api/meta/errors.go
index cbf5d0263..f36aa4ec2 100644
--- a/vendor/k8s.io/apimachinery/pkg/api/meta/errors.go
+++ b/vendor/k8s.io/apimachinery/pkg/api/meta/errors.go
@@ -17,6 +17,7 @@ limitations under the License.
package meta
import (
+ "errors"
"fmt"
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -43,6 +44,11 @@ func (e *AmbiguousResourceError) Error() string {
return fmt.Sprintf("%v matches multiple resources or kinds", e.PartialResource)
}
+func (*AmbiguousResourceError) Is(target error) bool {
+ _, ok := target.(*AmbiguousResourceError)
+ return ok
+}
+
// AmbiguousKindError is returned if the RESTMapper finds multiple matches for a kind
type AmbiguousKindError struct {
PartialKind schema.GroupVersionKind
@@ -63,16 +69,16 @@ func (e *AmbiguousKindError) Error() string {
return fmt.Sprintf("%v matches multiple resources or kinds", e.PartialKind)
}
+func (*AmbiguousKindError) Is(target error) bool {
+ _, ok := target.(*AmbiguousKindError)
+ return ok
+}
+
func IsAmbiguousError(err error) bool {
if err == nil {
return false
}
- switch err.(type) {
- case *AmbiguousResourceError, *AmbiguousKindError:
- return true
- default:
- return false
- }
+ return errors.Is(err, &AmbiguousResourceError{}) || errors.Is(err, &AmbiguousKindError{})
}
// NoResourceMatchError is returned if the RESTMapper can't find any match for a resource
@@ -84,6 +90,11 @@ func (e *NoResourceMatchError) Error() string {
return fmt.Sprintf("no matches for %v", e.PartialResource)
}
+func (*NoResourceMatchError) Is(target error) bool {
+ _, ok := target.(*NoResourceMatchError)
+ return ok
+}
+
// NoKindMatchError is returned if the RESTMapper can't find any match for a kind
type NoKindMatchError struct {
// GroupKind is the API group and kind that was searched
@@ -108,14 +119,14 @@ func (e *NoKindMatchError) Error() string {
}
}
+func (*NoKindMatchError) Is(target error) bool {
+ _, ok := target.(*NoKindMatchError)
+ return ok
+}
+
func IsNoMatchError(err error) bool {
if err == nil {
return false
}
- switch err.(type) {
- case *NoResourceMatchError, *NoKindMatchError:
- return true
- default:
- return false
- }
+ return errors.Is(err, &NoResourceMatchError{}) || errors.Is(err, &NoKindMatchError{})
}
diff --git a/vendor/k8s.io/apimachinery/pkg/api/meta/help.go b/vendor/k8s.io/apimachinery/pkg/api/meta/help.go
index bc6ba9376..1fdd32c4b 100644
--- a/vendor/k8s.io/apimachinery/pkg/api/meta/help.go
+++ b/vendor/k8s.io/apimachinery/pkg/api/meta/help.go
@@ -40,8 +40,7 @@ var (
// IsListType returns true if the provided Object has a slice called Items.
// TODO: Replace the code in this check with an interface comparison by
-//
-// creating and enforcing that lists implement a list accessor.
+// creating and enforcing that lists implement a list accessor.
func IsListType(obj runtime.Object) bool {
switch t := obj.(type) {
case runtime.Unstructured:
@@ -98,7 +97,7 @@ func getItemsPtr(list runtime.Object) (interface{}, error) {
return nil, errExpectFieldItems
}
switch items.Kind() {
- case reflect.Interface, reflect.Ptr:
+ case reflect.Interface, reflect.Pointer:
target := reflect.TypeOf(items.Interface()).Elem()
if target.Kind() != reflect.Slice {
return nil, errExpectSliceItems
@@ -113,8 +112,27 @@ func getItemsPtr(list runtime.Object) (interface{}, error) {
// EachListItem invokes fn on each runtime.Object in the list. Any error immediately terminates
// the loop.
+//
+// If items passed to fn are retained for different durations, and you want to avoid
+// retaining all items in obj as long as any item is referenced, use EachListItemWithAlloc instead.
func EachListItem(obj runtime.Object, fn func(runtime.Object) error) error {
+ return eachListItem(obj, fn, false)
+}
+
+// EachListItemWithAlloc works like EachListItem, but avoids retaining references to the items slice in obj.
+// It does this by making a shallow copy of non-pointer items in obj.
+//
+// If the items passed to fn are not retained, or are retained for the same duration, use EachListItem instead for memory efficiency.
+func EachListItemWithAlloc(obj runtime.Object, fn func(runtime.Object) error) error {
+ return eachListItem(obj, fn, true)
+}
+
+// allocNew: Whether shallow copy is required when the elements in Object.Items are struct
+func eachListItem(obj runtime.Object, fn func(runtime.Object) error, allocNew bool) error {
if unstructured, ok := obj.(runtime.Unstructured); ok {
+ if allocNew {
+ return unstructured.EachListItemWithAlloc(fn)
+ }
return unstructured.EachListItem(fn)
}
// TODO: Change to an interface call?
@@ -131,7 +149,7 @@ func EachListItem(obj runtime.Object, fn func(runtime.Object) error) error {
return nil
}
takeAddr := false
- if elemType := items.Type().Elem(); elemType.Kind() != reflect.Ptr && elemType.Kind() != reflect.Interface {
+ if elemType := items.Type().Elem(); elemType.Kind() != reflect.Pointer && elemType.Kind() != reflect.Interface {
if !items.Index(0).CanAddr() {
return fmt.Errorf("unable to take address of items in %T for EachListItem", obj)
}
@@ -141,8 +159,19 @@ func EachListItem(obj runtime.Object, fn func(runtime.Object) error) error {
for i := 0; i < len; i++ {
raw := items.Index(i)
if takeAddr {
- raw = raw.Addr()
+ if allocNew {
+ // shallow copy to avoid retaining a reference to the original list item
+ itemCopy := reflect.New(raw.Type())
+ // assign to itemCopy and type-assert
+ itemCopy.Elem().Set(raw)
+ // reflect.New will guarantee that itemCopy must be a pointer.
+ raw = itemCopy
+ } else {
+ raw = raw.Addr()
+ }
}
+ // raw must be a pointer or an interface
+ // allocate a pointer is cheap
switch item := raw.Interface().(type) {
case *runtime.RawExtension:
if err := fn(item.Object); err != nil {
@@ -167,7 +196,23 @@ func EachListItem(obj runtime.Object, fn func(runtime.Object) error) error {
// ExtractList returns obj's Items element as an array of runtime.Objects.
// Returns an error if obj is not a List type (does not have an Items member).
+//
+// If items in the returned list are retained for different durations, and you want to avoid
+// retaining all items in obj as long as any item is referenced, use ExtractListWithAlloc instead.
func ExtractList(obj runtime.Object) ([]runtime.Object, error) {
+ return extractList(obj, false)
+}
+
+// ExtractListWithAlloc works like ExtractList, but avoids retaining references to the items slice in obj.
+// It does this by making a shallow copy of non-pointer items in obj.
+//
+// If the items in the returned list are not retained, or are retained for the same duration, use ExtractList instead for memory efficiency.
+func ExtractListWithAlloc(obj runtime.Object) ([]runtime.Object, error) {
+ return extractList(obj, true)
+}
+
+// allocNew: Whether shallow copy is required when the elements in Object.Items are struct
+func extractList(obj runtime.Object, allocNew bool) ([]runtime.Object, error) {
itemsPtr, err := GetItemsPtr(obj)
if err != nil {
return nil, err
@@ -177,10 +222,17 @@ func ExtractList(obj runtime.Object) ([]runtime.Object, error) {
return nil, err
}
list := make([]runtime.Object, items.Len())
+ if len(list) == 0 {
+ return list, nil
+ }
+ elemType := items.Type().Elem()
+ isRawExtension := elemType == rawExtensionObjectType
+ implementsObject := elemType.Implements(objectType)
for i := range list {
raw := items.Index(i)
- switch item := raw.Interface().(type) {
- case runtime.RawExtension:
+ switch {
+ case isRawExtension:
+ item := raw.Interface().(runtime.RawExtension)
switch {
case item.Object != nil:
list[i] = item.Object
@@ -190,8 +242,18 @@ func ExtractList(obj runtime.Object) ([]runtime.Object, error) {
default:
list[i] = nil
}
- case runtime.Object:
- list[i] = item
+ case implementsObject:
+ list[i] = raw.Interface().(runtime.Object)
+ case allocNew:
+ // shallow copy to avoid retaining a reference to the original list item
+ itemCopy := reflect.New(raw.Type())
+ // assign to itemCopy and type-assert
+ itemCopy.Elem().Set(raw)
+ var ok bool
+ // reflect.New will guarantee that itemCopy must be a pointer.
+ if list[i], ok = itemCopy.Interface().(runtime.Object); !ok {
+ return nil, fmt.Errorf("%v: item[%v]: Expected object, got %#v(%s)", obj, i, raw.Interface(), raw.Kind())
+ }
default:
var found bool
if list[i], found = raw.Addr().Interface().(runtime.Object); !found {
@@ -202,8 +264,12 @@ func ExtractList(obj runtime.Object) ([]runtime.Object, error) {
return list, nil
}
-// objectSliceType is the type of a slice of Objects
-var objectSliceType = reflect.TypeOf([]runtime.Object{})
+var (
+ // objectSliceType is the type of a slice of Objects
+ objectSliceType = reflect.TypeOf([]runtime.Object{})
+ objectType = reflect.TypeOf((*runtime.Object)(nil)).Elem()
+ rawExtensionObjectType = reflect.TypeOf(runtime.RawExtension{})
+)
// LenList returns the length of this list or 0 if it is not a list.
func LenList(list runtime.Object) int {
@@ -238,7 +304,7 @@ func SetList(list runtime.Object, objects []runtime.Object) error {
slice := reflect.MakeSlice(items.Type(), len(objects), len(objects))
for i := range objects {
dest := slice.Index(i)
- if dest.Type() == reflect.TypeOf(runtime.RawExtension{}) {
+ if dest.Type() == rawExtensionObjectType {
dest = dest.FieldByName("Object")
}
diff --git a/vendor/k8s.io/apimachinery/pkg/api/meta/meta.go b/vendor/k8s.io/apimachinery/pkg/api/meta/meta.go
index 6a4116a04..2551f07f5 100644
--- a/vendor/k8s.io/apimachinery/pkg/api/meta/meta.go
+++ b/vendor/k8s.io/apimachinery/pkg/api/meta/meta.go
@@ -130,7 +130,6 @@ func AsPartialObjectMetadata(m metav1.Object) *metav1.PartialObjectMetadata {
Annotations: m.GetAnnotations(),
OwnerReferences: m.GetOwnerReferences(),
Finalizers: m.GetFinalizers(),
- ClusterName: m.GetClusterName(),
ManagedFields: m.GetManagedFields(),
},
}
@@ -600,7 +599,7 @@ func (a genericAccessor) SetFinalizers(finalizers []string) {
func (a genericAccessor) GetOwnerReferences() []metav1.OwnerReference {
var ret []metav1.OwnerReference
s := a.ownerReferences
- if s.Kind() != reflect.Ptr || s.Elem().Kind() != reflect.Slice {
+ if s.Kind() != reflect.Pointer || s.Elem().Kind() != reflect.Slice {
klog.Errorf("expect %v to be a pointer to slice", s)
return ret
}
@@ -618,7 +617,7 @@ func (a genericAccessor) GetOwnerReferences() []metav1.OwnerReference {
func (a genericAccessor) SetOwnerReferences(references []metav1.OwnerReference) {
s := a.ownerReferences
- if s.Kind() != reflect.Ptr || s.Elem().Kind() != reflect.Slice {
+ if s.Kind() != reflect.Pointer || s.Elem().Kind() != reflect.Slice {
klog.Errorf("expect %v to be a pointer to slice", s)
}
s = s.Elem()
diff --git a/vendor/k8s.io/apimachinery/pkg/api/meta/restmapper.go b/vendor/k8s.io/apimachinery/pkg/api/meta/restmapper.go
index f41b9bf78..91cb98cae 100644
--- a/vendor/k8s.io/apimachinery/pkg/api/meta/restmapper.go
+++ b/vendor/k8s.io/apimachinery/pkg/api/meta/restmapper.go
@@ -521,10 +521,9 @@ func (m *DefaultRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string
}
// MaybeResetRESTMapper calls Reset() on the mapper if it is a ResettableRESTMapper.
-func MaybeResetRESTMapper(mapper RESTMapper) bool {
+func MaybeResetRESTMapper(mapper RESTMapper) {
m, ok := mapper.(ResettableRESTMapper)
if ok {
m.Reset()
}
- return ok
}
diff --git a/vendor/k8s.io/apimachinery/pkg/api/resource/OWNERS b/vendor/k8s.io/apimachinery/pkg/api/resource/OWNERS
index 15bded17a..063fd285d 100644
--- a/vendor/k8s.io/apimachinery/pkg/api/resource/OWNERS
+++ b/vendor/k8s.io/apimachinery/pkg/api/resource/OWNERS
@@ -1,12 +1,10 @@
# See the OWNERS docs at https://go.k8s.io/owners
reviewers:
-- thockin
-- lavalamp
-- smarterclayton
-- wojtek-t
-- derekwaynecarr
-- mikedanese
-- saad-ali
-- janetkuo
-- xiang90
+ - thockin
+ - smarterclayton
+ - wojtek-t
+ - derekwaynecarr
+ - mikedanese
+ - saad-ali
+ - janetkuo
diff --git a/vendor/k8s.io/apimachinery/pkg/api/resource/amount.go b/vendor/k8s.io/apimachinery/pkg/api/resource/amount.go
index a8866a43e..2eebec667 100644
--- a/vendor/k8s.io/apimachinery/pkg/api/resource/amount.go
+++ b/vendor/k8s.io/apimachinery/pkg/api/resource/amount.go
@@ -203,6 +203,44 @@ func (a *int64Amount) Sub(b int64Amount) bool {
return a.Add(int64Amount{value: -b.value, scale: b.scale})
}
+// Mul multiplies the provided b to the current amount, or
+// returns false if overflow or underflow would result.
+func (a *int64Amount) Mul(b int64) bool {
+ switch {
+ case a.value == 0:
+ return true
+ case b == 0:
+ a.value = 0
+ a.scale = 0
+ return true
+ case a.scale == 0:
+ c, ok := int64Multiply(a.value, b)
+ if !ok {
+ return false
+ }
+ a.value = c
+ case a.scale > 0:
+ c, ok := int64Multiply(a.value, b)
+ if !ok {
+ return false
+ }
+ if _, ok = positiveScaleInt64(c, a.scale); !ok {
+ return false
+ }
+ a.value = c
+ default:
+ c, ok := int64Multiply(a.value, b)
+ if !ok {
+ return false
+ }
+ if _, ok = negativeScaleInt64(c, -a.scale); !ok {
+ return false
+ }
+ a.value = c
+ }
+ return true
+}
+
// AsScale adjusts this amount to set a minimum scale, rounding up, and returns true iff no precision
// was lost. (1.1e5).AsScale(5) would return 1.1e5, but (1.1e5).AsScale(6) would return 1e6.
func (a int64Amount) AsScale(scale Scale) (int64Amount, bool) {
diff --git a/vendor/k8s.io/apimachinery/pkg/api/resource/generated.pb.go b/vendor/k8s.io/apimachinery/pkg/api/resource/generated.pb.go
index 172db57fa..c3a272168 100644
--- a/vendor/k8s.io/apimachinery/pkg/api/resource/generated.pb.go
+++ b/vendor/k8s.io/apimachinery/pkg/api/resource/generated.pb.go
@@ -15,7 +15,7 @@ limitations under the License.
*/
// Code generated by protoc-gen-gogo. DO NOT EDIT.
-// source: k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/api/resource/generated.proto
+// source: k8s.io/apimachinery/pkg/api/resource/generated.proto
package resource
@@ -41,7 +41,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
func (m *Quantity) Reset() { *m = Quantity{} }
func (*Quantity) ProtoMessage() {}
func (*Quantity) Descriptor() ([]byte, []int) {
- return fileDescriptor_612bba87bd70906c, []int{0}
+ return fileDescriptor_7288c78ff45111e9, []int{0}
}
func (m *Quantity) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Quantity.Unmarshal(m, b)
@@ -64,7 +64,7 @@ var xxx_messageInfo_Quantity proto.InternalMessageInfo
func (m *QuantityValue) Reset() { *m = QuantityValue{} }
func (*QuantityValue) ProtoMessage() {}
func (*QuantityValue) Descriptor() ([]byte, []int) {
- return fileDescriptor_612bba87bd70906c, []int{1}
+ return fileDescriptor_7288c78ff45111e9, []int{1}
}
func (m *QuantityValue) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_QuantityValue.Unmarshal(m, b)
@@ -90,25 +90,24 @@ func init() {
}
func init() {
- proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/api/resource/generated.proto", fileDescriptor_612bba87bd70906c)
+ proto.RegisterFile("k8s.io/apimachinery/pkg/api/resource/generated.proto", fileDescriptor_7288c78ff45111e9)
}
-var fileDescriptor_612bba87bd70906c = []byte{
- // 254 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xf2, 0xcd, 0xb6, 0x28, 0xd6,
- 0xcb, 0xcc, 0xd7, 0xcf, 0x2e, 0x4d, 0x4a, 0x2d, 0xca, 0x4b, 0x2d, 0x49, 0x2d, 0xd6, 0x2f, 0x4b,
- 0xcd, 0x4b, 0xc9, 0x2f, 0xd2, 0x87, 0x4a, 0x24, 0x16, 0x64, 0xe6, 0x26, 0x26, 0x67, 0x64, 0xe6,
- 0xa5, 0x16, 0x55, 0xea, 0x17, 0x64, 0xa7, 0x83, 0x04, 0xf4, 0x8b, 0x52, 0x8b, 0xf3, 0x4b, 0x8b,
- 0x92, 0x53, 0xf5, 0xd3, 0x53, 0xf3, 0x52, 0x8b, 0x12, 0x4b, 0x52, 0x53, 0xf4, 0x0a, 0x8a, 0xf2,
- 0x4b, 0xf2, 0x85, 0x54, 0x20, 0xba, 0xf4, 0x90, 0x75, 0xe9, 0x15, 0x64, 0xa7, 0x83, 0x04, 0xf4,
- 0x60, 0xba, 0xa4, 0x74, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3,
- 0xf3, 0xd3, 0xf3, 0xf5, 0xc1, 0x9a, 0x93, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc, 0x82, 0x18,
- 0xaa, 0x64, 0xc1, 0xc5, 0x11, 0x58, 0x9a, 0x98, 0x57, 0x92, 0x59, 0x52, 0x29, 0x24, 0xc6, 0xc5,
- 0x56, 0x5c, 0x52, 0x94, 0x99, 0x97, 0x2e, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x19, 0x04, 0xe5, 0x59,
- 0x89, 0xcc, 0x58, 0x20, 0xcf, 0xd0, 0xb1, 0x50, 0x9e, 0x61, 0xc2, 0x42, 0x79, 0x86, 0x05, 0x0b,
- 0xe5, 0x19, 0x1a, 0xee, 0x28, 0x30, 0x28, 0xd9, 0x72, 0xf1, 0xc2, 0x74, 0x86, 0x25, 0xe6, 0x94,
- 0xa6, 0x92, 0xa6, 0xdd, 0x49, 0xef, 0xc4, 0x43, 0x39, 0x86, 0x0b, 0x0f, 0xe5, 0x18, 0x6e, 0x3c,
- 0x94, 0x63, 0x68, 0x78, 0x24, 0xc7, 0x78, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x37,
- 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0x43, 0x14, 0x07, 0xcc, 0x5f,
- 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x21, 0x76, 0x9f, 0x66, 0x4d, 0x01, 0x00, 0x00,
+var fileDescriptor_7288c78ff45111e9 = []byte{
+ // 234 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0xc9, 0xb6, 0x28, 0xd6,
+ 0xcb, 0xcc, 0xd7, 0x4f, 0x2c, 0xc8, 0xcc, 0x4d, 0x4c, 0xce, 0xc8, 0xcc, 0x4b, 0x2d, 0xaa, 0xd4,
+ 0x2f, 0xc8, 0x4e, 0x07, 0x09, 0xe8, 0x17, 0xa5, 0x16, 0xe7, 0x97, 0x16, 0x25, 0xa7, 0xea, 0xa7,
+ 0xa7, 0xe6, 0xa5, 0x16, 0x25, 0x96, 0xa4, 0xa6, 0xe8, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0xa9,
+ 0x40, 0x74, 0xe9, 0x21, 0xeb, 0xd2, 0x2b, 0xc8, 0x4e, 0x07, 0x09, 0xe8, 0xc1, 0x74, 0x49, 0xe9,
+ 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xa7, 0xe7, 0xeb,
+ 0x83, 0x35, 0x27, 0x95, 0xa6, 0x81, 0x79, 0x60, 0x0e, 0x98, 0x05, 0x31, 0x54, 0xc9, 0x82, 0x8b,
+ 0x23, 0xb0, 0x34, 0x31, 0xaf, 0x24, 0xb3, 0xa4, 0x52, 0x48, 0x8c, 0x8b, 0xad, 0xb8, 0xa4, 0x28,
+ 0x33, 0x2f, 0x5d, 0x82, 0x51, 0x81, 0x51, 0x83, 0x33, 0x08, 0xca, 0xb3, 0x12, 0x99, 0xb1, 0x40,
+ 0x9e, 0xa1, 0x63, 0xa1, 0x3c, 0xc3, 0x84, 0x85, 0xf2, 0x0c, 0x0b, 0x16, 0xca, 0x33, 0x34, 0xdc,
+ 0x51, 0x60, 0x50, 0xb2, 0xe5, 0xe2, 0x85, 0xe9, 0x0c, 0x4b, 0xcc, 0x29, 0x4d, 0x25, 0x4d, 0xbb,
+ 0x93, 0xd7, 0x89, 0x87, 0x72, 0x0c, 0x17, 0x1e, 0xca, 0x31, 0xdc, 0x78, 0x28, 0xc7, 0xd0, 0xf0,
+ 0x48, 0x8e, 0xf1, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x6f, 0x3c, 0x92, 0x63, 0x7c,
+ 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x28, 0x15, 0x62, 0x42, 0x0a, 0x10, 0x00, 0x00,
+ 0xff, 0xff, 0x50, 0x91, 0xd0, 0x9c, 0x50, 0x01, 0x00, 0x00,
}
diff --git a/vendor/k8s.io/apimachinery/pkg/api/resource/generated.proto b/vendor/k8s.io/apimachinery/pkg/api/resource/generated.proto
index f8b3f80c0..ddd0db8fb 100644
--- a/vendor/k8s.io/apimachinery/pkg/api/resource/generated.proto
+++ b/vendor/k8s.io/apimachinery/pkg/api/resource/generated.proto
@@ -22,7 +22,7 @@ syntax = "proto2";
package k8s.io.apimachinery.pkg.api.resource;
// Package-wide variables from generator "generated".
-option go_package = "resource";
+option go_package = "k8s.io/apimachinery/pkg/api/resource";
// Quantity is a fixed-point representation of a number.
// It provides convenient marshaling/unmarshaling in JSON and YAML,
@@ -30,6 +30,7 @@ option go_package = "resource";
//
// The serialization format is:
//
+// ```
// ::=
//
// (Note that may be empty, from the "" case in .)
@@ -49,6 +50,7 @@ option go_package = "resource";
// (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)
//
// ::= "e" | "E"
+// ```
//
// No matter which of the three exponent forms is used, no quantity may represent
// a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal
@@ -63,16 +65,16 @@ option go_package = "resource";
// This means that Exponent/suffix will be adjusted up or down (with a
// corresponding increase or decrease in Mantissa) such that:
//
-// a. No precision is lost
-// b. No fractional digits will be emitted
-// c. The exponent (or suffix) is as large as possible.
+// - No precision is lost
+// - No fractional digits will be emitted
+// - The exponent (or suffix) is as large as possible.
//
// The sign will be omitted unless the number is negative.
//
// Examples:
//
-// 1.5 will be serialized as "1500m"
-// 1.5Gi will be serialized as "1536Mi"
+// - 1.5 will be serialized as "1500m"
+// - 1.5Gi will be serialized as "1536Mi"
//
// Note that the quantity will NEVER be internally represented by a
// floating point number. That is the whole point of this exercise.
diff --git a/vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go b/vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go
index 323537c5b..50af8334f 100644
--- a/vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go
+++ b/vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go
@@ -25,6 +25,8 @@ import (
"strconv"
"strings"
+ cbor "k8s.io/apimachinery/pkg/runtime/serializer/cbor/direct"
+
inf "gopkg.in/inf.v0"
)
@@ -34,6 +36,7 @@ import (
//
// The serialization format is:
//
+// ```
// ::=
//
// (Note that may be empty, from the "" case in .)
@@ -53,6 +56,7 @@ import (
// (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)
//
// ::= "e" | "E"
+// ```
//
// No matter which of the three exponent forms is used, no quantity may represent
// a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal
@@ -67,16 +71,16 @@ import (
// This means that Exponent/suffix will be adjusted up or down (with a
// corresponding increase or decrease in Mantissa) such that:
//
-// a. No precision is lost
-// b. No fractional digits will be emitted
-// c. The exponent (or suffix) is as large as possible.
+// - No precision is lost
+// - No fractional digits will be emitted
+// - The exponent (or suffix) is as large as possible.
//
// The sign will be omitted unless the number is negative.
//
// Examples:
//
-// 1.5 will be serialized as "1500m"
-// 1.5Gi will be serialized as "1536Mi"
+// - 1.5 will be serialized as "1500m"
+// - 1.5Gi will be serialized as "1536Mi"
//
// Note that the quantity will NEVER be internally represented by a
// floating point number. That is the whole point of this exercise.
@@ -406,6 +410,10 @@ func (_ Quantity) OpenAPISchemaType() []string { return []string{"string"} }
// the OpenAPI spec of this type.
func (_ Quantity) OpenAPISchemaFormat() string { return "" }
+// OpenAPIV3OneOfTypes is used by the kube-openapi generator when constructing
+// the OpenAPI v3 spec of this type.
+func (Quantity) OpenAPIV3OneOfTypes() []string { return []string{"string", "number"} }
+
// CanonicalizeBytes returns the canonical form of q and its suffix (see comment on Quantity).
//
// Note about BinarySI:
@@ -586,6 +594,16 @@ func (q *Quantity) Sub(y Quantity) {
q.ToDec().d.Dec.Sub(q.d.Dec, y.AsDec())
}
+// Mul multiplies the provided y to the current value.
+// It will return false if the result is inexact. Otherwise, it will return true.
+func (q *Quantity) Mul(y int64) bool {
+ q.s = ""
+ if q.d.Dec == nil && q.i.Mul(y) {
+ return true
+ }
+ return q.ToDec().d.Dec.Mul(q.d.Dec, inf.NewDec(y, inf.Scale(0))).UnscaledBig().IsInt64()
+}
+
// Cmp returns 0 if the quantity is equal to y, -1 if the quantity is less than y, or 1 if the
// quantity is greater than y.
func (q *Quantity) Cmp(y Quantity) int {
@@ -648,7 +666,7 @@ func (q Quantity) MarshalJSON() ([]byte, error) {
copy(out[1:], q.s)
return out, nil
}
- result := make([]byte, int64QuantityExpectedBytes, int64QuantityExpectedBytes)
+ result := make([]byte, int64QuantityExpectedBytes)
result[0] = '"'
number, suffix := q.CanonicalizeBytes(result[1:1])
// if the same slice was returned to us that we passed in, avoid another allocation by copying number into
@@ -667,6 +685,12 @@ func (q Quantity) MarshalJSON() ([]byte, error) {
return result, nil
}
+func (q Quantity) MarshalCBOR() ([]byte, error) {
+ // The call to String() should never return the string "" because the receiver's
+ // address will never be nil.
+ return cbor.Marshal(q.String())
+}
+
// ToUnstructured implements the value.UnstructuredConverter interface.
func (q Quantity) ToUnstructured() interface{} {
return q.String()
@@ -695,6 +719,27 @@ func (q *Quantity) UnmarshalJSON(value []byte) error {
return nil
}
+func (q *Quantity) UnmarshalCBOR(value []byte) error {
+ var s *string
+ if err := cbor.Unmarshal(value, &s); err != nil {
+ return err
+ }
+
+ if s == nil {
+ q.d.Dec = nil
+ q.i = int64Amount{}
+ return nil
+ }
+
+ parsed, err := ParseQuantity(strings.TrimSpace(*s))
+ if err != nil {
+ return err
+ }
+
+ *q = parsed
+ return nil
+}
+
// NewDecimalQuantity returns a new Quantity representing the given
// value in the given format.
func NewDecimalQuantity(b inf.Dec, format Format) *Quantity {
diff --git a/vendor/k8s.io/apimachinery/pkg/api/resource/suffix.go b/vendor/k8s.io/apimachinery/pkg/api/resource/suffix.go
index 5ed7abe66..6ec527f9c 100644
--- a/vendor/k8s.io/apimachinery/pkg/api/resource/suffix.go
+++ b/vendor/k8s.io/apimachinery/pkg/api/resource/suffix.go
@@ -165,7 +165,7 @@ func (sh *suffixHandler) constructBytes(base, exponent int32, format Format) (s
if exponent == 0 {
return nil, true
}
- result := make([]byte, 8, 8)
+ result := make([]byte, 8)
result[0] = 'e'
number := strconv.AppendInt(result[1:1], int64(exponent), 10)
if &result[1] == &number[0] {
diff --git a/vendor/k8s.io/apimachinery/pkg/api/validation/OWNERS b/vendor/k8s.io/apimachinery/pkg/api/validation/OWNERS
new file mode 100644
index 000000000..402373247
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/api/validation/OWNERS
@@ -0,0 +1,11 @@
+# See the OWNERS docs at https://go.k8s.io/owners
+
+# Disable inheritance as this is an api owners file
+options:
+ no_parent_owners: true
+approvers:
+ - api-approvers
+reviewers:
+ - api-reviewers
+labels:
+ - kind/api-change
diff --git a/vendor/k8s.io/apimachinery/pkg/api/validation/doc.go b/vendor/k8s.io/apimachinery/pkg/api/validation/doc.go
new file mode 100644
index 000000000..9f20152e4
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/api/validation/doc.go
@@ -0,0 +1,18 @@
+/*
+Copyright 2017 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Package validation contains generic api type validation functions.
+package validation // import "k8s.io/apimachinery/pkg/api/validation"
diff --git a/vendor/k8s.io/apimachinery/pkg/api/validation/generic.go b/vendor/k8s.io/apimachinery/pkg/api/validation/generic.go
new file mode 100644
index 000000000..e0b5b1490
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/api/validation/generic.go
@@ -0,0 +1,88 @@
+/*
+Copyright 2014 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package validation
+
+import (
+ "strings"
+
+ "k8s.io/apimachinery/pkg/util/validation"
+ "k8s.io/apimachinery/pkg/util/validation/field"
+)
+
+// IsNegativeErrorMsg is a error message for value must be greater than or equal to 0.
+const IsNegativeErrorMsg string = `must be greater than or equal to 0`
+
+// ValidateNameFunc validates that the provided name is valid for a given resource type.
+// Not all resources have the same validation rules for names. Prefix is true
+// if the name will have a value appended to it. If the name is not valid,
+// this returns a list of descriptions of individual characteristics of the
+// value that were not valid. Otherwise this returns an empty list or nil.
+type ValidateNameFunc func(name string, prefix bool) []string
+
+// NameIsDNSSubdomain is a ValidateNameFunc for names that must be a DNS subdomain.
+func NameIsDNSSubdomain(name string, prefix bool) []string {
+ if prefix {
+ name = maskTrailingDash(name)
+ }
+ return validation.IsDNS1123Subdomain(name)
+}
+
+// NameIsDNSLabel is a ValidateNameFunc for names that must be a DNS 1123 label.
+func NameIsDNSLabel(name string, prefix bool) []string {
+ if prefix {
+ name = maskTrailingDash(name)
+ }
+ return validation.IsDNS1123Label(name)
+}
+
+// NameIsDNS1035Label is a ValidateNameFunc for names that must be a DNS 952 label.
+func NameIsDNS1035Label(name string, prefix bool) []string {
+ if prefix {
+ name = maskTrailingDash(name)
+ }
+ return validation.IsDNS1035Label(name)
+}
+
+// ValidateNamespaceName can be used to check whether the given namespace name is valid.
+// Prefix indicates this name will be used as part of generation, in which case
+// trailing dashes are allowed.
+var ValidateNamespaceName = NameIsDNSLabel
+
+// ValidateServiceAccountName can be used to check whether the given service account name is valid.
+// Prefix indicates this name will be used as part of generation, in which case
+// trailing dashes are allowed.
+var ValidateServiceAccountName = NameIsDNSSubdomain
+
+// maskTrailingDash replaces the final character of a string with a subdomain safe
+// value if it is a dash and if the length of this string is greater than 1. Note that
+// this is used when a value could be appended to the string, see ValidateNameFunc
+// for more info.
+func maskTrailingDash(name string) string {
+ if len(name) > 1 && strings.HasSuffix(name, "-") {
+ return name[:len(name)-2] + "a"
+ }
+ return name
+}
+
+// ValidateNonnegativeField validates that given value is not negative.
+func ValidateNonnegativeField(value int64, fldPath *field.Path) field.ErrorList {
+ allErrs := field.ErrorList{}
+ if value < 0 {
+ allErrs = append(allErrs, field.Invalid(fldPath, value, IsNegativeErrorMsg))
+ }
+ return allErrs
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/api/validation/objectmeta.go b/vendor/k8s.io/apimachinery/pkg/api/validation/objectmeta.go
new file mode 100644
index 000000000..593d7ba8c
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/api/validation/objectmeta.go
@@ -0,0 +1,265 @@
+/*
+Copyright 2014 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package validation
+
+import (
+ "fmt"
+ "strings"
+
+ apiequality "k8s.io/apimachinery/pkg/api/equality"
+ "k8s.io/apimachinery/pkg/api/meta"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ v1validation "k8s.io/apimachinery/pkg/apis/meta/v1/validation"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ "k8s.io/apimachinery/pkg/util/sets"
+ "k8s.io/apimachinery/pkg/util/validation"
+ "k8s.io/apimachinery/pkg/util/validation/field"
+)
+
+// FieldImmutableErrorMsg is a error message for field is immutable.
+const FieldImmutableErrorMsg string = `field is immutable`
+
+const TotalAnnotationSizeLimitB int = 256 * (1 << 10) // 256 kB
+
+// BannedOwners is a black list of object that are not allowed to be owners.
+var BannedOwners = map[schema.GroupVersionKind]struct{}{
+ {Group: "", Version: "v1", Kind: "Event"}: {},
+}
+
+// ValidateAnnotations validates that a set of annotations are correctly defined.
+func ValidateAnnotations(annotations map[string]string, fldPath *field.Path) field.ErrorList {
+ allErrs := field.ErrorList{}
+ for k := range annotations {
+ // The rule is QualifiedName except that case doesn't matter, so convert to lowercase before checking.
+ for _, msg := range validation.IsQualifiedName(strings.ToLower(k)) {
+ allErrs = append(allErrs, field.Invalid(fldPath, k, msg))
+ }
+ }
+ if err := ValidateAnnotationsSize(annotations); err != nil {
+ allErrs = append(allErrs, field.TooLong(fldPath, "", TotalAnnotationSizeLimitB))
+ }
+ return allErrs
+}
+
+func ValidateAnnotationsSize(annotations map[string]string) error {
+ var totalSize int64
+ for k, v := range annotations {
+ totalSize += (int64)(len(k)) + (int64)(len(v))
+ }
+ if totalSize > (int64)(TotalAnnotationSizeLimitB) {
+ return fmt.Errorf("annotations size %d is larger than limit %d", totalSize, TotalAnnotationSizeLimitB)
+ }
+ return nil
+}
+
+func validateOwnerReference(ownerReference metav1.OwnerReference, fldPath *field.Path) field.ErrorList {
+ allErrs := field.ErrorList{}
+ gvk := schema.FromAPIVersionAndKind(ownerReference.APIVersion, ownerReference.Kind)
+ // gvk.Group is empty for the legacy group.
+ if len(gvk.Version) == 0 {
+ allErrs = append(allErrs, field.Invalid(fldPath.Child("apiVersion"), ownerReference.APIVersion, "version must not be empty"))
+ }
+ if len(gvk.Kind) == 0 {
+ allErrs = append(allErrs, field.Invalid(fldPath.Child("kind"), ownerReference.Kind, "kind must not be empty"))
+ }
+ if len(ownerReference.Name) == 0 {
+ allErrs = append(allErrs, field.Invalid(fldPath.Child("name"), ownerReference.Name, "name must not be empty"))
+ }
+ if len(ownerReference.UID) == 0 {
+ allErrs = append(allErrs, field.Invalid(fldPath.Child("uid"), ownerReference.UID, "uid must not be empty"))
+ }
+ if _, ok := BannedOwners[gvk]; ok {
+ allErrs = append(allErrs, field.Invalid(fldPath, ownerReference, fmt.Sprintf("%s is disallowed from being an owner", gvk)))
+ }
+ return allErrs
+}
+
+// ValidateOwnerReferences validates that a set of owner references are correctly defined.
+func ValidateOwnerReferences(ownerReferences []metav1.OwnerReference, fldPath *field.Path) field.ErrorList {
+ allErrs := field.ErrorList{}
+ firstControllerName := ""
+ for _, ref := range ownerReferences {
+ allErrs = append(allErrs, validateOwnerReference(ref, fldPath)...)
+ if ref.Controller != nil && *ref.Controller {
+ curControllerName := ref.Kind + "/" + ref.Name
+ if firstControllerName != "" {
+ allErrs = append(allErrs, field.Invalid(fldPath, ownerReferences,
+ fmt.Sprintf("Only one reference can have Controller set to true. Found \"true\" in references for %v and %v", firstControllerName, curControllerName)))
+ } else {
+ firstControllerName = curControllerName
+ }
+ }
+ }
+ return allErrs
+}
+
+// ValidateFinalizerName validates finalizer names.
+func ValidateFinalizerName(stringValue string, fldPath *field.Path) field.ErrorList {
+ allErrs := field.ErrorList{}
+ for _, msg := range validation.IsQualifiedName(stringValue) {
+ allErrs = append(allErrs, field.Invalid(fldPath, stringValue, msg))
+ }
+
+ return allErrs
+}
+
+// ValidateNoNewFinalizers validates the new finalizers has no new finalizers compare to old finalizers.
+func ValidateNoNewFinalizers(newFinalizers []string, oldFinalizers []string, fldPath *field.Path) field.ErrorList {
+ allErrs := field.ErrorList{}
+ extra := sets.NewString(newFinalizers...).Difference(sets.NewString(oldFinalizers...))
+ if len(extra) != 0 {
+ allErrs = append(allErrs, field.Forbidden(fldPath, fmt.Sprintf("no new finalizers can be added if the object is being deleted, found new finalizers %#v", extra.List())))
+ }
+ return allErrs
+}
+
+// ValidateImmutableField validates the new value and the old value are deeply equal.
+func ValidateImmutableField(newVal, oldVal interface{}, fldPath *field.Path) field.ErrorList {
+ allErrs := field.ErrorList{}
+ if !apiequality.Semantic.DeepEqual(oldVal, newVal) {
+ allErrs = append(allErrs, field.Invalid(fldPath, newVal, FieldImmutableErrorMsg))
+ }
+ return allErrs
+}
+
+// ValidateObjectMeta validates an object's metadata on creation. It expects that name generation has already
+// been performed.
+// It doesn't return an error for rootscoped resources with namespace, because namespace should already be cleared before.
+func ValidateObjectMeta(objMeta *metav1.ObjectMeta, requiresNamespace bool, nameFn ValidateNameFunc, fldPath *field.Path) field.ErrorList {
+ metadata, err := meta.Accessor(objMeta)
+ if err != nil {
+ var allErrs field.ErrorList
+ allErrs = append(allErrs, field.Invalid(fldPath, objMeta, err.Error()))
+ return allErrs
+ }
+ return ValidateObjectMetaAccessor(metadata, requiresNamespace, nameFn, fldPath)
+}
+
+// ValidateObjectMetaAccessor validates an object's metadata on creation. It expects that name generation has already
+// been performed.
+// It doesn't return an error for rootscoped resources with namespace, because namespace should already be cleared before.
+func ValidateObjectMetaAccessor(meta metav1.Object, requiresNamespace bool, nameFn ValidateNameFunc, fldPath *field.Path) field.ErrorList {
+ var allErrs field.ErrorList
+
+ if len(meta.GetGenerateName()) != 0 {
+ for _, msg := range nameFn(meta.GetGenerateName(), true) {
+ allErrs = append(allErrs, field.Invalid(fldPath.Child("generateName"), meta.GetGenerateName(), msg))
+ }
+ }
+ // If the generated name validates, but the calculated value does not, it's a problem with generation, and we
+ // report it here. This may confuse users, but indicates a programming bug and still must be validated.
+ // If there are multiple fields out of which one is required then add an or as a separator
+ if len(meta.GetName()) == 0 {
+ allErrs = append(allErrs, field.Required(fldPath.Child("name"), "name or generateName is required"))
+ } else {
+ for _, msg := range nameFn(meta.GetName(), false) {
+ allErrs = append(allErrs, field.Invalid(fldPath.Child("name"), meta.GetName(), msg))
+ }
+ }
+ if requiresNamespace {
+ if len(meta.GetNamespace()) == 0 {
+ allErrs = append(allErrs, field.Required(fldPath.Child("namespace"), ""))
+ } else {
+ for _, msg := range ValidateNamespaceName(meta.GetNamespace(), false) {
+ allErrs = append(allErrs, field.Invalid(fldPath.Child("namespace"), meta.GetNamespace(), msg))
+ }
+ }
+ } else {
+ if len(meta.GetNamespace()) != 0 {
+ allErrs = append(allErrs, field.Forbidden(fldPath.Child("namespace"), "not allowed on this type"))
+ }
+ }
+
+ allErrs = append(allErrs, ValidateNonnegativeField(meta.GetGeneration(), fldPath.Child("generation"))...)
+ allErrs = append(allErrs, v1validation.ValidateLabels(meta.GetLabels(), fldPath.Child("labels"))...)
+ allErrs = append(allErrs, ValidateAnnotations(meta.GetAnnotations(), fldPath.Child("annotations"))...)
+ allErrs = append(allErrs, ValidateOwnerReferences(meta.GetOwnerReferences(), fldPath.Child("ownerReferences"))...)
+ allErrs = append(allErrs, ValidateFinalizers(meta.GetFinalizers(), fldPath.Child("finalizers"))...)
+ allErrs = append(allErrs, v1validation.ValidateManagedFields(meta.GetManagedFields(), fldPath.Child("managedFields"))...)
+ return allErrs
+}
+
+// ValidateFinalizers tests if the finalizers name are valid, and if there are conflicting finalizers.
+func ValidateFinalizers(finalizers []string, fldPath *field.Path) field.ErrorList {
+ allErrs := field.ErrorList{}
+ hasFinalizerOrphanDependents := false
+ hasFinalizerDeleteDependents := false
+ for _, finalizer := range finalizers {
+ allErrs = append(allErrs, ValidateFinalizerName(finalizer, fldPath)...)
+ if finalizer == metav1.FinalizerOrphanDependents {
+ hasFinalizerOrphanDependents = true
+ }
+ if finalizer == metav1.FinalizerDeleteDependents {
+ hasFinalizerDeleteDependents = true
+ }
+ }
+ if hasFinalizerDeleteDependents && hasFinalizerOrphanDependents {
+ allErrs = append(allErrs, field.Invalid(fldPath, finalizers, fmt.Sprintf("finalizer %s and %s cannot be both set", metav1.FinalizerOrphanDependents, metav1.FinalizerDeleteDependents)))
+ }
+ return allErrs
+}
+
+// ValidateObjectMetaUpdate validates an object's metadata when updated.
+func ValidateObjectMetaUpdate(newMeta, oldMeta *metav1.ObjectMeta, fldPath *field.Path) field.ErrorList {
+ newMetadata, err := meta.Accessor(newMeta)
+ if err != nil {
+ allErrs := field.ErrorList{}
+ allErrs = append(allErrs, field.Invalid(fldPath, newMeta, err.Error()))
+ return allErrs
+ }
+ oldMetadata, err := meta.Accessor(oldMeta)
+ if err != nil {
+ allErrs := field.ErrorList{}
+ allErrs = append(allErrs, field.Invalid(fldPath, oldMeta, err.Error()))
+ return allErrs
+ }
+ return ValidateObjectMetaAccessorUpdate(newMetadata, oldMetadata, fldPath)
+}
+
+// ValidateObjectMetaAccessorUpdate validates an object's metadata when updated.
+func ValidateObjectMetaAccessorUpdate(newMeta, oldMeta metav1.Object, fldPath *field.Path) field.ErrorList {
+ var allErrs field.ErrorList
+
+ // Finalizers cannot be added if the object is already being deleted.
+ if oldMeta.GetDeletionTimestamp() != nil {
+ allErrs = append(allErrs, ValidateNoNewFinalizers(newMeta.GetFinalizers(), oldMeta.GetFinalizers(), fldPath.Child("finalizers"))...)
+ }
+
+ // Reject updates that don't specify a resource version
+ if len(newMeta.GetResourceVersion()) == 0 {
+ allErrs = append(allErrs, field.Invalid(fldPath.Child("resourceVersion"), newMeta.GetResourceVersion(), "must be specified for an update"))
+ }
+
+ // Generation shouldn't be decremented
+ if newMeta.GetGeneration() < oldMeta.GetGeneration() {
+ allErrs = append(allErrs, field.Invalid(fldPath.Child("generation"), newMeta.GetGeneration(), "must not be decremented"))
+ }
+
+ allErrs = append(allErrs, ValidateImmutableField(newMeta.GetName(), oldMeta.GetName(), fldPath.Child("name"))...)
+ allErrs = append(allErrs, ValidateImmutableField(newMeta.GetNamespace(), oldMeta.GetNamespace(), fldPath.Child("namespace"))...)
+ allErrs = append(allErrs, ValidateImmutableField(newMeta.GetUID(), oldMeta.GetUID(), fldPath.Child("uid"))...)
+ allErrs = append(allErrs, ValidateImmutableField(newMeta.GetCreationTimestamp(), oldMeta.GetCreationTimestamp(), fldPath.Child("creationTimestamp"))...)
+ allErrs = append(allErrs, ValidateImmutableField(newMeta.GetDeletionTimestamp(), oldMeta.GetDeletionTimestamp(), fldPath.Child("deletionTimestamp"))...)
+ allErrs = append(allErrs, ValidateImmutableField(newMeta.GetDeletionGracePeriodSeconds(), oldMeta.GetDeletionGracePeriodSeconds(), fldPath.Child("deletionGracePeriodSeconds"))...)
+
+ allErrs = append(allErrs, v1validation.ValidateLabels(newMeta.GetLabels(), fldPath.Child("labels"))...)
+ allErrs = append(allErrs, ValidateAnnotations(newMeta.GetAnnotations(), fldPath.Child("annotations"))...)
+ allErrs = append(allErrs, ValidateOwnerReferences(newMeta.GetOwnerReferences(), fldPath.Child("ownerReferences"))...)
+ allErrs = append(allErrs, v1validation.ValidateManagedFields(newMeta.GetManagedFields(), fldPath.Child("managedFields"))...)
+
+ return allErrs
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/defaults.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/defaults.go
new file mode 100644
index 000000000..29c6a48b6
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/defaults.go
@@ -0,0 +1,38 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internalversion
+
+import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+// SetListOptionsDefaults sets defaults on the provided ListOptions if applicable.
+//
+// TODO(#115478): once the watch-list fg is always on we register this function in the scheme (via AddTypeDefaultingFunc).
+// TODO(#115478): when the function is registered in the scheme remove all callers of this method.
+func SetListOptionsDefaults(obj *ListOptions, isWatchListFeatureEnabled bool) {
+ if !isWatchListFeatureEnabled {
+ return
+ }
+ if obj.SendInitialEvents != nil || len(obj.ResourceVersionMatch) != 0 {
+ return
+ }
+ legacy := obj.ResourceVersion == "" || obj.ResourceVersion == "0"
+ if obj.Watch && legacy {
+ turnOnInitialEvents := true
+ obj.SendInitialEvents = &turnOnInitialEvents
+ obj.ResourceVersionMatch = metav1.ResourceVersionMatchNotOlderThan
+ }
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/types.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/types.go
index a49b5f2be..00d2b8c68 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/types.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/types.go
@@ -66,6 +66,31 @@ type ListOptions struct {
// it does not recognize and will return a 410 error if the token can no longer be used because
// it has expired.
Continue string
+
+ // `sendInitialEvents=true` may be set together with `watch=true`.
+ // In that case, the watch stream will begin with synthetic events to
+ // produce the current state of objects in the collection. Once all such
+ // events have been sent, a synthetic "Bookmark" event will be sent.
+ // The bookmark will report the ResourceVersion (RV) corresponding to the
+ // set of objects, and be marked with `"k8s.io/initial-events-end": "true"` annotation.
+ // Afterwards, the watch stream will proceed as usual, sending watch events
+ // corresponding to changes (subsequent to the RV) to objects watched.
+ //
+ // When `sendInitialEvents` option is set, we require `resourceVersionMatch`
+ // option to also be set. The semantic of the watch request is as following:
+ // - `resourceVersionMatch` = NotOlderThan
+ // is interpreted as "data at least as new as the provided `resourceVersion`"
+ // and the bookmark event is send when the state is synced
+ // to a `resourceVersion` at least as fresh as the one provided by the ListOptions.
+ // If `resourceVersion` is unset, this is interpreted as "consistent read" and the
+ // bookmark event is send when the state is synced at least to the moment
+ // when request started being processed.
+ // - `resourceVersionMatch` set to any other value or unset
+ // Invalid error is returned.
+ //
+ // Defaults to true if `resourceVersion=""` or `resourceVersion="0"` (for backward
+ // compatibility reasons) and to false otherwise.
+ SendInitialEvents *bool
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go
index 6d212b846..a6552c276 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go
@@ -115,6 +115,7 @@ func autoConvert_internalversion_ListOptions_To_v1_ListOptions(in *ListOptions,
out.TimeoutSeconds = (*int64)(unsafe.Pointer(in.TimeoutSeconds))
out.Limit = in.Limit
out.Continue = in.Continue
+ out.SendInitialEvents = (*bool)(unsafe.Pointer(in.SendInitialEvents))
return nil
}
@@ -137,6 +138,7 @@ func autoConvert_v1_ListOptions_To_internalversion_ListOptions(in *v1.ListOption
out.TimeoutSeconds = (*int64)(unsafe.Pointer(in.TimeoutSeconds))
out.Limit = in.Limit
out.Continue = in.Continue
+ out.SendInitialEvents = (*bool)(unsafe.Pointer(in.SendInitialEvents))
return nil
}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go
index 6e1eac5c7..af66a2ac4 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go
@@ -75,6 +75,11 @@ func (in *ListOptions) DeepCopyInto(out *ListOptions) {
*out = new(int64)
**out = **in
}
+ if in.SendInitialEvents != nil {
+ in, out := &in.SendInitialEvents, &out.SendInitialEvents
+ *out = new(bool)
+ **out = **in
+ }
return
}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/OWNERS b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/OWNERS
index 5731b9ee2..e7e5c152d 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/OWNERS
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/OWNERS
@@ -1,23 +1,16 @@
# See the OWNERS docs at https://go.k8s.io/owners
reviewers:
-- thockin
-- smarterclayton
-- wojtek-t
-- deads2k
-- brendandburns
-- caesarxuchao
-- liggitt
-- davidopp
-- sttts
-- quinton-hoole
-- luxas
-- janetkuo
-- justinsb
-- ncdc
-- soltysh
-- dims
-- hongchaodeng
-- krousey
-- therc
-- kevin-wangzefeng
+ - thockin
+ - smarterclayton
+ - wojtek-t
+ - deads2k
+ - caesarxuchao
+ - liggitt
+ - sttts
+ - luxas
+ - janetkuo
+ - justinsb
+ - ncdc
+ - soltysh
+ - dims
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/controller_ref.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/controller_ref.go
index 15b45ffa8..5005beb12 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/controller_ref.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/controller_ref.go
@@ -18,6 +18,7 @@ package v1
import (
"k8s.io/apimachinery/pkg/runtime/schema"
+ "k8s.io/utils/ptr"
)
// IsControlledBy checks if the object has a controllerRef set to the given owner
@@ -36,10 +37,14 @@ func GetControllerOf(controllee Object) *OwnerReference {
return nil
}
cp := *ref
+ cp.Controller = ptr.To(*ref.Controller)
+ if ref.BlockOwnerDeletion != nil {
+ cp.BlockOwnerDeletion = ptr.To(*ref.BlockOwnerDeletion)
+ }
return &cp
}
-// GetControllerOf returns a pointer to the controllerRef if controllee has a controller
+// GetControllerOfNoCopy returns a pointer to the controllerRef if controllee has a controller
func GetControllerOfNoCopy(controllee Object) *OwnerReference {
refs := controllee.GetOwnerReferences()
for i := range refs {
@@ -52,14 +57,12 @@ func GetControllerOfNoCopy(controllee Object) *OwnerReference {
// NewControllerRef creates an OwnerReference pointing to the given owner.
func NewControllerRef(owner Object, gvk schema.GroupVersionKind) *OwnerReference {
- blockOwnerDeletion := true
- isController := true
return &OwnerReference{
APIVersion: gvk.GroupVersion().String(),
Kind: gvk.Kind,
Name: owner.GetName(),
UID: owner.GetUID(),
- BlockOwnerDeletion: &blockOwnerDeletion,
- Controller: &isController,
+ BlockOwnerDeletion: ptr.To(true),
+ Controller: ptr.To(true),
}
}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.pb.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.pb.go
index 9e7924c12..229ea2c2c 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.pb.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.pb.go
@@ -15,7 +15,7 @@ limitations under the License.
*/
// Code generated by protoc-gen-gogo. DO NOT EDIT.
-// source: k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto
+// source: k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto
package v1
@@ -52,7 +52,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
func (m *APIGroup) Reset() { *m = APIGroup{} }
func (*APIGroup) ProtoMessage() {}
func (*APIGroup) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{0}
+ return fileDescriptor_a8431b6e0aeeb761, []int{0}
}
func (m *APIGroup) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -80,7 +80,7 @@ var xxx_messageInfo_APIGroup proto.InternalMessageInfo
func (m *APIGroupList) Reset() { *m = APIGroupList{} }
func (*APIGroupList) ProtoMessage() {}
func (*APIGroupList) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{1}
+ return fileDescriptor_a8431b6e0aeeb761, []int{1}
}
func (m *APIGroupList) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -108,7 +108,7 @@ var xxx_messageInfo_APIGroupList proto.InternalMessageInfo
func (m *APIResource) Reset() { *m = APIResource{} }
func (*APIResource) ProtoMessage() {}
func (*APIResource) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{2}
+ return fileDescriptor_a8431b6e0aeeb761, []int{2}
}
func (m *APIResource) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -136,7 +136,7 @@ var xxx_messageInfo_APIResource proto.InternalMessageInfo
func (m *APIResourceList) Reset() { *m = APIResourceList{} }
func (*APIResourceList) ProtoMessage() {}
func (*APIResourceList) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{3}
+ return fileDescriptor_a8431b6e0aeeb761, []int{3}
}
func (m *APIResourceList) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -164,7 +164,7 @@ var xxx_messageInfo_APIResourceList proto.InternalMessageInfo
func (m *APIVersions) Reset() { *m = APIVersions{} }
func (*APIVersions) ProtoMessage() {}
func (*APIVersions) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{4}
+ return fileDescriptor_a8431b6e0aeeb761, []int{4}
}
func (m *APIVersions) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -192,7 +192,7 @@ var xxx_messageInfo_APIVersions proto.InternalMessageInfo
func (m *ApplyOptions) Reset() { *m = ApplyOptions{} }
func (*ApplyOptions) ProtoMessage() {}
func (*ApplyOptions) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{5}
+ return fileDescriptor_a8431b6e0aeeb761, []int{5}
}
func (m *ApplyOptions) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -220,7 +220,7 @@ var xxx_messageInfo_ApplyOptions proto.InternalMessageInfo
func (m *Condition) Reset() { *m = Condition{} }
func (*Condition) ProtoMessage() {}
func (*Condition) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{6}
+ return fileDescriptor_a8431b6e0aeeb761, []int{6}
}
func (m *Condition) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -248,7 +248,7 @@ var xxx_messageInfo_Condition proto.InternalMessageInfo
func (m *CreateOptions) Reset() { *m = CreateOptions{} }
func (*CreateOptions) ProtoMessage() {}
func (*CreateOptions) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{7}
+ return fileDescriptor_a8431b6e0aeeb761, []int{7}
}
func (m *CreateOptions) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -276,7 +276,7 @@ var xxx_messageInfo_CreateOptions proto.InternalMessageInfo
func (m *DeleteOptions) Reset() { *m = DeleteOptions{} }
func (*DeleteOptions) ProtoMessage() {}
func (*DeleteOptions) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{8}
+ return fileDescriptor_a8431b6e0aeeb761, []int{8}
}
func (m *DeleteOptions) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -304,7 +304,7 @@ var xxx_messageInfo_DeleteOptions proto.InternalMessageInfo
func (m *Duration) Reset() { *m = Duration{} }
func (*Duration) ProtoMessage() {}
func (*Duration) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{9}
+ return fileDescriptor_a8431b6e0aeeb761, []int{9}
}
func (m *Duration) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -329,10 +329,38 @@ func (m *Duration) XXX_DiscardUnknown() {
var xxx_messageInfo_Duration proto.InternalMessageInfo
+func (m *FieldSelectorRequirement) Reset() { *m = FieldSelectorRequirement{} }
+func (*FieldSelectorRequirement) ProtoMessage() {}
+func (*FieldSelectorRequirement) Descriptor() ([]byte, []int) {
+ return fileDescriptor_a8431b6e0aeeb761, []int{10}
+}
+func (m *FieldSelectorRequirement) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *FieldSelectorRequirement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ b = b[:cap(b)]
+ n, err := m.MarshalToSizedBuffer(b)
+ if err != nil {
+ return nil, err
+ }
+ return b[:n], nil
+}
+func (m *FieldSelectorRequirement) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_FieldSelectorRequirement.Merge(m, src)
+}
+func (m *FieldSelectorRequirement) XXX_Size() int {
+ return m.Size()
+}
+func (m *FieldSelectorRequirement) XXX_DiscardUnknown() {
+ xxx_messageInfo_FieldSelectorRequirement.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_FieldSelectorRequirement proto.InternalMessageInfo
+
func (m *FieldsV1) Reset() { *m = FieldsV1{} }
func (*FieldsV1) ProtoMessage() {}
func (*FieldsV1) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{10}
+ return fileDescriptor_a8431b6e0aeeb761, []int{11}
}
func (m *FieldsV1) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -360,7 +388,7 @@ var xxx_messageInfo_FieldsV1 proto.InternalMessageInfo
func (m *GetOptions) Reset() { *m = GetOptions{} }
func (*GetOptions) ProtoMessage() {}
func (*GetOptions) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{11}
+ return fileDescriptor_a8431b6e0aeeb761, []int{12}
}
func (m *GetOptions) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -388,7 +416,7 @@ var xxx_messageInfo_GetOptions proto.InternalMessageInfo
func (m *GroupKind) Reset() { *m = GroupKind{} }
func (*GroupKind) ProtoMessage() {}
func (*GroupKind) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{12}
+ return fileDescriptor_a8431b6e0aeeb761, []int{13}
}
func (m *GroupKind) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -416,7 +444,7 @@ var xxx_messageInfo_GroupKind proto.InternalMessageInfo
func (m *GroupResource) Reset() { *m = GroupResource{} }
func (*GroupResource) ProtoMessage() {}
func (*GroupResource) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{13}
+ return fileDescriptor_a8431b6e0aeeb761, []int{14}
}
func (m *GroupResource) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -444,7 +472,7 @@ var xxx_messageInfo_GroupResource proto.InternalMessageInfo
func (m *GroupVersion) Reset() { *m = GroupVersion{} }
func (*GroupVersion) ProtoMessage() {}
func (*GroupVersion) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{14}
+ return fileDescriptor_a8431b6e0aeeb761, []int{15}
}
func (m *GroupVersion) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -472,7 +500,7 @@ var xxx_messageInfo_GroupVersion proto.InternalMessageInfo
func (m *GroupVersionForDiscovery) Reset() { *m = GroupVersionForDiscovery{} }
func (*GroupVersionForDiscovery) ProtoMessage() {}
func (*GroupVersionForDiscovery) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{15}
+ return fileDescriptor_a8431b6e0aeeb761, []int{16}
}
func (m *GroupVersionForDiscovery) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -500,7 +528,7 @@ var xxx_messageInfo_GroupVersionForDiscovery proto.InternalMessageInfo
func (m *GroupVersionKind) Reset() { *m = GroupVersionKind{} }
func (*GroupVersionKind) ProtoMessage() {}
func (*GroupVersionKind) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{16}
+ return fileDescriptor_a8431b6e0aeeb761, []int{17}
}
func (m *GroupVersionKind) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -528,7 +556,7 @@ var xxx_messageInfo_GroupVersionKind proto.InternalMessageInfo
func (m *GroupVersionResource) Reset() { *m = GroupVersionResource{} }
func (*GroupVersionResource) ProtoMessage() {}
func (*GroupVersionResource) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{17}
+ return fileDescriptor_a8431b6e0aeeb761, []int{18}
}
func (m *GroupVersionResource) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -556,7 +584,7 @@ var xxx_messageInfo_GroupVersionResource proto.InternalMessageInfo
func (m *LabelSelector) Reset() { *m = LabelSelector{} }
func (*LabelSelector) ProtoMessage() {}
func (*LabelSelector) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{18}
+ return fileDescriptor_a8431b6e0aeeb761, []int{19}
}
func (m *LabelSelector) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -584,7 +612,7 @@ var xxx_messageInfo_LabelSelector proto.InternalMessageInfo
func (m *LabelSelectorRequirement) Reset() { *m = LabelSelectorRequirement{} }
func (*LabelSelectorRequirement) ProtoMessage() {}
func (*LabelSelectorRequirement) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{19}
+ return fileDescriptor_a8431b6e0aeeb761, []int{20}
}
func (m *LabelSelectorRequirement) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -612,7 +640,7 @@ var xxx_messageInfo_LabelSelectorRequirement proto.InternalMessageInfo
func (m *List) Reset() { *m = List{} }
func (*List) ProtoMessage() {}
func (*List) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{20}
+ return fileDescriptor_a8431b6e0aeeb761, []int{21}
}
func (m *List) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -640,7 +668,7 @@ var xxx_messageInfo_List proto.InternalMessageInfo
func (m *ListMeta) Reset() { *m = ListMeta{} }
func (*ListMeta) ProtoMessage() {}
func (*ListMeta) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{21}
+ return fileDescriptor_a8431b6e0aeeb761, []int{22}
}
func (m *ListMeta) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -668,7 +696,7 @@ var xxx_messageInfo_ListMeta proto.InternalMessageInfo
func (m *ListOptions) Reset() { *m = ListOptions{} }
func (*ListOptions) ProtoMessage() {}
func (*ListOptions) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{22}
+ return fileDescriptor_a8431b6e0aeeb761, []int{23}
}
func (m *ListOptions) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -696,7 +724,7 @@ var xxx_messageInfo_ListOptions proto.InternalMessageInfo
func (m *ManagedFieldsEntry) Reset() { *m = ManagedFieldsEntry{} }
func (*ManagedFieldsEntry) ProtoMessage() {}
func (*ManagedFieldsEntry) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{23}
+ return fileDescriptor_a8431b6e0aeeb761, []int{24}
}
func (m *ManagedFieldsEntry) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -724,7 +752,7 @@ var xxx_messageInfo_ManagedFieldsEntry proto.InternalMessageInfo
func (m *MicroTime) Reset() { *m = MicroTime{} }
func (*MicroTime) ProtoMessage() {}
func (*MicroTime) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{24}
+ return fileDescriptor_a8431b6e0aeeb761, []int{25}
}
func (m *MicroTime) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MicroTime.Unmarshal(m, b)
@@ -747,7 +775,7 @@ var xxx_messageInfo_MicroTime proto.InternalMessageInfo
func (m *ObjectMeta) Reset() { *m = ObjectMeta{} }
func (*ObjectMeta) ProtoMessage() {}
func (*ObjectMeta) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{25}
+ return fileDescriptor_a8431b6e0aeeb761, []int{26}
}
func (m *ObjectMeta) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -775,7 +803,7 @@ var xxx_messageInfo_ObjectMeta proto.InternalMessageInfo
func (m *OwnerReference) Reset() { *m = OwnerReference{} }
func (*OwnerReference) ProtoMessage() {}
func (*OwnerReference) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{26}
+ return fileDescriptor_a8431b6e0aeeb761, []int{27}
}
func (m *OwnerReference) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -803,7 +831,7 @@ var xxx_messageInfo_OwnerReference proto.InternalMessageInfo
func (m *PartialObjectMetadata) Reset() { *m = PartialObjectMetadata{} }
func (*PartialObjectMetadata) ProtoMessage() {}
func (*PartialObjectMetadata) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{27}
+ return fileDescriptor_a8431b6e0aeeb761, []int{28}
}
func (m *PartialObjectMetadata) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -831,7 +859,7 @@ var xxx_messageInfo_PartialObjectMetadata proto.InternalMessageInfo
func (m *PartialObjectMetadataList) Reset() { *m = PartialObjectMetadataList{} }
func (*PartialObjectMetadataList) ProtoMessage() {}
func (*PartialObjectMetadataList) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{28}
+ return fileDescriptor_a8431b6e0aeeb761, []int{29}
}
func (m *PartialObjectMetadataList) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -859,7 +887,7 @@ var xxx_messageInfo_PartialObjectMetadataList proto.InternalMessageInfo
func (m *Patch) Reset() { *m = Patch{} }
func (*Patch) ProtoMessage() {}
func (*Patch) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{29}
+ return fileDescriptor_a8431b6e0aeeb761, []int{30}
}
func (m *Patch) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -887,7 +915,7 @@ var xxx_messageInfo_Patch proto.InternalMessageInfo
func (m *PatchOptions) Reset() { *m = PatchOptions{} }
func (*PatchOptions) ProtoMessage() {}
func (*PatchOptions) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{30}
+ return fileDescriptor_a8431b6e0aeeb761, []int{31}
}
func (m *PatchOptions) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -915,7 +943,7 @@ var xxx_messageInfo_PatchOptions proto.InternalMessageInfo
func (m *Preconditions) Reset() { *m = Preconditions{} }
func (*Preconditions) ProtoMessage() {}
func (*Preconditions) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{31}
+ return fileDescriptor_a8431b6e0aeeb761, []int{32}
}
func (m *Preconditions) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -943,7 +971,7 @@ var xxx_messageInfo_Preconditions proto.InternalMessageInfo
func (m *RootPaths) Reset() { *m = RootPaths{} }
func (*RootPaths) ProtoMessage() {}
func (*RootPaths) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{32}
+ return fileDescriptor_a8431b6e0aeeb761, []int{33}
}
func (m *RootPaths) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -971,7 +999,7 @@ var xxx_messageInfo_RootPaths proto.InternalMessageInfo
func (m *ServerAddressByClientCIDR) Reset() { *m = ServerAddressByClientCIDR{} }
func (*ServerAddressByClientCIDR) ProtoMessage() {}
func (*ServerAddressByClientCIDR) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{33}
+ return fileDescriptor_a8431b6e0aeeb761, []int{34}
}
func (m *ServerAddressByClientCIDR) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -999,7 +1027,7 @@ var xxx_messageInfo_ServerAddressByClientCIDR proto.InternalMessageInfo
func (m *Status) Reset() { *m = Status{} }
func (*Status) ProtoMessage() {}
func (*Status) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{34}
+ return fileDescriptor_a8431b6e0aeeb761, []int{35}
}
func (m *Status) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1027,7 +1055,7 @@ var xxx_messageInfo_Status proto.InternalMessageInfo
func (m *StatusCause) Reset() { *m = StatusCause{} }
func (*StatusCause) ProtoMessage() {}
func (*StatusCause) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{35}
+ return fileDescriptor_a8431b6e0aeeb761, []int{36}
}
func (m *StatusCause) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1055,7 +1083,7 @@ var xxx_messageInfo_StatusCause proto.InternalMessageInfo
func (m *StatusDetails) Reset() { *m = StatusDetails{} }
func (*StatusDetails) ProtoMessage() {}
func (*StatusDetails) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{36}
+ return fileDescriptor_a8431b6e0aeeb761, []int{37}
}
func (m *StatusDetails) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1083,7 +1111,7 @@ var xxx_messageInfo_StatusDetails proto.InternalMessageInfo
func (m *TableOptions) Reset() { *m = TableOptions{} }
func (*TableOptions) ProtoMessage() {}
func (*TableOptions) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{37}
+ return fileDescriptor_a8431b6e0aeeb761, []int{38}
}
func (m *TableOptions) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1111,7 +1139,7 @@ var xxx_messageInfo_TableOptions proto.InternalMessageInfo
func (m *Time) Reset() { *m = Time{} }
func (*Time) ProtoMessage() {}
func (*Time) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{38}
+ return fileDescriptor_a8431b6e0aeeb761, []int{39}
}
func (m *Time) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Time.Unmarshal(m, b)
@@ -1134,7 +1162,7 @@ var xxx_messageInfo_Time proto.InternalMessageInfo
func (m *Timestamp) Reset() { *m = Timestamp{} }
func (*Timestamp) ProtoMessage() {}
func (*Timestamp) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{39}
+ return fileDescriptor_a8431b6e0aeeb761, []int{40}
}
func (m *Timestamp) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1162,7 +1190,7 @@ var xxx_messageInfo_Timestamp proto.InternalMessageInfo
func (m *TypeMeta) Reset() { *m = TypeMeta{} }
func (*TypeMeta) ProtoMessage() {}
func (*TypeMeta) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{40}
+ return fileDescriptor_a8431b6e0aeeb761, []int{41}
}
func (m *TypeMeta) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1190,7 +1218,7 @@ var xxx_messageInfo_TypeMeta proto.InternalMessageInfo
func (m *UpdateOptions) Reset() { *m = UpdateOptions{} }
func (*UpdateOptions) ProtoMessage() {}
func (*UpdateOptions) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{41}
+ return fileDescriptor_a8431b6e0aeeb761, []int{42}
}
func (m *UpdateOptions) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1218,7 +1246,7 @@ var xxx_messageInfo_UpdateOptions proto.InternalMessageInfo
func (m *Verbs) Reset() { *m = Verbs{} }
func (*Verbs) ProtoMessage() {}
func (*Verbs) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{42}
+ return fileDescriptor_a8431b6e0aeeb761, []int{43}
}
func (m *Verbs) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1246,7 +1274,7 @@ var xxx_messageInfo_Verbs proto.InternalMessageInfo
func (m *WatchEvent) Reset() { *m = WatchEvent{} }
func (*WatchEvent) ProtoMessage() {}
func (*WatchEvent) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{43}
+ return fileDescriptor_a8431b6e0aeeb761, []int{44}
}
func (m *WatchEvent) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1282,6 +1310,7 @@ func init() {
proto.RegisterType((*CreateOptions)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1.CreateOptions")
proto.RegisterType((*DeleteOptions)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1.DeleteOptions")
proto.RegisterType((*Duration)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1.Duration")
+ proto.RegisterType((*FieldSelectorRequirement)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1.FieldSelectorRequirement")
proto.RegisterType((*FieldsV1)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1.FieldsV1")
proto.RegisterType((*GetOptions)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1.GetOptions")
proto.RegisterType((*GroupKind)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1.GroupKind")
@@ -1322,190 +1351,191 @@ func init() {
}
func init() {
- proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto", fileDescriptor_cf52fa777ced5367)
-}
-
-var fileDescriptor_cf52fa777ced5367 = []byte{
- // 2859 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x3a, 0xcb, 0x6f, 0x24, 0x47,
- 0xf9, 0xee, 0x19, 0x8f, 0x3d, 0xf3, 0x8d, 0xc7, 0x8f, 0x5a, 0xef, 0xef, 0x37, 0x6b, 0x84, 0xc7,
- 0xe9, 0xa0, 0x68, 0x03, 0xc9, 0x38, 0x5e, 0x42, 0xb4, 0xd9, 0x90, 0x80, 0xc7, 0xb3, 0xde, 0x98,
- 0xac, 0x63, 0xab, 0xbc, 0xbb, 0x40, 0x88, 0x50, 0xda, 0xdd, 0xe5, 0x71, 0xe3, 0x9e, 0xee, 0x49,
- 0x55, 0x8f, 0x37, 0x03, 0x07, 0x72, 0x00, 0x01, 0x12, 0x8a, 0xc2, 0x8d, 0x13, 0x4a, 0x04, 0x7f,
- 0x00, 0xe2, 0x02, 0x7f, 0x00, 0x12, 0x39, 0x06, 0x71, 0x89, 0x04, 0x1a, 0x25, 0xe6, 0xc0, 0x11,
- 0x71, 0xf5, 0x05, 0x54, 0x8f, 0xee, 0xae, 0x9e, 0xc7, 0xba, 0x27, 0xbb, 0x44, 0xdc, 0xa6, 0xbf,
- 0x77, 0x55, 0x7d, 0xf5, 0xbd, 0x6a, 0x60, 0xf7, 0xe4, 0x3a, 0xab, 0xbb, 0xc1, 0xfa, 0x49, 0xf7,
- 0x90, 0x50, 0x9f, 0x84, 0x84, 0xad, 0x9f, 0x12, 0xdf, 0x09, 0xe8, 0xba, 0x42, 0x58, 0x1d, 0xb7,
- 0x6d, 0xd9, 0xc7, 0xae, 0x4f, 0x68, 0x6f, 0xbd, 0x73, 0xd2, 0xe2, 0x00, 0xb6, 0xde, 0x26, 0xa1,
- 0xb5, 0x7e, 0xba, 0xb1, 0xde, 0x22, 0x3e, 0xa1, 0x56, 0x48, 0x9c, 0x7a, 0x87, 0x06, 0x61, 0x80,
- 0xbe, 0x20, 0xb9, 0xea, 0x3a, 0x57, 0xbd, 0x73, 0xd2, 0xe2, 0x00, 0x56, 0xe7, 0x5c, 0xf5, 0xd3,
- 0x8d, 0x95, 0xa7, 0x5b, 0x6e, 0x78, 0xdc, 0x3d, 0xac, 0xdb, 0x41, 0x7b, 0xbd, 0x15, 0xb4, 0x82,
- 0x75, 0xc1, 0x7c, 0xd8, 0x3d, 0x12, 0x5f, 0xe2, 0x43, 0xfc, 0x92, 0x42, 0x57, 0xc6, 0x9a, 0x42,
- 0xbb, 0x7e, 0xe8, 0xb6, 0xc9, 0xa0, 0x15, 0x2b, 0xcf, 0x5d, 0xc4, 0xc0, 0xec, 0x63, 0xd2, 0xb6,
- 0x06, 0xf9, 0xcc, 0x3f, 0xe5, 0xa1, 0xb8, 0xb9, 0xbf, 0x73, 0x8b, 0x06, 0xdd, 0x0e, 0x5a, 0x83,
- 0x69, 0xdf, 0x6a, 0x93, 0xaa, 0xb1, 0x66, 0x5c, 0x2d, 0x35, 0xe6, 0x3e, 0xe8, 0xd7, 0xa6, 0xce,
- 0xfa, 0xb5, 0xe9, 0x57, 0xad, 0x36, 0xc1, 0x02, 0x83, 0x3c, 0x28, 0x9e, 0x12, 0xca, 0xdc, 0xc0,
- 0x67, 0xd5, 0xdc, 0x5a, 0xfe, 0x6a, 0xf9, 0xda, 0x4b, 0xf5, 0x2c, 0xeb, 0xaf, 0x0b, 0x05, 0xf7,
- 0x24, 0xeb, 0x76, 0x40, 0x9b, 0x2e, 0xb3, 0x83, 0x53, 0x42, 0x7b, 0x8d, 0x45, 0xa5, 0xa5, 0xa8,
- 0x90, 0x0c, 0xc7, 0x1a, 0xd0, 0x8f, 0x0c, 0x58, 0xec, 0x50, 0x72, 0x44, 0x28, 0x25, 0x8e, 0xc2,
- 0x57, 0xf3, 0x6b, 0xc6, 0x23, 0x50, 0x5b, 0x55, 0x6a, 0x17, 0xf7, 0x07, 0xe4, 0xe3, 0x21, 0x8d,
- 0xe8, 0xd7, 0x06, 0xac, 0x30, 0x42, 0x4f, 0x09, 0xdd, 0x74, 0x1c, 0x4a, 0x18, 0x6b, 0xf4, 0xb6,
- 0x3c, 0x97, 0xf8, 0xe1, 0xd6, 0x4e, 0x13, 0xb3, 0xea, 0xb4, 0xd8, 0x87, 0xaf, 0x65, 0x33, 0xe8,
- 0x60, 0x9c, 0x9c, 0x86, 0xa9, 0x2c, 0x5a, 0x19, 0x4b, 0xc2, 0xf0, 0x03, 0xcc, 0x30, 0x8f, 0x60,
- 0x2e, 0x3a, 0xc8, 0xdb, 0x2e, 0x0b, 0xd1, 0x3d, 0x98, 0x69, 0xf1, 0x0f, 0x56, 0x35, 0x84, 0x81,
- 0xf5, 0x6c, 0x06, 0x46, 0x32, 0x1a, 0xf3, 0xca, 0x9e, 0x19, 0xf1, 0xc9, 0xb0, 0x92, 0x66, 0xfe,
- 0x6c, 0x1a, 0xca, 0x9b, 0xfb, 0x3b, 0x98, 0xb0, 0xa0, 0x4b, 0x6d, 0x92, 0xc1, 0x69, 0xae, 0xc3,
- 0x1c, 0x73, 0xfd, 0x56, 0xd7, 0xb3, 0x28, 0x87, 0x56, 0x67, 0x04, 0xe5, 0xb2, 0xa2, 0x9c, 0x3b,
- 0xd0, 0x70, 0x38, 0x45, 0x89, 0xae, 0x01, 0x70, 0x09, 0xac, 0x63, 0xd9, 0xc4, 0xa9, 0xe6, 0xd6,
- 0x8c, 0xab, 0xc5, 0x06, 0x52, 0x7c, 0xf0, 0x6a, 0x8c, 0xc1, 0x1a, 0x15, 0x7a, 0x1c, 0x0a, 0xc2,
- 0xd2, 0x6a, 0x51, 0xa8, 0xa9, 0x28, 0xf2, 0x82, 0x58, 0x06, 0x96, 0x38, 0xf4, 0x24, 0xcc, 0x2a,
- 0x2f, 0xab, 0x96, 0x04, 0xd9, 0x82, 0x22, 0x9b, 0x8d, 0xdc, 0x20, 0xc2, 0xf3, 0xf5, 0x9d, 0xb8,
- 0xbe, 0x23, 0xfc, 0x4e, 0x5b, 0xdf, 0x2b, 0xae, 0xef, 0x60, 0x81, 0x41, 0xb7, 0xa1, 0x70, 0x4a,
- 0xe8, 0x21, 0xf7, 0x04, 0xee, 0x9a, 0x5f, 0xca, 0xb6, 0xd1, 0xf7, 0x38, 0x4b, 0xa3, 0xc4, 0x4d,
- 0x13, 0x3f, 0xb1, 0x14, 0x82, 0xea, 0x00, 0xec, 0x38, 0xa0, 0xa1, 0x58, 0x5e, 0xb5, 0xb0, 0x96,
- 0xbf, 0x5a, 0x6a, 0xcc, 0xf3, 0xf5, 0x1e, 0xc4, 0x50, 0xac, 0x51, 0x70, 0x7a, 0xdb, 0x0a, 0x49,
- 0x2b, 0xa0, 0x2e, 0x61, 0xd5, 0xd9, 0x84, 0x7e, 0x2b, 0x86, 0x62, 0x8d, 0x02, 0x7d, 0x03, 0x10,
- 0x0b, 0x03, 0x6a, 0xb5, 0x88, 0x5a, 0xea, 0xcb, 0x16, 0x3b, 0xae, 0x82, 0x58, 0xdd, 0x8a, 0x5a,
- 0x1d, 0x3a, 0x18, 0xa2, 0xc0, 0x23, 0xb8, 0xcc, 0xdf, 0x19, 0xb0, 0xa0, 0xf9, 0x82, 0xf0, 0xbb,
- 0xeb, 0x30, 0xd7, 0xd2, 0x6e, 0x9d, 0xf2, 0x8b, 0xf8, 0xb4, 0xf5, 0x1b, 0x89, 0x53, 0x94, 0x88,
- 0x40, 0x89, 0x2a, 0x49, 0x51, 0x74, 0xd9, 0xc8, 0xec, 0xb4, 0x91, 0x0d, 0x89, 0x26, 0x0d, 0xc8,
- 0x70, 0x22, 0xd9, 0xfc, 0x87, 0x21, 0x1c, 0x38, 0x8a, 0x37, 0xe8, 0xaa, 0x16, 0xd3, 0x0c, 0xb1,
- 0x7d, 0x73, 0x63, 0xe2, 0xd1, 0x05, 0x81, 0x20, 0xf7, 0x3f, 0x11, 0x08, 0x6e, 0x14, 0x7f, 0xf9,
- 0x5e, 0x6d, 0xea, 0xed, 0xbf, 0xad, 0x4d, 0x99, 0xbf, 0x30, 0x60, 0x6e, 0xb3, 0xd3, 0xf1, 0x7a,
- 0x7b, 0x9d, 0x50, 0x2c, 0xc0, 0x84, 0x19, 0x87, 0xf6, 0x70, 0xd7, 0x57, 0x0b, 0x05, 0x7e, 0xbf,
- 0x9b, 0x02, 0x82, 0x15, 0x86, 0xdf, 0x9f, 0xa3, 0x80, 0xda, 0x44, 0x5d, 0xb7, 0xf8, 0xfe, 0x6c,
- 0x73, 0x20, 0x96, 0x38, 0x7e, 0xc8, 0x47, 0x2e, 0xf1, 0x9c, 0x5d, 0xcb, 0xb7, 0x5a, 0x84, 0xaa,
- 0xcb, 0x11, 0x6f, 0xfd, 0xb6, 0x86, 0xc3, 0x29, 0x4a, 0xf3, 0xdf, 0x39, 0x28, 0x6d, 0x05, 0xbe,
- 0xe3, 0x86, 0xea, 0x72, 0x85, 0xbd, 0xce, 0x50, 0xf0, 0xb8, 0xd3, 0xeb, 0x10, 0x2c, 0x30, 0xe8,
- 0x79, 0x98, 0x61, 0xa1, 0x15, 0x76, 0x99, 0xb0, 0xa7, 0xd4, 0x78, 0x2c, 0x0a, 0x4b, 0x07, 0x02,
- 0x7a, 0xde, 0xaf, 0x2d, 0xc4, 0xe2, 0x24, 0x08, 0x2b, 0x06, 0xee, 0xe9, 0xc1, 0xa1, 0xd8, 0x28,
- 0xe7, 0x96, 0x4c, 0x7b, 0x51, 0xfe, 0xc8, 0x27, 0x9e, 0xbe, 0x37, 0x44, 0x81, 0x47, 0x70, 0xa1,
- 0x53, 0x40, 0x9e, 0xc5, 0xc2, 0x3b, 0xd4, 0xf2, 0x99, 0xd0, 0x75, 0xc7, 0x6d, 0x13, 0x75, 0xe1,
- 0xbf, 0x98, 0xed, 0xc4, 0x39, 0x47, 0xa2, 0xf7, 0xf6, 0x90, 0x34, 0x3c, 0x42, 0x03, 0x7a, 0x02,
- 0x66, 0x28, 0xb1, 0x58, 0xe0, 0x57, 0x0b, 0x62, 0xf9, 0x71, 0x54, 0xc6, 0x02, 0x8a, 0x15, 0x96,
- 0x07, 0xb4, 0x36, 0x61, 0xcc, 0x6a, 0x45, 0xe1, 0x35, 0x0e, 0x68, 0xbb, 0x12, 0x8c, 0x23, 0xbc,
- 0xf9, 0x5b, 0x03, 0x2a, 0x5b, 0x94, 0x58, 0x21, 0x99, 0xc4, 0x2d, 0x3e, 0xf5, 0x89, 0xa3, 0x4d,
- 0x58, 0x10, 0xdf, 0xf7, 0x2c, 0xcf, 0x75, 0xe4, 0x19, 0x4c, 0x0b, 0xe6, 0xff, 0x57, 0xcc, 0x0b,
- 0xdb, 0x69, 0x34, 0x1e, 0xa4, 0x37, 0x7f, 0x92, 0x87, 0x4a, 0x93, 0x78, 0x24, 0x31, 0x79, 0x1b,
- 0x50, 0x8b, 0x5a, 0x36, 0xd9, 0x27, 0xd4, 0x0d, 0x9c, 0x03, 0x62, 0x07, 0xbe, 0xc3, 0x84, 0x1b,
- 0xe5, 0x1b, 0xff, 0xc7, 0xf7, 0xf7, 0xd6, 0x10, 0x16, 0x8f, 0xe0, 0x40, 0x1e, 0x54, 0x3a, 0x54,
- 0xfc, 0x16, 0x7b, 0x2e, 0xbd, 0xac, 0x7c, 0xed, 0xcb, 0xd9, 0x8e, 0x74, 0x5f, 0x67, 0x6d, 0x2c,
- 0x9d, 0xf5, 0x6b, 0x95, 0x14, 0x08, 0xa7, 0x85, 0xa3, 0xaf, 0xc3, 0x62, 0x40, 0x3b, 0xc7, 0x96,
- 0xdf, 0x24, 0x1d, 0xe2, 0x3b, 0xc4, 0x0f, 0x99, 0xd8, 0xc8, 0x62, 0x63, 0x99, 0xd7, 0x22, 0x7b,
- 0x03, 0x38, 0x3c, 0x44, 0x8d, 0x5e, 0x83, 0xa5, 0x0e, 0x0d, 0x3a, 0x56, 0x4b, 0x6c, 0xcc, 0x7e,
- 0xe0, 0xb9, 0x76, 0x4f, 0x6d, 0xe7, 0x53, 0x67, 0xfd, 0xda, 0xd2, 0xfe, 0x20, 0xf2, 0xbc, 0x5f,
- 0xbb, 0x24, 0xb6, 0x8e, 0x43, 0x12, 0x24, 0x1e, 0x16, 0xa3, 0xb9, 0x41, 0x61, 0x9c, 0x1b, 0x98,
- 0x3b, 0x50, 0x6c, 0x76, 0xd5, 0x9d, 0x78, 0x11, 0x8a, 0x8e, 0xfa, 0xad, 0x76, 0x3e, 0xba, 0x9c,
- 0x31, 0xcd, 0x79, 0xbf, 0x56, 0xe1, 0xe5, 0x67, 0x3d, 0x02, 0xe0, 0x98, 0xc5, 0x7c, 0x02, 0x8a,
- 0xe2, 0xe0, 0xd9, 0xbd, 0x0d, 0xb4, 0x08, 0x79, 0x6c, 0xdd, 0x17, 0x52, 0xe6, 0x30, 0xff, 0xa9,
- 0x45, 0xb1, 0x3d, 0x80, 0x5b, 0x24, 0x8c, 0x0e, 0x7e, 0x13, 0x16, 0xa2, 0x50, 0x9e, 0xce, 0x30,
- 0xb1, 0x37, 0xe1, 0x34, 0x1a, 0x0f, 0xd2, 0x9b, 0xaf, 0x43, 0x49, 0x64, 0x21, 0x9e, 0xc2, 0x93,
- 0x72, 0xc1, 0x78, 0x40, 0xb9, 0x10, 0xd5, 0x00, 0xb9, 0x71, 0x35, 0x80, 0x66, 0xae, 0x07, 0x15,
- 0xc9, 0x1b, 0x15, 0x48, 0x99, 0x34, 0x3c, 0x05, 0xc5, 0xc8, 0x4c, 0xa5, 0x25, 0x2e, 0x8c, 0x23,
- 0x41, 0x38, 0xa6, 0xd0, 0xb4, 0x1d, 0x43, 0x2a, 0xa3, 0x66, 0x53, 0xa6, 0x55, 0x3f, 0xb9, 0x07,
- 0x57, 0x3f, 0x9a, 0xa6, 0x1f, 0x42, 0x75, 0x5c, 0x35, 0xfd, 0x10, 0x39, 0x3f, 0xbb, 0x29, 0xe6,
- 0x3b, 0x06, 0x2c, 0xea, 0x92, 0xb2, 0x1f, 0x5f, 0x76, 0x25, 0x17, 0x57, 0x7b, 0xda, 0x8e, 0xfc,
- 0xca, 0x80, 0xe5, 0xd4, 0xd2, 0x26, 0x3a, 0xf1, 0x09, 0x8c, 0xd2, 0x9d, 0x23, 0x3f, 0x81, 0x73,
- 0xfc, 0x25, 0x07, 0x95, 0xdb, 0xd6, 0x21, 0xf1, 0x0e, 0x88, 0x47, 0xec, 0x30, 0xa0, 0xe8, 0x07,
- 0x50, 0x6e, 0x5b, 0xa1, 0x7d, 0x2c, 0xa0, 0x51, 0x67, 0xd0, 0xcc, 0x16, 0xec, 0x52, 0x92, 0xea,
- 0xbb, 0x89, 0x98, 0x9b, 0x7e, 0x48, 0x7b, 0x8d, 0x4b, 0xca, 0xa4, 0xb2, 0x86, 0xc1, 0xba, 0x36,
- 0xd1, 0xce, 0x89, 0xef, 0x9b, 0x6f, 0x75, 0x78, 0xd9, 0x32, 0x79, 0x17, 0x99, 0x32, 0x01, 0x93,
- 0x37, 0xbb, 0x2e, 0x25, 0x6d, 0xe2, 0x87, 0x49, 0x3b, 0xb7, 0x3b, 0x20, 0x1f, 0x0f, 0x69, 0x5c,
- 0x79, 0x09, 0x16, 0x07, 0x8d, 0xe7, 0xf1, 0xe7, 0x84, 0xf4, 0xe4, 0x79, 0x61, 0xfe, 0x13, 0x2d,
- 0x43, 0xe1, 0xd4, 0xf2, 0xba, 0xea, 0x36, 0x62, 0xf9, 0x71, 0x23, 0x77, 0xdd, 0x30, 0x7f, 0x63,
- 0x40, 0x75, 0x9c, 0x21, 0xe8, 0xf3, 0x9a, 0xa0, 0x46, 0x59, 0x59, 0x95, 0x7f, 0x85, 0xf4, 0xa4,
- 0xd4, 0x9b, 0x50, 0x0c, 0x3a, 0xbc, 0xa6, 0x08, 0xa8, 0x3a, 0xf5, 0x27, 0xa3, 0x93, 0xdc, 0x53,
- 0xf0, 0xf3, 0x7e, 0xed, 0x72, 0x4a, 0x7c, 0x84, 0xc0, 0x31, 0x2b, 0x8f, 0xd4, 0xc2, 0x1e, 0x9e,
- 0x3d, 0xe2, 0x48, 0x7d, 0x4f, 0x40, 0xb0, 0xc2, 0x98, 0x7f, 0x30, 0x60, 0x5a, 0x14, 0xe4, 0xaf,
- 0x43, 0x91, 0xef, 0x9f, 0x63, 0x85, 0x96, 0xb0, 0x2b, 0x73, 0x2b, 0xc8, 0xb9, 0x77, 0x49, 0x68,
- 0x25, 0xde, 0x16, 0x41, 0x70, 0x2c, 0x11, 0x61, 0x28, 0xb8, 0x21, 0x69, 0x47, 0x07, 0xf9, 0xf4,
- 0x58, 0xd1, 0x6a, 0x10, 0x51, 0xc7, 0xd6, 0xfd, 0x9b, 0x6f, 0x85, 0xc4, 0xe7, 0x87, 0x91, 0x5c,
- 0x8d, 0x1d, 0x2e, 0x03, 0x4b, 0x51, 0xe6, 0xbf, 0x0c, 0x88, 0x55, 0x71, 0xe7, 0x67, 0xc4, 0x3b,
- 0xba, 0xed, 0xfa, 0x27, 0x6a, 0x5b, 0x63, 0x73, 0x0e, 0x14, 0x1c, 0xc7, 0x14, 0xa3, 0xd2, 0x43,
- 0x6e, 0xb2, 0xf4, 0xc0, 0x15, 0xda, 0x81, 0x1f, 0xba, 0x7e, 0x77, 0xe8, 0xb6, 0x6d, 0x29, 0x38,
- 0x8e, 0x29, 0x78, 0x21, 0x42, 0x49, 0xdb, 0x72, 0x7d, 0xd7, 0x6f, 0xf1, 0x45, 0x6c, 0x05, 0x5d,
- 0x3f, 0x14, 0x19, 0x59, 0x15, 0x22, 0x78, 0x08, 0x8b, 0x47, 0x70, 0x98, 0xbf, 0x9f, 0x86, 0x32,
- 0x5f, 0x73, 0x94, 0xe7, 0x5e, 0x80, 0x8a, 0xa7, 0x7b, 0x81, 0x5a, 0xfb, 0x65, 0x65, 0x4a, 0xfa,
- 0x5e, 0xe3, 0x34, 0x2d, 0x67, 0x16, 0x25, 0x54, 0xcc, 0x9c, 0x4b, 0x33, 0x6f, 0xeb, 0x48, 0x9c,
- 0xa6, 0xe5, 0xd1, 0xeb, 0x3e, 0xbf, 0x1f, 0xaa, 0x32, 0x89, 0x8f, 0xe8, 0x9b, 0x1c, 0x88, 0x25,
- 0x0e, 0xed, 0xc2, 0x25, 0xcb, 0xf3, 0x82, 0xfb, 0x02, 0xd8, 0x08, 0x82, 0x93, 0xb6, 0x45, 0x4f,
- 0x98, 0x68, 0xa6, 0x8b, 0x8d, 0xcf, 0x29, 0x96, 0x4b, 0x9b, 0xc3, 0x24, 0x78, 0x14, 0xdf, 0xa8,
- 0x63, 0x9b, 0x9e, 0xf0, 0xd8, 0x8e, 0x61, 0x79, 0x00, 0x24, 0x6e, 0xb9, 0xea, 0x6c, 0x9f, 0x55,
- 0x72, 0x96, 0xf1, 0x08, 0x9a, 0xf3, 0x31, 0x70, 0x3c, 0x52, 0x22, 0xba, 0x01, 0xf3, 0xdc, 0x93,
- 0x83, 0x6e, 0x18, 0xd5, 0x9d, 0x05, 0x71, 0xdc, 0xe8, 0xac, 0x5f, 0x9b, 0xbf, 0x93, 0xc2, 0xe0,
- 0x01, 0x4a, 0xbe, 0xb9, 0x9e, 0xdb, 0x76, 0xc3, 0xea, 0xac, 0x60, 0x89, 0x37, 0xf7, 0x36, 0x07,
- 0x62, 0x89, 0x4b, 0x79, 0x60, 0xf1, 0x22, 0x0f, 0x34, 0xff, 0x9c, 0x07, 0x24, 0x6b, 0x6d, 0x47,
- 0xd6, 0x53, 0x32, 0xa4, 0xf1, 0x8e, 0x40, 0xd5, 0xea, 0xc6, 0x40, 0x47, 0xa0, 0xca, 0xf4, 0x08,
- 0x8f, 0x76, 0xa1, 0x24, 0x43, 0x4b, 0x72, 0x5d, 0xd6, 0x15, 0x71, 0x69, 0x2f, 0x42, 0x9c, 0xf7,
- 0x6b, 0x2b, 0x29, 0x35, 0x31, 0x46, 0x74, 0x6b, 0x89, 0x04, 0x74, 0x0d, 0xc0, 0xea, 0xb8, 0xfa,
- 0xbc, 0xae, 0x94, 0x4c, 0x6d, 0x92, 0xce, 0x1b, 0x6b, 0x54, 0xe8, 0x65, 0x98, 0x0e, 0x3f, 0x5d,
- 0x47, 0x55, 0x14, 0x0d, 0x23, 0xef, 0x9f, 0x84, 0x04, 0xae, 0x5d, 0xf8, 0x33, 0xe3, 0x66, 0xa9,
- 0x66, 0x28, 0xd6, 0xbe, 0x1d, 0x63, 0xb0, 0x46, 0x85, 0xbe, 0x05, 0xc5, 0x23, 0x55, 0x8a, 0x8a,
- 0x83, 0xc9, 0x1c, 0x22, 0xa3, 0x02, 0x56, 0x8e, 0x0c, 0xa2, 0x2f, 0x1c, 0x4b, 0x43, 0x5f, 0x81,
- 0x32, 0xeb, 0x1e, 0xc6, 0xd9, 0x5b, 0x9e, 0x66, 0x9c, 0x2a, 0x0f, 0x12, 0x14, 0xd6, 0xe9, 0xcc,
- 0x37, 0xa1, 0xb4, 0xeb, 0xda, 0x34, 0x10, 0x3d, 0xe0, 0x93, 0x30, 0xcb, 0x52, 0x0d, 0x4e, 0x7c,
- 0x92, 0x91, 0x97, 0x45, 0x78, 0xee, 0x5e, 0xbe, 0xe5, 0x07, 0xb2, 0x8d, 0x29, 0x24, 0xee, 0xf5,
- 0x2a, 0x07, 0x62, 0x89, 0xbb, 0xb1, 0xcc, 0x0b, 0x84, 0x9f, 0xbe, 0x5f, 0x9b, 0x7a, 0xf7, 0xfd,
- 0xda, 0xd4, 0x7b, 0xef, 0xab, 0x62, 0xe1, 0x1c, 0x00, 0xf6, 0x0e, 0xbf, 0x47, 0x6c, 0x19, 0x76,
- 0x33, 0x8d, 0xf5, 0xa2, 0x69, 0xb2, 0x18, 0xeb, 0xe5, 0x06, 0x8a, 0x3e, 0x0d, 0x87, 0x53, 0x94,
- 0x68, 0x1d, 0x4a, 0xf1, 0xc0, 0x4e, 0xf9, 0xc7, 0x52, 0xe4, 0x6f, 0xf1, 0x54, 0x0f, 0x27, 0x34,
- 0xa9, 0x1c, 0x30, 0x7d, 0x61, 0x0e, 0x68, 0x40, 0xbe, 0xeb, 0x3a, 0xaa, 0x61, 0x7e, 0x26, 0xca,
- 0xc1, 0x77, 0x77, 0x9a, 0xe7, 0xfd, 0xda, 0x63, 0xe3, 0xe6, 0xe4, 0x61, 0xaf, 0x43, 0x58, 0xfd,
- 0xee, 0x4e, 0x13, 0x73, 0xe6, 0x51, 0x01, 0x69, 0x66, 0xc2, 0x80, 0x74, 0x0d, 0xa0, 0x95, 0x8c,
- 0x1d, 0xe4, 0x7d, 0x8f, 0x1d, 0x51, 0x1b, 0x37, 0x68, 0x54, 0x88, 0xc1, 0x92, 0xcd, 0x5b, 0x73,
- 0xd5, 0xfe, 0xb3, 0xd0, 0x6a, 0xcb, 0x41, 0xe6, 0x64, 0x77, 0xe2, 0x8a, 0x52, 0xb3, 0xb4, 0x35,
- 0x28, 0x0c, 0x0f, 0xcb, 0x47, 0x01, 0x2c, 0x39, 0xaa, 0x43, 0x4c, 0x94, 0x96, 0x26, 0x56, 0x7a,
- 0x99, 0x2b, 0x6c, 0x0e, 0x0a, 0xc2, 0xc3, 0xb2, 0xd1, 0x77, 0x61, 0x25, 0x02, 0x0e, 0xb7, 0xe9,
- 0x22, 0x60, 0xe7, 0x1b, 0xab, 0x67, 0xfd, 0xda, 0x4a, 0x73, 0x2c, 0x15, 0x7e, 0x80, 0x04, 0xe4,
- 0xc0, 0x8c, 0x27, 0x0b, 0xdc, 0xb2, 0x28, 0x4a, 0xbe, 0x9a, 0x6d, 0x15, 0x89, 0xf7, 0xd7, 0xf5,
- 0xc2, 0x36, 0x1e, 0xb9, 0xa8, 0x9a, 0x56, 0xc9, 0x46, 0x6f, 0x41, 0xd9, 0xf2, 0xfd, 0x20, 0xb4,
- 0xe4, 0xe0, 0x60, 0x4e, 0xa8, 0xda, 0x9c, 0x58, 0xd5, 0x66, 0x22, 0x63, 0xa0, 0x90, 0xd6, 0x30,
- 0x58, 0x57, 0x85, 0xee, 0xc3, 0x42, 0x70, 0xdf, 0x27, 0x14, 0x93, 0x23, 0x42, 0x89, 0x6f, 0x13,
- 0x56, 0xad, 0x08, 0xed, 0xcf, 0x66, 0xd4, 0x9e, 0x62, 0x4e, 0x5c, 0x3a, 0x0d, 0x67, 0x78, 0x50,
- 0x0b, 0xaa, 0xf3, 0xd8, 0xea, 0x5b, 0x9e, 0xfb, 0x7d, 0x42, 0x59, 0x75, 0x3e, 0x99, 0x35, 0x6f,
- 0xc7, 0x50, 0xac, 0x51, 0xf0, 0xe8, 0x67, 0x7b, 0x5d, 0x16, 0x12, 0x39, 0xf8, 0x5f, 0x48, 0x47,
- 0xbf, 0xad, 0x04, 0x85, 0x75, 0x3a, 0xd4, 0x85, 0x4a, 0x5b, 0xcf, 0x34, 0xd5, 0x25, 0xb1, 0xba,
- 0xeb, 0xd9, 0x56, 0x37, 0x9c, 0x0b, 0x93, 0xc2, 0x27, 0x85, 0xc3, 0x69, 0x2d, 0x2b, 0xcf, 0x43,
- 0xf9, 0x53, 0xf6, 0x04, 0xbc, 0xa7, 0x18, 0x3c, 0xc7, 0x89, 0x7a, 0x8a, 0x3f, 0xe6, 0x60, 0x3e,
- 0xbd, 0xfb, 0x03, 0x59, 0xb4, 0x90, 0x29, 0x8b, 0x46, 0xdd, 0xab, 0x31, 0xf6, 0xad, 0x22, 0x0a,
- 0xeb, 0xf9, 0xb1, 0x61, 0x5d, 0x45, 0xcf, 0xe9, 0x87, 0x89, 0x9e, 0x75, 0x00, 0x5e, 0x9e, 0xd0,
- 0xc0, 0xf3, 0x08, 0x15, 0x81, 0xb3, 0xa8, 0xde, 0x24, 0x62, 0x28, 0xd6, 0x28, 0x78, 0x11, 0x7d,
- 0xe8, 0x05, 0xf6, 0x89, 0xd8, 0x82, 0xe8, 0xd2, 0x8b, 0x90, 0x59, 0x94, 0x45, 0x74, 0x63, 0x08,
- 0x8b, 0x47, 0x70, 0x98, 0x3d, 0xb8, 0xbc, 0x6f, 0xd1, 0xd0, 0xb5, 0xbc, 0xe4, 0x82, 0x89, 0x2e,
- 0xe5, 0x8d, 0xa1, 0x1e, 0xe8, 0x99, 0x49, 0x2f, 0x6a, 0xb2, 0xf9, 0x09, 0x2c, 0xe9, 0x83, 0xcc,
- 0xbf, 0x1a, 0x70, 0x65, 0xa4, 0xee, 0xcf, 0xa0, 0x07, 0x7b, 0x23, 0xdd, 0x83, 0xbd, 0x90, 0x71,
- 0x78, 0x39, 0xca, 0xda, 0x31, 0x1d, 0xd9, 0x2c, 0x14, 0xf6, 0x79, 0xed, 0x6b, 0x7e, 0x68, 0xc0,
- 0x9c, 0xf8, 0x35, 0xc9, 0xec, 0xb8, 0x96, 0x7e, 0x52, 0x28, 0x3d, 0xba, 0xe7, 0x84, 0x47, 0x31,
- 0x5c, 0x7e, 0xc7, 0x80, 0xf4, 0xd4, 0x16, 0xbd, 0x24, 0xaf, 0x80, 0x11, 0x8f, 0x55, 0x27, 0x74,
- 0xff, 0x17, 0xc7, 0x35, 0xa1, 0x97, 0x32, 0xcd, 0x27, 0x9f, 0x82, 0x12, 0x0e, 0x82, 0x70, 0xdf,
- 0x0a, 0x8f, 0x19, 0xdf, 0xbb, 0x0e, 0xff, 0xa1, 0xb6, 0x57, 0xec, 0x9d, 0xc0, 0x60, 0x09, 0x37,
- 0x7f, 0x6e, 0xc0, 0x95, 0xb1, 0x2f, 0x45, 0x3c, 0x8a, 0xd8, 0xf1, 0x97, 0x5a, 0x51, 0xec, 0xc8,
- 0x09, 0x1d, 0xd6, 0xa8, 0x78, 0xf7, 0x98, 0x7a, 0x5e, 0x1a, 0xec, 0x1e, 0x53, 0xda, 0x70, 0x9a,
- 0xd6, 0xfc, 0x67, 0x0e, 0xd4, 0xd3, 0xcc, 0x7f, 0xd9, 0xe9, 0x9f, 0x18, 0x78, 0x18, 0x9a, 0x4f,
- 0x3f, 0x0c, 0xc5, 0xaf, 0x40, 0xda, 0xcb, 0x48, 0xfe, 0xc1, 0x2f, 0x23, 0xe8, 0xb9, 0xf8, 0xb1,
- 0x45, 0xfa, 0xd0, 0x6a, 0xfa, 0xb1, 0xe5, 0xbc, 0x5f, 0x9b, 0x53, 0xc2, 0xd3, 0x8f, 0x2f, 0xaf,
- 0xc1, 0xac, 0x43, 0x42, 0xcb, 0xf5, 0x64, 0x27, 0x98, 0xf9, 0xf9, 0x40, 0x0a, 0x6b, 0x4a, 0xd6,
- 0x46, 0x99, 0xdb, 0xa4, 0x3e, 0x70, 0x24, 0x90, 0x07, 0x6c, 0x3b, 0x70, 0x64, 0x23, 0x53, 0x48,
- 0x02, 0xf6, 0x56, 0xe0, 0x10, 0x2c, 0x30, 0xe6, 0xbb, 0x06, 0x94, 0xa5, 0xa4, 0x2d, 0xab, 0xcb,
- 0x08, 0xda, 0x88, 0x57, 0x21, 0x8f, 0xfb, 0x8a, 0xfe, 0xaa, 0x76, 0xde, 0xaf, 0x95, 0x04, 0x99,
- 0xe8, 0x81, 0x46, 0xbc, 0x1e, 0xe5, 0x2e, 0xd8, 0xa3, 0xc7, 0xa1, 0x20, 0x2e, 0x90, 0xda, 0xcc,
- 0xe4, 0x79, 0x90, 0x03, 0xb1, 0xc4, 0x99, 0x1f, 0xe7, 0xa0, 0x92, 0x5a, 0x5c, 0x86, 0x76, 0x22,
- 0x1e, 0x9a, 0xe6, 0x32, 0x0c, 0xe2, 0xc7, 0x3f, 0xc6, 0xab, 0xf4, 0x35, 0xf3, 0x30, 0xe9, 0xeb,
- 0xdb, 0x30, 0x63, 0xf3, 0x3d, 0x8a, 0xfe, 0xdb, 0xb1, 0x31, 0xc9, 0x71, 0x8a, 0xdd, 0x4d, 0xbc,
- 0x51, 0x7c, 0x32, 0xac, 0x04, 0xa2, 0x5b, 0xb0, 0x44, 0x49, 0x48, 0x7b, 0x9b, 0x47, 0x21, 0xa1,
- 0xfa, 0xf8, 0xa0, 0x90, 0x14, 0xed, 0x78, 0x90, 0x00, 0x0f, 0xf3, 0x98, 0x87, 0x30, 0x77, 0xc7,
- 0x3a, 0xf4, 0xe2, 0x07, 0x31, 0x0c, 0x15, 0xd7, 0xb7, 0xbd, 0xae, 0x43, 0x64, 0x40, 0x8f, 0xa2,
- 0x57, 0x74, 0x69, 0x77, 0x74, 0xe4, 0x79, 0xbf, 0x76, 0x29, 0x05, 0x90, 0x2f, 0x40, 0x38, 0x2d,
- 0xc2, 0xf4, 0x60, 0xfa, 0x33, 0x6c, 0x40, 0xbf, 0x03, 0xa5, 0xa4, 0x45, 0x78, 0xc4, 0x2a, 0xcd,
- 0x37, 0xa0, 0xc8, 0x3d, 0x3e, 0x6a, 0x6d, 0x2f, 0xa8, 0x92, 0xd2, 0xb5, 0x57, 0x2e, 0x4b, 0xed,
- 0x25, 0x9e, 0x55, 0xef, 0x76, 0x9c, 0x87, 0x7c, 0x56, 0xcd, 0x3d, 0x4c, 0xe6, 0xcb, 0x4f, 0x98,
- 0xf9, 0xae, 0x81, 0xfc, 0xeb, 0x09, 0x4f, 0x32, 0xb2, 0x80, 0xd0, 0x92, 0x8c, 0x9e, 0xff, 0xb5,
- 0x37, 0x85, 0x1f, 0x1b, 0x00, 0x62, 0x78, 0x77, 0xf3, 0x94, 0xf8, 0x61, 0x86, 0x07, 0xfc, 0xbb,
- 0x30, 0x13, 0x48, 0x8f, 0x94, 0x4f, 0xab, 0x13, 0x4e, 0x88, 0xe3, 0x8b, 0x24, 0x7d, 0x12, 0x2b,
- 0x61, 0x8d, 0xab, 0x1f, 0x7c, 0xb2, 0x3a, 0xf5, 0xe1, 0x27, 0xab, 0x53, 0x1f, 0x7d, 0xb2, 0x3a,
- 0xf5, 0xf6, 0xd9, 0xaa, 0xf1, 0xc1, 0xd9, 0xaa, 0xf1, 0xe1, 0xd9, 0xaa, 0xf1, 0xd1, 0xd9, 0xaa,
- 0xf1, 0xf1, 0xd9, 0xaa, 0xf1, 0xee, 0xdf, 0x57, 0xa7, 0x5e, 0xcb, 0x9d, 0x6e, 0xfc, 0x27, 0x00,
- 0x00, 0xff, 0xff, 0x7e, 0xef, 0x1e, 0xdd, 0xf0, 0x27, 0x00, 0x00,
+ proto.RegisterFile("k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto", fileDescriptor_a8431b6e0aeeb761)
+}
+
+var fileDescriptor_a8431b6e0aeeb761 = []byte{
+ // 2873 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x1a, 0x5d, 0x6f, 0x23, 0x57,
+ 0x35, 0x63, 0xc7, 0x89, 0x7d, 0x6c, 0xe7, 0xe3, 0x6e, 0x16, 0xbc, 0x41, 0xc4, 0xe9, 0xb4, 0xaa,
+ 0xb6, 0xd0, 0x3a, 0xdd, 0xa5, 0x54, 0xdb, 0x2d, 0x2d, 0xc4, 0xf1, 0x66, 0x9b, 0x76, 0xd3, 0x44,
+ 0x37, 0xbb, 0x0b, 0x94, 0x0a, 0x75, 0xe2, 0xb9, 0x71, 0x86, 0x8c, 0x67, 0xdc, 0x7b, 0xc7, 0x49,
+ 0x0d, 0x0f, 0xf4, 0x01, 0x04, 0x48, 0xa8, 0x2a, 0x6f, 0x3c, 0xa1, 0x56, 0xf0, 0x03, 0x10, 0x4f,
+ 0xbc, 0x83, 0x44, 0x1f, 0x8b, 0x78, 0xa9, 0x04, 0xb2, 0xba, 0xe1, 0x81, 0x47, 0xc4, 0x6b, 0x84,
+ 0x04, 0xba, 0x1f, 0x33, 0x73, 0xc7, 0x1f, 0x9b, 0xf1, 0xee, 0x52, 0xf1, 0xe6, 0x39, 0xdf, 0xf7,
+ 0xde, 0x73, 0xce, 0x3d, 0xe7, 0x5c, 0xc3, 0x73, 0x47, 0xd7, 0x58, 0xcd, 0xf1, 0xd7, 0xac, 0x8e,
+ 0xd3, 0xb6, 0x9a, 0x87, 0x8e, 0x47, 0x68, 0x6f, 0xad, 0x73, 0xd4, 0xe2, 0x00, 0xb6, 0xd6, 0x26,
+ 0x81, 0xb5, 0x76, 0x7c, 0x65, 0xad, 0x45, 0x3c, 0x42, 0xad, 0x80, 0xd8, 0xb5, 0x0e, 0xf5, 0x03,
+ 0x1f, 0x3d, 0x21, 0xb9, 0x6a, 0x3a, 0x57, 0xad, 0x73, 0xd4, 0xe2, 0x00, 0x56, 0xe3, 0x5c, 0xb5,
+ 0xe3, 0x2b, 0xcb, 0xcf, 0xb4, 0x9c, 0xe0, 0xb0, 0xbb, 0x5f, 0x6b, 0xfa, 0xed, 0xb5, 0x96, 0xdf,
+ 0xf2, 0xd7, 0x04, 0xf3, 0x7e, 0xf7, 0x40, 0x7c, 0x89, 0x0f, 0xf1, 0x4b, 0x0a, 0x5d, 0x5e, 0x1b,
+ 0x67, 0x0a, 0xed, 0x7a, 0x81, 0xd3, 0x26, 0x83, 0x56, 0x2c, 0x3f, 0x7f, 0x1e, 0x03, 0x6b, 0x1e,
+ 0x92, 0xb6, 0x35, 0xc8, 0x67, 0xfe, 0x29, 0x0b, 0xf9, 0xf5, 0xdd, 0xad, 0x9b, 0xd4, 0xef, 0x76,
+ 0xd0, 0x2a, 0x4c, 0x7b, 0x56, 0x9b, 0x54, 0x8c, 0x55, 0xe3, 0x72, 0xa1, 0x5e, 0xfa, 0xa8, 0x5f,
+ 0x9d, 0x3a, 0xed, 0x57, 0xa7, 0x5f, 0xb7, 0xda, 0x04, 0x0b, 0x0c, 0x72, 0x21, 0x7f, 0x4c, 0x28,
+ 0x73, 0x7c, 0x8f, 0x55, 0x32, 0xab, 0xd9, 0xcb, 0xc5, 0xab, 0x2f, 0xd7, 0xd2, 0xac, 0xbf, 0x26,
+ 0x14, 0xdc, 0x95, 0xac, 0x9b, 0x3e, 0x6d, 0x38, 0xac, 0xe9, 0x1f, 0x13, 0xda, 0xab, 0x2f, 0x28,
+ 0x2d, 0x79, 0x85, 0x64, 0x38, 0xd2, 0x80, 0x7e, 0x64, 0xc0, 0x42, 0x87, 0x92, 0x03, 0x42, 0x29,
+ 0xb1, 0x15, 0xbe, 0x92, 0x5d, 0x35, 0x1e, 0x81, 0xda, 0x8a, 0x52, 0xbb, 0xb0, 0x3b, 0x20, 0x1f,
+ 0x0f, 0x69, 0x44, 0xbf, 0x36, 0x60, 0x99, 0x11, 0x7a, 0x4c, 0xe8, 0xba, 0x6d, 0x53, 0xc2, 0x58,
+ 0xbd, 0xb7, 0xe1, 0x3a, 0xc4, 0x0b, 0x36, 0xb6, 0x1a, 0x98, 0x55, 0xa6, 0xc5, 0x3e, 0x7c, 0x3d,
+ 0x9d, 0x41, 0x7b, 0xe3, 0xe4, 0xd4, 0x4d, 0x65, 0xd1, 0xf2, 0x58, 0x12, 0x86, 0xef, 0x63, 0x86,
+ 0x79, 0x00, 0xa5, 0xf0, 0x20, 0x6f, 0x39, 0x2c, 0x40, 0x77, 0x61, 0xa6, 0xc5, 0x3f, 0x58, 0xc5,
+ 0x10, 0x06, 0xd6, 0xd2, 0x19, 0x18, 0xca, 0xa8, 0xcf, 0x29, 0x7b, 0x66, 0xc4, 0x27, 0xc3, 0x4a,
+ 0x9a, 0xf9, 0xb3, 0x69, 0x28, 0xae, 0xef, 0x6e, 0x61, 0xc2, 0xfc, 0x2e, 0x6d, 0x92, 0x14, 0x4e,
+ 0x73, 0x0d, 0x4a, 0xcc, 0xf1, 0x5a, 0x5d, 0xd7, 0xa2, 0x1c, 0x5a, 0x99, 0x11, 0x94, 0x4b, 0x8a,
+ 0xb2, 0xb4, 0xa7, 0xe1, 0x70, 0x82, 0x12, 0x5d, 0x05, 0xe0, 0x12, 0x58, 0xc7, 0x6a, 0x12, 0xbb,
+ 0x92, 0x59, 0x35, 0x2e, 0xe7, 0xeb, 0x48, 0xf1, 0xc1, 0xeb, 0x11, 0x06, 0x6b, 0x54, 0xe8, 0x71,
+ 0xc8, 0x09, 0x4b, 0x2b, 0x79, 0xa1, 0xa6, 0xac, 0xc8, 0x73, 0x62, 0x19, 0x58, 0xe2, 0xd0, 0x53,
+ 0x30, 0xab, 0xbc, 0xac, 0x52, 0x10, 0x64, 0xf3, 0x8a, 0x6c, 0x36, 0x74, 0x83, 0x10, 0xcf, 0xd7,
+ 0x77, 0xe4, 0x78, 0xb6, 0xf0, 0x3b, 0x6d, 0x7d, 0xaf, 0x39, 0x9e, 0x8d, 0x05, 0x06, 0xdd, 0x82,
+ 0xdc, 0x31, 0xa1, 0xfb, 0xdc, 0x13, 0xb8, 0x6b, 0x7e, 0x39, 0xdd, 0x46, 0xdf, 0xe5, 0x2c, 0xf5,
+ 0x02, 0x37, 0x4d, 0xfc, 0xc4, 0x52, 0x08, 0xaa, 0x01, 0xb0, 0x43, 0x9f, 0x06, 0x62, 0x79, 0x95,
+ 0xdc, 0x6a, 0xf6, 0x72, 0xa1, 0x3e, 0xc7, 0xd7, 0xbb, 0x17, 0x41, 0xb1, 0x46, 0xc1, 0xe9, 0x9b,
+ 0x56, 0x40, 0x5a, 0x3e, 0x75, 0x08, 0xab, 0xcc, 0xc6, 0xf4, 0x1b, 0x11, 0x14, 0x6b, 0x14, 0xe8,
+ 0x55, 0x40, 0x2c, 0xf0, 0xa9, 0xd5, 0x22, 0x6a, 0xa9, 0xaf, 0x58, 0xec, 0xb0, 0x02, 0x62, 0x75,
+ 0xcb, 0x6a, 0x75, 0x68, 0x6f, 0x88, 0x02, 0x8f, 0xe0, 0x32, 0x7f, 0x67, 0xc0, 0xbc, 0xe6, 0x0b,
+ 0xc2, 0xef, 0xae, 0x41, 0xa9, 0xa5, 0x45, 0x9d, 0xf2, 0x8b, 0xe8, 0xb4, 0xf5, 0x88, 0xc4, 0x09,
+ 0x4a, 0x44, 0xa0, 0x40, 0x95, 0xa4, 0x30, 0xbb, 0x5c, 0x49, 0xed, 0xb4, 0xa1, 0x0d, 0xb1, 0x26,
+ 0x0d, 0xc8, 0x70, 0x2c, 0xd9, 0xfc, 0x87, 0x21, 0x1c, 0x38, 0xcc, 0x37, 0xe8, 0xb2, 0x96, 0xd3,
+ 0x0c, 0xb1, 0x7d, 0xa5, 0x31, 0xf9, 0xe8, 0x9c, 0x44, 0x90, 0xf9, 0xbf, 0x48, 0x04, 0xd7, 0xf3,
+ 0xbf, 0xfc, 0xa0, 0x3a, 0xf5, 0xee, 0xdf, 0x56, 0xa7, 0xcc, 0x5f, 0x18, 0x50, 0x5a, 0xef, 0x74,
+ 0xdc, 0xde, 0x4e, 0x27, 0x10, 0x0b, 0x30, 0x61, 0xc6, 0xa6, 0x3d, 0xdc, 0xf5, 0xd4, 0x42, 0x81,
+ 0xc7, 0x77, 0x43, 0x40, 0xb0, 0xc2, 0xf0, 0xf8, 0x39, 0xf0, 0x69, 0x93, 0xa8, 0x70, 0x8b, 0xe2,
+ 0x67, 0x93, 0x03, 0xb1, 0xc4, 0xf1, 0x43, 0x3e, 0x70, 0x88, 0x6b, 0x6f, 0x5b, 0x9e, 0xd5, 0x22,
+ 0x54, 0x05, 0x47, 0xb4, 0xf5, 0x9b, 0x1a, 0x0e, 0x27, 0x28, 0xcd, 0xff, 0x64, 0xa0, 0xb0, 0xe1,
+ 0x7b, 0xb6, 0x13, 0xa8, 0xe0, 0x0a, 0x7a, 0x9d, 0xa1, 0xe4, 0x71, 0xbb, 0xd7, 0x21, 0x58, 0x60,
+ 0xd0, 0x0b, 0x30, 0xc3, 0x02, 0x2b, 0xe8, 0x32, 0x61, 0x4f, 0xa1, 0xfe, 0x58, 0x98, 0x96, 0xf6,
+ 0x04, 0xf4, 0xac, 0x5f, 0x9d, 0x8f, 0xc4, 0x49, 0x10, 0x56, 0x0c, 0xdc, 0xd3, 0xfd, 0x7d, 0xb1,
+ 0x51, 0xf6, 0x4d, 0x79, 0xed, 0x85, 0xf7, 0x47, 0x36, 0xf6, 0xf4, 0x9d, 0x21, 0x0a, 0x3c, 0x82,
+ 0x0b, 0x1d, 0x03, 0x72, 0x2d, 0x16, 0xdc, 0xa6, 0x96, 0xc7, 0x84, 0xae, 0xdb, 0x4e, 0x9b, 0xa8,
+ 0x80, 0xff, 0x52, 0xba, 0x13, 0xe7, 0x1c, 0xb1, 0xde, 0x5b, 0x43, 0xd2, 0xf0, 0x08, 0x0d, 0xe8,
+ 0x49, 0x98, 0xa1, 0xc4, 0x62, 0xbe, 0x57, 0xc9, 0x89, 0xe5, 0x47, 0x59, 0x19, 0x0b, 0x28, 0x56,
+ 0x58, 0x9e, 0xd0, 0xda, 0x84, 0x31, 0xab, 0x15, 0xa6, 0xd7, 0x28, 0xa1, 0x6d, 0x4b, 0x30, 0x0e,
+ 0xf1, 0xe6, 0x6f, 0x0d, 0x28, 0x6f, 0x50, 0x62, 0x05, 0x64, 0x12, 0xb7, 0x78, 0xe0, 0x13, 0x47,
+ 0xeb, 0x30, 0x2f, 0xbe, 0xef, 0x5a, 0xae, 0x63, 0xcb, 0x33, 0x98, 0x16, 0xcc, 0x9f, 0x57, 0xcc,
+ 0xf3, 0x9b, 0x49, 0x34, 0x1e, 0xa4, 0x37, 0x7f, 0x92, 0x85, 0x72, 0x83, 0xb8, 0x24, 0x36, 0x79,
+ 0x13, 0x50, 0x8b, 0x5a, 0x4d, 0xb2, 0x4b, 0xa8, 0xe3, 0xdb, 0x7b, 0xa4, 0xe9, 0x7b, 0x36, 0x13,
+ 0x6e, 0x94, 0xad, 0x7f, 0x8e, 0xef, 0xef, 0xcd, 0x21, 0x2c, 0x1e, 0xc1, 0x81, 0x5c, 0x28, 0x77,
+ 0xa8, 0xf8, 0x2d, 0xf6, 0x5c, 0x7a, 0x59, 0xf1, 0xea, 0x57, 0xd2, 0x1d, 0xe9, 0xae, 0xce, 0x5a,
+ 0x5f, 0x3c, 0xed, 0x57, 0xcb, 0x09, 0x10, 0x4e, 0x0a, 0x47, 0xdf, 0x80, 0x05, 0x9f, 0x76, 0x0e,
+ 0x2d, 0xaf, 0x41, 0x3a, 0xc4, 0xb3, 0x89, 0x17, 0x30, 0xb1, 0x91, 0xf9, 0xfa, 0x12, 0xaf, 0x45,
+ 0x76, 0x06, 0x70, 0x78, 0x88, 0x1a, 0xbd, 0x01, 0x8b, 0x1d, 0xea, 0x77, 0xac, 0x96, 0xd8, 0x98,
+ 0x5d, 0xdf, 0x75, 0x9a, 0x3d, 0xb5, 0x9d, 0x4f, 0x9f, 0xf6, 0xab, 0x8b, 0xbb, 0x83, 0xc8, 0xb3,
+ 0x7e, 0xf5, 0x82, 0xd8, 0x3a, 0x0e, 0x89, 0x91, 0x78, 0x58, 0x8c, 0xe6, 0x06, 0xb9, 0x71, 0x6e,
+ 0x60, 0x6e, 0x41, 0xbe, 0xd1, 0x55, 0x31, 0xf1, 0x12, 0xe4, 0x6d, 0xf5, 0x5b, 0xed, 0x7c, 0x18,
+ 0x9c, 0x11, 0xcd, 0x59, 0xbf, 0x5a, 0xe6, 0xe5, 0x67, 0x2d, 0x04, 0xe0, 0x88, 0xc5, 0xfc, 0x8d,
+ 0x01, 0x15, 0x71, 0xf2, 0x7b, 0xc4, 0x25, 0xcd, 0xc0, 0xa7, 0x98, 0xbc, 0xdd, 0x75, 0x28, 0x69,
+ 0x13, 0x2f, 0x40, 0x5f, 0x84, 0xec, 0x11, 0xe9, 0xa9, 0xbc, 0x50, 0x54, 0x62, 0xb3, 0xaf, 0x91,
+ 0x1e, 0xe6, 0x70, 0x74, 0x03, 0xf2, 0x7e, 0x87, 0xc7, 0xa6, 0x4f, 0x55, 0x5e, 0x78, 0x2a, 0x54,
+ 0xbd, 0xa3, 0xe0, 0x67, 0xfd, 0xea, 0xc5, 0x84, 0xf8, 0x10, 0x81, 0x23, 0x56, 0xbe, 0xe2, 0x63,
+ 0xcb, 0xed, 0x12, 0x7e, 0x0a, 0xd1, 0x8a, 0xef, 0x0a, 0x08, 0x56, 0x18, 0xf3, 0x49, 0xc8, 0x0b,
+ 0x31, 0xec, 0xee, 0x15, 0xb4, 0x00, 0x59, 0x6c, 0x9d, 0x08, 0xab, 0x4a, 0x98, 0xff, 0xd4, 0x92,
+ 0xed, 0x0e, 0xc0, 0x4d, 0x12, 0x84, 0xfe, 0xb9, 0x0e, 0xf3, 0xe1, 0x8d, 0x93, 0xbc, 0x08, 0x23,
+ 0xa7, 0xc7, 0x49, 0x34, 0x1e, 0xa4, 0x37, 0xdf, 0x84, 0x82, 0xb8, 0x2c, 0x79, 0xa5, 0x11, 0x57,
+ 0x35, 0xc6, 0x7d, 0xaa, 0x9a, 0xb0, 0x54, 0xc9, 0x8c, 0x2b, 0x55, 0x34, 0x73, 0x5d, 0x28, 0x4b,
+ 0xde, 0xb0, 0x8e, 0x4b, 0xa5, 0xe1, 0x69, 0xc8, 0x87, 0x66, 0x2a, 0x2d, 0x51, 0xfd, 0x1e, 0x0a,
+ 0xc2, 0x11, 0x85, 0xa6, 0xed, 0x10, 0x12, 0x17, 0x7f, 0x3a, 0x65, 0x5a, 0x91, 0x96, 0xb9, 0x7f,
+ 0x91, 0xa6, 0x69, 0xfa, 0x21, 0x54, 0xc6, 0x15, 0xfd, 0x0f, 0x51, 0x9a, 0xa4, 0x37, 0xc5, 0x7c,
+ 0xcf, 0x80, 0x05, 0x5d, 0x52, 0xfa, 0xe3, 0x4b, 0xaf, 0xe4, 0xfc, 0xa2, 0x54, 0xdb, 0x91, 0x5f,
+ 0x19, 0xb0, 0x94, 0x58, 0xda, 0x44, 0x27, 0x3e, 0x81, 0x51, 0xba, 0x73, 0x64, 0x27, 0x70, 0x8e,
+ 0xbf, 0x64, 0xa0, 0x7c, 0xcb, 0xda, 0x27, 0x6e, 0x18, 0xa9, 0xe8, 0x07, 0x50, 0x6c, 0x5b, 0x41,
+ 0xf3, 0x50, 0x40, 0xc3, 0x06, 0xa6, 0x91, 0x2e, 0x27, 0x27, 0x24, 0xd5, 0xb6, 0x63, 0x31, 0x37,
+ 0xbc, 0x80, 0xf6, 0xea, 0x17, 0x94, 0x49, 0x45, 0x0d, 0x83, 0x75, 0x6d, 0xa2, 0xeb, 0x14, 0xdf,
+ 0x37, 0xde, 0xe9, 0xf0, 0xea, 0x6a, 0xf2, 0x66, 0x37, 0x61, 0x82, 0x96, 0xd5, 0xe2, 0xae, 0x73,
+ 0x7b, 0x40, 0x3e, 0x1e, 0xd2, 0xb8, 0xfc, 0x32, 0x2c, 0x0c, 0x1a, 0xcf, 0xf3, 0x4f, 0x94, 0x15,
+ 0x65, 0x22, 0x5c, 0x82, 0x9c, 0xc8, 0x53, 0xf2, 0x70, 0xb0, 0xfc, 0xb8, 0x9e, 0xb9, 0x66, 0x88,
+ 0xf4, 0x3a, 0xce, 0x90, 0x47, 0x94, 0x5e, 0x13, 0xe2, 0x1f, 0x30, 0xbd, 0xfe, 0xde, 0x80, 0x69,
+ 0xd1, 0x37, 0xbc, 0x09, 0x79, 0xbe, 0x7f, 0xb6, 0x15, 0x58, 0xc2, 0xae, 0xd4, 0x1d, 0x2b, 0xe7,
+ 0xde, 0x26, 0x81, 0x15, 0x7b, 0x5b, 0x08, 0xc1, 0x91, 0x44, 0x84, 0x21, 0xe7, 0x04, 0xa4, 0x1d,
+ 0x1e, 0xe4, 0x33, 0x63, 0x45, 0xab, 0x79, 0x49, 0x0d, 0x5b, 0x27, 0x37, 0xde, 0x09, 0x88, 0xc7,
+ 0x0f, 0x23, 0x0e, 0x8d, 0x2d, 0x2e, 0x03, 0x4b, 0x51, 0xe6, 0xbf, 0x0c, 0x88, 0x54, 0x71, 0xe7,
+ 0x67, 0xc4, 0x3d, 0xb8, 0xe5, 0x78, 0x47, 0x6a, 0x5b, 0x23, 0x73, 0xf6, 0x14, 0x1c, 0x47, 0x14,
+ 0xa3, 0xae, 0x87, 0xcc, 0x64, 0xd7, 0x03, 0x57, 0xd8, 0xf4, 0xbd, 0xc0, 0xf1, 0xba, 0x43, 0xd1,
+ 0xb6, 0xa1, 0xe0, 0x38, 0xa2, 0xe0, 0xf5, 0x12, 0x25, 0x6d, 0xcb, 0xf1, 0x1c, 0xaf, 0xc5, 0x17,
+ 0xb1, 0xe1, 0x77, 0xbd, 0x40, 0x14, 0x0e, 0xaa, 0x5e, 0xc2, 0x43, 0x58, 0x3c, 0x82, 0xc3, 0xfc,
+ 0xf7, 0x34, 0x14, 0xf9, 0x9a, 0xc3, 0x7b, 0xee, 0x45, 0x28, 0xbb, 0xba, 0x17, 0xa8, 0xb5, 0x5f,
+ 0x54, 0xa6, 0x24, 0xe3, 0x1a, 0x27, 0x69, 0x39, 0xf3, 0x81, 0x7e, 0x43, 0xab, 0x3d, 0x88, 0x98,
+ 0x93, 0xd5, 0x41, 0x92, 0x96, 0x67, 0xaf, 0x13, 0x1e, 0x1f, 0xaa, 0x80, 0x8a, 0x8e, 0xe8, 0x9b,
+ 0x1c, 0x88, 0x25, 0x0e, 0x6d, 0xc3, 0x05, 0xcb, 0x75, 0xfd, 0x13, 0x01, 0xac, 0xfb, 0xfe, 0x51,
+ 0xdb, 0xa2, 0x47, 0x4c, 0xf4, 0xfc, 0xf9, 0xfa, 0x17, 0x14, 0xcb, 0x85, 0xf5, 0x61, 0x12, 0x3c,
+ 0x8a, 0x6f, 0xd4, 0xb1, 0x4d, 0x4f, 0x78, 0x6c, 0x87, 0xb0, 0x34, 0x00, 0x12, 0x51, 0xae, 0x1a,
+ 0xf0, 0xe7, 0x94, 0x9c, 0x25, 0x3c, 0x82, 0xe6, 0x6c, 0x0c, 0x1c, 0x8f, 0x94, 0x88, 0xae, 0xc3,
+ 0x1c, 0xf7, 0x64, 0xbf, 0x1b, 0x84, 0xe5, 0x71, 0x4e, 0x1c, 0x37, 0x3a, 0xed, 0x57, 0xe7, 0x6e,
+ 0x27, 0x30, 0x78, 0x80, 0x92, 0x6f, 0xae, 0xeb, 0xb4, 0x9d, 0xa0, 0x32, 0x2b, 0x58, 0xa2, 0xcd,
+ 0xbd, 0xc5, 0x81, 0x58, 0xe2, 0x12, 0x1e, 0x98, 0x3f, 0xd7, 0x03, 0x37, 0x60, 0x91, 0x11, 0xcf,
+ 0xde, 0xf2, 0x9c, 0xc0, 0xb1, 0xdc, 0x1b, 0xc7, 0xa2, 0xf8, 0x2d, 0x8a, 0x83, 0xb8, 0xc8, 0x2b,
+ 0xd7, 0xbd, 0x41, 0x24, 0x1e, 0xa6, 0x37, 0xff, 0x9c, 0x05, 0x24, 0xfb, 0x0a, 0x5b, 0x16, 0x65,
+ 0x32, 0x2f, 0xf2, 0xee, 0x47, 0xf5, 0x25, 0xc6, 0x40, 0xf7, 0xa3, 0x5a, 0x92, 0x10, 0x8f, 0xb6,
+ 0xa1, 0x20, 0xf3, 0x53, 0x1c, 0x73, 0x6b, 0x8a, 0xb8, 0xb0, 0x13, 0x22, 0xce, 0xfa, 0xd5, 0xe5,
+ 0x84, 0x9a, 0x08, 0x23, 0x3a, 0xd3, 0x58, 0x02, 0xba, 0x0a, 0x60, 0x75, 0x1c, 0x7d, 0x36, 0x59,
+ 0x88, 0x27, 0x54, 0xf1, 0x94, 0x01, 0x6b, 0x54, 0xe8, 0x15, 0x98, 0x0e, 0x1e, 0xac, 0x7b, 0xcc,
+ 0x8b, 0xe6, 0x98, 0xf7, 0x8a, 0x42, 0x02, 0xd7, 0x2e, 0x82, 0x82, 0x71, 0xb3, 0x54, 0xe3, 0x17,
+ 0x69, 0xdf, 0x8c, 0x30, 0x58, 0xa3, 0x42, 0xdf, 0x82, 0xfc, 0x81, 0xaa, 0x67, 0xc5, 0xe9, 0xa6,
+ 0xce, 0xb3, 0x61, 0x15, 0x2c, 0xc7, 0x23, 0xe1, 0x17, 0x8e, 0xa4, 0xa1, 0xaf, 0x42, 0x91, 0x75,
+ 0xf7, 0xa3, 0x12, 0x40, 0xba, 0x44, 0x74, 0xdf, 0xee, 0xc5, 0x28, 0xac, 0xd3, 0x99, 0x6f, 0x43,
+ 0x61, 0xdb, 0x69, 0x52, 0x5f, 0xf4, 0xbb, 0x4f, 0xc1, 0x2c, 0x4b, 0x34, 0x73, 0xd1, 0x49, 0x86,
+ 0xae, 0x1a, 0xe2, 0xb9, 0x8f, 0x7a, 0x96, 0xe7, 0xcb, 0x96, 0x2d, 0x17, 0xfb, 0xe8, 0xeb, 0x1c,
+ 0x88, 0x25, 0xee, 0xfa, 0x12, 0xaf, 0x32, 0x7e, 0xfa, 0x61, 0x75, 0xea, 0xfd, 0x0f, 0xab, 0x53,
+ 0x1f, 0x7c, 0xa8, 0x2a, 0x8e, 0x3f, 0x00, 0xc0, 0xce, 0xfe, 0xf7, 0x48, 0x53, 0xe6, 0xee, 0x54,
+ 0x23, 0xcc, 0x70, 0x72, 0x2e, 0x46, 0x98, 0x99, 0x81, 0xca, 0x51, 0xc3, 0xe1, 0x04, 0x25, 0x5a,
+ 0x83, 0x42, 0x34, 0x9c, 0x54, 0xfe, 0xb1, 0x18, 0xfa, 0x5b, 0x34, 0xc1, 0xc4, 0x31, 0x4d, 0xe2,
+ 0x22, 0x99, 0x3e, 0xf7, 0x22, 0xa9, 0x43, 0xb6, 0xeb, 0xd8, 0x6a, 0x38, 0xf0, 0x6c, 0x78, 0x91,
+ 0xdf, 0xd9, 0x6a, 0x9c, 0xf5, 0xab, 0x8f, 0x8d, 0x7b, 0x13, 0x08, 0x7a, 0x1d, 0xc2, 0x6a, 0x77,
+ 0xb6, 0x1a, 0x98, 0x33, 0x8f, 0xca, 0x6a, 0x33, 0x13, 0x66, 0xb5, 0xab, 0x00, 0xad, 0x78, 0xc4,
+ 0x22, 0x93, 0x46, 0xe4, 0x88, 0xda, 0x68, 0x45, 0xa3, 0x42, 0x0c, 0x16, 0x9b, 0x94, 0x58, 0xe1,
+ 0xa8, 0x83, 0x05, 0x56, 0x5b, 0x0e, 0x6d, 0x27, 0x8b, 0x89, 0x4b, 0x4a, 0xcd, 0xe2, 0xc6, 0xa0,
+ 0x30, 0x3c, 0x2c, 0x1f, 0xf9, 0xb0, 0x68, 0xab, 0x6e, 0x38, 0x56, 0x5a, 0x98, 0x58, 0xa9, 0xc8,
+ 0x58, 0x8d, 0x41, 0x41, 0x78, 0x58, 0x36, 0xfa, 0x2e, 0x2c, 0x87, 0xc0, 0xe1, 0x91, 0x84, 0xc8,
+ 0xfa, 0xd9, 0xfa, 0xca, 0x69, 0xbf, 0xba, 0xdc, 0x18, 0x4b, 0x85, 0xef, 0x23, 0x01, 0xd9, 0x30,
+ 0xe3, 0xca, 0x2a, 0xb9, 0x28, 0x2a, 0x9b, 0xaf, 0xa5, 0x5b, 0x45, 0xec, 0xfd, 0x35, 0xbd, 0x3a,
+ 0x8e, 0xc6, 0x4b, 0xaa, 0x30, 0x56, 0xb2, 0xd1, 0x3b, 0x50, 0xb4, 0x3c, 0xcf, 0x0f, 0x2c, 0x39,
+ 0x24, 0x29, 0x09, 0x55, 0xeb, 0x13, 0xab, 0x5a, 0x8f, 0x65, 0x0c, 0x54, 0xe3, 0x1a, 0x06, 0xeb,
+ 0xaa, 0xd0, 0x09, 0xcc, 0xfb, 0x27, 0x1e, 0xa1, 0x98, 0x1c, 0x10, 0x4a, 0xbc, 0x26, 0x61, 0x95,
+ 0xb2, 0xd0, 0xfe, 0x5c, 0x4a, 0xed, 0x09, 0xe6, 0xd8, 0xa5, 0x93, 0x70, 0x86, 0x07, 0xb5, 0xa0,
+ 0x1a, 0xcf, 0xad, 0x9e, 0xe5, 0x3a, 0xdf, 0x27, 0x94, 0x55, 0xe6, 0xe2, 0xb9, 0xfa, 0x66, 0x04,
+ 0xc5, 0x1a, 0x05, 0xea, 0x42, 0xb9, 0xad, 0x5f, 0x19, 0x95, 0x45, 0x61, 0xe6, 0xb5, 0x74, 0x66,
+ 0x0e, 0x5f, 0x6a, 0x71, 0x19, 0x94, 0xc0, 0xe1, 0xa4, 0x96, 0xe5, 0x17, 0xa0, 0xf8, 0x80, 0x1d,
+ 0x02, 0xef, 0x30, 0x06, 0x0f, 0x64, 0xa2, 0x0e, 0xe3, 0x8f, 0x19, 0x98, 0x4b, 0x6e, 0xe3, 0xc0,
+ 0x75, 0x98, 0x4b, 0x75, 0x1d, 0x86, 0xbd, 0xac, 0x31, 0xf6, 0x81, 0x25, 0xcc, 0xcf, 0xd9, 0xb1,
+ 0xf9, 0x59, 0xa5, 0xc1, 0xe9, 0x87, 0x49, 0x83, 0x35, 0x00, 0x5e, 0xac, 0x50, 0xdf, 0x75, 0x09,
+ 0x15, 0x19, 0x30, 0xaf, 0x1e, 0x52, 0x22, 0x28, 0xd6, 0x28, 0x78, 0x49, 0xbd, 0xef, 0xfa, 0xcd,
+ 0x23, 0xb1, 0x05, 0x61, 0xf4, 0x8a, 0xdc, 0x97, 0x97, 0x25, 0x75, 0x7d, 0x08, 0x8b, 0x47, 0x70,
+ 0x98, 0x3d, 0xb8, 0xb8, 0x6b, 0x51, 0x5e, 0xe4, 0xc4, 0x91, 0x22, 0x7a, 0x96, 0xb7, 0x86, 0x3a,
+ 0xa2, 0x67, 0x27, 0x8d, 0xb8, 0x78, 0xf3, 0x63, 0x58, 0xdc, 0x15, 0x99, 0x7f, 0x35, 0xe0, 0xd2,
+ 0x48, 0xdd, 0x9f, 0x41, 0x47, 0xf6, 0x56, 0xb2, 0x23, 0x7b, 0x31, 0xe5, 0xc4, 0x75, 0x94, 0xb5,
+ 0x63, 0xfa, 0xb3, 0x59, 0xc8, 0xed, 0xf2, 0x4a, 0xd8, 0xfc, 0xd8, 0x80, 0x92, 0xf8, 0x35, 0xc9,
+ 0xc0, 0xbb, 0x9a, 0x7c, 0x07, 0x29, 0x3c, 0xba, 0x37, 0x90, 0x47, 0x31, 0x11, 0x7f, 0xcf, 0x80,
+ 0xe4, 0xa8, 0x19, 0xbd, 0x2c, 0x43, 0xc0, 0x88, 0x66, 0xc1, 0x13, 0xba, 0xff, 0x4b, 0xe3, 0x5a,
+ 0xd2, 0x0b, 0xa9, 0xa6, 0x95, 0x4f, 0x43, 0x01, 0xfb, 0x7e, 0xb0, 0x6b, 0x05, 0x87, 0x8c, 0xef,
+ 0x5d, 0x87, 0xff, 0x50, 0xdb, 0x2b, 0xf6, 0x4e, 0x60, 0xb0, 0x84, 0x9b, 0x3f, 0x37, 0xe0, 0xd2,
+ 0xd8, 0xe7, 0x2d, 0x9e, 0x45, 0x9a, 0xd1, 0x97, 0x5a, 0x51, 0xe4, 0xc8, 0x31, 0x1d, 0xd6, 0xa8,
+ 0x78, 0x2f, 0x99, 0x78, 0x13, 0x1b, 0xec, 0x25, 0x13, 0xda, 0x70, 0x92, 0xd6, 0xfc, 0x67, 0x06,
+ 0xd4, 0x7b, 0xd2, 0xff, 0xd8, 0xe9, 0x9f, 0x1c, 0x78, 0xcd, 0x9a, 0x4b, 0xbe, 0x66, 0x45, 0x4f,
+ 0x57, 0xda, 0x73, 0x4e, 0xf6, 0xfe, 0xcf, 0x39, 0xe8, 0xf9, 0xe8, 0x85, 0x48, 0xfa, 0xd0, 0x4a,
+ 0xf2, 0x85, 0xe8, 0xac, 0x5f, 0x2d, 0x29, 0xe1, 0xc9, 0x17, 0xa3, 0x37, 0x60, 0xd6, 0x26, 0x81,
+ 0xe5, 0xb8, 0xb2, 0x2f, 0x4c, 0xfd, 0xe6, 0x21, 0x85, 0x35, 0x24, 0x6b, 0xbd, 0xc8, 0x6d, 0x52,
+ 0x1f, 0x38, 0x14, 0xc8, 0x13, 0x76, 0xd3, 0xb7, 0x65, 0x47, 0x92, 0x8b, 0x13, 0xf6, 0x86, 0x6f,
+ 0x13, 0x2c, 0x30, 0xe6, 0xfb, 0x06, 0x14, 0xa5, 0xa4, 0x0d, 0xab, 0xcb, 0x08, 0xba, 0x12, 0xad,
+ 0x42, 0x1e, 0xf7, 0x25, 0xfd, 0x29, 0xf0, 0xac, 0x5f, 0x2d, 0x08, 0x32, 0xd1, 0xcc, 0x8c, 0x78,
+ 0xf2, 0xca, 0x9c, 0xb3, 0x47, 0x8f, 0x43, 0x4e, 0x04, 0x90, 0xda, 0xcc, 0xf8, 0x4d, 0x93, 0x03,
+ 0xb1, 0xc4, 0x99, 0x9f, 0x66, 0xa0, 0x9c, 0x58, 0x5c, 0x8a, 0xbe, 0x20, 0x1a, 0xa1, 0x66, 0x52,
+ 0x8c, 0xe5, 0xc7, 0xff, 0x83, 0x40, 0x5d, 0x5f, 0x33, 0x0f, 0x73, 0x7d, 0x7d, 0x1b, 0x66, 0x9a,
+ 0x7c, 0x8f, 0xc2, 0x3f, 0xa4, 0x5c, 0x99, 0xe4, 0x38, 0xc5, 0xee, 0xc6, 0xde, 0x28, 0x3e, 0x19,
+ 0x56, 0x02, 0xd1, 0x4d, 0x58, 0xa4, 0x24, 0xa0, 0xbd, 0xf5, 0x83, 0x80, 0x50, 0x7d, 0x98, 0x90,
+ 0x8b, 0xab, 0x6f, 0x3c, 0x48, 0x80, 0x87, 0x79, 0xcc, 0x7d, 0x28, 0xdd, 0xb6, 0xf6, 0xdd, 0xe8,
+ 0x15, 0x0f, 0x43, 0xd9, 0xf1, 0x9a, 0x6e, 0xd7, 0x26, 0x32, 0xa1, 0x87, 0xd9, 0x2b, 0x0c, 0xda,
+ 0x2d, 0x1d, 0x79, 0xd6, 0xaf, 0x5e, 0x48, 0x00, 0xe4, 0xb3, 0x15, 0x4e, 0x8a, 0x30, 0x5d, 0x98,
+ 0xfe, 0x0c, 0x3b, 0xc9, 0xef, 0x40, 0x21, 0xae, 0xf5, 0x1f, 0xb1, 0x4a, 0xf3, 0x2d, 0xc8, 0x73,
+ 0x8f, 0x0f, 0x7b, 0xd4, 0x73, 0xaa, 0xa4, 0x64, 0xed, 0x95, 0x49, 0x53, 0x7b, 0x89, 0xb7, 0xe0,
+ 0x3b, 0x1d, 0xfb, 0x21, 0xdf, 0x82, 0x33, 0x0f, 0x73, 0xf3, 0x65, 0x27, 0xbc, 0xf9, 0xae, 0x82,
+ 0xfc, 0xbf, 0x0c, 0xbf, 0x64, 0x64, 0x01, 0xa1, 0x5d, 0x32, 0xfa, 0xfd, 0xaf, 0xbd, 0x30, 0xfc,
+ 0xd8, 0x00, 0x10, 0xa3, 0x3c, 0x31, 0x46, 0x4a, 0xf1, 0xaf, 0x83, 0x3b, 0x30, 0xe3, 0x4b, 0x8f,
+ 0x94, 0xef, 0xc1, 0x13, 0xce, 0x8b, 0xa3, 0x40, 0x92, 0x3e, 0x89, 0x95, 0xb0, 0xfa, 0xab, 0x1f,
+ 0xdd, 0x5b, 0x99, 0xfa, 0xf8, 0xde, 0xca, 0xd4, 0x27, 0xf7, 0x56, 0xa6, 0xde, 0x3d, 0x5d, 0x31,
+ 0x3e, 0x3a, 0x5d, 0x31, 0x3e, 0x3e, 0x5d, 0x31, 0x3e, 0x39, 0x5d, 0x31, 0x3e, 0x3d, 0x5d, 0x31,
+ 0xde, 0xff, 0xfb, 0xca, 0xd4, 0x1b, 0x4f, 0xa4, 0xf9, 0x1f, 0xe2, 0x7f, 0x03, 0x00, 0x00, 0xff,
+ 0xff, 0xd3, 0xee, 0xe4, 0x1c, 0xae, 0x28, 0x00, 0x00,
}
func (m *APIGroup) Marshal() (dAtA []byte, err error) {
@@ -2025,6 +2055,48 @@ func (m *Duration) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
+func (m *FieldSelectorRequirement) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
+ }
+ return dAtA[:n], nil
+}
+
+func (m *FieldSelectorRequirement) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *FieldSelectorRequirement) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if len(m.Values) > 0 {
+ for iNdEx := len(m.Values) - 1; iNdEx >= 0; iNdEx-- {
+ i -= len(m.Values[iNdEx])
+ copy(dAtA[i:], m.Values[iNdEx])
+ i = encodeVarintGenerated(dAtA, i, uint64(len(m.Values[iNdEx])))
+ i--
+ dAtA[i] = 0x1a
+ }
+ }
+ i -= len(m.Operator)
+ copy(dAtA[i:], m.Operator)
+ i = encodeVarintGenerated(dAtA, i, uint64(len(m.Operator)))
+ i--
+ dAtA[i] = 0x12
+ i -= len(m.Key)
+ copy(dAtA[i:], m.Key)
+ i = encodeVarintGenerated(dAtA, i, uint64(len(m.Key)))
+ i--
+ dAtA[i] = 0xa
+ return len(dAtA) - i, nil
+}
+
func (m *FieldsV1) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@@ -2504,6 +2576,16 @@ func (m *ListOptions) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
+ if m.SendInitialEvents != nil {
+ i--
+ if *m.SendInitialEvents {
+ dAtA[i] = 1
+ } else {
+ dAtA[i] = 0
+ }
+ i--
+ dAtA[i] = 0x58
+ }
i -= len(m.ResourceVersionMatch)
copy(dAtA[i:], m.ResourceVersionMatch)
i = encodeVarintGenerated(dAtA, i, uint64(len(m.ResourceVersionMatch)))
@@ -2664,11 +2746,6 @@ func (m *ObjectMeta) MarshalToSizedBuffer(dAtA []byte) (int, error) {
dAtA[i] = 0x8a
}
}
- i -= len(m.ClusterName)
- copy(dAtA[i:], m.ClusterName)
- i = encodeVarintGenerated(dAtA, i, uint64(len(m.ClusterName)))
- i--
- dAtA[i] = 0x7a
if len(m.Finalizers) > 0 {
for iNdEx := len(m.Finalizers) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Finalizers[iNdEx])
@@ -3709,6 +3786,25 @@ func (m *Duration) Size() (n int) {
return n
}
+func (m *FieldSelectorRequirement) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = len(m.Key)
+ n += 1 + l + sovGenerated(uint64(l))
+ l = len(m.Operator)
+ n += 1 + l + sovGenerated(uint64(l))
+ if len(m.Values) > 0 {
+ for _, s := range m.Values {
+ l = len(s)
+ n += 1 + l + sovGenerated(uint64(l))
+ }
+ }
+ return n
+}
+
func (m *FieldsV1) Size() (n int) {
if m == nil {
return 0
@@ -3914,6 +4010,9 @@ func (m *ListOptions) Size() (n int) {
n += 2
l = len(m.ResourceVersionMatch)
n += 1 + l + sovGenerated(uint64(l))
+ if m.SendInitialEvents != nil {
+ n += 2
+ }
return n
}
@@ -4000,8 +4099,6 @@ func (m *ObjectMeta) Size() (n int) {
n += 1 + l + sovGenerated(uint64(l))
}
}
- l = len(m.ClusterName)
- n += 1 + l + sovGenerated(uint64(l))
if len(m.ManagedFields) > 0 {
for _, e := range m.ManagedFields {
l = e.Size()
@@ -4423,6 +4520,18 @@ func (this *Duration) String() string {
}, "")
return s
}
+func (this *FieldSelectorRequirement) String() string {
+ if this == nil {
+ return "nil"
+ }
+ s := strings.Join([]string{`&FieldSelectorRequirement{`,
+ `Key:` + fmt.Sprintf("%v", this.Key) + `,`,
+ `Operator:` + fmt.Sprintf("%v", this.Operator) + `,`,
+ `Values:` + fmt.Sprintf("%v", this.Values) + `,`,
+ `}`,
+ }, "")
+ return s
+}
func (this *GetOptions) String() string {
if this == nil {
return "nil"
@@ -4525,6 +4634,7 @@ func (this *ListOptions) String() string {
`Continue:` + fmt.Sprintf("%v", this.Continue) + `,`,
`AllowWatchBookmarks:` + fmt.Sprintf("%v", this.AllowWatchBookmarks) + `,`,
`ResourceVersionMatch:` + fmt.Sprintf("%v", this.ResourceVersionMatch) + `,`,
+ `SendInitialEvents:` + valueToStringGenerated(this.SendInitialEvents) + `,`,
`}`,
}, "")
return s
@@ -4594,7 +4704,6 @@ func (this *ObjectMeta) String() string {
`Annotations:` + mapStringForAnnotations + `,`,
`OwnerReferences:` + repeatedStringForOwnerReferences + `,`,
`Finalizers:` + fmt.Sprintf("%v", this.Finalizers) + `,`,
- `ClusterName:` + fmt.Sprintf("%v", this.ClusterName) + `,`,
`ManagedFields:` + repeatedStringForManagedFields + `,`,
`}`,
}, "")
@@ -6437,6 +6546,152 @@ func (m *Duration) Unmarshal(dAtA []byte) error {
}
return nil
}
+func (m *FieldSelectorRequirement) Unmarshal(dAtA []byte) error {
+ l := len(dAtA)
+ iNdEx := 0
+ for iNdEx < l {
+ preIndex := iNdEx
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenerated
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ fieldNum := int32(wire >> 3)
+ wireType := int(wire & 0x7)
+ if wireType == 4 {
+ return fmt.Errorf("proto: FieldSelectorRequirement: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: FieldSelectorRequirement: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenerated
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthGenerated
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthGenerated
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Key = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 2:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Operator", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenerated
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthGenerated
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthGenerated
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Operator = FieldSelectorOperator(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 3:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenerated
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthGenerated
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthGenerated
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Values = append(m.Values, string(dAtA[iNdEx:postIndex]))
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipGenerated(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthGenerated
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
func (m *FieldsV1) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
@@ -8259,6 +8514,27 @@ func (m *ListOptions) Unmarshal(dAtA []byte) error {
}
m.ResourceVersionMatch = ResourceVersionMatch(dAtA[iNdEx:postIndex])
iNdEx = postIndex
+ case 11:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field SendInitialEvents", wireType)
+ }
+ var v int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenerated
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ v |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ b := bool(v != 0)
+ m.SendInitialEvents = &b
default:
iNdEx = preIndex
skippy, err := skipGenerated(dAtA[iNdEx:])
@@ -9211,38 +9487,6 @@ func (m *ObjectMeta) Unmarshal(dAtA []byte) error {
}
m.Finalizers = append(m.Finalizers, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
- case 15:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field ClusterName", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- stringLen |= uint64(b&0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthGenerated
- }
- postIndex := iNdEx + intStringLen
- if postIndex < 0 {
- return ErrInvalidLengthGenerated
- }
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.ClusterName = string(dAtA[iNdEx:postIndex])
- iNdEx = postIndex
case 17:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ManagedFields", wireType)
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto
index da8f61447..18dd0b067 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto
@@ -25,7 +25,7 @@ import "k8s.io/apimachinery/pkg/runtime/generated.proto";
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
// Package-wide variables from generator "generated".
-option go_package = "v1";
+option go_package = "k8s.io/apimachinery/pkg/apis/meta/v1";
// APIGroup contains the name, the supported versions, and the preferred version
// of a group.
@@ -34,6 +34,7 @@ message APIGroup {
optional string name = 1;
// versions are the versions supported in this group.
+ // +listType=atomic
repeated GroupVersionForDiscovery versions = 2;
// preferredVersion is the version preferred by the API server, which
@@ -49,6 +50,7 @@ message APIGroup {
// For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP.
// Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.
// +optional
+ // +listType=atomic
repeated ServerAddressByClientCIDR serverAddressByClientCIDRs = 4;
}
@@ -56,6 +58,7 @@ message APIGroup {
// /apis.
message APIGroupList {
// groups is a list of APIGroup.
+ // +listType=atomic
repeated APIGroup groups = 1;
}
@@ -88,9 +91,11 @@ message APIResource {
optional Verbs verbs = 4;
// shortNames is a list of suggested short names of the resource.
+ // +listType=atomic
repeated string shortNames = 5;
// categories is a list of the grouped resources this resource belongs to (e.g. 'all')
+ // +listType=atomic
repeated string categories = 7;
// The hash value of the storage version, the version this resource is
@@ -112,6 +117,7 @@ message APIResourceList {
optional string groupVersion = 1;
// resources contains the name of the resources and if they are namespaced.
+ // +listType=atomic
repeated APIResource resources = 2;
}
@@ -122,6 +128,7 @@ message APIResourceList {
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
message APIVersions {
// versions are the api versions that are available.
+ // +listType=atomic
repeated string versions = 1;
// a map of client CIDR to server address that is serving this group.
@@ -131,6 +138,7 @@ message APIVersions {
// The server returns only those CIDRs that it thinks that the client can match.
// For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP.
// Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.
+ // +listType=atomic
repeated ServerAddressByClientCIDR serverAddressByClientCIDRs = 2;
}
@@ -145,6 +153,7 @@ message ApplyOptions {
// request. Valid values are:
// - All: all dry run stages will be processed
// +optional
+ // +listType=atomic
repeated string dryRun = 1;
// Force is going to "force" Apply requests. It means user will
@@ -235,6 +244,7 @@ message CreateOptions {
// request. Valid values are:
// - All: all dry run stages will be processed
// +optional
+ // +listType=atomic
repeated string dryRun = 1;
// fieldManager is a name associated with the actor or entity
@@ -244,16 +254,22 @@ message CreateOptions {
// +optional
optional string fieldManager = 3;
- // fieldValidation determines how the server should respond to
- // unknown/duplicate fields in the object in the request.
- // Introduced as alpha in 1.23, older servers or servers with the
- // `ServerSideFieldValidation` feature disabled will discard valid values
- // specified in this param and not perform any server side field validation.
- // Valid values are:
- // - Ignore: ignores unknown/duplicate fields.
- // - Warn: responds with a warning for each
- // unknown/duplicate field, but successfully serves the request.
- // - Strict: fails the request on unknown/duplicate fields.
+ // fieldValidation instructs the server on how to handle
+ // objects in the request (POST/PUT/PATCH) containing unknown
+ // or duplicate fields. Valid values are:
+ // - Ignore: This will ignore any unknown fields that are silently
+ // dropped from the object, and will ignore all but the last duplicate
+ // field that the decoder encounters. This is the default behavior
+ // prior to v1.23.
+ // - Warn: This will send a warning via the standard warning response
+ // header for each unknown field that is dropped from the object, and
+ // for each duplicate field that is encountered. The request will
+ // still succeed if there are no other errors, and will only persist
+ // the last of any duplicate fields. This is the default in v1.23+
+ // - Strict: This will fail the request with a BadRequest error if
+ // any unknown fields would be dropped from the object, or if any
+ // duplicate fields are present. The error returned from the server
+ // will contain all unknown and duplicate fields encountered.
// +optional
optional string fieldValidation = 4;
}
@@ -297,6 +313,7 @@ message DeleteOptions {
// request. Valid values are:
// - All: all dry run stages will be processed
// +optional
+ // +listType=atomic
repeated string dryRun = 5;
}
@@ -307,6 +324,25 @@ message Duration {
optional int64 duration = 1;
}
+// FieldSelectorRequirement is a selector that contains values, a key, and an operator that
+// relates the key and values.
+message FieldSelectorRequirement {
+ // key is the field selector key that the requirement applies to.
+ optional string key = 1;
+
+ // operator represents a key's relationship to a set of values.
+ // Valid operators are In, NotIn, Exists, DoesNotExist.
+ // The list of operators may grow in the future.
+ optional string operator = 2;
+
+ // values is an array of string values.
+ // If the operator is In or NotIn, the values array must be non-empty.
+ // If the operator is Exists or DoesNotExist, the values array must be empty.
+ // +optional
+ // +listType=atomic
+ repeated string values = 3;
+}
+
// FieldsV1 stores a set of fields in a data structure like a Trie, in JSON format.
//
// Each key is either a '.' representing the field itself, and will always map to an empty set,
@@ -412,6 +448,7 @@ message LabelSelector {
// matchExpressions is a list of label selector requirements. The requirements are ANDed.
// +optional
+ // +listType=atomic
repeated LabelSelectorRequirement matchExpressions = 2;
}
@@ -419,8 +456,6 @@ message LabelSelector {
// relates the key and values.
message LabelSelectorRequirement {
// key is the label key that the selector applies to.
- // +patchMergeKey=key
- // +patchStrategy=merge
optional string key = 1;
// operator represents a key's relationship to a set of values.
@@ -432,6 +467,7 @@ message LabelSelectorRequirement {
// the values array must be empty. This array is replaced during a strategic
// merge patch.
// +optional
+ // +listType=atomic
repeated string values = 3;
}
@@ -443,19 +479,13 @@ message List {
optional ListMeta metadata = 1;
// List of objects
- repeated k8s.io.apimachinery.pkg.runtime.RawExtension items = 2;
+ repeated .k8s.io.apimachinery.pkg.runtime.RawExtension items = 2;
}
// ListMeta describes metadata that synthetic resources must have, including lists and
// various status objects. A resource may have only one of {ObjectMeta, ListMeta}.
message ListMeta {
- // selfLink is a URL representing this object.
- // Populated by the system.
- // Read-only.
- //
- // DEPRECATED
- // Kubernetes will stop propagating this field in 1.20 release and the field is planned
- // to be removed in 1.21 release.
+ // Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.
// +optional
optional string selfLink = 1;
@@ -572,6 +602,32 @@ message ListOptions {
// This field is not supported when watch is true. Clients may start a watch from the last
// resourceVersion value returned by the server and not miss any modifications.
optional string continue = 8;
+
+ // `sendInitialEvents=true` may be set together with `watch=true`.
+ // In that case, the watch stream will begin with synthetic events to
+ // produce the current state of objects in the collection. Once all such
+ // events have been sent, a synthetic "Bookmark" event will be sent.
+ // The bookmark will report the ResourceVersion (RV) corresponding to the
+ // set of objects, and be marked with `"k8s.io/initial-events-end": "true"` annotation.
+ // Afterwards, the watch stream will proceed as usual, sending watch events
+ // corresponding to changes (subsequent to the RV) to objects watched.
+ //
+ // When `sendInitialEvents` option is set, we require `resourceVersionMatch`
+ // option to also be set. The semantic of the watch request is as following:
+ // - `resourceVersionMatch` = NotOlderThan
+ // is interpreted as "data at least as new as the provided `resourceVersion`"
+ // and the bookmark event is send when the state is synced
+ // to a `resourceVersion` at least as fresh as the one provided by the ListOptions.
+ // If `resourceVersion` is unset, this is interpreted as "consistent read" and the
+ // bookmark event is send when the state is synced at least to the moment
+ // when request started being processed.
+ // - `resourceVersionMatch` set to any other value or unset
+ // Invalid error is returned.
+ //
+ // Defaults to true if `resourceVersion=""` or `resourceVersion="0"` (for backward
+ // compatibility reasons) and to false otherwise.
+ // +optional
+ optional bool sendInitialEvents = 11;
}
// ManagedFieldsEntry is a workflow-id, a FieldSet and the group version of the resource
@@ -590,7 +646,11 @@ message ManagedFieldsEntry {
// set because it cannot be automatically converted.
optional string apiVersion = 3;
- // Time is timestamp of when these fields were set. It should always be empty if Operation is 'Apply'
+ // Time is the timestamp of when the ManagedFields entry was added. The
+ // timestamp will also be updated if a field is added, the manager
+ // changes any of the owned fields value or removes a field. The
+ // timestamp does not update when a field is removed from the entry
+ // because another manager took it over.
// +optional
optional Time time = 4;
@@ -638,7 +698,7 @@ message ObjectMeta {
// automatically. Name is primarily intended for creation idempotence and configuration
// definition.
// Cannot be updated.
- // More info: http://kubernetes.io/docs/user-guide/identifiers#names
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names
// +optional
optional string name = 1;
@@ -650,10 +710,7 @@ message ObjectMeta {
// and may be truncated by the length of the suffix required to make the value
// unique on the server.
//
- // If this field is specified and the generated name exists, the server will
- // NOT return a 409 - instead, it will either return 201 Created or 500 with Reason
- // ServerTimeout indicating a unique name could not be found in the time allotted, and the client
- // should retry (optionally after the time indicated in the Retry-After header).
+ // If this field is specified and the generated name exists, the server will return a 409.
//
// Applied only if Name is not specified.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency
@@ -667,17 +724,11 @@ message ObjectMeta {
//
// Must be a DNS_LABEL.
// Cannot be updated.
- // More info: http://kubernetes.io/docs/user-guide/namespaces
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces
// +optional
optional string namespace = 3;
- // SelfLink is a URL representing this object.
- // Populated by the system.
- // Read-only.
- //
- // DEPRECATED
- // Kubernetes will stop propagating this field in 1.20 release and the field is planned
- // to be removed in 1.21 release.
+ // Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.
// +optional
optional string selfLink = 4;
@@ -687,7 +738,7 @@ message ObjectMeta {
//
// Populated by the system.
// Read-only.
- // More info: http://kubernetes.io/docs/user-guide/identifiers#uids
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids
// +optional
optional string uid = 5;
@@ -751,14 +802,14 @@ message ObjectMeta {
// Map of string keys and values that can be used to organize and categorize
// (scope and select) objects. May match selectors of replication controllers
// and services.
- // More info: http://kubernetes.io/docs/user-guide/labels
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels
// +optional
map labels = 11;
// Annotations is an unstructured key value map stored with a resource that may be
// set by external tools to store and retrieve arbitrary metadata. They are not
// queryable and should be preserved when modifying objects.
- // More info: http://kubernetes.io/docs/user-guide/annotations
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations
// +optional
map annotations = 12;
@@ -769,6 +820,8 @@ message ObjectMeta {
// +optional
// +patchMergeKey=uid
// +patchStrategy=merge
+ // +listType=map
+ // +listMapKey=uid
repeated OwnerReference ownerReferences = 13;
// Must be empty before the object is deleted from the registry. Each entry
@@ -786,14 +839,9 @@ message ObjectMeta {
// are not vulnerable to ordering changes in the list.
// +optional
// +patchStrategy=merge
+ // +listType=set
repeated string finalizers = 14;
- // The name of the cluster which the object belongs to.
- // This is used to distinguish resources with same name and namespace in different clusters.
- // This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.
- // +optional
- optional string clusterName = 15;
-
// ManagedFields maps workflow-id and version to the set of fields
// that are managed by that workflow. This is mostly for internal
// housekeeping, and users typically shouldn't need to set or
@@ -803,6 +851,7 @@ message ObjectMeta {
// workflow used when modifying the object.
//
// +optional
+ // +listType=atomic
repeated ManagedFieldsEntry managedFields = 17;
}
@@ -819,11 +868,11 @@ message OwnerReference {
optional string kind = 1;
// Name of the referent.
- // More info: http://kubernetes.io/docs/user-guide/identifiers#names
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names
optional string name = 3;
// UID of the referent.
- // More info: http://kubernetes.io/docs/user-guide/identifiers#uids
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids
optional string uid = 4;
// If true, this reference points to the managing controller.
@@ -833,6 +882,8 @@ message OwnerReference {
// If true, AND if the owner has the "foregroundDeletion" finalizer, then
// the owner cannot be deleted from the key-value store until this
// reference is removed.
+ // See https://kubernetes.io/docs/concepts/architecture/garbage-collection/#foreground-deletion
+ // for how the garbage collector interacts with this field and enforces the foreground deletion.
// Defaults to false.
// To set this field, a user needs "delete" permission of the owner,
// otherwise 422 (Unprocessable Entity) will be returned.
@@ -875,6 +926,7 @@ message PatchOptions {
// request. Valid values are:
// - All: all dry run stages will be processed
// +optional
+ // +listType=atomic
repeated string dryRun = 1;
// Force is going to "force" Apply requests. It means user will
@@ -893,16 +945,22 @@ message PatchOptions {
// +optional
optional string fieldManager = 3;
- // fieldValidation determines how the server should respond to
- // unknown/duplicate fields in the object in the request.
- // Introduced as alpha in 1.23, older servers or servers with the
- // `ServerSideFieldValidation` feature disabled will discard valid values
- // specified in this param and not perform any server side field validation.
- // Valid values are:
- // - Ignore: ignores unknown/duplicate fields.
- // - Warn: responds with a warning for each
- // unknown/duplicate field, but successfully serves the request.
- // - Strict: fails the request on unknown/duplicate fields.
+ // fieldValidation instructs the server on how to handle
+ // objects in the request (POST/PUT/PATCH) containing unknown
+ // or duplicate fields. Valid values are:
+ // - Ignore: This will ignore any unknown fields that are silently
+ // dropped from the object, and will ignore all but the last duplicate
+ // field that the decoder encounters. This is the default behavior
+ // prior to v1.23.
+ // - Warn: This will send a warning via the standard warning response
+ // header for each unknown field that is dropped from the object, and
+ // for each duplicate field that is encountered. The request will
+ // still succeed if there are no other errors, and will only persist
+ // the last of any duplicate fields. This is the default in v1.23+
+ // - Strict: This will fail the request with a BadRequest error if
+ // any unknown fields would be dropped from the object, or if any
+ // duplicate fields are present. The error returned from the server
+ // will contain all unknown and duplicate fields encountered.
// +optional
optional string fieldValidation = 4;
}
@@ -922,6 +980,7 @@ message Preconditions {
// For example: "/healthz", "/apis".
message RootPaths {
// paths are the paths available at root.
+ // +listType=atomic
repeated string paths = 1;
}
@@ -964,6 +1023,7 @@ message Status {
// is not guaranteed to conform to any schema except that defined by
// the reason type.
// +optional
+ // +listType=atomic
optional StatusDetails details = 5;
// Suggested HTTP return code for this status, 0 if not set.
@@ -1021,13 +1081,14 @@ message StatusDetails {
// UID of the resource.
// (when there is a single resource which can be described).
- // More info: http://kubernetes.io/docs/user-guide/identifiers#uids
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids
// +optional
optional string uid = 6;
// The Causes array includes more details associated with the StatusReason
// failure. Not all StatusReasons may provide detailed causes.
// +optional
+ // +listType=atomic
repeated StatusCause causes = 4;
// If specified, the time in seconds before the operation should be retried. Some errors may indicate
@@ -1114,6 +1175,7 @@ message UpdateOptions {
// request. Valid values are:
// - All: all dry run stages will be processed
// +optional
+ // +listType=atomic
repeated string dryRun = 1;
// fieldManager is a name associated with the actor or entity
@@ -1123,16 +1185,22 @@ message UpdateOptions {
// +optional
optional string fieldManager = 2;
- // fieldValidation determines how the server should respond to
- // unknown/duplicate fields in the object in the request.
- // Introduced as alpha in 1.23, older servers or servers with the
- // `ServerSideFieldValidation` feature disabled will discard valid values
- // specified in this param and not perform any server side field validation.
- // Valid values are:
- // - Ignore: ignores unknown/duplicate fields.
- // - Warn: responds with a warning for each
- // unknown/duplicate field, but successfully serves the request.
- // - Strict: fails the request on unknown/duplicate fields.
+ // fieldValidation instructs the server on how to handle
+ // objects in the request (POST/PUT/PATCH) containing unknown
+ // or duplicate fields. Valid values are:
+ // - Ignore: This will ignore any unknown fields that are silently
+ // dropped from the object, and will ignore all but the last duplicate
+ // field that the decoder encounters. This is the default behavior
+ // prior to v1.23.
+ // - Warn: This will send a warning via the standard warning response
+ // header for each unknown field that is dropped from the object, and
+ // for each duplicate field that is encountered. The request will
+ // still succeed if there are no other errors, and will only persist
+ // the last of any duplicate fields. This is the default in v1.23+
+ // - Strict: This will fail the request with a BadRequest error if
+ // any unknown fields would be dropped from the object, or if any
+ // duplicate fields are present. The error returned from the server
+ // will contain all unknown and duplicate fields encountered.
// +optional
optional string fieldValidation = 3;
}
@@ -1160,6 +1228,6 @@ message WatchEvent {
// * If Type is Deleted: the state of the object immediately before deletion.
// * If Type is Error: *Status is recommended; other types may make sense
// depending on context.
- optional k8s.io.apimachinery.pkg.runtime.RawExtension object = 2;
+ optional .k8s.io.apimachinery.pkg.runtime.RawExtension object = 2;
}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go
index 2b6a30b65..c748071ed 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go
@@ -24,8 +24,10 @@ import (
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/labels"
+ cbor "k8s.io/apimachinery/pkg/runtime/serializer/cbor/direct"
"k8s.io/apimachinery/pkg/selection"
"k8s.io/apimachinery/pkg/types"
+ utiljson "k8s.io/apimachinery/pkg/util/json"
)
// LabelSelectorAsSelector converts the LabelSelector api type into a struct that implements
@@ -58,7 +60,7 @@ func LabelSelectorAsSelector(ps *LabelSelector) (labels.Selector, error) {
case LabelSelectorOpDoesNotExist:
op = selection.DoesNotExist
default:
- return nil, fmt.Errorf("%q is not a valid pod selector operator", expr.Operator)
+ return nil, fmt.Errorf("%q is not a valid label selector operator", expr.Operator)
}
r, err := labels.NewRequirement(expr.Key, op, append([]string(nil), expr.Values...))
if err != nil {
@@ -280,13 +282,20 @@ func (f FieldsV1) MarshalJSON() ([]byte, error) {
if f.Raw == nil {
return []byte("null"), nil
}
+ if f.getContentType() == fieldsV1InvalidOrValidCBORObject {
+ var u map[string]interface{}
+ if err := cbor.Unmarshal(f.Raw, &u); err != nil {
+ return nil, fmt.Errorf("metav1.FieldsV1 cbor invalid: %w", err)
+ }
+ return utiljson.Marshal(u)
+ }
return f.Raw, nil
}
// UnmarshalJSON implements json.Unmarshaler
func (f *FieldsV1) UnmarshalJSON(b []byte) error {
if f == nil {
- return errors.New("metav1.Fields: UnmarshalJSON on nil pointer")
+ return errors.New("metav1.FieldsV1: UnmarshalJSON on nil pointer")
}
if !bytes.Equal(b, []byte("null")) {
f.Raw = append(f.Raw[0:0], b...)
@@ -296,3 +305,75 @@ func (f *FieldsV1) UnmarshalJSON(b []byte) error {
var _ json.Marshaler = FieldsV1{}
var _ json.Unmarshaler = &FieldsV1{}
+
+func (f FieldsV1) MarshalCBOR() ([]byte, error) {
+ if f.Raw == nil {
+ return cbor.Marshal(nil)
+ }
+ if f.getContentType() == fieldsV1InvalidOrValidJSONObject {
+ var u map[string]interface{}
+ if err := utiljson.Unmarshal(f.Raw, &u); err != nil {
+ return nil, fmt.Errorf("metav1.FieldsV1 json invalid: %w", err)
+ }
+ return cbor.Marshal(u)
+ }
+ return f.Raw, nil
+}
+
+var cborNull = []byte{0xf6}
+
+func (f *FieldsV1) UnmarshalCBOR(b []byte) error {
+ if f == nil {
+ return errors.New("metav1.FieldsV1: UnmarshalCBOR on nil pointer")
+ }
+ if !bytes.Equal(b, cborNull) {
+ f.Raw = append(f.Raw[0:0], b...)
+ }
+ return nil
+}
+
+const (
+ // fieldsV1InvalidOrEmpty indicates that a FieldsV1 either contains no raw bytes or its raw
+ // bytes don't represent an allowable value in any supported encoding.
+ fieldsV1InvalidOrEmpty = iota
+
+ // fieldsV1InvalidOrValidJSONObject indicates that a FieldV1 either contains raw bytes that
+ // are a valid JSON encoding of an allowable value or don't represent an allowable value in
+ // any supported encoding.
+ fieldsV1InvalidOrValidJSONObject
+
+ // fieldsV1InvalidOrValidCBORObject indicates that a FieldV1 either contains raw bytes that
+ // are a valid CBOR encoding of an allowable value or don't represent an allowable value in
+ // any supported encoding.
+ fieldsV1InvalidOrValidCBORObject
+)
+
+// getContentType returns one of fieldsV1InvalidOrEmpty, fieldsV1InvalidOrValidJSONObject,
+// fieldsV1InvalidOrValidCBORObject based on the value of Raw.
+//
+// Raw can be encoded in JSON or CBOR and is only valid if it is empty, null, or an object (map)
+// value. It is invalid if it contains a JSON string, number, boolean, or array. If Raw is nonempty
+// and represents an allowable value, then the initial byte unambiguously distinguishes a
+// JSON-encoded value from a CBOR-encoded value.
+//
+// A valid JSON-encoded value can begin with any of the four JSON whitespace characters, the first
+// character 'n' of null, or '{' (0x09, 0x0a, 0x0d, 0x20, 0x6e, or 0x7b, respectively). A valid
+// CBOR-encoded value can begin with the null simple value, an initial byte with major type "map",
+// or, if a tag-enclosed map, an initial byte with major type "tag" (0xf6, 0xa0...0xbf, or
+// 0xc6...0xdb). The two sets of valid initial bytes don't intersect.
+func (f FieldsV1) getContentType() int {
+ if len(f.Raw) > 0 {
+ p := f.Raw[0]
+ switch p {
+ case 'n', '{', '\t', '\r', '\n', ' ':
+ return fieldsV1InvalidOrValidJSONObject
+ case 0xf6: // null
+ return fieldsV1InvalidOrValidCBORObject
+ default:
+ if p >= 0xa0 && p <= 0xbf /* map */ || p >= 0xc6 && p <= 0xdb /* tag */ {
+ return fieldsV1InvalidOrValidCBORObject
+ }
+ }
+ }
+ return fieldsV1InvalidOrEmpty
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/meta.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/meta.go
index 2002f91b0..92d3ed5e0 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/meta.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/meta.go
@@ -59,8 +59,6 @@ type Object interface {
SetFinalizers(finalizers []string)
GetOwnerReferences() []OwnerReference
SetOwnerReferences([]OwnerReference)
- GetClusterName() string
- SetClusterName(clusterName string)
GetManagedFields() []ManagedFieldsEntry
SetManagedFields(managedFields []ManagedFieldsEntry)
}
@@ -172,8 +170,6 @@ func (meta *ObjectMeta) GetOwnerReferences() []OwnerReference { return m
func (meta *ObjectMeta) SetOwnerReferences(references []OwnerReference) {
meta.OwnerReferences = references
}
-func (meta *ObjectMeta) GetClusterName() string { return meta.ClusterName }
-func (meta *ObjectMeta) SetClusterName(clusterName string) { meta.ClusterName = clusterName }
func (meta *ObjectMeta) GetManagedFields() []ManagedFieldsEntry { return meta.ManagedFields }
func (meta *ObjectMeta) SetManagedFields(managedFields []ManagedFieldsEntry) {
meta.ManagedFields = managedFields
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go
index 8eb37f436..9f302b3f3 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go
@@ -19,6 +19,8 @@ package v1
import (
"encoding/json"
"time"
+
+ cbor "k8s.io/apimachinery/pkg/runtime/serializer/cbor/direct"
)
const RFC3339Micro = "2006-01-02T15:04:05.000000Z07:00"
@@ -129,6 +131,25 @@ func (t *MicroTime) UnmarshalJSON(b []byte) error {
return nil
}
+func (t *MicroTime) UnmarshalCBOR(b []byte) error {
+ var s *string
+ if err := cbor.Unmarshal(b, &s); err != nil {
+ return err
+ }
+ if s == nil {
+ t.Time = time.Time{}
+ return nil
+ }
+
+ parsed, err := time.Parse(RFC3339Micro, *s)
+ if err != nil {
+ return err
+ }
+
+ t.Time = parsed.Local()
+ return nil
+}
+
// UnmarshalQueryParameter converts from a URL query parameter value to an object
func (t *MicroTime) UnmarshalQueryParameter(str string) error {
if len(str) == 0 {
@@ -160,6 +181,13 @@ func (t MicroTime) MarshalJSON() ([]byte, error) {
return json.Marshal(t.UTC().Format(RFC3339Micro))
}
+func (t MicroTime) MarshalCBOR() ([]byte, error) {
+ if t.IsZero() {
+ return cbor.Marshal(nil)
+ }
+ return cbor.Marshal(t.UTC().Format(RFC3339Micro))
+}
+
// OpenAPISchemaType is used by the kube-openapi generator when constructing
// the OpenAPI spec of this type.
//
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time.go
index 421770d43..0333cfdb3 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time.go
@@ -19,6 +19,8 @@ package v1
import (
"encoding/json"
"time"
+
+ cbor "k8s.io/apimachinery/pkg/runtime/serializer/cbor/direct"
)
// Time is a wrapper around time.Time which supports correct
@@ -116,6 +118,25 @@ func (t *Time) UnmarshalJSON(b []byte) error {
return nil
}
+func (t *Time) UnmarshalCBOR(b []byte) error {
+ var s *string
+ if err := cbor.Unmarshal(b, &s); err != nil {
+ return err
+ }
+ if s == nil {
+ t.Time = time.Time{}
+ return nil
+ }
+
+ parsed, err := time.Parse(time.RFC3339, *s)
+ if err != nil {
+ return err
+ }
+
+ t.Time = parsed.Local()
+ return nil
+}
+
// UnmarshalQueryParameter converts from a URL query parameter value to an object
func (t *Time) UnmarshalQueryParameter(str string) error {
if len(str) == 0 {
@@ -151,6 +172,14 @@ func (t Time) MarshalJSON() ([]byte, error) {
return buf, nil
}
+func (t Time) MarshalCBOR() ([]byte, error) {
+ if t.IsZero() {
+ return cbor.Marshal(nil)
+ }
+
+ return cbor.Marshal(t.UTC().Format(time.RFC3339))
+}
+
// ToUnstructured implements the value.UnstructuredConverter interface.
func (t Time) ToUnstructured() interface{} {
if t.IsZero() {
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go
index 35f9eca13..473adb9ef 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go
@@ -59,13 +59,7 @@ type TypeMeta struct {
// ListMeta describes metadata that synthetic resources must have, including lists and
// various status objects. A resource may have only one of {ObjectMeta, ListMeta}.
type ListMeta struct {
- // selfLink is a URL representing this object.
- // Populated by the system.
- // Read-only.
- //
- // DEPRECATED
- // Kubernetes will stop propagating this field in 1.20 release and the field is planned
- // to be removed in 1.21 release.
+ // Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.
// +optional
SelfLink string `json:"selfLink,omitempty" protobuf:"bytes,1,opt,name=selfLink"`
@@ -120,7 +114,7 @@ type ObjectMeta struct {
// automatically. Name is primarily intended for creation idempotence and configuration
// definition.
// Cannot be updated.
- // More info: http://kubernetes.io/docs/user-guide/identifiers#names
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names
// +optional
Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
@@ -132,10 +126,7 @@ type ObjectMeta struct {
// and may be truncated by the length of the suffix required to make the value
// unique on the server.
//
- // If this field is specified and the generated name exists, the server will
- // NOT return a 409 - instead, it will either return 201 Created or 500 with Reason
- // ServerTimeout indicating a unique name could not be found in the time allotted, and the client
- // should retry (optionally after the time indicated in the Retry-After header).
+ // If this field is specified and the generated name exists, the server will return a 409.
//
// Applied only if Name is not specified.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency
@@ -149,17 +140,11 @@ type ObjectMeta struct {
//
// Must be a DNS_LABEL.
// Cannot be updated.
- // More info: http://kubernetes.io/docs/user-guide/namespaces
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces
// +optional
Namespace string `json:"namespace,omitempty" protobuf:"bytes,3,opt,name=namespace"`
- // SelfLink is a URL representing this object.
- // Populated by the system.
- // Read-only.
- //
- // DEPRECATED
- // Kubernetes will stop propagating this field in 1.20 release and the field is planned
- // to be removed in 1.21 release.
+ // Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.
// +optional
SelfLink string `json:"selfLink,omitempty" protobuf:"bytes,4,opt,name=selfLink"`
@@ -169,7 +154,7 @@ type ObjectMeta struct {
//
// Populated by the system.
// Read-only.
- // More info: http://kubernetes.io/docs/user-guide/identifiers#uids
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids
// +optional
UID types.UID `json:"uid,omitempty" protobuf:"bytes,5,opt,name=uid,casttype=k8s.io/kubernetes/pkg/types.UID"`
@@ -233,14 +218,14 @@ type ObjectMeta struct {
// Map of string keys and values that can be used to organize and categorize
// (scope and select) objects. May match selectors of replication controllers
// and services.
- // More info: http://kubernetes.io/docs/user-guide/labels
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels
// +optional
Labels map[string]string `json:"labels,omitempty" protobuf:"bytes,11,rep,name=labels"`
// Annotations is an unstructured key value map stored with a resource that may be
// set by external tools to store and retrieve arbitrary metadata. They are not
// queryable and should be preserved when modifying objects.
- // More info: http://kubernetes.io/docs/user-guide/annotations
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations
// +optional
Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,12,rep,name=annotations"`
@@ -251,6 +236,8 @@ type ObjectMeta struct {
// +optional
// +patchMergeKey=uid
// +patchStrategy=merge
+ // +listType=map
+ // +listMapKey=uid
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" patchStrategy:"merge" patchMergeKey:"uid" protobuf:"bytes,13,rep,name=ownerReferences"`
// Must be empty before the object is deleted from the registry. Each entry
@@ -268,13 +255,12 @@ type ObjectMeta struct {
// are not vulnerable to ordering changes in the list.
// +optional
// +patchStrategy=merge
+ // +listType=set
Finalizers []string `json:"finalizers,omitempty" patchStrategy:"merge" protobuf:"bytes,14,rep,name=finalizers"`
- // The name of the cluster which the object belongs to.
- // This is used to distinguish resources with same name and namespace in different clusters.
- // This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.
- // +optional
- ClusterName string `json:"clusterName,omitempty" protobuf:"bytes,15,opt,name=clusterName"`
+ // Tombstone: ClusterName was a legacy field that was always cleared by
+ // the system and never used.
+ // ClusterName string `json:"clusterName,omitempty" protobuf:"bytes,15,opt,name=clusterName"`
// ManagedFields maps workflow-id and version to the set of fields
// that are managed by that workflow. This is mostly for internal
@@ -285,6 +271,7 @@ type ObjectMeta struct {
// workflow used when modifying the object.
//
// +optional
+ // +listType=atomic
ManagedFields []ManagedFieldsEntry `json:"managedFields,omitempty" protobuf:"bytes,17,rep,name=managedFields"`
}
@@ -312,10 +299,10 @@ type OwnerReference struct {
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
Kind string `json:"kind" protobuf:"bytes,1,opt,name=kind"`
// Name of the referent.
- // More info: http://kubernetes.io/docs/user-guide/identifiers#names
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names
Name string `json:"name" protobuf:"bytes,3,opt,name=name"`
// UID of the referent.
- // More info: http://kubernetes.io/docs/user-guide/identifiers#uids
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids
UID types.UID `json:"uid" protobuf:"bytes,4,opt,name=uid,casttype=k8s.io/apimachinery/pkg/types.UID"`
// If true, this reference points to the managing controller.
// +optional
@@ -323,6 +310,8 @@ type OwnerReference struct {
// If true, AND if the owner has the "foregroundDeletion" finalizer, then
// the owner cannot be deleted from the key-value store until this
// reference is removed.
+ // See https://kubernetes.io/docs/concepts/architecture/garbage-collection/#foreground-deletion
+ // for how the garbage collector interacts with this field and enforces the foreground deletion.
// Defaults to false.
// To set this field, a user needs "delete" permission of the owner,
// otherwise 422 (Unprocessable Entity) will be returned.
@@ -415,8 +404,43 @@ type ListOptions struct {
// This field is not supported when watch is true. Clients may start a watch from the last
// resourceVersion value returned by the server and not miss any modifications.
Continue string `json:"continue,omitempty" protobuf:"bytes,8,opt,name=continue"`
+
+ // `sendInitialEvents=true` may be set together with `watch=true`.
+ // In that case, the watch stream will begin with synthetic events to
+ // produce the current state of objects in the collection. Once all such
+ // events have been sent, a synthetic "Bookmark" event will be sent.
+ // The bookmark will report the ResourceVersion (RV) corresponding to the
+ // set of objects, and be marked with `"k8s.io/initial-events-end": "true"` annotation.
+ // Afterwards, the watch stream will proceed as usual, sending watch events
+ // corresponding to changes (subsequent to the RV) to objects watched.
+ //
+ // When `sendInitialEvents` option is set, we require `resourceVersionMatch`
+ // option to also be set. The semantic of the watch request is as following:
+ // - `resourceVersionMatch` = NotOlderThan
+ // is interpreted as "data at least as new as the provided `resourceVersion`"
+ // and the bookmark event is send when the state is synced
+ // to a `resourceVersion` at least as fresh as the one provided by the ListOptions.
+ // If `resourceVersion` is unset, this is interpreted as "consistent read" and the
+ // bookmark event is send when the state is synced at least to the moment
+ // when request started being processed.
+ // - `resourceVersionMatch` set to any other value or unset
+ // Invalid error is returned.
+ //
+ // Defaults to true if `resourceVersion=""` or `resourceVersion="0"` (for backward
+ // compatibility reasons) and to false otherwise.
+ // +optional
+ SendInitialEvents *bool `json:"sendInitialEvents,omitempty" protobuf:"varint,11,opt,name=sendInitialEvents"`
}
+const (
+ // InitialEventsAnnotationKey the name of the key
+ // under which an annotation marking the end of
+ // a watchlist stream is stored.
+ //
+ // The annotation is added to a "Bookmark" event.
+ InitialEventsAnnotationKey = "k8s.io/initial-events-end"
+)
+
// resourceVersionMatch specifies how the resourceVersion parameter is applied. resourceVersionMatch
// may only be set if resourceVersion is also set.
//
@@ -520,6 +544,7 @@ type DeleteOptions struct {
// request. Valid values are:
// - All: all dry run stages will be processed
// +optional
+ // +listType=atomic
DryRun []string `json:"dryRun,omitempty" protobuf:"bytes,5,rep,name=dryRun"`
}
@@ -545,6 +570,7 @@ type CreateOptions struct {
// request. Valid values are:
// - All: all dry run stages will be processed
// +optional
+ // +listType=atomic
DryRun []string `json:"dryRun,omitempty" protobuf:"bytes,1,rep,name=dryRun"`
// +k8s:deprecated=includeUninitialized,protobuf=2
@@ -555,16 +581,22 @@ type CreateOptions struct {
// +optional
FieldManager string `json:"fieldManager,omitempty" protobuf:"bytes,3,name=fieldManager"`
- // fieldValidation determines how the server should respond to
- // unknown/duplicate fields in the object in the request.
- // Introduced as alpha in 1.23, older servers or servers with the
- // `ServerSideFieldValidation` feature disabled will discard valid values
- // specified in this param and not perform any server side field validation.
- // Valid values are:
- // - Ignore: ignores unknown/duplicate fields.
- // - Warn: responds with a warning for each
- // unknown/duplicate field, but successfully serves the request.
- // - Strict: fails the request on unknown/duplicate fields.
+ // fieldValidation instructs the server on how to handle
+ // objects in the request (POST/PUT/PATCH) containing unknown
+ // or duplicate fields. Valid values are:
+ // - Ignore: This will ignore any unknown fields that are silently
+ // dropped from the object, and will ignore all but the last duplicate
+ // field that the decoder encounters. This is the default behavior
+ // prior to v1.23.
+ // - Warn: This will send a warning via the standard warning response
+ // header for each unknown field that is dropped from the object, and
+ // for each duplicate field that is encountered. The request will
+ // still succeed if there are no other errors, and will only persist
+ // the last of any duplicate fields. This is the default in v1.23+
+ // - Strict: This will fail the request with a BadRequest error if
+ // any unknown fields would be dropped from the object, or if any
+ // duplicate fields are present. The error returned from the server
+ // will contain all unknown and duplicate fields encountered.
// +optional
FieldValidation string `json:"fieldValidation,omitempty" protobuf:"bytes,4,name=fieldValidation"`
}
@@ -583,6 +615,7 @@ type PatchOptions struct {
// request. Valid values are:
// - All: all dry run stages will be processed
// +optional
+ // +listType=atomic
DryRun []string `json:"dryRun,omitempty" protobuf:"bytes,1,rep,name=dryRun"`
// Force is going to "force" Apply requests. It means user will
@@ -601,16 +634,22 @@ type PatchOptions struct {
// +optional
FieldManager string `json:"fieldManager,omitempty" protobuf:"bytes,3,name=fieldManager"`
- // fieldValidation determines how the server should respond to
- // unknown/duplicate fields in the object in the request.
- // Introduced as alpha in 1.23, older servers or servers with the
- // `ServerSideFieldValidation` feature disabled will discard valid values
- // specified in this param and not perform any server side field validation.
- // Valid values are:
- // - Ignore: ignores unknown/duplicate fields.
- // - Warn: responds with a warning for each
- // unknown/duplicate field, but successfully serves the request.
- // - Strict: fails the request on unknown/duplicate fields.
+ // fieldValidation instructs the server on how to handle
+ // objects in the request (POST/PUT/PATCH) containing unknown
+ // or duplicate fields. Valid values are:
+ // - Ignore: This will ignore any unknown fields that are silently
+ // dropped from the object, and will ignore all but the last duplicate
+ // field that the decoder encounters. This is the default behavior
+ // prior to v1.23.
+ // - Warn: This will send a warning via the standard warning response
+ // header for each unknown field that is dropped from the object, and
+ // for each duplicate field that is encountered. The request will
+ // still succeed if there are no other errors, and will only persist
+ // the last of any duplicate fields. This is the default in v1.23+
+ // - Strict: This will fail the request with a BadRequest error if
+ // any unknown fields would be dropped from the object, or if any
+ // duplicate fields are present. The error returned from the server
+ // will contain all unknown and duplicate fields encountered.
// +optional
FieldValidation string `json:"fieldValidation,omitempty" protobuf:"bytes,4,name=fieldValidation"`
}
@@ -628,6 +667,7 @@ type ApplyOptions struct {
// request. Valid values are:
// - All: all dry run stages will be processed
// +optional
+ // +listType=atomic
DryRun []string `json:"dryRun,omitempty" protobuf:"bytes,1,rep,name=dryRun"`
// Force is going to "force" Apply requests. It means user will
@@ -660,6 +700,7 @@ type UpdateOptions struct {
// request. Valid values are:
// - All: all dry run stages will be processed
// +optional
+ // +listType=atomic
DryRun []string `json:"dryRun,omitempty" protobuf:"bytes,1,rep,name=dryRun"`
// fieldManager is a name associated with the actor or entity
@@ -669,16 +710,22 @@ type UpdateOptions struct {
// +optional
FieldManager string `json:"fieldManager,omitempty" protobuf:"bytes,2,name=fieldManager"`
- // fieldValidation determines how the server should respond to
- // unknown/duplicate fields in the object in the request.
- // Introduced as alpha in 1.23, older servers or servers with the
- // `ServerSideFieldValidation` feature disabled will discard valid values
- // specified in this param and not perform any server side field validation.
- // Valid values are:
- // - Ignore: ignores unknown/duplicate fields.
- // - Warn: responds with a warning for each
- // unknown/duplicate field, but successfully serves the request.
- // - Strict: fails the request on unknown/duplicate fields.
+ // fieldValidation instructs the server on how to handle
+ // objects in the request (POST/PUT/PATCH) containing unknown
+ // or duplicate fields. Valid values are:
+ // - Ignore: This will ignore any unknown fields that are silently
+ // dropped from the object, and will ignore all but the last duplicate
+ // field that the decoder encounters. This is the default behavior
+ // prior to v1.23.
+ // - Warn: This will send a warning via the standard warning response
+ // header for each unknown field that is dropped from the object, and
+ // for each duplicate field that is encountered. The request will
+ // still succeed if there are no other errors, and will only persist
+ // the last of any duplicate fields. This is the default in v1.23+
+ // - Strict: This will fail the request with a BadRequest error if
+ // any unknown fields would be dropped from the object, or if any
+ // duplicate fields are present. The error returned from the server
+ // will contain all unknown and duplicate fields encountered.
// +optional
FieldValidation string `json:"fieldValidation,omitempty" protobuf:"bytes,3,name=fieldValidation"`
}
@@ -722,6 +769,7 @@ type Status struct {
// is not guaranteed to conform to any schema except that defined by
// the reason type.
// +optional
+ // +listType=atomic
Details *StatusDetails `json:"details,omitempty" protobuf:"bytes,5,opt,name=details"`
// Suggested HTTP return code for this status, 0 if not set.
// +optional
@@ -749,12 +797,13 @@ type StatusDetails struct {
Kind string `json:"kind,omitempty" protobuf:"bytes,3,opt,name=kind"`
// UID of the resource.
// (when there is a single resource which can be described).
- // More info: http://kubernetes.io/docs/user-guide/identifiers#uids
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids
// +optional
UID types.UID `json:"uid,omitempty" protobuf:"bytes,6,opt,name=uid,casttype=k8s.io/apimachinery/pkg/types.UID"`
// The Causes array includes more details associated with the StatusReason
// failure. Not all StatusReasons may provide detailed causes.
// +optional
+ // +listType=atomic
Causes []StatusCause `json:"causes,omitempty" protobuf:"bytes,4,rep,name=causes"`
// If specified, the time in seconds before the operation should be retried. Some errors may indicate
// the client must take an alternate action - for those errors this field may indicate how long to wait
@@ -966,6 +1015,24 @@ const (
// CauseTypeFieldValueNotSupported is used to report valid (as per formatting rules)
// values that can not be handled (e.g. an enumerated string).
CauseTypeFieldValueNotSupported CauseType = "FieldValueNotSupported"
+ // CauseTypeForbidden is used to report valid (as per formatting rules)
+ // values which would be accepted under some conditions, but which are not
+ // permitted by the current conditions (such as security policy). See
+ // Forbidden().
+ CauseTypeForbidden CauseType = "FieldValueForbidden"
+ // CauseTypeTooLong is used to report that the given value is too long.
+ // This is similar to ErrorTypeInvalid, but the error will not include the
+ // too-long value. See TooLong().
+ CauseTypeTooLong CauseType = "FieldValueTooLong"
+ // CauseTypeTooMany is used to report "too many". This is used to
+ // report that a given list has too many items. This is similar to FieldValueTooLong,
+ // but the error indicates quantity instead of length.
+ CauseTypeTooMany CauseType = "FieldValueTooMany"
+ // CauseTypeInternal is used to report other errors that are not related
+ // to user input. See InternalError().
+ CauseTypeInternal CauseType = "InternalError"
+ // CauseTypeTypeInvalid is for the value did not match the schema type for that field
+ CauseTypeTypeInvalid CauseType = "FieldValueTypeInvalid"
// CauseTypeUnexpectedServerResponse is used to report when the server responded to the client
// without the expected return type. The presence of this cause indicates the error may be
// due to an intervening proxy or the server software malfunctioning.
@@ -1000,6 +1067,7 @@ type List struct {
type APIVersions struct {
TypeMeta `json:",inline"`
// versions are the api versions that are available.
+ // +listType=atomic
Versions []string `json:"versions" protobuf:"bytes,1,rep,name=versions"`
// a map of client CIDR to server address that is serving this group.
// This is to help clients reach servers in the most network-efficient way possible.
@@ -1008,6 +1076,7 @@ type APIVersions struct {
// The server returns only those CIDRs that it thinks that the client can match.
// For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP.
// Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.
+ // +listType=atomic
ServerAddressByClientCIDRs []ServerAddressByClientCIDR `json:"serverAddressByClientCIDRs" protobuf:"bytes,2,rep,name=serverAddressByClientCIDRs"`
}
@@ -1018,6 +1087,7 @@ type APIVersions struct {
type APIGroupList struct {
TypeMeta `json:",inline"`
// groups is a list of APIGroup.
+ // +listType=atomic
Groups []APIGroup `json:"groups" protobuf:"bytes,1,rep,name=groups"`
}
@@ -1030,6 +1100,7 @@ type APIGroup struct {
// name is the name of the group.
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
// versions are the versions supported in this group.
+ // +listType=atomic
Versions []GroupVersionForDiscovery `json:"versions" protobuf:"bytes,2,rep,name=versions"`
// preferredVersion is the version preferred by the API server, which
// probably is the storage version.
@@ -1043,6 +1114,7 @@ type APIGroup struct {
// For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP.
// Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.
// +optional
+ // +listType=atomic
ServerAddressByClientCIDRs []ServerAddressByClientCIDR `json:"serverAddressByClientCIDRs,omitempty" protobuf:"bytes,4,rep,name=serverAddressByClientCIDRs"`
}
@@ -1087,8 +1159,10 @@ type APIResource struct {
// update, patch, delete, deletecollection, and proxy)
Verbs Verbs `json:"verbs" protobuf:"bytes,4,opt,name=verbs"`
// shortNames is a list of suggested short names of the resource.
+ // +listType=atomic
ShortNames []string `json:"shortNames,omitempty" protobuf:"bytes,5,rep,name=shortNames"`
// categories is a list of the grouped resources this resource belongs to (e.g. 'all')
+ // +listType=atomic
Categories []string `json:"categories,omitempty" protobuf:"bytes,7,rep,name=categories"`
// The hash value of the storage version, the version this resource is
// converted to when written to the data store. Value must be treated
@@ -1121,6 +1195,7 @@ type APIResourceList struct {
// groupVersion is the group and version this APIResourceList is for.
GroupVersion string `json:"groupVersion" protobuf:"bytes,1,opt,name=groupVersion"`
// resources contains the name of the resources and if they are namespaced.
+ // +listType=atomic
APIResources []APIResource `json:"resources" protobuf:"bytes,2,rep,name=resources"`
}
@@ -1128,6 +1203,7 @@ type APIResourceList struct {
// For example: "/healthz", "/apis".
type RootPaths struct {
// paths are the paths available at root.
+ // +listType=atomic
Paths []string `json:"paths" protobuf:"bytes,1,rep,name=paths"`
}
@@ -1171,6 +1247,7 @@ type LabelSelector struct {
MatchLabels map[string]string `json:"matchLabels,omitempty" protobuf:"bytes,1,rep,name=matchLabels"`
// matchExpressions is a list of label selector requirements. The requirements are ANDed.
// +optional
+ // +listType=atomic
MatchExpressions []LabelSelectorRequirement `json:"matchExpressions,omitempty" protobuf:"bytes,2,rep,name=matchExpressions"`
}
@@ -1178,9 +1255,7 @@ type LabelSelector struct {
// relates the key and values.
type LabelSelectorRequirement struct {
// key is the label key that the selector applies to.
- // +patchMergeKey=key
- // +patchStrategy=merge
- Key string `json:"key" patchStrategy:"merge" patchMergeKey:"key" protobuf:"bytes,1,opt,name=key"`
+ Key string `json:"key" protobuf:"bytes,1,opt,name=key"`
// operator represents a key's relationship to a set of values.
// Valid operators are In, NotIn, Exists and DoesNotExist.
Operator LabelSelectorOperator `json:"operator" protobuf:"bytes,2,opt,name=operator,casttype=LabelSelectorOperator"`
@@ -1189,6 +1264,7 @@ type LabelSelectorRequirement struct {
// the values array must be empty. This array is replaced during a strategic
// merge patch.
// +optional
+ // +listType=atomic
Values []string `json:"values,omitempty" protobuf:"bytes,3,rep,name=values"`
}
@@ -1202,6 +1278,33 @@ const (
LabelSelectorOpDoesNotExist LabelSelectorOperator = "DoesNotExist"
)
+// FieldSelectorRequirement is a selector that contains values, a key, and an operator that
+// relates the key and values.
+type FieldSelectorRequirement struct {
+ // key is the field selector key that the requirement applies to.
+ Key string `json:"key" protobuf:"bytes,1,opt,name=key"`
+ // operator represents a key's relationship to a set of values.
+ // Valid operators are In, NotIn, Exists, DoesNotExist.
+ // The list of operators may grow in the future.
+ Operator FieldSelectorOperator `json:"operator" protobuf:"bytes,2,opt,name=operator,casttype=FieldSelectorOperator"`
+ // values is an array of string values.
+ // If the operator is In or NotIn, the values array must be non-empty.
+ // If the operator is Exists or DoesNotExist, the values array must be empty.
+ // +optional
+ // +listType=atomic
+ Values []string `json:"values,omitempty" protobuf:"bytes,3,rep,name=values"`
+}
+
+// A field selector operator is the set of operators that can be used in a selector requirement.
+type FieldSelectorOperator string
+
+const (
+ FieldSelectorOpIn FieldSelectorOperator = "In"
+ FieldSelectorOpNotIn FieldSelectorOperator = "NotIn"
+ FieldSelectorOpExists FieldSelectorOperator = "Exists"
+ FieldSelectorOpDoesNotExist FieldSelectorOperator = "DoesNotExist"
+)
+
// ManagedFieldsEntry is a workflow-id, a FieldSet and the group version of the resource
// that the fieldset applies to.
type ManagedFieldsEntry struct {
@@ -1215,7 +1318,11 @@ type ManagedFieldsEntry struct {
// APIVersion field. It is necessary to track the version of a field
// set because it cannot be automatically converted.
APIVersion string `json:"apiVersion,omitempty" protobuf:"bytes,3,opt,name=apiVersion"`
- // Time is timestamp of when these fields were set. It should always be empty if Operation is 'Apply'
+ // Time is the timestamp of when the ManagedFields entry was added. The
+ // timestamp will also be updated if a field is added, the manager
+ // changes any of the owned fields value or removes a field. The
+ // timestamp does not update when a field is removed from the entry
+ // because another manager took it over.
// +optional
Time *Time `json:"time,omitempty" protobuf:"bytes,4,opt,name=time"`
@@ -1286,8 +1393,10 @@ type Table struct {
// columnDefinitions describes each column in the returned items array. The number of cells per row
// will always match the number of column definitions.
+ // +listType=atomic
ColumnDefinitions []TableColumnDefinition `json:"columnDefinitions"`
// rows is the list of items in the table.
+ // +listType=atomic
Rows []TableRow `json:"rows"`
}
@@ -1320,12 +1429,14 @@ type TableRow struct {
// cells will be as wide as the column definitions array and may contain strings, numbers (float64 or
// int64), booleans, simple maps, lists, or null. See the type field of the column definition for a
// more detailed description.
+ // +listType=atomic
Cells []interface{} `json:"cells"`
// conditions describe additional status of a row that are relevant for a human user. These conditions
// apply to the row, not to the object, and will be specific to table output. The only defined
// condition type is 'Completed', for a row that indicates a resource that has run to completion and
// can be given less visual priority.
// +optional
+ // +listType=atomic
Conditions []TableRowCondition `json:"conditions,omitempty"`
// This field contains the requested additional information about each object based on the includeObject
// policy when requesting the Table. If "None", this field is empty, if "Object" this will be the
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types_swagger_doc_generated.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types_swagger_doc_generated.go
index 088ff01f0..1fa37215c 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types_swagger_doc_generated.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types_swagger_doc_generated.go
@@ -24,7 +24,7 @@ package v1
// they are on one line! For multiple line or blocks that you want to ignore use ---.
// Any context after a --- is ignored.
//
-// Those methods can be generated by using hack/update-generated-swagger-docs.sh
+// Those methods can be generated by using hack/update-codegen.sh
// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT.
var map_APIGroup = map[string]string{
@@ -115,7 +115,7 @@ var map_CreateOptions = map[string]string{
"": "CreateOptions may be provided when creating an API object.",
"dryRun": "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed",
"fieldManager": "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.",
- "fieldValidation": "fieldValidation determines how the server should respond to unknown/duplicate fields in the object in the request. Introduced as alpha in 1.23, older servers or servers with the `ServerSideFieldValidation` feature disabled will discard valid values specified in this param and not perform any server side field validation. Valid values are: - Ignore: ignores unknown/duplicate fields. - Warn: responds with a warning for each unknown/duplicate field, but successfully serves the request. - Strict: fails the request on unknown/duplicate fields.",
+ "fieldValidation": "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.",
}
func (CreateOptions) SwaggerDoc() map[string]string {
@@ -135,6 +135,17 @@ func (DeleteOptions) SwaggerDoc() map[string]string {
return map_DeleteOptions
}
+var map_FieldSelectorRequirement = map[string]string{
+ "": "FieldSelectorRequirement is a selector that contains values, a key, and an operator that relates the key and values.",
+ "key": "key is the field selector key that the requirement applies to.",
+ "operator": "operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. The list of operators may grow in the future.",
+ "values": "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty.",
+}
+
+func (FieldSelectorRequirement) SwaggerDoc() map[string]string {
+ return map_FieldSelectorRequirement
+}
+
var map_FieldsV1 = map[string]string{
"": "FieldsV1 stores a set of fields in a data structure like a Trie, in JSON format.\n\nEach key is either a '.' representing the field itself, and will always map to an empty set, or a string representing a sub-field or item. The string will follow one of these four formats: 'f:', where is the name of a field in a struct, or key in a map 'v:', where is the exact json formatted value of a list item 'i:', where is position of a item in a list 'k:', where is a map of a list item's key fields to their unique values If a key maps to an empty Fields value, the field that key represents is part of the set.\n\nThe exact format is defined in sigs.k8s.io/structured-merge-diff",
}
@@ -195,7 +206,7 @@ func (List) SwaggerDoc() map[string]string {
var map_ListMeta = map[string]string{
"": "ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.",
- "selfLink": "selfLink is a URL representing this object. Populated by the system. Read-only.\n\nDEPRECATED Kubernetes will stop propagating this field in 1.20 release and the field is planned to be removed in 1.21 release.",
+ "selfLink": "Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.",
"resourceVersion": "String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency",
"continue": "continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message.",
"remainingItemCount": "remainingItemCount is the number of subsequent items in the list which are not included in this list response. If the list request contained label or field selectors, then the number of remaining items is unknown and the field will be left unset and omitted during serialization. If the list is complete (either because it is not chunking or because this is the last chunk), then there are no more remaining items and this field will be left unset and omitted during serialization. Servers older than v1.15 do not set this field. The intended use of the remainingItemCount is *estimating* the size of a collection. Clients should not rely on the remainingItemCount to be set or to be exact.",
@@ -216,6 +227,7 @@ var map_ListOptions = map[string]string{
"timeoutSeconds": "Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.",
"limit": "limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.\n\nThe server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.",
"continue": "The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".\n\nThis field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.",
+ "sendInitialEvents": "`sendInitialEvents=true` may be set together with `watch=true`. In that case, the watch stream will begin with synthetic events to produce the current state of objects in the collection. Once all such events have been sent, a synthetic \"Bookmark\" event will be sent. The bookmark will report the ResourceVersion (RV) corresponding to the set of objects, and be marked with `\"k8s.io/initial-events-end\": \"true\"` annotation. Afterwards, the watch stream will proceed as usual, sending watch events corresponding to changes (subsequent to the RV) to objects watched.\n\nWhen `sendInitialEvents` option is set, we require `resourceVersionMatch` option to also be set. The semantic of the watch request is as following: - `resourceVersionMatch` = NotOlderThan\n is interpreted as \"data at least as new as the provided `resourceVersion`\"\n and the bookmark event is send when the state is synced\n to a `resourceVersion` at least as fresh as the one provided by the ListOptions.\n If `resourceVersion` is unset, this is interpreted as \"consistent read\" and the\n bookmark event is send when the state is synced at least to the moment\n when request started being processed.\n- `resourceVersionMatch` set to any other value or unset\n Invalid error is returned.\n\nDefaults to true if `resourceVersion=\"\"` or `resourceVersion=\"0\"` (for backward compatibility reasons) and to false otherwise.",
}
func (ListOptions) SwaggerDoc() map[string]string {
@@ -227,7 +239,7 @@ var map_ManagedFieldsEntry = map[string]string{
"manager": "Manager is an identifier of the workflow managing these fields.",
"operation": "Operation is the type of operation which lead to this ManagedFieldsEntry being created. The only valid values for this field are 'Apply' and 'Update'.",
"apiVersion": "APIVersion defines the version of this resource that this field set applies to. The format is \"group/version\" just like the top-level APIVersion field. It is necessary to track the version of a field set because it cannot be automatically converted.",
- "time": "Time is timestamp of when these fields were set. It should always be empty if Operation is 'Apply'",
+ "time": "Time is the timestamp of when the ManagedFields entry was added. The timestamp will also be updated if a field is added, the manager changes any of the owned fields value or removes a field. The timestamp does not update when a field is removed from the entry because another manager took it over.",
"fieldsType": "FieldsType is the discriminator for the different fields format and version. There is currently only one possible value: \"FieldsV1\"",
"fieldsV1": "FieldsV1 holds the first JSON version format as described in the \"FieldsV1\" type.",
"subresource": "Subresource is the name of the subresource used to update that object, or empty string if the object was updated through the main resource. The value of this field is used to distinguish between managers, even if they share the same name. For example, a status update will be distinct from a regular update using the same manager name. Note that the APIVersion field is not related to the Subresource field and it always corresponds to the version of the main resource.",
@@ -239,21 +251,20 @@ func (ManagedFieldsEntry) SwaggerDoc() map[string]string {
var map_ObjectMeta = map[string]string{
"": "ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.",
- "name": "Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names",
- "generateName": "GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header).\n\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency",
- "namespace": "Namespace defines the space within which each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces",
- "selfLink": "SelfLink is a URL representing this object. Populated by the system. Read-only.\n\nDEPRECATED Kubernetes will stop propagating this field in 1.20 release and the field is planned to be removed in 1.21 release.",
- "uid": "UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\n\nPopulated by the system. Read-only. More info: http://kubernetes.io/docs/user-guide/identifiers#uids",
+ "name": "Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names",
+ "generateName": "GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will return a 409.\n\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency",
+ "namespace": "Namespace defines the space within which each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces",
+ "selfLink": "Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.",
+ "uid": "UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\n\nPopulated by the system. Read-only. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids",
"resourceVersion": "An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\n\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency",
"generation": "A sequence number representing a specific generation of the desired state. Populated by the system. Read-only.",
"creationTimestamp": "CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.\n\nPopulated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
"deletionTimestamp": "DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field, once the finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. Once the deletionTimestamp is set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested.\n\nPopulated by the system when a graceful deletion is requested. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
"deletionGracePeriodSeconds": "Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only.",
- "labels": "Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels",
- "annotations": "Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations",
+ "labels": "Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels",
+ "annotations": "Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations",
"ownerReferences": "List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.",
"finalizers": "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. Finalizers may be processed and removed in any order. Order is NOT enforced because it introduces significant risk of stuck finalizers. finalizers is a shared field, any actor with permission can reorder it. If the finalizer list is processed in order, then this can lead to a situation in which the component responsible for the first finalizer in the list is waiting for a signal (field value, external system, or other) produced by a component responsible for a finalizer later in the list, resulting in a deadlock. Without enforced ordering finalizers are free to order amongst themselves and are not vulnerable to ordering changes in the list.",
- "clusterName": "The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.",
"managedFields": "ManagedFields maps workflow-id and version to the set of fields that are managed by that workflow. This is mostly for internal housekeeping, and users typically shouldn't need to set or understand this field. A workflow can be the user's name, a controller's name, or the name of a specific apply path like \"ci-cd\". The set of fields is always in the version that the workflow used when modifying the object.",
}
@@ -265,10 +276,10 @@ var map_OwnerReference = map[string]string{
"": "OwnerReference contains enough information to let you identify an owning object. An owning object must be in the same namespace as the dependent, or be cluster-scoped, so there is no namespace field.",
"apiVersion": "API version of the referent.",
"kind": "Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
- "name": "Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names",
- "uid": "UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#uids",
+ "name": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names",
+ "uid": "UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids",
"controller": "If true, this reference points to the managing controller.",
- "blockOwnerDeletion": "If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.",
+ "blockOwnerDeletion": "If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. See https://kubernetes.io/docs/concepts/architecture/garbage-collection/#foreground-deletion for how the garbage collector interacts with this field and enforces the foreground deletion. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.",
}
func (OwnerReference) SwaggerDoc() map[string]string {
@@ -307,7 +318,7 @@ var map_PatchOptions = map[string]string{
"dryRun": "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed",
"force": "Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests.",
"fieldManager": "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).",
- "fieldValidation": "fieldValidation determines how the server should respond to unknown/duplicate fields in the object in the request. Introduced as alpha in 1.23, older servers or servers with the `ServerSideFieldValidation` feature disabled will discard valid values specified in this param and not perform any server side field validation. Valid values are: - Ignore: ignores unknown/duplicate fields. - Warn: responds with a warning for each unknown/duplicate field, but successfully serves the request. - Strict: fails the request on unknown/duplicate fields.",
+ "fieldValidation": "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.",
}
func (PatchOptions) SwaggerDoc() map[string]string {
@@ -373,7 +384,7 @@ var map_StatusDetails = map[string]string{
"name": "The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).",
"group": "The group attribute of the resource associated with the status StatusReason.",
"kind": "The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
- "uid": "UID of the resource. (when there is a single resource which can be described). More info: http://kubernetes.io/docs/user-guide/identifiers#uids",
+ "uid": "UID of the resource. (when there is a single resource which can be described). More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids",
"causes": "The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.",
"retryAfterSeconds": "If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.",
}
@@ -452,7 +463,7 @@ var map_UpdateOptions = map[string]string{
"": "UpdateOptions may be provided when updating an API object. All fields in UpdateOptions should also be present in PatchOptions.",
"dryRun": "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed",
"fieldManager": "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.",
- "fieldValidation": "fieldValidation determines how the server should respond to unknown/duplicate fields in the object in the request. Introduced as alpha in 1.23, older servers or servers with the `ServerSideFieldValidation` feature disabled will discard valid values specified in this param and not perform any server side field validation. Valid values are: - Ignore: ignores unknown/duplicate fields. - Warn: responds with a warning for each unknown/duplicate field, but successfully serves the request. - Strict: fails the request on unknown/duplicate fields.",
+ "fieldValidation": "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.",
}
func (UpdateOptions) SwaggerDoc() map[string]string {
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go
index d26c6cff4..0f58d66c0 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go
@@ -173,7 +173,7 @@ func NestedStringMap(obj map[string]interface{}, fields ...string) (map[string]s
if str, ok := v.(string); ok {
strMap[k] = str
} else {
- return nil, false, fmt.Errorf("%v accessor error: contains non-string key in the map: %v is of the type %T, expected string", jsonPath(fields), v, v)
+ return nil, false, fmt.Errorf("%v accessor error: contains non-string value in the map under key %q: %v is of the type %T, expected string", jsonPath(fields), k, v, v)
}
}
return strMap, true, nil
@@ -340,6 +340,7 @@ func (s unstructuredJSONScheme) Decode(data []byte, _ *schema.GroupVersionKind,
if len(gvk.Kind) == 0 {
return nil, &gvk, runtime.NewMissingKindErr(string(data))
}
+ // TODO(109023): require apiVersion here as well
return obj, &gvk, nil
}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured.go
index d1903394d..40d289f37 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured.go
@@ -101,6 +101,11 @@ func (obj *Unstructured) EachListItem(fn func(runtime.Object) error) error {
return nil
}
+func (obj *Unstructured) EachListItemWithAlloc(fn func(runtime.Object) error) error {
+ // EachListItem has allocated a new Object for the user, we can use it directly.
+ return obj.EachListItem(fn)
+}
+
func (obj *Unstructured) UnstructuredContent() map[string]interface{} {
if obj.Object == nil {
return make(map[string]interface{})
@@ -444,18 +449,6 @@ func (u *Unstructured) SetFinalizers(finalizers []string) {
u.setNestedStringSlice(finalizers, "metadata", "finalizers")
}
-func (u *Unstructured) GetClusterName() string {
- return getNestedString(u.Object, "metadata", "clusterName")
-}
-
-func (u *Unstructured) SetClusterName(clusterName string) {
- if len(clusterName) == 0 {
- RemoveNestedField(u.Object, "metadata", "clusterName")
- return
- }
- u.setNestedField(clusterName, "metadata", "clusterName")
-}
-
func (u *Unstructured) GetManagedFields() []metav1.ManagedFieldsEntry {
items, found, err := NestedSlice(u.Object, "metadata", "managedFields")
if !found || err != nil {
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go
index 5028f5fb5..82beda2a2 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go
@@ -52,6 +52,15 @@ func (u *UnstructuredList) EachListItem(fn func(runtime.Object) error) error {
return nil
}
+func (u *UnstructuredList) EachListItemWithAlloc(fn func(runtime.Object) error) error {
+ for i := range u.Items {
+ if err := fn(&Unstructured{Object: u.Items[i].Object}); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
// NewEmptyInstance returns a new instance of the concrete type containing only kind/apiVersion and no other data.
// This should be called instead of reflect.New() for unstructured types because the go type alone does not preserve kind/apiVersion info.
func (u *UnstructuredList) NewEmptyInstance() runtime.Unstructured {
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go
new file mode 100644
index 000000000..3eba5ba54
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go
@@ -0,0 +1,359 @@
+/*
+Copyright 2015 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package validation
+
+import (
+ "fmt"
+ "regexp"
+ "unicode"
+
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/types"
+ "k8s.io/apimachinery/pkg/util/sets"
+ "k8s.io/apimachinery/pkg/util/validation"
+ "k8s.io/apimachinery/pkg/util/validation/field"
+)
+
+// LabelSelectorValidationOptions is a struct that can be passed to ValidateLabelSelector to record the validate options
+type LabelSelectorValidationOptions struct {
+ // Allow invalid label value in selector
+ AllowInvalidLabelValueInSelector bool
+
+ // Allows an operator that is not interpretable to pass validation. This is useful for cases where a broader check
+ // can be performed, as in a *SubjectAccessReview
+ AllowUnknownOperatorInRequirement bool
+}
+
+// LabelSelectorHasInvalidLabelValue returns true if the given selector contains an invalid label value in a match expression.
+// This is useful for determining whether AllowInvalidLabelValueInSelector should be set to true when validating an update
+// based on existing persisted invalid values.
+func LabelSelectorHasInvalidLabelValue(ps *metav1.LabelSelector) bool {
+ if ps == nil {
+ return false
+ }
+ for _, e := range ps.MatchExpressions {
+ for _, v := range e.Values {
+ if len(validation.IsValidLabelValue(v)) > 0 {
+ return true
+ }
+ }
+ }
+ return false
+}
+
+// ValidateLabelSelector validate the LabelSelector according to the opts and returns any validation errors.
+// opts.AllowInvalidLabelValueInSelector is only expected to be set to true when required for backwards compatibility with existing invalid data.
+func ValidateLabelSelector(ps *metav1.LabelSelector, opts LabelSelectorValidationOptions, fldPath *field.Path) field.ErrorList {
+ allErrs := field.ErrorList{}
+ if ps == nil {
+ return allErrs
+ }
+ allErrs = append(allErrs, ValidateLabels(ps.MatchLabels, fldPath.Child("matchLabels"))...)
+ for i, expr := range ps.MatchExpressions {
+ allErrs = append(allErrs, ValidateLabelSelectorRequirement(expr, opts, fldPath.Child("matchExpressions").Index(i))...)
+ }
+ return allErrs
+}
+
+// ValidateLabelSelectorRequirement validate the requirement according to the opts and returns any validation errors.
+// opts.AllowInvalidLabelValueInSelector is only expected to be set to true when required for backwards compatibility with existing invalid data.
+func ValidateLabelSelectorRequirement(sr metav1.LabelSelectorRequirement, opts LabelSelectorValidationOptions, fldPath *field.Path) field.ErrorList {
+ allErrs := field.ErrorList{}
+ switch sr.Operator {
+ case metav1.LabelSelectorOpIn, metav1.LabelSelectorOpNotIn:
+ if len(sr.Values) == 0 {
+ allErrs = append(allErrs, field.Required(fldPath.Child("values"), "must be specified when `operator` is 'In' or 'NotIn'"))
+ }
+ case metav1.LabelSelectorOpExists, metav1.LabelSelectorOpDoesNotExist:
+ if len(sr.Values) > 0 {
+ allErrs = append(allErrs, field.Forbidden(fldPath.Child("values"), "may not be specified when `operator` is 'Exists' or 'DoesNotExist'"))
+ }
+ default:
+ if !opts.AllowUnknownOperatorInRequirement {
+ allErrs = append(allErrs, field.Invalid(fldPath.Child("operator"), sr.Operator, "not a valid selector operator"))
+ }
+ }
+ allErrs = append(allErrs, ValidateLabelName(sr.Key, fldPath.Child("key"))...)
+ if !opts.AllowInvalidLabelValueInSelector {
+ for valueIndex, value := range sr.Values {
+ for _, msg := range validation.IsValidLabelValue(value) {
+ allErrs = append(allErrs, field.Invalid(fldPath.Child("values").Index(valueIndex), value, msg))
+ }
+ }
+ }
+ return allErrs
+}
+
+// ValidateLabelName validates that the label name is correctly defined.
+func ValidateLabelName(labelName string, fldPath *field.Path) field.ErrorList {
+ allErrs := field.ErrorList{}
+ for _, msg := range validation.IsQualifiedName(labelName) {
+ allErrs = append(allErrs, field.Invalid(fldPath, labelName, msg))
+ }
+ return allErrs
+}
+
+// ValidateLabels validates that a set of labels are correctly defined.
+func ValidateLabels(labels map[string]string, fldPath *field.Path) field.ErrorList {
+ allErrs := field.ErrorList{}
+ for k, v := range labels {
+ allErrs = append(allErrs, ValidateLabelName(k, fldPath)...)
+ for _, msg := range validation.IsValidLabelValue(v) {
+ allErrs = append(allErrs, field.Invalid(fldPath, v, msg))
+ }
+ }
+ return allErrs
+}
+
+// FieldSelectorValidationOptions is a struct that can be passed to ValidateFieldSelectorRequirement to record the validate options
+type FieldSelectorValidationOptions struct {
+ // Allows an operator that is not interpretable to pass validation. This is useful for cases where a broader check
+ // can be performed, as in a *SubjectAccessReview
+ AllowUnknownOperatorInRequirement bool
+}
+
+// ValidateLabelSelectorRequirement validates the requirement according to the opts and returns any validation errors.
+func ValidateFieldSelectorRequirement(requirement metav1.FieldSelectorRequirement, opts FieldSelectorValidationOptions, fldPath *field.Path) field.ErrorList {
+ allErrs := field.ErrorList{}
+
+ if len(requirement.Key) == 0 {
+ allErrs = append(allErrs, field.Required(fldPath.Child("key"), "must be specified"))
+ }
+
+ switch requirement.Operator {
+ case metav1.FieldSelectorOpIn, metav1.FieldSelectorOpNotIn:
+ if len(requirement.Values) == 0 {
+ allErrs = append(allErrs, field.Required(fldPath.Child("values"), "must be specified when `operator` is 'In' or 'NotIn'"))
+ }
+ case metav1.FieldSelectorOpExists, metav1.FieldSelectorOpDoesNotExist:
+ if len(requirement.Values) > 0 {
+ allErrs = append(allErrs, field.Forbidden(fldPath.Child("values"), "may not be specified when `operator` is 'Exists' or 'DoesNotExist'"))
+ }
+ default:
+ if !opts.AllowUnknownOperatorInRequirement {
+ allErrs = append(allErrs, field.Invalid(fldPath.Child("operator"), requirement.Operator, "not a valid selector operator"))
+ }
+ }
+
+ return allErrs
+}
+
+func ValidateDeleteOptions(options *metav1.DeleteOptions) field.ErrorList {
+ allErrs := field.ErrorList{}
+ //lint:file-ignore SA1019 Keep validation for deprecated OrphanDependents option until it's being removed
+ if options.OrphanDependents != nil && options.PropagationPolicy != nil {
+ allErrs = append(allErrs, field.Invalid(field.NewPath("propagationPolicy"), options.PropagationPolicy, "orphanDependents and deletionPropagation cannot be both set"))
+ }
+ if options.PropagationPolicy != nil &&
+ *options.PropagationPolicy != metav1.DeletePropagationForeground &&
+ *options.PropagationPolicy != metav1.DeletePropagationBackground &&
+ *options.PropagationPolicy != metav1.DeletePropagationOrphan {
+ allErrs = append(allErrs, field.NotSupported(field.NewPath("propagationPolicy"), options.PropagationPolicy, []string{string(metav1.DeletePropagationForeground), string(metav1.DeletePropagationBackground), string(metav1.DeletePropagationOrphan), "nil"}))
+ }
+ allErrs = append(allErrs, ValidateDryRun(field.NewPath("dryRun"), options.DryRun)...)
+ return allErrs
+}
+
+func ValidateCreateOptions(options *metav1.CreateOptions) field.ErrorList {
+ allErrs := field.ErrorList{}
+ allErrs = append(allErrs, ValidateFieldManager(options.FieldManager, field.NewPath("fieldManager"))...)
+ allErrs = append(allErrs, ValidateDryRun(field.NewPath("dryRun"), options.DryRun)...)
+ allErrs = append(allErrs, ValidateFieldValidation(field.NewPath("fieldValidation"), options.FieldValidation)...)
+ return allErrs
+}
+
+func ValidateUpdateOptions(options *metav1.UpdateOptions) field.ErrorList {
+ allErrs := field.ErrorList{}
+ allErrs = append(allErrs, ValidateFieldManager(options.FieldManager, field.NewPath("fieldManager"))...)
+ allErrs = append(allErrs, ValidateDryRun(field.NewPath("dryRun"), options.DryRun)...)
+ allErrs = append(allErrs, ValidateFieldValidation(field.NewPath("fieldValidation"), options.FieldValidation)...)
+ return allErrs
+}
+
+func ValidatePatchOptions(options *metav1.PatchOptions, patchType types.PatchType) field.ErrorList {
+ allErrs := field.ErrorList{}
+ if patchType != types.ApplyPatchType {
+ if options.Force != nil {
+ allErrs = append(allErrs, field.Forbidden(field.NewPath("force"), "may not be specified for non-apply patch"))
+ }
+ } else {
+ if options.FieldManager == "" {
+ // This field is defaulted to "kubectl" by kubectl, but HAS TO be explicitly set by controllers.
+ allErrs = append(allErrs, field.Required(field.NewPath("fieldManager"), "is required for apply patch"))
+ }
+ }
+ allErrs = append(allErrs, ValidateFieldManager(options.FieldManager, field.NewPath("fieldManager"))...)
+ allErrs = append(allErrs, ValidateDryRun(field.NewPath("dryRun"), options.DryRun)...)
+ allErrs = append(allErrs, ValidateFieldValidation(field.NewPath("fieldValidation"), options.FieldValidation)...)
+ return allErrs
+}
+
+var FieldManagerMaxLength = 128
+
+// ValidateFieldManager valides that the fieldManager is the proper length and
+// only has printable characters.
+func ValidateFieldManager(fieldManager string, fldPath *field.Path) field.ErrorList {
+ allErrs := field.ErrorList{}
+ // the field can not be set as a `*string`, so a empty string ("") is
+ // considered as not set and is defaulted by the rest of the process
+ // (unless apply is used, in which case it is required).
+ if len(fieldManager) > FieldManagerMaxLength {
+ allErrs = append(allErrs, field.TooLong(fldPath, fieldManager, FieldManagerMaxLength))
+ }
+ // Verify that all characters are printable.
+ for i, r := range fieldManager {
+ if !unicode.IsPrint(r) {
+ allErrs = append(allErrs, field.Invalid(fldPath, fieldManager, fmt.Sprintf("invalid character %#U (at position %d)", r, i)))
+ }
+ }
+
+ return allErrs
+}
+
+var allowedDryRunValues = sets.NewString(metav1.DryRunAll)
+
+// ValidateDryRun validates that a dryRun query param only contains allowed values.
+func ValidateDryRun(fldPath *field.Path, dryRun []string) field.ErrorList {
+ allErrs := field.ErrorList{}
+ if !allowedDryRunValues.HasAll(dryRun...) {
+ allErrs = append(allErrs, field.NotSupported(fldPath, dryRun, allowedDryRunValues.List()))
+ }
+ return allErrs
+}
+
+var allowedFieldValidationValues = sets.NewString("", metav1.FieldValidationIgnore, metav1.FieldValidationWarn, metav1.FieldValidationStrict)
+
+// ValidateFieldValidation validates that a fieldValidation query param only contains allowed values.
+func ValidateFieldValidation(fldPath *field.Path, fieldValidation string) field.ErrorList {
+ allErrs := field.ErrorList{}
+ if !allowedFieldValidationValues.Has(fieldValidation) {
+ allErrs = append(allErrs, field.NotSupported(fldPath, fieldValidation, allowedFieldValidationValues.List()))
+ }
+ return allErrs
+
+}
+
+const UninitializedStatusUpdateErrorMsg string = `must not update status when the object is uninitialized`
+
+// ValidateTableOptions returns any invalid flags on TableOptions.
+func ValidateTableOptions(opts *metav1.TableOptions) field.ErrorList {
+ var allErrs field.ErrorList
+ switch opts.IncludeObject {
+ case metav1.IncludeMetadata, metav1.IncludeNone, metav1.IncludeObject, "":
+ default:
+ allErrs = append(allErrs, field.Invalid(field.NewPath("includeObject"), opts.IncludeObject, "must be 'Metadata', 'Object', 'None', or empty"))
+ }
+ return allErrs
+}
+
+const MaxSubresourceNameLength = 256
+
+func ValidateManagedFields(fieldsList []metav1.ManagedFieldsEntry, fldPath *field.Path) field.ErrorList {
+ var allErrs field.ErrorList
+ for i, fields := range fieldsList {
+ fldPath := fldPath.Index(i)
+ switch fields.Operation {
+ case metav1.ManagedFieldsOperationApply, metav1.ManagedFieldsOperationUpdate:
+ default:
+ allErrs = append(allErrs, field.Invalid(fldPath.Child("operation"), fields.Operation, "must be `Apply` or `Update`"))
+ }
+ if len(fields.FieldsType) > 0 && fields.FieldsType != "FieldsV1" {
+ allErrs = append(allErrs, field.Invalid(fldPath.Child("fieldsType"), fields.FieldsType, "must be `FieldsV1`"))
+ }
+ allErrs = append(allErrs, ValidateFieldManager(fields.Manager, fldPath.Child("manager"))...)
+
+ if len(fields.Subresource) > MaxSubresourceNameLength {
+ allErrs = append(allErrs, field.TooLong(fldPath.Child("subresource"), fields.Subresource, MaxSubresourceNameLength))
+ }
+ }
+ return allErrs
+}
+
+func ValidateConditions(conditions []metav1.Condition, fldPath *field.Path) field.ErrorList {
+ var allErrs field.ErrorList
+
+ conditionTypeToFirstIndex := map[string]int{}
+ for i, condition := range conditions {
+ if _, ok := conditionTypeToFirstIndex[condition.Type]; ok {
+ allErrs = append(allErrs, field.Duplicate(fldPath.Index(i).Child("type"), condition.Type))
+ } else {
+ conditionTypeToFirstIndex[condition.Type] = i
+ }
+
+ allErrs = append(allErrs, ValidateCondition(condition, fldPath.Index(i))...)
+ }
+
+ return allErrs
+}
+
+// validConditionStatuses is used internally to check validity and provide a good message
+var validConditionStatuses = sets.NewString(string(metav1.ConditionTrue), string(metav1.ConditionFalse), string(metav1.ConditionUnknown))
+
+const (
+ maxReasonLen = 1 * 1024
+ maxMessageLen = 32 * 1024
+)
+
+func ValidateCondition(condition metav1.Condition, fldPath *field.Path) field.ErrorList {
+ var allErrs field.ErrorList
+
+ // type is set and is a valid format
+ allErrs = append(allErrs, ValidateLabelName(condition.Type, fldPath.Child("type"))...)
+
+ // status is set and is an accepted value
+ if !validConditionStatuses.Has(string(condition.Status)) {
+ allErrs = append(allErrs, field.NotSupported(fldPath.Child("status"), condition.Status, validConditionStatuses.List()))
+ }
+
+ if condition.ObservedGeneration < 0 {
+ allErrs = append(allErrs, field.Invalid(fldPath.Child("observedGeneration"), condition.ObservedGeneration, "must be greater than or equal to zero"))
+ }
+
+ if condition.LastTransitionTime.IsZero() {
+ allErrs = append(allErrs, field.Required(fldPath.Child("lastTransitionTime"), "must be set"))
+ }
+
+ if len(condition.Reason) == 0 {
+ allErrs = append(allErrs, field.Required(fldPath.Child("reason"), "must be set"))
+ } else {
+ for _, currErr := range isValidConditionReason(condition.Reason) {
+ allErrs = append(allErrs, field.Invalid(fldPath.Child("reason"), condition.Reason, currErr))
+ }
+ if len(condition.Reason) > maxReasonLen {
+ allErrs = append(allErrs, field.TooLong(fldPath.Child("reason"), condition.Reason, maxReasonLen))
+ }
+ }
+
+ if len(condition.Message) > maxMessageLen {
+ allErrs = append(allErrs, field.TooLong(fldPath.Child("message"), condition.Message, maxMessageLen))
+ }
+
+ return allErrs
+}
+
+const conditionReasonFmt string = "[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?"
+const conditionReasonErrMsg string = "a condition reason must start with alphabetic character, optionally followed by a string of alphanumeric characters or '_,:', and must end with an alphanumeric character or '_'"
+
+var conditionReasonRegexp = regexp.MustCompile("^" + conditionReasonFmt + "$")
+
+// isValidConditionReason tests for a string that conforms to rules for condition reasons. This checks the format, but not the length.
+func isValidConditionReason(value string) []string {
+ if !conditionReasonRegexp.MatchString(value) {
+ return []string{validation.RegexError(conditionReasonErrMsg, conditionReasonFmt, "my_name", "MY_NAME", "MyName", "ReasonA,ReasonB", "ReasonA:ReasonB")}
+ }
+ return nil
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go
index b7590f0b3..afe01ed5a 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go
@@ -426,6 +426,13 @@ func autoConvert_url_Values_To_v1_ListOptions(in *url.Values, out *ListOptions,
} else {
out.Continue = ""
}
+ if values, ok := map[string][]string(*in)["sendInitialEvents"]; ok && len(values) > 0 {
+ if err := runtime.Convert_Slice_string_To_Pointer_bool(&values, &out.SendInitialEvents, s); err != nil {
+ return err
+ }
+ } else {
+ out.SendInitialEvents = nil
+ }
return nil
}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go
index 418e6099f..90cc54a7e 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go
@@ -327,6 +327,27 @@ func (in *Duration) DeepCopy() *Duration {
return out
}
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *FieldSelectorRequirement) DeepCopyInto(out *FieldSelectorRequirement) {
+ *out = *in
+ if in.Values != nil {
+ in, out := &in.Values, &out.Values
+ *out = make([]string, len(*in))
+ copy(*out, *in)
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FieldSelectorRequirement.
+func (in *FieldSelectorRequirement) DeepCopy() *FieldSelectorRequirement {
+ if in == nil {
+ return nil
+ }
+ out := new(FieldSelectorRequirement)
+ in.DeepCopyInto(out)
+ return out
+}
+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *FieldsV1) DeepCopyInto(out *FieldsV1) {
*out = *in
@@ -602,6 +623,11 @@ func (in *ListOptions) DeepCopyInto(out *ListOptions) {
*out = new(int64)
**out = **in
}
+ if in.SendInitialEvents != nil {
+ in, out := &in.SendInitialEvents, &out.SendInitialEvents
+ *out = new(bool)
+ **out = **in
+ }
return
}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.pb.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.pb.go
index a5a949679..819d936fe 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.pb.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.pb.go
@@ -15,7 +15,7 @@ limitations under the License.
*/
// Code generated by protoc-gen-gogo. DO NOT EDIT.
-// source: k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto
+// source: k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto
package v1beta1
@@ -47,7 +47,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
func (m *PartialObjectMetadataList) Reset() { *m = PartialObjectMetadataList{} }
func (*PartialObjectMetadataList) ProtoMessage() {}
func (*PartialObjectMetadataList) Descriptor() ([]byte, []int) {
- return fileDescriptor_90ec10f86b91f9a8, []int{0}
+ return fileDescriptor_39237a8d8061b52f, []int{0}
}
func (m *PartialObjectMetadataList) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -77,31 +77,30 @@ func init() {
}
func init() {
- proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto", fileDescriptor_90ec10f86b91f9a8)
+ proto.RegisterFile("k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto", fileDescriptor_39237a8d8061b52f)
}
-var fileDescriptor_90ec10f86b91f9a8 = []byte{
- // 317 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0x41, 0x4b, 0xf3, 0x30,
- 0x1c, 0xc6, 0x9b, 0xf7, 0x65, 0x38, 0x3a, 0x04, 0xd9, 0x69, 0xee, 0x90, 0x0d, 0x4f, 0xf3, 0xb0,
- 0x84, 0x0d, 0x11, 0xc1, 0xdb, 0x6e, 0x82, 0xa2, 0xec, 0x28, 0x1e, 0x4c, 0xbb, 0xbf, 0x5d, 0xac,
- 0x69, 0x4a, 0xf2, 0xef, 0xc0, 0x9b, 0x1f, 0xc1, 0x8f, 0xb5, 0xe3, 0x8e, 0x03, 0x61, 0xb8, 0xf8,
- 0x45, 0x24, 0x5d, 0x15, 0x19, 0x0a, 0xbb, 0xf5, 0x79, 0xca, 0xef, 0x97, 0x27, 0x24, 0x1c, 0xa7,
- 0x67, 0x96, 0x49, 0xcd, 0xd3, 0x22, 0x02, 0x93, 0x01, 0x82, 0xe5, 0x33, 0xc8, 0x26, 0xda, 0xf0,
- 0xea, 0x87, 0xc8, 0xa5, 0x12, 0xf1, 0x54, 0x66, 0x60, 0x9e, 0x79, 0x9e, 0x26, 0xbe, 0xb0, 0x5c,
- 0x01, 0x0a, 0x3e, 0x1b, 0x44, 0x80, 0x62, 0xc0, 0x13, 0xc8, 0xc0, 0x08, 0x84, 0x09, 0xcb, 0x8d,
- 0x46, 0xdd, 0x3c, 0xde, 0xa0, 0xec, 0x27, 0xca, 0xf2, 0x34, 0xf1, 0x85, 0x65, 0x1e, 0x65, 0x15,
- 0xda, 0xee, 0x27, 0x12, 0xa7, 0x45, 0xc4, 0x62, 0xad, 0x78, 0xa2, 0x13, 0xcd, 0x4b, 0x43, 0x54,
- 0x3c, 0x94, 0xa9, 0x0c, 0xe5, 0xd7, 0xc6, 0xdc, 0x3e, 0xd9, 0x65, 0xd4, 0xf6, 0x9e, 0xf6, 0xe9,
- 0x5f, 0x94, 0x29, 0x32, 0x94, 0x0a, 0xb8, 0x8d, 0xa7, 0xa0, 0xc4, 0x36, 0x77, 0xf4, 0x46, 0xc2,
- 0xc3, 0x1b, 0x61, 0x50, 0x8a, 0xa7, 0xeb, 0xe8, 0x11, 0x62, 0xbc, 0x02, 0x14, 0x13, 0x81, 0xe2,
- 0x52, 0x5a, 0x6c, 0xde, 0x85, 0x75, 0x55, 0xe5, 0xd6, 0xbf, 0x2e, 0xe9, 0x35, 0x86, 0x8c, 0xed,
- 0x72, 0x71, 0xe6, 0x69, 0x6f, 0x1a, 0x1d, 0xcc, 0x57, 0x9d, 0xc0, 0xad, 0x3a, 0xf5, 0xaf, 0x66,
- 0xfc, 0x6d, 0x6c, 0xde, 0x87, 0x35, 0x89, 0xa0, 0x6c, 0x8b, 0x74, 0xff, 0xf7, 0x1a, 0xc3, 0xf3,
- 0xdd, 0xd4, 0xbf, 0xae, 0x1d, 0xed, 0x57, 0xe7, 0xd4, 0x2e, 0xbc, 0x71, 0xbc, 0x11, 0x8f, 0xfa,
- 0xf3, 0x35, 0x0d, 0x16, 0x6b, 0x1a, 0x2c, 0xd7, 0x34, 0x78, 0x71, 0x94, 0xcc, 0x1d, 0x25, 0x0b,
- 0x47, 0xc9, 0xd2, 0x51, 0xf2, 0xee, 0x28, 0x79, 0xfd, 0xa0, 0xc1, 0xed, 0x5e, 0xf5, 0x52, 0x9f,
- 0x01, 0x00, 0x00, 0xff, 0xff, 0xf7, 0x82, 0x5b, 0x80, 0x29, 0x02, 0x00, 0x00,
+var fileDescriptor_39237a8d8061b52f = []byte{
+ // 303 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x41, 0x4b, 0xf3, 0x30,
+ 0x1c, 0xc6, 0x9b, 0xf7, 0x65, 0x30, 0x3a, 0x04, 0xd9, 0x69, 0xee, 0x90, 0x0d, 0x4f, 0xdb, 0xc1,
+ 0x84, 0x0d, 0x11, 0xc5, 0xdb, 0x6e, 0x82, 0x32, 0xd9, 0x51, 0x3c, 0x98, 0x76, 0x31, 0x8b, 0x35,
+ 0x4d, 0x69, 0xfe, 0x15, 0xbc, 0xf9, 0x11, 0xfc, 0x58, 0x3d, 0xee, 0x38, 0x10, 0x86, 0x8d, 0x5f,
+ 0x44, 0xd2, 0x56, 0x91, 0xa1, 0xd0, 0x5b, 0x9e, 0x07, 0x7e, 0xbf, 0x3c, 0x81, 0xf8, 0x67, 0xd1,
+ 0xa9, 0x21, 0x52, 0x53, 0x96, 0x48, 0xc5, 0xc2, 0x95, 0x8c, 0x79, 0xfa, 0x4c, 0x93, 0x48, 0xb8,
+ 0xc2, 0x50, 0xc5, 0x81, 0xd1, 0xa7, 0x49, 0xc0, 0x81, 0x4d, 0xa8, 0xe0, 0x31, 0x4f, 0x19, 0xf0,
+ 0x25, 0x49, 0x52, 0x0d, 0xba, 0x3b, 0xae, 0x50, 0xf2, 0x13, 0x25, 0x49, 0x24, 0x5c, 0x61, 0x88,
+ 0x43, 0x49, 0x8d, 0xf6, 0x8f, 0x84, 0x84, 0x55, 0x16, 0x90, 0x50, 0x2b, 0x2a, 0xb4, 0xd0, 0xb4,
+ 0x34, 0x04, 0xd9, 0x7d, 0x99, 0xca, 0x50, 0x9e, 0x2a, 0x73, 0xff, 0xb8, 0xc9, 0xa8, 0xdd, 0x3d,
+ 0xfd, 0x93, 0xbf, 0xa8, 0x34, 0x8b, 0x41, 0x2a, 0x4e, 0x4d, 0xb8, 0xe2, 0x8a, 0xed, 0x72, 0x87,
+ 0x6f, 0xc8, 0x3f, 0xb8, 0x66, 0x29, 0x48, 0xf6, 0x38, 0x0f, 0x1e, 0x78, 0x08, 0x57, 0x1c, 0xd8,
+ 0x92, 0x01, 0xbb, 0x94, 0x06, 0xba, 0xb7, 0x7e, 0x5b, 0xd5, 0xb9, 0xf7, 0x6f, 0x88, 0x46, 0x9d,
+ 0x29, 0x21, 0x4d, 0x1e, 0x4e, 0x1c, 0xed, 0x4c, 0xb3, 0xfd, 0x7c, 0x3b, 0xf0, 0xec, 0x76, 0xd0,
+ 0xfe, 0x6a, 0x16, 0xdf, 0xc6, 0xee, 0x9d, 0xdf, 0x92, 0xc0, 0x95, 0xe9, 0xa1, 0xe1, 0xff, 0x51,
+ 0x67, 0x7a, 0xde, 0x4c, 0xfd, 0xeb, 0xda, 0xd9, 0x5e, 0x7d, 0x4f, 0xeb, 0xc2, 0x19, 0x17, 0x95,
+ 0x78, 0x36, 0xcf, 0x0b, 0xec, 0xad, 0x0b, 0xec, 0x6d, 0x0a, 0xec, 0xbd, 0x58, 0x8c, 0x72, 0x8b,
+ 0xd1, 0xda, 0x62, 0xb4, 0xb1, 0x18, 0xbd, 0x5b, 0x8c, 0x5e, 0x3f, 0xb0, 0x77, 0x33, 0x6e, 0xfc,
+ 0x0d, 0x3e, 0x03, 0x00, 0x00, 0xff, 0xff, 0xfe, 0x0f, 0xd7, 0x36, 0x32, 0x02, 0x00, 0x00,
}
func (m *PartialObjectMetadataList) Marshal() (dAtA []byte, err error) {
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto
index a209dd456..fcec55354 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto
@@ -25,7 +25,7 @@ import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
// Package-wide variables from generator "generated".
-option go_package = "v1beta1";
+option go_package = "k8s.io/apimachinery/pkg/apis/meta/v1beta1";
// PartialObjectMetadataList contains a list of objects containing only their metadata.
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
@@ -33,9 +33,9 @@ message PartialObjectMetadataList {
// Standard list metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
// +optional
- optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 2;
+ optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 2;
// items contains each of the included items.
- repeated k8s.io.apimachinery.pkg.apis.meta.v1.PartialObjectMetadata items = 1;
+ repeated .k8s.io.apimachinery.pkg.apis.meta.v1.PartialObjectMetadata items = 1;
}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types_swagger_doc_generated.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types_swagger_doc_generated.go
index ef7e7c1e9..dff735dcf 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types_swagger_doc_generated.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types_swagger_doc_generated.go
@@ -24,7 +24,7 @@ package v1beta1
// they are on one line! For multiple line or blocks that you want to ignore use ---.
// Any context after a --- is ignored.
//
-// Those methods can be generated by using hack/update-generated-swagger-docs.sh
+// Those methods can be generated by using hack/update-codegen.sh
// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT.
var map_PartialObjectMetadataList = map[string]string{
diff --git a/vendor/k8s.io/apimachinery/pkg/conversion/converter.go b/vendor/k8s.io/apimachinery/pkg/conversion/converter.go
index ed51a25e3..76b76247c 100644
--- a/vendor/k8s.io/apimachinery/pkg/conversion/converter.go
+++ b/vendor/k8s.io/apimachinery/pkg/conversion/converter.go
@@ -115,10 +115,10 @@ type ConversionFuncs struct {
// previously defined functions.
func (c ConversionFuncs) AddUntyped(a, b interface{}, fn ConversionFunc) error {
tA, tB := reflect.TypeOf(a), reflect.TypeOf(b)
- if tA.Kind() != reflect.Ptr {
+ if tA.Kind() != reflect.Pointer {
return fmt.Errorf("the type %T must be a pointer to register as an untyped conversion", a)
}
- if tB.Kind() != reflect.Ptr {
+ if tB.Kind() != reflect.Pointer {
return fmt.Errorf("the type %T must be a pointer to register as an untyped conversion", b)
}
c.untyped[typePair{tA, tB}] = fn
@@ -179,10 +179,10 @@ func (c *Converter) RegisterGeneratedUntypedConversionFunc(a, b interface{}, fn
func (c *Converter) RegisterIgnoredConversion(from, to interface{}) error {
typeFrom := reflect.TypeOf(from)
typeTo := reflect.TypeOf(to)
- if reflect.TypeOf(from).Kind() != reflect.Ptr {
+ if typeFrom.Kind() != reflect.Pointer {
return fmt.Errorf("expected pointer arg for 'from' param 0, got: %v", typeFrom)
}
- if typeTo.Kind() != reflect.Ptr {
+ if typeTo.Kind() != reflect.Pointer {
return fmt.Errorf("expected pointer arg for 'to' param 1, got: %v", typeTo)
}
c.ignoredUntypedConversions[typePair{typeFrom, typeTo}] = struct{}{}
diff --git a/vendor/k8s.io/apimachinery/pkg/conversion/deep_equal.go b/vendor/k8s.io/apimachinery/pkg/conversion/deep_equal.go
index f21abe1e5..25b2923f2 100644
--- a/vendor/k8s.io/apimachinery/pkg/conversion/deep_equal.go
+++ b/vendor/k8s.io/apimachinery/pkg/conversion/deep_equal.go
@@ -34,3 +34,14 @@ func EqualitiesOrDie(funcs ...interface{}) Equalities {
}
return e
}
+
+// Performs a shallow copy of the equalities map
+func (e Equalities) Copy() Equalities {
+ result := Equalities{reflect.Equalities{}}
+
+ for key, value := range e.Equalities {
+ result.Equalities[key] = value
+ }
+
+ return result
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/conversion/helper.go b/vendor/k8s.io/apimachinery/pkg/conversion/helper.go
index 4ebc1ebc5..7fadd27a4 100644
--- a/vendor/k8s.io/apimachinery/pkg/conversion/helper.go
+++ b/vendor/k8s.io/apimachinery/pkg/conversion/helper.go
@@ -26,7 +26,7 @@ import (
// Returns an error if this is not possible.
func EnforcePtr(obj interface{}) (reflect.Value, error) {
v := reflect.ValueOf(obj)
- if v.Kind() != reflect.Ptr {
+ if v.Kind() != reflect.Pointer {
if v.Kind() == reflect.Invalid {
return reflect.Value{}, fmt.Errorf("expected pointer, but got invalid kind")
}
diff --git a/vendor/k8s.io/apimachinery/pkg/conversion/queryparams/convert.go b/vendor/k8s.io/apimachinery/pkg/conversion/queryparams/convert.go
index 2f0dd0074..b0a9246d9 100644
--- a/vendor/k8s.io/apimachinery/pkg/conversion/queryparams/convert.go
+++ b/vendor/k8s.io/apimachinery/pkg/conversion/queryparams/convert.go
@@ -55,7 +55,7 @@ func jsonTag(field reflect.StructField) (string, bool) {
}
func isPointerKind(kind reflect.Kind) bool {
- return kind == reflect.Ptr
+ return kind == reflect.Pointer
}
func isStructKind(kind reflect.Kind) bool {
@@ -139,7 +139,7 @@ func Convert(obj interface{}) (url.Values, error) {
}
var sv reflect.Value
switch reflect.TypeOf(obj).Kind() {
- case reflect.Ptr, reflect.Interface:
+ case reflect.Pointer, reflect.Interface:
sv = reflect.ValueOf(obj).Elem()
default:
return nil, fmt.Errorf("expecting a pointer or interface")
diff --git a/vendor/k8s.io/apimachinery/pkg/labels/labels.go b/vendor/k8s.io/apimachinery/pkg/labels/labels.go
index 8360d842b..19d823cef 100644
--- a/vendor/k8s.io/apimachinery/pkg/labels/labels.go
+++ b/vendor/k8s.io/apimachinery/pkg/labels/labels.go
@@ -77,6 +77,8 @@ func (ls Set) AsValidatedSelector() (Selector, error) {
// perform any validation.
// According to our measurements this is significantly faster
// in codepaths that matter at high scale.
+// Note: this method copies the Set; if the Set is immutable, consider wrapping it with ValidatedSetSelector
+// instead, which does not copy.
func (ls Set) AsSelectorPreValidated() Selector {
return SelectorFromValidatedSet(ls)
}
diff --git a/vendor/k8s.io/apimachinery/pkg/labels/selector.go b/vendor/k8s.io/apimachinery/pkg/labels/selector.go
index 4c0f25931..9e22a0056 100644
--- a/vendor/k8s.io/apimachinery/pkg/labels/selector.go
+++ b/vendor/k8s.io/apimachinery/pkg/labels/selector.go
@@ -22,12 +22,12 @@ import (
"strconv"
"strings"
- "github.com/google/go-cmp/cmp"
"k8s.io/apimachinery/pkg/selection"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/validation"
"k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/klog/v2"
+ stringslices "k8s.io/utils/strings/slices"
)
var (
@@ -45,6 +45,19 @@ var (
// Requirements is AND of all requirements.
type Requirements []Requirement
+func (r Requirements) String() string {
+ var sb strings.Builder
+
+ for i, requirement := range r {
+ if i > 0 {
+ sb.WriteString(", ")
+ }
+ sb.WriteString(requirement.String())
+ }
+
+ return sb.String()
+}
+
// Selector represents a label selector.
type Selector interface {
// Matches returns true if this selector matches the given set of labels.
@@ -74,9 +87,12 @@ type Selector interface {
RequiresExactMatch(label string) (value string, found bool)
}
+// Sharing this saves 1 alloc per use; this is safe because it's immutable.
+var sharedEverythingSelector Selector = internalSelector{}
+
// Everything returns a selector that matches all labels.
func Everything() Selector {
- return internalSelector{}
+ return sharedEverythingSelector
}
type nothingSelector struct{}
@@ -91,9 +107,12 @@ func (n nothingSelector) RequiresExactMatch(label string) (value string, found b
return "", false
}
+// Sharing this saves 1 alloc per use; this is safe because it's immutable.
+var sharedNothingSelector Selector = nothingSelector{}
+
// Nothing returns a selector that matches no labels
func Nothing() Selector {
- return nothingSelector{}
+ return sharedNothingSelector
}
// NewSelector returns a nil selector
@@ -143,14 +162,12 @@ type Requirement struct {
// NewRequirement is the constructor for a Requirement.
// If any of these rules is violated, an error is returned:
-// (1) The operator can only be In, NotIn, Equals, DoubleEquals, Gt, Lt, NotEquals, Exists, or DoesNotExist.
-// (2) If the operator is In or NotIn, the values set must be non-empty.
-// (3) If the operator is Equals, DoubleEquals, or NotEquals, the values set must contain one value.
-// (4) If the operator is Exists or DoesNotExist, the value set must be empty.
-// (5) If the operator is Gt or Lt, the values set must contain only one value, which will be interpreted as an integer.
-// (6) The key is invalid due to its length, or sequence
-//
-// of characters. See validateLabelKey for more details.
+// 1. The operator can only be In, NotIn, Equals, DoubleEquals, Gt, Lt, NotEquals, Exists, or DoesNotExist.
+// 2. If the operator is In or NotIn, the values set must be non-empty.
+// 3. If the operator is Equals, DoubleEquals, or NotEquals, the values set must contain one value.
+// 4. If the operator is Exists or DoesNotExist, the value set must be empty.
+// 5. If the operator is Gt or Lt, the values set must contain only one value, which will be interpreted as an integer.
+// 6. The key is invalid due to its length, or sequence of characters. See validateLabelKey for more details.
//
// The empty string is a valid value in the input values set.
// Returned error, if not nil, is guaranteed to be an aggregated field.ErrorList
@@ -207,22 +224,15 @@ func (r *Requirement) hasValue(value string) bool {
// Matches returns true if the Requirement matches the input Labels.
// There is a match in the following cases:
-// (1) The operator is Exists and Labels has the Requirement's key.
-// (2) The operator is In, Labels has the Requirement's key and Labels'
-//
-// value for that key is in Requirement's value set.
-//
-// (3) The operator is NotIn, Labels has the Requirement's key and
-//
-// Labels' value for that key is not in Requirement's value set.
-//
-// (4) The operator is DoesNotExist or NotIn and Labels does not have the
-//
-// Requirement's key.
-//
-// (5) The operator is GreaterThanOperator or LessThanOperator, and Labels has
-//
-// the Requirement's key and the corresponding value satisfies mathematical inequality.
+// 1. The operator is Exists and Labels has the Requirement's key.
+// 2. The operator is In, Labels has the Requirement's key and Labels'
+// value for that key is in Requirement's value set.
+// 3. The operator is NotIn, Labels has the Requirement's key and
+// Labels' value for that key is not in Requirement's value set.
+// 4. The operator is DoesNotExist or NotIn and Labels does not have the
+// Requirement's key.
+// 5. The operator is GreaterThanOperator or LessThanOperator, and Labels has
+// the Requirement's key and the corresponding value satisfies mathematical inequality.
func (r *Requirement) Matches(ls Labels) bool {
switch r.operator {
case selection.In, selection.Equals, selection.DoubleEquals:
@@ -288,6 +298,13 @@ func (r *Requirement) Values() sets.String {
return ret
}
+// ValuesUnsorted returns a copy of requirement values as passed to NewRequirement without sorting.
+func (r *Requirement) ValuesUnsorted() []string {
+ ret := make([]string, 0, len(r.strValues))
+ ret = append(ret, r.strValues...)
+ return ret
+}
+
// Equal checks the equality of requirement.
func (r Requirement) Equal(x Requirement) bool {
if r.key != x.key {
@@ -296,7 +313,7 @@ func (r Requirement) Equal(x Requirement) bool {
if r.operator != x.operator {
return false
}
- return cmp.Equal(r.strValues, x.strValues)
+ return stringslices.Equal(r.strValues, x.strValues)
}
// Empty returns true if the internalSelector doesn't restrict selection space
@@ -866,15 +883,14 @@ func (p *Parser) parseExactValue() (sets.String, error) {
// "x in (foo,,baz),y,z notin ()"
//
// Note:
-//
-// (1) Inclusion - " in " - denotes that the KEY exists and is equal to any of the
-// VALUEs in its requirement
-// (2) Exclusion - " notin " - denotes that the KEY is not equal to any
-// of the VALUEs in its requirement or does not exist
-// (3) The empty string is a valid VALUE
-// (4) A requirement with just a KEY - as in "y" above - denotes that
-// the KEY exists and can be any VALUE.
-// (5) A requirement with just !KEY requires that the KEY not exist.
+// 1. Inclusion - " in " - denotes that the KEY exists and is equal to any of the
+// VALUEs in its requirement
+// 2. Exclusion - " notin " - denotes that the KEY is not equal to any
+// of the VALUEs in its requirement or does not exist
+// 3. The empty string is a valid VALUE
+// 4. A requirement with just a KEY - as in "y" above - denotes that
+// the KEY exists and can be any VALUE.
+// 5. A requirement with just !KEY requires that the KEY not exist.
func Parse(selector string, opts ...field.PathOption) (Selector, error) {
parsedSelector, err := parse(selector, field.ToPath(opts...))
if err == nil {
@@ -942,6 +958,8 @@ func ValidatedSelectorFromSet(ls Set) (Selector, error) {
// SelectorFromValidatedSet returns a Selector which will match exactly the given Set.
// A nil and empty Sets are considered equivalent to Everything().
// It assumes that Set is already validated and doesn't do any validation.
+// Note: this method copies the Set; if the Set is immutable, consider wrapping it with ValidatedSetSelector
+// instead, which does not copy.
func SelectorFromValidatedSet(ls Set) Selector {
if ls == nil || len(ls) == 0 {
return internalSelector{}
@@ -963,3 +981,76 @@ func SelectorFromValidatedSet(ls Set) Selector {
func ParseToRequirements(selector string, opts ...field.PathOption) ([]Requirement, error) {
return parse(selector, field.ToPath(opts...))
}
+
+// ValidatedSetSelector wraps a Set, allowing it to implement the Selector interface. Unlike
+// Set.AsSelectorPreValidated (which copies the input Set), this type simply wraps the underlying
+// Set. As a result, it is substantially more efficient. A nil and empty Sets are considered
+// equivalent to Everything().
+//
+// Callers MUST ensure the underlying Set is not mutated, and that it is already validated. If these
+// constraints are not met, Set.AsValidatedSelector should be preferred
+//
+// None of the Selector methods mutate the underlying Set, but Add() and Requirements() convert to
+// the less optimized version.
+type ValidatedSetSelector Set
+
+func (s ValidatedSetSelector) Matches(labels Labels) bool {
+ for k, v := range s {
+ if !labels.Has(k) || v != labels.Get(k) {
+ return false
+ }
+ }
+ return true
+}
+
+func (s ValidatedSetSelector) Empty() bool {
+ return len(s) == 0
+}
+
+func (s ValidatedSetSelector) String() string {
+ keys := make([]string, 0, len(s))
+ for k := range s {
+ keys = append(keys, k)
+ }
+ // Ensure deterministic output
+ sort.Strings(keys)
+ b := strings.Builder{}
+ for i, key := range keys {
+ v := s[key]
+ b.Grow(len(key) + 2 + len(v))
+ if i != 0 {
+ b.WriteString(",")
+ }
+ b.WriteString(key)
+ b.WriteString("=")
+ b.WriteString(v)
+ }
+ return b.String()
+}
+
+func (s ValidatedSetSelector) Add(r ...Requirement) Selector {
+ return s.toFullSelector().Add(r...)
+}
+
+func (s ValidatedSetSelector) Requirements() (requirements Requirements, selectable bool) {
+ return s.toFullSelector().Requirements()
+}
+
+func (s ValidatedSetSelector) DeepCopySelector() Selector {
+ res := make(ValidatedSetSelector, len(s))
+ for k, v := range s {
+ res[k] = v
+ }
+ return res
+}
+
+func (s ValidatedSetSelector) RequiresExactMatch(label string) (value string, found bool) {
+ v, f := s[label]
+ return v, f
+}
+
+func (s ValidatedSetSelector) toFullSelector() Selector {
+ return SelectorFromValidatedSet(Set(s))
+}
+
+var _ Selector = ValidatedSetSelector{}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/allocator.go b/vendor/k8s.io/apimachinery/pkg/runtime/allocator.go
new file mode 100644
index 000000000..8bf22ae8a
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/allocator.go
@@ -0,0 +1,76 @@
+/*
+Copyright 2022 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package runtime
+
+import (
+ "sync"
+)
+
+// AllocatorPool simply stores Allocator objects to avoid additional memory allocations
+// by caching created but unused items for later reuse, relieving pressure on the garbage collector.
+//
+// Usage:
+//
+// memoryAllocator := runtime.AllocatorPool.Get().(*runtime.Allocator)
+// defer runtime.AllocatorPool.Put(memoryAllocator)
+//
+// A note for future:
+//
+// consider introducing multiple pools for storing buffers of different sizes
+// perhaps this could allow us to be more efficient.
+var AllocatorPool = sync.Pool{
+ New: func() interface{} {
+ return &Allocator{}
+ },
+}
+
+// Allocator knows how to allocate memory
+// It exists to make the cost of object serialization cheaper.
+// In some cases, it allows for allocating memory only once and then reusing it.
+// This approach puts less load on GC and leads to less fragmented memory in general.
+type Allocator struct {
+ buf []byte
+}
+
+var _ MemoryAllocator = &Allocator{}
+
+// Allocate reserves memory for n bytes only if the underlying array doesn't have enough capacity
+// otherwise it returns previously allocated block of memory.
+//
+// Note that the returned array is not zeroed, it is the caller's
+// responsibility to clean the memory if needed.
+func (a *Allocator) Allocate(n uint64) []byte {
+ if uint64(cap(a.buf)) >= n {
+ a.buf = a.buf[:n]
+ return a.buf
+ }
+ // grow the buffer
+ size := uint64(2*cap(a.buf)) + n
+ a.buf = make([]byte, size)
+ a.buf = a.buf[:n]
+ return a.buf
+}
+
+// SimpleAllocator a wrapper around make([]byte)
+// conforms to the MemoryAllocator interface
+type SimpleAllocator struct{}
+
+var _ MemoryAllocator = &SimpleAllocator{}
+
+func (sa *SimpleAllocator) Allocate(n uint64) []byte {
+ return make([]byte, n)
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/codec.go b/vendor/k8s.io/apimachinery/pkg/runtime/codec.go
index 7fc513dd0..73f85286c 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/codec.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/codec.go
@@ -45,7 +45,6 @@ func NewCodec(e Encoder, d Decoder) Codec {
// Encode is a convenience wrapper for encoding to a []byte from an Encoder
func Encode(e Encoder, obj Object) ([]byte, error) {
- // TODO: reuse buffer
buf := &bytes.Buffer{}
if err := e.Encode(obj, buf); err != nil {
return nil, err
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/codec_check.go b/vendor/k8s.io/apimachinery/pkg/runtime/codec_check.go
index 000228061..e88400776 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/codec_check.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/codec_check.go
@@ -30,7 +30,7 @@ import (
// TODO: verify that the correct external version is chosen on encode...
func CheckCodec(c Codec, internalType Object, externalTypes ...schema.GroupVersionKind) error {
if _, err := Encode(c, internalType); err != nil {
- return fmt.Errorf("Internal type not encodable: %v", err)
+ return fmt.Errorf("internal type not encodable: %v", err)
}
for _, et := range externalTypes {
typeMeta := TypeMeta{
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/converter.go b/vendor/k8s.io/apimachinery/pkg/runtime/converter.go
index b99492a89..62eb27afc 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/converter.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/converter.go
@@ -231,13 +231,13 @@ func (c *fromUnstructuredContext) pushKey(key string) {
}
-// FromUnstructuredWIthValidation converts an object from map[string]interface{} representation into a concrete type.
+// FromUnstructuredWithValidation converts an object from map[string]interface{} representation into a concrete type.
// It uses encoding/json/Unmarshaler if object implements it or reflection if not.
// It takes a validationDirective that indicates how to behave when it encounters unknown fields.
func (c *unstructuredConverter) FromUnstructuredWithValidation(u map[string]interface{}, obj interface{}, returnUnknownFields bool) error {
t := reflect.TypeOf(obj)
value := reflect.ValueOf(obj)
- if t.Kind() != reflect.Ptr || value.IsNil() {
+ if t.Kind() != reflect.Pointer || value.IsNil() {
return fmt.Errorf("FromUnstructured requires a non-nil pointer to an object, got %v", t)
}
@@ -291,7 +291,7 @@ func fromUnstructured(sv, dv reflect.Value, ctx *fromUnstructuredContext) error
st, dt := sv.Type(), dv.Type()
switch dt.Kind() {
- case reflect.Map, reflect.Slice, reflect.Ptr, reflect.Struct, reflect.Interface:
+ case reflect.Map, reflect.Slice, reflect.Pointer, reflect.Struct, reflect.Interface:
// Those require non-trivial conversion.
default:
// This should handle all simple types.
@@ -353,7 +353,7 @@ func fromUnstructured(sv, dv reflect.Value, ctx *fromUnstructuredContext) error
return mapFromUnstructured(sv, dv, ctx)
case reflect.Slice:
return sliceFromUnstructured(sv, dv, ctx)
- case reflect.Ptr:
+ case reflect.Pointer:
return pointerFromUnstructured(sv, dv, ctx)
case reflect.Struct:
return structFromUnstructured(sv, dv, ctx)
@@ -465,7 +465,7 @@ func sliceFromUnstructured(sv, dv reflect.Value, ctx *fromUnstructuredContext) e
}
dv.SetBytes(data)
} else {
- dv.Set(reflect.Zero(dt))
+ dv.Set(reflect.MakeSlice(dt, 0, 0))
}
return nil
}
@@ -496,13 +496,13 @@ func sliceFromUnstructured(sv, dv reflect.Value, ctx *fromUnstructuredContext) e
func pointerFromUnstructured(sv, dv reflect.Value, ctx *fromUnstructuredContext) error {
st, dt := sv.Type(), dv.Type()
- if st.Kind() == reflect.Ptr && sv.IsNil() {
+ if st.Kind() == reflect.Pointer && sv.IsNil() {
dv.Set(reflect.Zero(dt))
return nil
}
dv.Set(reflect.New(dt.Elem()))
switch st.Kind() {
- case reflect.Ptr, reflect.Interface:
+ case reflect.Pointer, reflect.Interface:
return fromUnstructured(sv.Elem(), dv.Elem(), ctx)
default:
return fromUnstructured(sv, dv.Elem(), ctx)
@@ -579,7 +579,7 @@ func (c *unstructuredConverter) ToUnstructured(obj interface{}) (map[string]inte
} else {
t := reflect.TypeOf(obj)
value := reflect.ValueOf(obj)
- if t.Kind() != reflect.Ptr || value.IsNil() {
+ if t.Kind() != reflect.Pointer || value.IsNil() {
return nil, fmt.Errorf("ToUnstructured requires a non-nil pointer to an object, got %v", t)
}
u = map[string]interface{}{}
@@ -686,7 +686,7 @@ func toUnstructured(sv, dv reflect.Value) error {
return mapToUnstructured(sv, dv)
case reflect.Slice:
return sliceToUnstructured(sv, dv)
- case reflect.Ptr:
+ case reflect.Pointer:
return pointerToUnstructured(sv, dv)
case reflect.Struct:
return structToUnstructured(sv, dv)
@@ -705,24 +705,13 @@ func mapToUnstructured(sv, dv reflect.Value) error {
}
if dt.Kind() == reflect.Interface && dv.NumMethod() == 0 {
if st.Key().Kind() == reflect.String {
- switch st.Elem().Kind() {
- // TODO It should be possible to reuse the slice for primitive types.
- // However, it is panicing in the following form.
- // case reflect.String, reflect.Bool,
- // reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
- // reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
- // sv.Set(sv)
- // return nil
- default:
- // We need to do a proper conversion.
- }
+ dv.Set(reflect.MakeMap(mapStringInterfaceType))
+ dv = dv.Elem()
+ dt = dv.Type()
}
- dv.Set(reflect.MakeMap(mapStringInterfaceType))
- dv = dv.Elem()
- dt = dv.Type()
}
if dt.Kind() != reflect.Map {
- return fmt.Errorf("cannot convert struct to: %v", dt.Kind())
+ return fmt.Errorf("cannot convert map to: %v", dt.Kind())
}
if !st.Key().AssignableTo(dt.Key()) && !st.Key().ConvertibleTo(dt.Key()) {
@@ -763,20 +752,9 @@ func sliceToUnstructured(sv, dv reflect.Value) error {
return nil
}
if dt.Kind() == reflect.Interface && dv.NumMethod() == 0 {
- switch st.Elem().Kind() {
- // TODO It should be possible to reuse the slice for primitive types.
- // However, it is panicing in the following form.
- // case reflect.String, reflect.Bool,
- // reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
- // reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
- // sv.Set(sv)
- // return nil
- default:
- // We need to do a proper conversion.
- dv.Set(reflect.MakeSlice(reflect.SliceOf(dt), sv.Len(), sv.Cap()))
- dv = dv.Elem()
- dt = dv.Type()
- }
+ dv.Set(reflect.MakeSlice(reflect.SliceOf(dt), sv.Len(), sv.Cap()))
+ dv = dv.Elem()
+ dt = dv.Type()
}
if dt.Kind() != reflect.Slice {
return fmt.Errorf("cannot convert slice to: %v", dt.Kind())
@@ -812,7 +790,7 @@ func isZero(v reflect.Value) bool {
case reflect.Map, reflect.Slice:
// TODO: It seems that 0-len maps are ignored in it.
return v.IsNil() || v.Len() == 0
- case reflect.Ptr, reflect.Interface:
+ case reflect.Pointer, reflect.Interface:
return v.IsNil()
}
return false
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/extension.go b/vendor/k8s.io/apimachinery/pkg/runtime/extension.go
index 9056397fa..60c000bcb 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/extension.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/extension.go
@@ -18,16 +18,77 @@ package runtime
import (
"bytes"
- "encoding/json"
"errors"
+ "fmt"
+
+ cbor "k8s.io/apimachinery/pkg/runtime/serializer/cbor/direct"
+ "k8s.io/apimachinery/pkg/util/json"
)
+// RawExtension intentionally avoids implementing value.UnstructuredConverter for now because the
+// signature of ToUnstructured does not allow returning an error value in cases where the conversion
+// is not possible (content type is unrecognized or bytes don't match content type).
+func rawToUnstructured(raw []byte, contentType string) (interface{}, error) {
+ switch contentType {
+ case ContentTypeJSON:
+ var u interface{}
+ if err := json.Unmarshal(raw, &u); err != nil {
+ return nil, fmt.Errorf("failed to parse RawExtension bytes as JSON: %w", err)
+ }
+ return u, nil
+ case ContentTypeCBOR:
+ var u interface{}
+ if err := cbor.Unmarshal(raw, &u); err != nil {
+ return nil, fmt.Errorf("failed to parse RawExtension bytes as CBOR: %w", err)
+ }
+ return u, nil
+ default:
+ return nil, fmt.Errorf("cannot convert RawExtension with unrecognized content type to unstructured")
+ }
+}
+
+func (re RawExtension) guessContentType() string {
+ switch {
+ case bytes.HasPrefix(re.Raw, cborSelfDescribed):
+ return ContentTypeCBOR
+ case len(re.Raw) > 0:
+ switch re.Raw[0] {
+ case '\t', '\r', '\n', ' ', '{', '[', 'n', 't', 'f', '"', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
+ // Prefixes for the four whitespace characters, objects, arrays, strings, numbers, true, false, and null.
+ return ContentTypeJSON
+ }
+ }
+ return ""
+}
+
func (re *RawExtension) UnmarshalJSON(in []byte) error {
if re == nil {
return errors.New("runtime.RawExtension: UnmarshalJSON on nil pointer")
}
- if !bytes.Equal(in, []byte("null")) {
- re.Raw = append(re.Raw[0:0], in...)
+ if bytes.Equal(in, []byte("null")) {
+ return nil
+ }
+ re.Raw = append(re.Raw[0:0], in...)
+ return nil
+}
+
+var (
+ cborNull = []byte{0xf6}
+ cborSelfDescribed = []byte{0xd9, 0xd9, 0xf7}
+)
+
+func (re *RawExtension) UnmarshalCBOR(in []byte) error {
+ if re == nil {
+ return errors.New("runtime.RawExtension: UnmarshalCBOR on nil pointer")
+ }
+ if !bytes.Equal(in, cborNull) {
+ if !bytes.HasPrefix(in, cborSelfDescribed) {
+ // The self-described CBOR tag doesn't change the interpretation of the data
+ // item it encloses, but it is useful as a magic number. Its encoding is
+ // also what is used to implement the CBOR RecognizingDecoder.
+ re.Raw = append(re.Raw[:0], cborSelfDescribed...)
+ }
+ re.Raw = append(re.Raw, in...)
}
return nil
}
@@ -46,6 +107,35 @@ func (re RawExtension) MarshalJSON() ([]byte, error) {
}
return []byte("null"), nil
}
- // TODO: Check whether ContentType is actually JSON before returning it.
- return re.Raw, nil
+
+ contentType := re.guessContentType()
+ if contentType == ContentTypeJSON {
+ return re.Raw, nil
+ }
+
+ u, err := rawToUnstructured(re.Raw, contentType)
+ if err != nil {
+ return nil, err
+ }
+ return json.Marshal(u)
+}
+
+func (re RawExtension) MarshalCBOR() ([]byte, error) {
+ if re.Raw == nil {
+ if re.Object != nil {
+ return cbor.Marshal(re.Object)
+ }
+ return cbor.Marshal(nil)
+ }
+
+ contentType := re.guessContentType()
+ if contentType == ContentTypeCBOR {
+ return re.Raw, nil
+ }
+
+ u, err := rawToUnstructured(re.Raw, contentType)
+ if err != nil {
+ return nil, err
+ }
+ return cbor.Marshal(u)
}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/generated.pb.go b/vendor/k8s.io/apimachinery/pkg/runtime/generated.pb.go
index ac428d610..2e40e140a 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/generated.pb.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/generated.pb.go
@@ -15,7 +15,7 @@ limitations under the License.
*/
// Code generated by protoc-gen-gogo. DO NOT EDIT.
-// source: k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/generated.proto
+// source: k8s.io/apimachinery/pkg/runtime/generated.proto
package runtime
@@ -45,7 +45,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
func (m *RawExtension) Reset() { *m = RawExtension{} }
func (*RawExtension) ProtoMessage() {}
func (*RawExtension) Descriptor() ([]byte, []int) {
- return fileDescriptor_9d3c45d7f546725c, []int{0}
+ return fileDescriptor_2e0e4b920403a48c, []int{0}
}
func (m *RawExtension) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -73,7 +73,7 @@ var xxx_messageInfo_RawExtension proto.InternalMessageInfo
func (m *TypeMeta) Reset() { *m = TypeMeta{} }
func (*TypeMeta) ProtoMessage() {}
func (*TypeMeta) Descriptor() ([]byte, []int) {
- return fileDescriptor_9d3c45d7f546725c, []int{1}
+ return fileDescriptor_2e0e4b920403a48c, []int{1}
}
func (m *TypeMeta) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -101,7 +101,7 @@ var xxx_messageInfo_TypeMeta proto.InternalMessageInfo
func (m *Unknown) Reset() { *m = Unknown{} }
func (*Unknown) ProtoMessage() {}
func (*Unknown) Descriptor() ([]byte, []int) {
- return fileDescriptor_9d3c45d7f546725c, []int{2}
+ return fileDescriptor_2e0e4b920403a48c, []int{2}
}
func (m *Unknown) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -133,35 +133,34 @@ func init() {
}
func init() {
- proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/generated.proto", fileDescriptor_9d3c45d7f546725c)
-}
-
-var fileDescriptor_9d3c45d7f546725c = []byte{
- // 378 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x8f, 0x4f, 0xab, 0x13, 0x31,
- 0x14, 0xc5, 0x27, 0xaf, 0x85, 0x3e, 0xd3, 0xc2, 0x93, 0xb8, 0x70, 0x74, 0x91, 0x79, 0x74, 0xe5,
- 0x5b, 0xbc, 0x04, 0x1e, 0x08, 0x6e, 0x3b, 0xa5, 0xa0, 0x88, 0x20, 0xc1, 0x3f, 0xe0, 0xca, 0x74,
- 0x26, 0x4e, 0xc3, 0xd0, 0x9b, 0x21, 0xcd, 0x38, 0x76, 0xe7, 0x47, 0xf0, 0x63, 0x75, 0xd9, 0x65,
- 0x57, 0xc5, 0x8e, 0x1f, 0xc2, 0xad, 0x34, 0x4d, 0x6b, 0xd5, 0x85, 0xbb, 0xe4, 0x9e, 0xf3, 0x3b,
- 0xf7, 0x1e, 0xfc, 0xbc, 0x7c, 0xb6, 0x60, 0xda, 0xf0, 0xb2, 0x9e, 0x2a, 0x0b, 0xca, 0xa9, 0x05,
- 0xff, 0xac, 0x20, 0x37, 0x96, 0x07, 0x41, 0x56, 0x7a, 0x2e, 0xb3, 0x99, 0x06, 0x65, 0x97, 0xbc,
- 0x2a, 0x0b, 0x6e, 0x6b, 0x70, 0x7a, 0xae, 0x78, 0xa1, 0x40, 0x59, 0xe9, 0x54, 0xce, 0x2a, 0x6b,
- 0x9c, 0x21, 0xc9, 0x01, 0x60, 0xe7, 0x00, 0xab, 0xca, 0x82, 0x05, 0xe0, 0xf1, 0x6d, 0xa1, 0xdd,
- 0xac, 0x9e, 0xb2, 0xcc, 0xcc, 0x79, 0x61, 0x0a, 0xc3, 0x3d, 0x37, 0xad, 0x3f, 0xf9, 0x9f, 0xff,
- 0xf8, 0xd7, 0x21, 0x6f, 0x78, 0x83, 0x07, 0x42, 0x36, 0x93, 0x2f, 0x4e, 0xc1, 0x42, 0x1b, 0x20,
- 0x8f, 0x70, 0xc7, 0xca, 0x26, 0x46, 0xd7, 0xe8, 0xc9, 0x20, 0xed, 0xb5, 0xdb, 0xa4, 0x23, 0x64,
- 0x23, 0xf6, 0xb3, 0xe1, 0x47, 0x7c, 0xf9, 0x66, 0x59, 0xa9, 0x57, 0xca, 0x49, 0x72, 0x87, 0xb1,
- 0xac, 0xf4, 0x3b, 0x65, 0xf7, 0x90, 0x77, 0xdf, 0x4b, 0xc9, 0x6a, 0x9b, 0x44, 0xed, 0x36, 0xc1,
- 0xa3, 0xd7, 0x2f, 0x82, 0x22, 0xce, 0x5c, 0xe4, 0x1a, 0x77, 0x4b, 0x0d, 0x79, 0x7c, 0xe1, 0xdd,
- 0x83, 0xe0, 0xee, 0xbe, 0xd4, 0x90, 0x0b, 0xaf, 0x0c, 0x7f, 0x22, 0xdc, 0x7b, 0x0b, 0x25, 0x98,
- 0x06, 0xc8, 0x7b, 0x7c, 0xe9, 0xc2, 0x36, 0x9f, 0xdf, 0xbf, 0xbb, 0x61, 0xff, 0xe9, 0xce, 0x8e,
- 0xe7, 0xa5, 0xf7, 0x43, 0xf8, 0xe9, 0x60, 0x71, 0x0a, 0x3b, 0x36, 0xbc, 0xf8, 0xb7, 0x21, 0x19,
- 0xe1, 0xab, 0xcc, 0x80, 0x53, 0xe0, 0x26, 0x90, 0x99, 0x5c, 0x43, 0x11, 0x77, 0xfc, 0xb1, 0x0f,
- 0x43, 0xde, 0xd5, 0xf8, 0x4f, 0x59, 0xfc, 0xed, 0x27, 0x4f, 0x71, 0x3f, 0x8c, 0xf6, 0xab, 0xe3,
- 0xae, 0xc7, 0x1f, 0x04, 0xbc, 0x3f, 0xfe, 0x2d, 0x89, 0x73, 0x5f, 0x7a, 0xbb, 0xda, 0xd1, 0x68,
- 0xbd, 0xa3, 0xd1, 0x66, 0x47, 0xa3, 0xaf, 0x2d, 0x45, 0xab, 0x96, 0xa2, 0x75, 0x4b, 0xd1, 0xa6,
- 0xa5, 0xe8, 0x7b, 0x4b, 0xd1, 0xb7, 0x1f, 0x34, 0xfa, 0xd0, 0x0b, 0x45, 0x7f, 0x05, 0x00, 0x00,
- 0xff, 0xff, 0xe3, 0x33, 0x18, 0x0b, 0x50, 0x02, 0x00, 0x00,
+ proto.RegisterFile("k8s.io/apimachinery/pkg/runtime/generated.proto", fileDescriptor_2e0e4b920403a48c)
+}
+
+var fileDescriptor_2e0e4b920403a48c = []byte{
+ // 365 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0x4f, 0x6b, 0x22, 0x31,
+ 0x18, 0xc6, 0x27, 0x2a, 0xe8, 0x46, 0xc1, 0x25, 0x7b, 0xd8, 0xd9, 0x3d, 0x64, 0xc4, 0xd3, 0x7a,
+ 0xd8, 0x0c, 0x08, 0x85, 0x5e, 0x1d, 0xf1, 0x50, 0x4a, 0xa1, 0x84, 0xfe, 0x81, 0x9e, 0x1a, 0x67,
+ 0xd2, 0x31, 0x0c, 0x26, 0xc3, 0x18, 0x99, 0x7a, 0xeb, 0x47, 0xe8, 0xc7, 0xf2, 0xe8, 0xd1, 0x93,
+ 0xd4, 0xe9, 0x87, 0xe8, 0xb5, 0x18, 0xa3, 0xb5, 0xed, 0xc1, 0x5b, 0xde, 0xf7, 0x79, 0x7e, 0xcf,
+ 0xfb, 0xbe, 0x10, 0xe8, 0x27, 0xa7, 0x13, 0x22, 0x94, 0xcf, 0x52, 0x31, 0x66, 0xe1, 0x48, 0x48,
+ 0x9e, 0xcd, 0xfc, 0x34, 0x89, 0xfd, 0x6c, 0x2a, 0xb5, 0x18, 0x73, 0x3f, 0xe6, 0x92, 0x67, 0x4c,
+ 0xf3, 0x88, 0xa4, 0x99, 0xd2, 0x0a, 0x79, 0x5b, 0x80, 0x1c, 0x02, 0x24, 0x4d, 0x62, 0x62, 0x81,
+ 0xbf, 0xff, 0x63, 0xa1, 0x47, 0xd3, 0x21, 0x09, 0xd5, 0xd8, 0x8f, 0x55, 0xac, 0x7c, 0xc3, 0x0d,
+ 0xa7, 0x0f, 0xa6, 0x32, 0x85, 0x79, 0x6d, 0xf3, 0xda, 0x1d, 0xd8, 0xa0, 0x2c, 0x1f, 0x3c, 0x6a,
+ 0x2e, 0x27, 0x42, 0x49, 0xf4, 0x07, 0x96, 0x33, 0x96, 0xbb, 0xa0, 0x05, 0xfe, 0x35, 0x82, 0x6a,
+ 0xb1, 0xf2, 0xca, 0x94, 0xe5, 0x74, 0xd3, 0x6b, 0xdf, 0xc3, 0xda, 0xd5, 0x2c, 0xe5, 0x17, 0x5c,
+ 0x33, 0xd4, 0x85, 0x90, 0xa5, 0xe2, 0x86, 0x67, 0x1b, 0xc8, 0xb8, 0x7f, 0x04, 0x68, 0xbe, 0xf2,
+ 0x9c, 0x62, 0xe5, 0xc1, 0xde, 0xe5, 0x99, 0x55, 0xe8, 0x81, 0x0b, 0xb5, 0x60, 0x25, 0x11, 0x32,
+ 0x72, 0x4b, 0xc6, 0xdd, 0xb0, 0xee, 0xca, 0xb9, 0x90, 0x11, 0x35, 0x4a, 0xfb, 0x0d, 0xc0, 0xea,
+ 0xb5, 0x4c, 0xa4, 0xca, 0x25, 0xba, 0x85, 0x35, 0x6d, 0xa7, 0x99, 0xfc, 0x7a, 0xb7, 0x43, 0x8e,
+ 0xdc, 0x4e, 0x76, 0xeb, 0x05, 0x3f, 0x6d, 0xf8, 0x7e, 0x61, 0xba, 0x0f, 0xdb, 0x5d, 0x58, 0xfa,
+ 0x7e, 0x21, 0xea, 0xc1, 0x66, 0xa8, 0xa4, 0xe6, 0x52, 0x0f, 0x64, 0xa8, 0x22, 0x21, 0x63, 0xb7,
+ 0x6c, 0x96, 0xfd, 0x6d, 0xf3, 0x9a, 0xfd, 0xcf, 0x32, 0xfd, 0xea, 0x47, 0x27, 0xb0, 0x6e, 0x5b,
+ 0x9b, 0xd1, 0x6e, 0xc5, 0xe0, 0xbf, 0x2c, 0x5e, 0xef, 0x7f, 0x48, 0xf4, 0xd0, 0x17, 0x0c, 0xe6,
+ 0x6b, 0xec, 0x2c, 0xd6, 0xd8, 0x59, 0xae, 0xb1, 0xf3, 0x54, 0x60, 0x30, 0x2f, 0x30, 0x58, 0x14,
+ 0x18, 0x2c, 0x0b, 0x0c, 0x5e, 0x0a, 0x0c, 0x9e, 0x5f, 0xb1, 0x73, 0xe7, 0x1d, 0xf9, 0x2d, 0xef,
+ 0x01, 0x00, 0x00, 0xff, 0xff, 0x2a, 0x9b, 0x09, 0xb3, 0x4f, 0x02, 0x00, 0x00,
}
func (m *RawExtension) Marshal() (dAtA []byte, err error) {
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/generated.proto b/vendor/k8s.io/apimachinery/pkg/runtime/generated.proto
index 347105649..5f06cc574 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/generated.proto
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/generated.proto
@@ -22,7 +22,7 @@ syntax = "proto2";
package k8s.io.apimachinery.pkg.runtime;
// Package-wide variables from generator "generated".
-option go_package = "runtime";
+option go_package = "k8s.io/apimachinery/pkg/runtime";
// RawExtension is used to hold extensions in external versions.
//
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/helper.go b/vendor/k8s.io/apimachinery/pkg/runtime/helper.go
index 7bd1a3a6a..cc0a77bba 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/helper.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/helper.go
@@ -236,10 +236,14 @@ func (e WithVersionEncoder) Encode(obj Object, stream io.Writer) error {
gvk = preferredGVK
}
}
- kind.SetGroupVersionKind(gvk)
- err = e.Encoder.Encode(obj, stream)
- kind.SetGroupVersionKind(oldGVK)
- return err
+
+ // The gvk only needs to be set if not already as desired.
+ if gvk != oldGVK {
+ kind.SetGroupVersionKind(gvk)
+ defer kind.SetGroupVersionKind(oldGVK)
+ }
+
+ return e.Encoder.Encode(obj, stream)
}
// WithoutVersionDecoder clears the group version kind of a deserialized object.
@@ -257,3 +261,26 @@ func (d WithoutVersionDecoder) Decode(data []byte, defaults *schema.GroupVersion
}
return obj, gvk, err
}
+
+type encoderWithAllocator struct {
+ encoder EncoderWithAllocator
+ memAllocator MemoryAllocator
+}
+
+// NewEncoderWithAllocator returns a new encoder
+func NewEncoderWithAllocator(e EncoderWithAllocator, a MemoryAllocator) Encoder {
+ return &encoderWithAllocator{
+ encoder: e,
+ memAllocator: a,
+ }
+}
+
+// Encode writes the provided object to the nested writer
+func (e *encoderWithAllocator) Encode(obj Object, w io.Writer) error {
+ return e.encoder.EncodeWithAllocator(obj, w, e.memAllocator)
+}
+
+// Identifier returns identifier of this encoder.
+func (e *encoderWithAllocator) Identifier() Identifier {
+ return e.encoder.Identifier()
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/interfaces.go b/vendor/k8s.io/apimachinery/pkg/runtime/interfaces.go
index b324b76c6..e89ea8939 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/interfaces.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/interfaces.go
@@ -69,6 +69,24 @@ type Encoder interface {
Identifier() Identifier
}
+// MemoryAllocator is responsible for allocating memory.
+// By encapsulating memory allocation into its own interface, we can reuse the memory
+// across many operations in places we know it can significantly improve the performance.
+type MemoryAllocator interface {
+ // Allocate reserves memory for n bytes.
+ // Note that implementations of this method are not required to zero the returned array.
+ // It is the caller's responsibility to clean the memory if needed.
+ Allocate(n uint64) []byte
+}
+
+// EncoderWithAllocator serializes objects in a way that allows callers to manage any additional memory allocations.
+type EncoderWithAllocator interface {
+ Encoder
+ // EncodeWithAllocator writes an object to a stream as Encode does.
+ // In addition, it allows for providing a memory allocator for efficient memory usage during object serialization
+ EncodeWithAllocator(obj Object, w io.Writer, memAlloc MemoryAllocator) error
+}
+
// Decoder attempts to load an object from data.
type Decoder interface {
// Decode attempts to deserialize the provided data using either the innate typing of the scheme or the
@@ -153,7 +171,7 @@ type NegotiatedSerializer interface {
// EncoderForVersion returns an encoder that ensures objects being written to the provided
// serializer are in the provided group version.
EncoderForVersion(serializer Encoder, gv GroupVersioner) Encoder
- // DecoderForVersion returns a decoder that ensures objects being read by the provided
+ // DecoderToVersion returns a decoder that ensures objects being read by the provided
// serializer are in the provided group version by default.
DecoderToVersion(serializer Decoder, gv GroupVersioner) Decoder
}
@@ -207,6 +225,12 @@ type NestedObjectEncoder interface {
// NestedObjectDecoder is an optional interface that objects may implement to be given
// an opportunity to decode any nested Objects / RawExtensions during serialization.
+// It is possible for DecodeNestedObjects to return a non-nil error but for the decoding
+// to have succeeded in the case of strict decoding errors (e.g. unknown/duplicate fields).
+// As such it is important for callers of DecodeNestedObjects to check to confirm whether
+// an error is a runtime.StrictDecodingError before short circuiting.
+// Similarly, implementations of DecodeNestedObjects should ensure that a runtime.StrictDecodingError
+// is only returned when the rest of decoding has succeeded.
type NestedObjectDecoder interface {
DecodeNestedObjects(d Decoder) error
}
@@ -284,14 +308,11 @@ type ResourceVersioner interface {
ResourceVersion(obj Object) (string, error)
}
-// SelfLinker provides methods for setting and retrieving the SelfLink field of an API object.
-type SelfLinker interface {
- SetSelfLink(obj Object, selfLink string) error
- SelfLink(obj Object) (string, error)
-
- // Knowing Name is sometimes necessary to use a SelfLinker.
+// Namer provides methods for retrieving name and namespace of an API object.
+type Namer interface {
+ // Name returns the name of a given object.
Name(obj Object) (string, error)
- // Knowing Namespace is sometimes necessary to use a SelfLinker
+ // Namespace returns the name of a given object.
Namespace(obj Object) (string, error)
}
@@ -344,4 +365,9 @@ type Unstructured interface {
// error should terminate the iteration. If IsList() returns false, this method should return an error
// instead of calling the provided function.
EachListItem(func(Object) error) error
+ // EachListItemWithAlloc works like EachListItem, but avoids retaining references to a slice of items.
+ // It does this by making a shallow copy of non-pointer items before passing them to fn.
+ //
+ // If the items passed to fn are not retained, or are retained for the same duration, use EachListItem instead for memory efficiency.
+ EachListItemWithAlloc(func(Object) error) error
}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.pb.go b/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.pb.go
index 29d3ac45b..7a26d2798 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.pb.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.pb.go
@@ -15,7 +15,7 @@ limitations under the License.
*/
// Code generated by protoc-gen-gogo. DO NOT EDIT.
-// source: k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.proto
+// source: k8s.io/apimachinery/pkg/runtime/schema/generated.proto
package schema
@@ -39,21 +39,20 @@ var _ = math.Inf
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
func init() {
- proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.proto", fileDescriptor_0462724132518e0d)
+ proto.RegisterFile("k8s.io/apimachinery/pkg/runtime/schema/generated.proto", fileDescriptor_25f8f0eed21c6089)
}
-var fileDescriptor_0462724132518e0d = []byte{
- // 185 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0xcc, 0xaf, 0x6e, 0xc3, 0x30,
- 0x10, 0xc7, 0x71, 0x9b, 0x0c, 0x0c, 0x0e, 0x0e, 0x1c, 0x1c, 0xda, 0x7c, 0x74, 0xb8, 0x2f, 0x50,
- 0x5e, 0xe6, 0x24, 0x57, 0xc7, 0xb2, 0xfc, 0x47, 0x8e, 0x5d, 0xa9, 0xac, 0x8f, 0xd0, 0xc7, 0x0a,
- 0x0c, 0x0c, 0x6c, 0xdc, 0x17, 0xa9, 0x64, 0x07, 0x94, 0xdd, 0x4f, 0xa7, 0xcf, 0xf7, 0xf3, 0x68,
- 0xfe, 0x27, 0xa1, 0x3d, 0x9a, 0xdc, 0x51, 0x74, 0x94, 0x68, 0xc2, 0x0b, 0xb9, 0xc1, 0x47, 0xdc,
- 0x1f, 0x32, 0x68, 0x2b, 0xfb, 0x51, 0x3b, 0x8a, 0x57, 0x0c, 0x46, 0x61, 0xcc, 0x2e, 0x69, 0x4b,
- 0x38, 0xf5, 0x23, 0x59, 0x89, 0x8a, 0x1c, 0x45, 0x99, 0x68, 0x10, 0x21, 0xfa, 0xe4, 0xbf, 0x7e,
- 0x9a, 0x13, 0xef, 0x4e, 0x04, 0xa3, 0xc4, 0xee, 0x44, 0x73, 0xdf, 0x7f, 0x4a, 0xa7, 0x31, 0x77,
- 0xa2, 0xf7, 0x16, 0x95, 0x57, 0x1e, 0x2b, 0xef, 0xf2, 0xb9, 0xae, 0x3a, 0xea, 0xd5, 0xb2, 0x87,
- 0xdf, 0x79, 0x03, 0xb6, 0x6c, 0xc0, 0xd6, 0x0d, 0xd8, 0xad, 0x00, 0x9f, 0x0b, 0xf0, 0xa5, 0x00,
- 0x5f, 0x0b, 0xf0, 0x47, 0x01, 0x7e, 0x7f, 0x02, 0x3b, 0x7d, 0xb4, 0xf8, 0x2b, 0x00, 0x00, 0xff,
- 0xff, 0xba, 0x7e, 0x65, 0xf4, 0xd6, 0x00, 0x00, 0x00,
+var fileDescriptor_25f8f0eed21c6089 = []byte{
+ // 170 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0xce, 0xa1, 0x0e, 0xc2, 0x30,
+ 0x10, 0xc6, 0xf1, 0xd6, 0x22, 0x91, 0x88, 0x93, 0x73, 0xdc, 0x39, 0x82, 0x46, 0xf3, 0x04, 0xb8,
+ 0x6e, 0x94, 0xae, 0x59, 0xba, 0x6b, 0xba, 0x4e, 0xe0, 0x78, 0x04, 0x1e, 0x6b, 0x72, 0x72, 0x92,
+ 0x95, 0x17, 0x21, 0x69, 0x11, 0x48, 0xdc, 0xfd, 0xc5, 0xef, 0xf2, 0x6d, 0x0e, 0xdd, 0x71, 0x40,
+ 0xcb, 0xa4, 0xbc, 0x75, 0xaa, 0x69, 0x6d, 0xaf, 0xc3, 0x9d, 0x7c, 0x67, 0x28, 0x8c, 0x7d, 0xb4,
+ 0x4e, 0xd3, 0xd0, 0xb4, 0xda, 0x29, 0x32, 0xba, 0xd7, 0x41, 0x45, 0x7d, 0x45, 0x1f, 0x38, 0xf2,
+ 0xb6, 0x2a, 0x0e, 0x7f, 0x1d, 0xfa, 0xce, 0xe0, 0xd7, 0x61, 0x71, 0xbb, 0xbd, 0xb1, 0xb1, 0x1d,
+ 0x6b, 0x6c, 0xd8, 0x91, 0x61, 0xc3, 0x94, 0x79, 0x3d, 0xde, 0x72, 0xe5, 0xc8, 0x57, 0x79, 0x7b,
+ 0x3a, 0x4f, 0x2b, 0x88, 0x79, 0x05, 0xb1, 0xac, 0x20, 0x1e, 0x09, 0xe4, 0x94, 0x40, 0xce, 0x09,
+ 0xe4, 0x92, 0x40, 0xbe, 0x12, 0xc8, 0xe7, 0x1b, 0xc4, 0xa5, 0xfa, 0x6f, 0xf4, 0x27, 0x00, 0x00,
+ 0xff, 0xff, 0x97, 0xb8, 0x4d, 0x1f, 0xdd, 0x00, 0x00, 0x00,
}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.proto b/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.proto
index c50766a4b..01a9c01e5 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.proto
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.proto
@@ -22,5 +22,5 @@ syntax = "proto2";
package k8s.io.apimachinery.pkg.runtime.schema;
// Package-wide variables from generator "generated".
-option go_package = "schema";
+option go_package = "k8s.io/apimachinery/pkg/runtime/schema";
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go b/vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go
index b21eb664e..d1c37c942 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go
@@ -39,7 +39,7 @@ func ParseResourceArg(arg string) (*GroupVersionResource, GroupResource) {
// ParseKindArg takes the common style of string which may be either `Kind.group.com` or `Kind.version.group.com`
// and parses it out into both possibilities. This code takes no responsibility for knowing which representation was intended
// but with a knowledge of all GroupKinds, calling code can take a very good guess. If there are only two segments, then
-// `*GroupVersionResource` is nil.
+// `*GroupVersionKind` is nil.
// `Kind.group.com` -> `group=com, version=group, kind=Kind` and `group=group.com, kind=Kind`
func ParseKindArg(arg string) (*GroupVersionKind, GroupKind) {
var gvk *GroupVersionKind
@@ -191,8 +191,7 @@ func (gv GroupVersion) Identifier() string {
// if none of the options match the group. It prefers a match to group and version over just group.
// TODO: Move GroupVersion to a package under pkg/runtime, since it's used by scheme.
// TODO: Introduce an adapter type between GroupVersion and runtime.GroupVersioner, and use LegacyCodec(GroupVersion)
-//
-// in fewer places.
+// in fewer places.
func (gv GroupVersion) KindForGroupVersionKinds(kinds []GroupVersionKind) (target GroupVersionKind, ok bool) {
for _, gvk := range kinds {
if gvk.Group == gv.Group && gvk.Version == gv.Version {
@@ -240,8 +239,7 @@ func (gv GroupVersion) WithResource(resource string) GroupVersionResource {
// GroupVersions can be used to represent a set of desired group versions.
// TODO: Move GroupVersions to a package under pkg/runtime, since it's used by scheme.
// TODO: Introduce an adapter type between GroupVersions and runtime.GroupVersioner, and use LegacyCodec(GroupVersion)
-//
-// in fewer places.
+// in fewer places.
type GroupVersions []GroupVersion
// Identifier implements runtime.GroupVersioner interface.
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go b/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
index 2e62dd62b..a5b116718 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
@@ -44,11 +44,11 @@ import (
// Schemes are not expected to change at runtime and are only threadsafe after
// registration is complete.
type Scheme struct {
- // versionMap allows one to figure out the go type of an object with
+ // gvkToType allows one to figure out the go type of an object with
// the given version and name.
gvkToType map[schema.GroupVersionKind]reflect.Type
- // typeToGroupVersion allows one to find metadata for a given go object.
+ // typeToGVK allows one to find metadata for a given go object.
// The reflect.Type we index by should *not* be a pointer.
typeToGVK map[reflect.Type][]schema.GroupVersionKind
@@ -64,7 +64,7 @@ type Scheme struct {
// resource field labels in that version to internal version.
fieldLabelConversionFuncs map[schema.GroupVersionKind]FieldLabelConversionFunc
- // defaulterFuncs is an array of interfaces to be called with an object to provide defaulting
+ // defaulterFuncs is a map to funcs to be called with an object to provide defaulting
// the provided object must be a pointer.
defaulterFuncs map[reflect.Type]func(interface{})
@@ -118,8 +118,7 @@ func (s *Scheme) Converter() *conversion.Converter {
// API group and version that would never be updated.
//
// TODO: there is discussion about removing unversioned and replacing it with objects that are manifest into
-//
-// every version with particular schemas. Resolve this method at that point.
+// every version with particular schemas. Resolve this method at that point.
func (s *Scheme) AddUnversionedTypes(version schema.GroupVersion, types ...Object) {
s.addObservedVersion(version)
s.AddKnownTypes(version, types...)
@@ -142,7 +141,7 @@ func (s *Scheme) AddKnownTypes(gv schema.GroupVersion, types ...Object) {
s.addObservedVersion(gv)
for _, obj := range types {
t := reflect.TypeOf(obj)
- if t.Kind() != reflect.Ptr {
+ if t.Kind() != reflect.Pointer {
panic("All types must be pointers to structs.")
}
t = t.Elem()
@@ -160,7 +159,7 @@ func (s *Scheme) AddKnownTypeWithName(gvk schema.GroupVersionKind, obj Object) {
if len(gvk.Version) == 0 {
panic(fmt.Sprintf("version is required on all types: %s %v", gvk, t))
}
- if t.Kind() != reflect.Ptr {
+ if t.Kind() != reflect.Pointer {
panic("All types must be pointers to structs.")
}
t = t.Elem()
@@ -463,7 +462,7 @@ func (s *Scheme) convertToVersion(copy bool, in Object, target GroupVersioner) (
} else {
// determine the incoming kinds with as few allocations as possible.
t = reflect.TypeOf(in)
- if t.Kind() != reflect.Ptr {
+ if t.Kind() != reflect.Pointer {
return nil, fmt.Errorf("only pointer types may be converted: %v", t)
}
t = t.Elem()
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/direct/direct.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/direct/direct.go
new file mode 100644
index 000000000..cd78b1df2
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/direct/direct.go
@@ -0,0 +1,36 @@
+/*
+Copyright 2024 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Package direct provides functions for marshaling and unmarshaling between arbitrary Go values and
+// CBOR data, with behavior that is compatible with that of the CBOR serializer. In particular,
+// types that implement cbor.Marshaler and cbor.Unmarshaler should use these functions.
+package direct
+
+import (
+ "k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes"
+)
+
+func Marshal(src interface{}) ([]byte, error) {
+ return modes.Encode.Marshal(src)
+}
+
+func Unmarshal(src []byte, dst interface{}) error {
+ return modes.Decode.Unmarshal(src, dst)
+}
+
+func Diagnose(src []byte) (string, error) {
+ return modes.Diagnostic.Diagnose(src)
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/buffers.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/buffers.go
new file mode 100644
index 000000000..f14cbd6b5
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/buffers.go
@@ -0,0 +1,65 @@
+/*
+Copyright 2024 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package modes
+
+import (
+ "bytes"
+ "sync"
+)
+
+var buffers = BufferProvider{p: new(sync.Pool)}
+
+type buffer struct {
+ bytes.Buffer
+}
+
+type pool interface {
+ Get() interface{}
+ Put(interface{})
+}
+
+type BufferProvider struct {
+ p pool
+}
+
+func (b *BufferProvider) Get() *buffer {
+ if buf, ok := b.p.Get().(*buffer); ok {
+ return buf
+ }
+ return &buffer{}
+}
+
+func (b *BufferProvider) Put(buf *buffer) {
+ if buf.Cap() > 3*1024*1024 /* Default MaxRequestBodyBytes */ {
+ // Objects in a sync.Pool are assumed to be fungible. This is not a good assumption
+ // for pools of *bytes.Buffer because a *bytes.Buffer's underlying array grows as
+ // needed to accommodate writes. In Kubernetes, apiservers tend to encode "small"
+ // objects very frequently and much larger objects (especially large lists) only
+ // occasionally. Under steady load, pooled buffers tend to be borrowed frequently
+ // enough to prevent them from being released. Over time, each buffer is used to
+ // encode a large object and its capacity increases accordingly. The result is that
+ // practically all buffers in the pool retain much more capacity than needed to
+ // encode most objects.
+
+ // As a basic mitigation for the worst case, buffers with more capacity than the
+ // default max request body size are never returned to the pool.
+ // TODO: Optimize for higher buffer utilization.
+ return
+ }
+ buf.Reset()
+ b.p.Put(buf)
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/custom.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/custom.go
new file mode 100644
index 000000000..858529e95
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/custom.go
@@ -0,0 +1,422 @@
+/*
+Copyright 2024 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package modes
+
+import (
+ "encoding"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "reflect"
+ "sync"
+
+ "github.com/fxamacker/cbor/v2"
+)
+
+// Returns a non-nil error if and only if the argument's type (or one of its component types, for
+// composite types) implements json.Marshaler or encoding.TextMarshaler without also implementing
+// cbor.Marshaler and likewise for the respective Unmarshaler interfaces.
+//
+// This is a temporary, graduation-blocking restriction and will be removed in favor of automatic
+// transcoding between CBOR and JSON/text for these types. This restriction allows CBOR to be
+// exercised for in-tree and unstructured types while mitigating the risk of mangling out-of-tree
+// types in client programs.
+func RejectCustomMarshalers(v interface{}) error {
+ if v == nil {
+ return nil
+ }
+ rv := reflect.ValueOf(v)
+ if err := marshalerCache.getChecker(rv.Type()).check(rv, maxDepth); err != nil {
+ return fmt.Errorf("unable to serialize %T: %w", v, err)
+ }
+ if err := unmarshalerCache.getChecker(rv.Type()).check(rv, maxDepth); err != nil {
+ return fmt.Errorf("unable to serialize %T: %w", v, err)
+ }
+ return nil
+}
+
+// Recursion depth is limited as a basic mitigation against cyclic objects. Objects created by the
+// decoder shouldn't be able to contain cycles, but practically any object can be passed to the
+// encoder.
+var errMaxDepthExceeded = errors.New("object depth exceeds limit (possible cycle?)")
+
+// The JSON encoder begins detecting cycles after depth 1000. Use a generous limit here, knowing
+// that it can might deeply nested acyclic objects. The limit will be removed along with the rest of
+// this mechanism.
+const maxDepth = 2048
+
+var marshalerCache = checkers{
+ cborInterface: reflect.TypeFor[cbor.Marshaler](),
+ nonCBORInterfaces: []reflect.Type{
+ reflect.TypeFor[json.Marshaler](),
+ reflect.TypeFor[encoding.TextMarshaler](),
+ },
+}
+
+var unmarshalerCache = checkers{
+ cborInterface: reflect.TypeFor[cbor.Unmarshaler](),
+ nonCBORInterfaces: []reflect.Type{
+ reflect.TypeFor[json.Unmarshaler](),
+ reflect.TypeFor[encoding.TextUnmarshaler](),
+ },
+ assumeAddressableValues: true,
+}
+
+// checker wraps a function for dynamically checking a value of a specific type for custom JSON
+// behaviors not matched by a custom CBOR behavior.
+type checker struct {
+ // check returns a non-nil error if the given value might be marshalled to or from CBOR
+ // using the default behavior for its kind, but marshalled to or from JSON using custom
+ // behavior.
+ check func(rv reflect.Value, depth int) error
+
+ // safe returns true if all values of this type are safe from mismatched custom marshalers.
+ safe func() bool
+}
+
+// TODO: stale
+// Having a single addressable checker for comparisons lets us prune and collapse parts of the
+// object traversal that are statically known to be safe. Depending on the type, it may be
+// unnecessary to inspect each value of that type. For example, no value of the built-in type bool
+// can implement json.Marshaler (a named type whose underlying type is bool could, but it is a
+// distinct type from bool).
+var noop = checker{
+ safe: func() bool {
+ return true
+ },
+ check: func(rv reflect.Value, depth int) error {
+ return nil
+ },
+}
+
+type checkers struct {
+ m sync.Map // reflect.Type => *checker
+
+ cborInterface reflect.Type
+ nonCBORInterfaces []reflect.Type
+
+ assumeAddressableValues bool
+}
+
+func (cache *checkers) getChecker(rt reflect.Type) checker {
+ if ptr, ok := cache.m.Load(rt); ok {
+ return *ptr.(*checker)
+ }
+
+ return cache.getCheckerInternal(rt, nil)
+}
+
+// linked list node representing the path from a composite type to an element type
+type path struct {
+ Type reflect.Type
+ Parent *path
+}
+
+func (p path) cyclic(rt reflect.Type) bool {
+ for ancestor := &p; ancestor != nil; ancestor = ancestor.Parent {
+ if ancestor.Type == rt {
+ return true
+ }
+ }
+ return false
+}
+
+func (cache *checkers) getCheckerInternal(rt reflect.Type, parent *path) (c checker) {
+ // Store a placeholder cache entry first to handle cyclic types.
+ var wg sync.WaitGroup
+ wg.Add(1)
+ defer wg.Done()
+ c = checker{
+ safe: func() bool {
+ wg.Wait()
+ return c.safe()
+ },
+ check: func(rv reflect.Value, depth int) error {
+ wg.Wait()
+ return c.check(rv, depth)
+ },
+ }
+ if actual, loaded := cache.m.LoadOrStore(rt, &c); loaded {
+ // Someone else stored an entry for this type, use it.
+ return *actual.(*checker)
+ }
+
+ // Take a nonreflective path for the unstructured container types. They're common and
+ // usually nested inside one another.
+ switch rt {
+ case reflect.TypeFor[map[string]interface{}](), reflect.TypeFor[[]interface{}]():
+ return checker{
+ safe: func() bool {
+ return false
+ },
+ check: func(rv reflect.Value, depth int) error {
+ return checkUnstructuredValue(cache, rv.Interface(), depth)
+ },
+ }
+ }
+
+ // It's possible that one of the relevant interfaces is implemented on a type with a pointer
+ // receiver, but that a particular value of that type is not addressable. For example:
+ //
+ // func (Foo) MarshalText() ([]byte, error) { ... }
+ // func (*Foo) MarshalCBOR() ([]byte, error) { ... }
+ //
+ // Both methods are in the method set of *Foo, but the method set of Foo contains only
+ // MarshalText.
+ //
+ // Both the unmarshaler and marshaler checks assume that methods implementing a JSON or text
+ // interface with a pointer receiver are always accessible. Only the unmarshaler check
+ // assumes that CBOR methods with pointer receivers are accessible.
+
+ if rt.Implements(cache.cborInterface) {
+ return noop
+ }
+ for _, unsafe := range cache.nonCBORInterfaces {
+ if rt.Implements(unsafe) {
+ err := fmt.Errorf("%v implements %v without corresponding cbor interface", rt, unsafe)
+ return checker{
+ safe: func() bool {
+ return false
+ },
+ check: func(reflect.Value, int) error {
+ return err
+ },
+ }
+ }
+ }
+
+ if cache.assumeAddressableValues && reflect.PointerTo(rt).Implements(cache.cborInterface) {
+ return noop
+ }
+ for _, unsafe := range cache.nonCBORInterfaces {
+ if reflect.PointerTo(rt).Implements(unsafe) {
+ err := fmt.Errorf("%v implements %v without corresponding cbor interface", reflect.PointerTo(rt), unsafe)
+ return checker{
+ safe: func() bool {
+ return false
+ },
+ check: func(reflect.Value, int) error {
+ return err
+ },
+ }
+ }
+ }
+
+ self := &path{Type: rt, Parent: parent}
+
+ switch rt.Kind() {
+ case reflect.Array:
+ ce := cache.getCheckerInternal(rt.Elem(), self)
+ rtlen := rt.Len()
+ if rtlen == 0 || (!self.cyclic(rt.Elem()) && ce.safe()) {
+ return noop
+ }
+ return checker{
+ safe: func() bool {
+ return false
+ },
+ check: func(rv reflect.Value, depth int) error {
+ if depth <= 0 {
+ return errMaxDepthExceeded
+ }
+ for i := 0; i < rtlen; i++ {
+ if err := ce.check(rv.Index(i), depth-1); err != nil {
+ return err
+ }
+ }
+ return nil
+ },
+ }
+
+ case reflect.Interface:
+ // All interface values have to be checked because their dynamic type might
+ // implement one of the interesting interfaces or be composed of another type that
+ // does.
+ return checker{
+ safe: func() bool {
+ return false
+ },
+ check: func(rv reflect.Value, depth int) error {
+ if rv.IsNil() {
+ return nil
+ }
+ // Unpacking interfaces must count against recursion depth,
+ // consider this cycle:
+ // > var i interface{}
+ // > var p *interface{} = &i
+ // > i = p
+ // > rv := reflect.ValueOf(i)
+ // > for {
+ // > rv = rv.Elem()
+ // > }
+ if depth <= 0 {
+ return errMaxDepthExceeded
+ }
+ rv = rv.Elem()
+ return cache.getChecker(rv.Type()).check(rv, depth-1)
+ },
+ }
+
+ case reflect.Map:
+ rtk := rt.Key()
+ ck := cache.getCheckerInternal(rtk, self)
+ rte := rt.Elem()
+ ce := cache.getCheckerInternal(rte, self)
+ if !self.cyclic(rtk) && !self.cyclic(rte) && ck.safe() && ce.safe() {
+ return noop
+ }
+ return checker{
+ safe: func() bool {
+ return false
+ },
+ check: func(rv reflect.Value, depth int) error {
+ if depth <= 0 {
+ return errMaxDepthExceeded
+ }
+ iter := rv.MapRange()
+ rvk := reflect.New(rtk).Elem()
+ rve := reflect.New(rte).Elem()
+ for iter.Next() {
+ rvk.SetIterKey(iter)
+ if err := ck.check(rvk, depth-1); err != nil {
+ return err
+ }
+ rve.SetIterValue(iter)
+ if err := ce.check(rve, depth-1); err != nil {
+ return err
+ }
+ }
+ return nil
+ },
+ }
+
+ case reflect.Pointer:
+ ce := cache.getCheckerInternal(rt.Elem(), self)
+ if !self.cyclic(rt.Elem()) && ce.safe() {
+ return noop
+ }
+ return checker{
+ safe: func() bool {
+ return false
+ },
+ check: func(rv reflect.Value, depth int) error {
+ if rv.IsNil() {
+ return nil
+ }
+ if depth <= 0 {
+ return errMaxDepthExceeded
+ }
+ return ce.check(rv.Elem(), depth-1)
+ },
+ }
+
+ case reflect.Slice:
+ ce := cache.getCheckerInternal(rt.Elem(), self)
+ if !self.cyclic(rt.Elem()) && ce.safe() {
+ return noop
+ }
+ return checker{
+ safe: func() bool {
+ return false
+ },
+ check: func(rv reflect.Value, depth int) error {
+ if depth <= 0 {
+ return errMaxDepthExceeded
+ }
+ for i := 0; i < rv.Len(); i++ {
+ if err := ce.check(rv.Index(i), depth-1); err != nil {
+ return err
+ }
+ }
+ return nil
+ },
+ }
+
+ case reflect.Struct:
+ type field struct {
+ Index int
+ Checker checker
+ }
+ var fields []field
+ for i := 0; i < rt.NumField(); i++ {
+ f := rt.Field(i)
+ cf := cache.getCheckerInternal(f.Type, self)
+ if !self.cyclic(f.Type) && cf.safe() {
+ continue
+ }
+ fields = append(fields, field{Index: i, Checker: cf})
+ }
+ if len(fields) == 0 {
+ return noop
+ }
+ return checker{
+ safe: func() bool {
+ return false
+ },
+ check: func(rv reflect.Value, depth int) error {
+ if depth <= 0 {
+ return errMaxDepthExceeded
+ }
+ for _, fi := range fields {
+ if err := fi.Checker.check(rv.Field(fi.Index), depth-1); err != nil {
+ return err
+ }
+ }
+ return nil
+ },
+ }
+
+ default:
+ // Not a serializable composite type (funcs and channels are composite types but are
+ // rejected by JSON and CBOR serialization).
+ return noop
+
+ }
+}
+
+func checkUnstructuredValue(cache *checkers, v interface{}, depth int) error {
+ switch v := v.(type) {
+ case nil, bool, int64, float64, string:
+ return nil
+ case []interface{}:
+ if depth <= 0 {
+ return errMaxDepthExceeded
+ }
+ for _, element := range v {
+ if err := checkUnstructuredValue(cache, element, depth-1); err != nil {
+ return err
+ }
+ }
+ return nil
+ case map[string]interface{}:
+ if depth <= 0 {
+ return errMaxDepthExceeded
+ }
+ for _, element := range v {
+ if err := checkUnstructuredValue(cache, element, depth-1); err != nil {
+ return err
+ }
+ }
+ return nil
+ default:
+ // Unmarshaling an unstructured doesn't use other dynamic types, but nothing
+ // prevents inserting values with arbitrary dynamic types into unstructured content,
+ // as long as they can be marshalled.
+ rv := reflect.ValueOf(v)
+ return cache.getChecker(rv.Type()).check(rv, depth)
+ }
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/decode.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/decode.go
new file mode 100644
index 000000000..895b0deff
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/decode.go
@@ -0,0 +1,158 @@
+/*
+Copyright 2024 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package modes
+
+import (
+ "reflect"
+
+ "github.com/fxamacker/cbor/v2"
+)
+
+var simpleValues *cbor.SimpleValueRegistry = func() *cbor.SimpleValueRegistry {
+ var opts []func(*cbor.SimpleValueRegistry) error
+ for sv := 0; sv <= 255; sv++ {
+ // Reject simple values 0-19, 23, and 32-255. The simple values 24-31 are reserved
+ // and considered ill-formed by the CBOR specification. We only accept false (20),
+ // true (21), and null (22).
+ switch sv {
+ case 20: // false
+ case 21: // true
+ case 22: // null
+ case 24, 25, 26, 27, 28, 29, 30, 31: // reserved
+ default:
+ opts = append(opts, cbor.WithRejectedSimpleValue(cbor.SimpleValue(sv)))
+ }
+ }
+ simpleValues, err := cbor.NewSimpleValueRegistryFromDefaults(opts...)
+ if err != nil {
+ panic(err)
+ }
+ return simpleValues
+}()
+
+var Decode cbor.DecMode = func() cbor.DecMode {
+ decode, err := cbor.DecOptions{
+ // Maps with duplicate keys are well-formed but invalid according to the CBOR spec
+ // and never acceptable. Unlike the JSON serializer, inputs containing duplicate map
+ // keys are rejected outright and not surfaced as a strict decoding error.
+ DupMapKey: cbor.DupMapKeyEnforcedAPF,
+
+ // For JSON parity, decoding an RFC3339 string into time.Time needs to be accepted
+ // with or without tagging. If a tag number is present, it must be valid.
+ TimeTag: cbor.DecTagOptional,
+
+ // Observed depth up to 16 in fuzzed batch/v1 CronJobList. JSON implementation limit
+ // is 10000.
+ MaxNestedLevels: 64,
+
+ MaxArrayElements: 1024,
+ MaxMapPairs: 1024,
+
+ // Indefinite-length sequences aren't produced by this serializer, but other
+ // implementations can.
+ IndefLength: cbor.IndefLengthAllowed,
+
+ // Accept inputs that contain CBOR tags.
+ TagsMd: cbor.TagsAllowed,
+
+ // Decode type 0 (unsigned integer) as int64.
+ // TODO: IntDecConvertSignedOrFail errors on overflow, JSON will try to fall back to float64.
+ IntDec: cbor.IntDecConvertSignedOrFail,
+
+ // Disable producing map[cbor.ByteString]interface{}, which is not acceptable for
+ // decodes into interface{}.
+ MapKeyByteString: cbor.MapKeyByteStringForbidden,
+
+ // Error on map keys that don't map to a field in the destination struct.
+ ExtraReturnErrors: cbor.ExtraDecErrorUnknownField,
+
+ // Decode maps into concrete type map[string]interface{} when the destination is an
+ // interface{}.
+ DefaultMapType: reflect.TypeOf(map[string]interface{}(nil)),
+
+ // A CBOR text string whose content is not a valid UTF-8 sequence is well-formed but
+ // invalid according to the CBOR spec. Reject invalid inputs. Encoders are
+ // responsible for ensuring that all text strings they produce contain valid UTF-8
+ // sequences and may use the byte string major type to encode strings that have not
+ // been validated.
+ UTF8: cbor.UTF8RejectInvalid,
+
+ // Never make a case-insensitive match between a map key and a struct field.
+ FieldNameMatching: cbor.FieldNameMatchingCaseSensitive,
+
+ // Produce string concrete values when decoding a CBOR byte string into interface{}.
+ DefaultByteStringType: reflect.TypeOf(""),
+
+ // Allow CBOR byte strings to be decoded into string destination values. If a byte
+ // string is enclosed in an "expected later encoding" tag
+ // (https://www.rfc-editor.org/rfc/rfc8949.html#section-3.4.5.2), then the text
+ // encoding indicated by that tag (e.g. base64) will be applied to the contents of
+ // the byte string.
+ ByteStringToString: cbor.ByteStringToStringAllowedWithExpectedLaterEncoding,
+
+ // Allow CBOR byte strings to match struct fields when appearing as a map key.
+ FieldNameByteString: cbor.FieldNameByteStringAllowed,
+
+ // When decoding an unrecognized tag to interface{}, return the decoded tag content
+ // instead of the default, a cbor.Tag representing a (number, content) pair.
+ UnrecognizedTagToAny: cbor.UnrecognizedTagContentToAny,
+
+ // Decode time tags to interface{} as strings containing RFC 3339 timestamps.
+ TimeTagToAny: cbor.TimeTagToRFC3339Nano,
+
+ // For parity with JSON, strings can be decoded into time.Time if they are RFC 3339
+ // timestamps.
+ ByteStringToTime: cbor.ByteStringToTimeAllowed,
+
+ // Reject NaN and infinite floating-point values since they don't have a JSON
+ // representation (RFC 8259 Section 6).
+ NaN: cbor.NaNDecodeForbidden,
+ Inf: cbor.InfDecodeForbidden,
+
+ // When unmarshaling a byte string into a []byte, assume that the byte string
+ // contains base64-encoded bytes, unless explicitly counterindicated by an "expected
+ // later encoding" tag. This is consistent with the because of unmarshaling a JSON
+ // text into a []byte.
+ ByteStringExpectedFormat: cbor.ByteStringExpectedBase64,
+
+ // Reject the arbitrary-precision integer tags because they can't be faithfully
+ // roundtripped through the allowable Unstructured types.
+ BignumTag: cbor.BignumTagForbidden,
+
+ // Reject anything other than the simple values true, false, and null.
+ SimpleValues: simpleValues,
+
+ // Disable default recognition of types implementing encoding.BinaryUnmarshaler,
+ // which is not recognized for JSON decoding.
+ BinaryUnmarshaler: cbor.BinaryUnmarshalerNone,
+ }.DecMode()
+ if err != nil {
+ panic(err)
+ }
+ return decode
+}()
+
+// DecodeLax is derived from Decode, but does not complain about unknown fields in the input.
+var DecodeLax cbor.DecMode = func() cbor.DecMode {
+ opts := Decode.DecOptions()
+ opts.ExtraReturnErrors &^= cbor.ExtraDecErrorUnknownField // clear bit
+ dm, err := opts.DecMode()
+ if err != nil {
+ panic(err)
+ }
+ return dm
+}()
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/diagnostic.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/diagnostic.go
new file mode 100644
index 000000000..61f3f145f
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/diagnostic.go
@@ -0,0 +1,36 @@
+/*
+Copyright 2024 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package modes
+
+import (
+ "github.com/fxamacker/cbor/v2"
+)
+
+var Diagnostic cbor.DiagMode = func() cbor.DiagMode {
+ opts := Decode.DecOptions()
+ diagnostic, err := cbor.DiagOptions{
+ ByteStringText: true,
+
+ MaxNestedLevels: opts.MaxNestedLevels,
+ MaxArrayElements: opts.MaxArrayElements,
+ MaxMapPairs: opts.MaxMapPairs,
+ }.DiagMode()
+ if err != nil {
+ panic(err)
+ }
+ return diagnostic
+}()
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/encode.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/encode.go
new file mode 100644
index 000000000..c66931384
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/encode.go
@@ -0,0 +1,155 @@
+/*
+Copyright 2024 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package modes
+
+import (
+ "io"
+
+ "github.com/fxamacker/cbor/v2"
+)
+
+var Encode = EncMode{
+ delegate: func() cbor.UserBufferEncMode {
+ encode, err := cbor.EncOptions{
+ // Map keys need to be sorted to have deterministic output, and this is the order
+ // defined in RFC 8949 4.2.1 "Core Deterministic Encoding Requirements".
+ Sort: cbor.SortBytewiseLexical,
+
+ // CBOR supports distinct types for IEEE-754 float16, float32, and float64. Store
+ // floats in the smallest width that preserves value so that equivalent float32 and
+ // float64 values encode to identical bytes, as they do in a JSON
+ // encoding. Satisfies one of the "Core Deterministic Encoding Requirements".
+ ShortestFloat: cbor.ShortestFloat16,
+
+ // Error on attempt to encode NaN and infinite values. This is what the JSON
+ // serializer does.
+ NaNConvert: cbor.NaNConvertReject,
+ InfConvert: cbor.InfConvertReject,
+
+ // Error on attempt to encode math/big.Int values, which can't be faithfully
+ // roundtripped through Unstructured in general (the dynamic numeric types allowed
+ // in Unstructured are limited to float64 and int64).
+ BigIntConvert: cbor.BigIntConvertReject,
+
+ // MarshalJSON for time.Time writes RFC3339 with nanos.
+ Time: cbor.TimeRFC3339Nano,
+
+ // The decoder must be able to accept RFC3339 strings with or without tag 0 (e.g. by
+ // the end of time.Time -> JSON -> Unstructured -> CBOR, the CBOR encoder has no
+ // reliable way of knowing that a particular string originated from serializing a
+ // time.Time), so producing tag 0 has little use.
+ TimeTag: cbor.EncTagNone,
+
+ // Indefinite-length items have multiple encodings and aren't being used anyway, so
+ // disable to avoid an opportunity for nondeterminism.
+ IndefLength: cbor.IndefLengthForbidden,
+
+ // Preserve distinction between nil and empty for slices and maps.
+ NilContainers: cbor.NilContainerAsNull,
+
+ // OK to produce tags.
+ TagsMd: cbor.TagsAllowed,
+
+ // Use the same definition of "empty" as encoding/json.
+ OmitEmpty: cbor.OmitEmptyGoValue,
+
+ // The CBOR types text string and byte string are structurally equivalent, with the
+ // semantic difference that a text string whose content is an invalid UTF-8 sequence
+ // is itself invalid. We reject all invalid text strings at decode time and do not
+ // validate or sanitize all Go strings at encode time. Encoding Go strings to the
+ // byte string type is comparable to the existing Protobuf behavior and cheaply
+ // ensures that the output is valid CBOR.
+ String: cbor.StringToByteString,
+
+ // Encode struct field names to the byte string type rather than the text string
+ // type.
+ FieldName: cbor.FieldNameToByteString,
+
+ // Marshal Go byte arrays to CBOR arrays of integers (as in JSON) instead of byte
+ // strings.
+ ByteArray: cbor.ByteArrayToArray,
+
+ // Marshal []byte to CBOR byte string enclosed in tag 22 (expected later base64
+ // encoding, https://www.rfc-editor.org/rfc/rfc8949.html#section-3.4.5.2), to
+ // interoperate with the existing JSON behavior. This indicates to the decoder that,
+ // when decoding into a string (or unstructured), the resulting value should be the
+ // base64 encoding of the original bytes. No base64 encoding or decoding needs to be
+ // performed for []byte-to-CBOR-to-[]byte roundtrips.
+ ByteSliceLaterFormat: cbor.ByteSliceLaterFormatBase64,
+
+ // Disable default recognition of types implementing encoding.BinaryMarshaler, which
+ // is not recognized for JSON encoding.
+ BinaryMarshaler: cbor.BinaryMarshalerNone,
+ }.UserBufferEncMode()
+ if err != nil {
+ panic(err)
+ }
+ return encode
+ }(),
+}
+
+var EncodeNondeterministic = EncMode{
+ delegate: func() cbor.UserBufferEncMode {
+ opts := Encode.options()
+ opts.Sort = cbor.SortNone // TODO: Use cbor.SortFastShuffle after bump to v2.7.0.
+ em, err := opts.UserBufferEncMode()
+ if err != nil {
+ panic(err)
+ }
+ return em
+ }(),
+}
+
+type EncMode struct {
+ delegate cbor.UserBufferEncMode
+}
+
+func (em EncMode) options() cbor.EncOptions {
+ return em.delegate.EncOptions()
+}
+
+func (em EncMode) MarshalTo(v interface{}, w io.Writer) error {
+ if buf, ok := w.(*buffer); ok {
+ return em.delegate.MarshalToBuffer(v, &buf.Buffer)
+ }
+
+ buf := buffers.Get()
+ defer buffers.Put(buf)
+ if err := em.delegate.MarshalToBuffer(v, &buf.Buffer); err != nil {
+ return err
+ }
+
+ if _, err := io.Copy(w, buf); err != nil {
+ return err
+ }
+
+ return nil
+}
+
+func (em EncMode) Marshal(v interface{}) ([]byte, error) {
+ buf := buffers.Get()
+ defer buffers.Put(buf)
+
+ if err := em.MarshalTo(v, &buf.Buffer); err != nil {
+ return nil, err
+ }
+
+ clone := make([]byte, buf.Len())
+ copy(clone, buf.Bytes())
+
+ return clone, nil
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/codec_factory.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/codec_factory.go
index 21944f2d8..ff9820842 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/codec_factory.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/codec_factory.go
@@ -259,8 +259,7 @@ func (f CodecFactory) SupportedMediaTypes() []runtime.SerializerInfo {
// invoke CodecForVersions. Callers that need only to read data should use UniversalDecoder().
//
// TODO: make this call exist only in pkg/api, and initialize it with the set of default versions.
-//
-// All other callers will be forced to request a Codec directly.
+// All other callers will be forced to request a Codec directly.
func (f CodecFactory) LegacyCodec(version ...schema.GroupVersion) runtime.Codec {
return versioning.NewDefaultingCodecForScheme(f.scheme, f.legacySerializer, f.universal, schema.GroupVersions(version), runtime.InternalGroupVersioner)
}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/json.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/json.go
index 6c082f660..1ae4a32eb 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/json.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/json.go
@@ -166,7 +166,20 @@ func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, i
strictErrs, err := s.unmarshal(into, data, originalData)
if err != nil {
return nil, actual, err
- } else if len(strictErrs) > 0 {
+ }
+
+ // when decoding directly into a provided unstructured object,
+ // extract the actual gvk decoded from the provided data,
+ // and ensure it is non-empty.
+ if isUnstructured {
+ *actual = into.GetObjectKind().GroupVersionKind()
+ if len(actual.Kind) == 0 {
+ return nil, actual, runtime.NewMissingKindErr(string(originalData))
+ }
+ // TODO(109023): require apiVersion here as well once unstructuredJSONScheme#Decode does
+ }
+
+ if len(strictErrs) > 0 {
return into, actual, runtime.NewStrictDecodingError(strictErrs)
}
return into, actual, nil
@@ -261,9 +274,9 @@ func (s *Serializer) unmarshal(into runtime.Object, data, originalData []byte) (
var strictJSONErrs []error
if u, isUnstructured := into.(runtime.Unstructured); isUnstructured {
// Unstructured is a custom unmarshaler that gets delegated
- // to, so inorder to detect strict JSON errors we need
+ // to, so in order to detect strict JSON errors we need
// to unmarshal directly into the object.
- m := u.UnstructuredContent()
+ m := map[string]interface{}{}
strictJSONErrs, err = kjson.UnmarshalStrict(data, &m)
u.SetUnstructuredContent(m)
} else {
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf/protobuf.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf/protobuf.go
index 8358d77c3..c63e6dc63 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf/protobuf.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf/protobuf.go
@@ -30,6 +30,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/runtime/serializer/recognizer"
"k8s.io/apimachinery/pkg/util/framer"
+ "k8s.io/klog/v2"
)
var (
@@ -86,6 +87,7 @@ type Serializer struct {
}
var _ runtime.Serializer = &Serializer{}
+var _ runtime.EncoderWithAllocator = &Serializer{}
var _ recognizer.RecognizingDecoder = &Serializer{}
const serializerIdentifier runtime.Identifier = "protobuf"
@@ -161,22 +163,36 @@ func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, i
return unmarshalToObject(s.typer, s.creater, &actual, into, unk.Raw)
}
+// EncodeWithAllocator writes an object to the provided writer.
+// In addition, it allows for providing a memory allocator for efficient memory usage during object serialization.
+func (s *Serializer) EncodeWithAllocator(obj runtime.Object, w io.Writer, memAlloc runtime.MemoryAllocator) error {
+ return s.encode(obj, w, memAlloc)
+}
+
// Encode serializes the provided object to the given writer.
func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error {
+ return s.encode(obj, w, &runtime.SimpleAllocator{})
+}
+
+func (s *Serializer) encode(obj runtime.Object, w io.Writer, memAlloc runtime.MemoryAllocator) error {
if co, ok := obj.(runtime.CacheableObject); ok {
- return co.CacheEncode(s.Identifier(), s.doEncode, w)
+ return co.CacheEncode(s.Identifier(), func(obj runtime.Object, w io.Writer) error { return s.doEncode(obj, w, memAlloc) }, w)
}
- return s.doEncode(obj, w)
+ return s.doEncode(obj, w, memAlloc)
}
-func (s *Serializer) doEncode(obj runtime.Object, w io.Writer) error {
+func (s *Serializer) doEncode(obj runtime.Object, w io.Writer, memAlloc runtime.MemoryAllocator) error {
+ if memAlloc == nil {
+ klog.Error("a mandatory memory allocator wasn't provided, this might have a negative impact on performance, check invocations of EncodeWithAllocator method, falling back on runtime.SimpleAllocator")
+ memAlloc = &runtime.SimpleAllocator{}
+ }
prefixSize := uint64(len(s.prefix))
var unk runtime.Unknown
switch t := obj.(type) {
case *runtime.Unknown:
estimatedSize := prefixSize + uint64(t.Size())
- data := make([]byte, estimatedSize)
+ data := memAlloc.Allocate(estimatedSize)
i, err := t.MarshalTo(data[prefixSize:])
if err != nil {
return err
@@ -196,11 +212,11 @@ func (s *Serializer) doEncode(obj runtime.Object, w io.Writer) error {
switch t := obj.(type) {
case bufferedMarshaller:
- // this path performs a single allocation during write but requires the caller to implement
- // the more efficient Size and MarshalToSizedBuffer methods
+ // this path performs a single allocation during write only when the Allocator wasn't provided
+ // it also requires the caller to implement the more efficient Size and MarshalToSizedBuffer methods
encodedSize := uint64(t.Size())
estimatedSize := prefixSize + estimateUnknownSize(&unk, encodedSize)
- data := make([]byte, estimatedSize)
+ data := memAlloc.Allocate(estimatedSize)
i, err := unk.NestedMarshalTo(data[prefixSize:], t, encodedSize)
if err != nil {
@@ -221,7 +237,7 @@ func (s *Serializer) doEncode(obj runtime.Object, w io.Writer) error {
unk.Raw = data
estimatedSize := prefixSize + uint64(unk.Size())
- data = make([]byte, estimatedSize)
+ data = memAlloc.Allocate(estimatedSize)
i, err := unk.MarshalTo(data[prefixSize:])
if err != nil {
@@ -395,19 +411,33 @@ func unmarshalToObject(typer runtime.ObjectTyper, creater runtime.ObjectCreater,
// Encode serializes the provided object to the given writer. Overrides is ignored.
func (s *RawSerializer) Encode(obj runtime.Object, w io.Writer) error {
+ return s.encode(obj, w, &runtime.SimpleAllocator{})
+}
+
+// EncodeWithAllocator writes an object to the provided writer.
+// In addition, it allows for providing a memory allocator for efficient memory usage during object serialization.
+func (s *RawSerializer) EncodeWithAllocator(obj runtime.Object, w io.Writer, memAlloc runtime.MemoryAllocator) error {
+ return s.encode(obj, w, memAlloc)
+}
+
+func (s *RawSerializer) encode(obj runtime.Object, w io.Writer, memAlloc runtime.MemoryAllocator) error {
if co, ok := obj.(runtime.CacheableObject); ok {
- return co.CacheEncode(s.Identifier(), s.doEncode, w)
+ return co.CacheEncode(s.Identifier(), func(obj runtime.Object, w io.Writer) error { return s.doEncode(obj, w, memAlloc) }, w)
}
- return s.doEncode(obj, w)
+ return s.doEncode(obj, w, memAlloc)
}
-func (s *RawSerializer) doEncode(obj runtime.Object, w io.Writer) error {
+func (s *RawSerializer) doEncode(obj runtime.Object, w io.Writer, memAlloc runtime.MemoryAllocator) error {
+ if memAlloc == nil {
+ klog.Error("a mandatory memory allocator wasn't provided, this might have a negative impact on performance, check invocations of EncodeWithAllocator method, falling back on runtime.SimpleAllocator")
+ memAlloc = &runtime.SimpleAllocator{}
+ }
switch t := obj.(type) {
case bufferedReverseMarshaller:
- // this path performs a single allocation during write but requires the caller to implement
- // the more efficient Size and MarshalToSizedBuffer methods
+ // this path performs a single allocation during write only when the Allocator wasn't provided
+ // it also requires the caller to implement the more efficient Size and MarshalToSizedBuffer methods
encodedSize := uint64(t.Size())
- data := make([]byte, encodedSize)
+ data := memAlloc.Allocate(encodedSize)
n, err := t.MarshalToSizedBuffer(data)
if err != nil {
@@ -417,10 +447,10 @@ func (s *RawSerializer) doEncode(obj runtime.Object, w io.Writer) error {
return err
case bufferedMarshaller:
- // this path performs a single allocation during write but requires the caller to implement
- // the more efficient Size and MarshalTo methods
+ // this path performs a single allocation during write only when the Allocator wasn't provided
+ // it also requires the caller to implement the more efficient Size and MarshalTo methods
encodedSize := uint64(t.Size())
- data := make([]byte, encodedSize)
+ data := memAlloc.Allocate(encodedSize)
n, err := t.MarshalTo(data)
if err != nil {
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go
index ea7c580bd..25f955ed7 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go
@@ -89,6 +89,8 @@ type codec struct {
originalSchemeName string
}
+var _ runtime.EncoderWithAllocator = &codec{}
+
var identifiersMap sync.Map
type codecIdentifier struct {
@@ -133,24 +135,34 @@ func (c *codec) Decode(data []byte, defaultGVK *schema.GroupVersionKind, into ru
}
}
- var strictDecodingErr error
+ var strictDecodingErrs []error
obj, gvk, err := c.decoder.Decode(data, defaultGVK, decodeInto)
if err != nil {
- if obj != nil && runtime.IsStrictDecodingError(err) {
- // save the strictDecodingError and the caller decide what to do with it
- strictDecodingErr = err
+ if strictErr, ok := runtime.AsStrictDecodingError(err); obj != nil && ok {
+ // save the strictDecodingError and let the caller decide what to do with it
+ strictDecodingErrs = append(strictDecodingErrs, strictErr.Errors()...)
} else {
return nil, gvk, err
}
}
- // TODO: look into strict handling of nested object decoding
if d, ok := obj.(runtime.NestedObjectDecoder); ok {
- if err := d.DecodeNestedObjects(runtime.WithoutVersionDecoder{c.decoder}); err != nil {
- return nil, gvk, err
+ if err := d.DecodeNestedObjects(runtime.WithoutVersionDecoder{Decoder: c.decoder}); err != nil {
+ if strictErr, ok := runtime.AsStrictDecodingError(err); ok {
+ // save the strictDecodingError let and the caller decide what to do with it
+ strictDecodingErrs = append(strictDecodingErrs, strictErr.Errors()...)
+ } else {
+ return nil, gvk, err
+
+ }
}
}
+ // aggregate the strict decoding errors into one
+ var strictDecodingErr error
+ if len(strictDecodingErrs) > 0 {
+ strictDecodingErr = runtime.NewStrictDecodingError(strictDecodingErrs)
+ }
// if we specify a target, use generic conversion.
if into != nil {
// perform defaulting if requested
@@ -182,19 +194,40 @@ func (c *codec) Decode(data []byte, defaultGVK *schema.GroupVersionKind, into ru
return out, gvk, strictDecodingErr
}
+// EncodeWithAllocator ensures the provided object is output in the appropriate group and version, invoking
+// conversion if necessary. Unversioned objects (according to the ObjectTyper) are output as is.
+// In addition, it allows for providing a memory allocator for efficient memory usage during object serialization.
+func (c *codec) EncodeWithAllocator(obj runtime.Object, w io.Writer, memAlloc runtime.MemoryAllocator) error {
+ return c.encode(obj, w, memAlloc)
+}
+
// Encode ensures the provided object is output in the appropriate group and version, invoking
// conversion if necessary. Unversioned objects (according to the ObjectTyper) are output as is.
func (c *codec) Encode(obj runtime.Object, w io.Writer) error {
+ return c.encode(obj, w, nil)
+}
+
+func (c *codec) encode(obj runtime.Object, w io.Writer, memAlloc runtime.MemoryAllocator) error {
if co, ok := obj.(runtime.CacheableObject); ok {
- return co.CacheEncode(c.Identifier(), c.doEncode, w)
+ return co.CacheEncode(c.Identifier(), func(obj runtime.Object, w io.Writer) error { return c.doEncode(obj, w, memAlloc) }, w)
}
- return c.doEncode(obj, w)
+ return c.doEncode(obj, w, memAlloc)
}
-func (c *codec) doEncode(obj runtime.Object, w io.Writer) error {
+func (c *codec) doEncode(obj runtime.Object, w io.Writer, memAlloc runtime.MemoryAllocator) error {
+ encodeFn := c.encoder.Encode
+ if memAlloc != nil {
+ if encoder, supportsAllocator := c.encoder.(runtime.EncoderWithAllocator); supportsAllocator {
+ encodeFn = func(obj runtime.Object, w io.Writer) error {
+ return encoder.EncodeWithAllocator(obj, w, memAlloc)
+ }
+ } else {
+ klog.V(6).Infof("a memory allocator was provided but the encoder %s doesn't implement the runtime.EncoderWithAllocator, using regular encoder.Encode method", c.encoder.Identifier())
+ }
+ }
switch obj := obj.(type) {
case *runtime.Unknown:
- return c.encoder.Encode(obj, w)
+ return encodeFn(obj, w)
case runtime.Unstructured:
// An unstructured list can contain objects of multiple group version kinds. don't short-circuit just
// because the top-level type matches our desired destination type. actually send the object to the converter
@@ -203,14 +236,14 @@ func (c *codec) doEncode(obj runtime.Object, w io.Writer) error {
// avoid conversion roundtrip if GVK is the right one already or is empty (yes, this is a hack, but the old behaviour we rely on in kubectl)
objGVK := obj.GetObjectKind().GroupVersionKind()
if len(objGVK.Version) == 0 {
- return c.encoder.Encode(obj, w)
+ return encodeFn(obj, w)
}
targetGVK, ok := c.encodeVersion.KindForGroupVersionKinds([]schema.GroupVersionKind{objGVK})
if !ok {
return runtime.NewNotRegisteredGVKErrForTarget(c.originalSchemeName, objGVK, c.encodeVersion)
}
if targetGVK == objGVK {
- return c.encoder.Encode(obj, w)
+ return encodeFn(obj, w)
}
}
}
@@ -232,7 +265,7 @@ func (c *codec) doEncode(obj runtime.Object, w io.Writer) error {
}
}
objectKind.SetGroupVersionKind(gvks[0])
- return c.encoder.Encode(obj, w)
+ return encodeFn(obj, w)
}
// Perform a conversion if necessary
@@ -248,7 +281,7 @@ func (c *codec) doEncode(obj runtime.Object, w io.Writer) error {
}
// Conversion is responsible for setting the proper group, version, and kind onto the outgoing object
- return c.encoder.Encode(out, w)
+ return encodeFn(out, w)
}
// Identifier implements runtime.Encoder interface.
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/splice.go b/vendor/k8s.io/apimachinery/pkg/runtime/splice.go
new file mode 100644
index 000000000..2badb7b97
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/splice.go
@@ -0,0 +1,76 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package runtime
+
+import (
+ "bytes"
+ "io"
+)
+
+// Splice is the interface that wraps the Splice method.
+//
+// Splice moves data from given slice without copying the underlying data for
+// efficiency purpose. Therefore, the caller should make sure the underlying
+// data is not changed later.
+type Splice interface {
+ Splice([]byte)
+ io.Writer
+ Reset()
+ Bytes() []byte
+}
+
+// A spliceBuffer implements Splice and io.Writer interfaces.
+type spliceBuffer struct {
+ raw []byte
+ buf *bytes.Buffer
+}
+
+func NewSpliceBuffer() Splice {
+ return &spliceBuffer{}
+}
+
+// Splice implements the Splice interface.
+func (sb *spliceBuffer) Splice(raw []byte) {
+ sb.raw = raw
+}
+
+// Write implements the io.Writer interface.
+func (sb *spliceBuffer) Write(p []byte) (n int, err error) {
+ if sb.buf == nil {
+ sb.buf = &bytes.Buffer{}
+ }
+ return sb.buf.Write(p)
+}
+
+// Reset resets the buffer to be empty.
+func (sb *spliceBuffer) Reset() {
+ if sb.buf != nil {
+ sb.buf.Reset()
+ }
+ sb.raw = nil
+}
+
+// Bytes returns the data held by the buffer.
+func (sb *spliceBuffer) Bytes() []byte {
+ if sb.buf != nil && len(sb.buf.Bytes()) > 0 {
+ return sb.buf.Bytes()
+ }
+ if sb.raw != nil {
+ return sb.raw
+ }
+ return []byte{}
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/types.go b/vendor/k8s.io/apimachinery/pkg/runtime/types.go
index 3dc9a5a2f..1680c149f 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/types.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/types.go
@@ -46,6 +46,7 @@ const (
ContentTypeJSON string = "application/json"
ContentTypeYAML string = "application/yaml"
ContentTypeProtobuf string = "application/vnd.kubernetes.protobuf"
+ ContentTypeCBOR string = "application/cbor"
)
// RawExtension is used to hold extensions in external versions.
@@ -123,7 +124,7 @@ type Unknown struct {
// Raw will hold the complete serialized object which couldn't be matched
// with a registered type. Most likely, nothing should be done with this
// except for passing it through the system.
- Raw []byte `protobuf:"bytes,2,opt,name=raw"`
+ Raw []byte `json:"-" protobuf:"bytes,2,opt,name=raw"`
// ContentEncoding is encoding used to encode 'Raw' data.
// Unspecified means no encoding.
ContentEncoding string `protobuf:"bytes,3,opt,name=contentEncoding"`
diff --git a/vendor/k8s.io/apimachinery/pkg/types/namespacedname.go b/vendor/k8s.io/apimachinery/pkg/types/namespacedname.go
index b19750f3a..db18ce1ce 100644
--- a/vendor/k8s.io/apimachinery/pkg/types/namespacedname.go
+++ b/vendor/k8s.io/apimachinery/pkg/types/namespacedname.go
@@ -37,3 +37,14 @@ const (
func (n NamespacedName) String() string {
return n.Namespace + string(Separator) + n.Name
}
+
+// MarshalLog emits a struct containing required key/value pair
+func (n NamespacedName) MarshalLog() interface{} {
+ return struct {
+ Name string `json:"name"`
+ Namespace string `json:"namespace,omitempty"`
+ }{
+ Name: n.Name,
+ Namespace: n.Namespace,
+ }
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/cache/expiring.go b/vendor/k8s.io/apimachinery/pkg/util/cache/expiring.go
index 0d2f153bf..1396274c7 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/cache/expiring.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/cache/expiring.go
@@ -40,6 +40,13 @@ func NewExpiringWithClock(clock clock.Clock) *Expiring {
// Expiring is a map whose entries expire after a per-entry timeout.
type Expiring struct {
+ // AllowExpiredGet causes the expiration check to be skipped on Get.
+ // It should only be used when a key always corresponds to the exact same value.
+ // Thus when this field is true, expired keys are considered valid
+ // until the next call to Set (which causes the GC to run).
+ // It may not be changed concurrently with calls to Get.
+ AllowExpiredGet bool
+
clock clock.Clock
// mu protects the below fields
@@ -70,7 +77,10 @@ func (c *Expiring) Get(key interface{}) (val interface{}, ok bool) {
c.mu.RLock()
defer c.mu.RUnlock()
e, ok := c.cache[key]
- if !ok || !c.clock.Now().Before(e.expiry) {
+ if !ok {
+ return nil, false
+ }
+ if !c.AllowExpiredGet && !c.clock.Now().Before(e.expiry) {
return nil, false
}
return e.val, true
diff --git a/vendor/k8s.io/apimachinery/pkg/util/cache/lruexpirecache.go b/vendor/k8s.io/apimachinery/pkg/util/cache/lruexpirecache.go
index 1328dd612..ad486d580 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/cache/lruexpirecache.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/cache/lruexpirecache.go
@@ -136,6 +136,19 @@ func (c *LRUExpireCache) Remove(key interface{}) {
delete(c.entries, key)
}
+// RemoveAll removes all keys that match predicate.
+func (c *LRUExpireCache) RemoveAll(predicate func(key any) bool) {
+ c.lock.Lock()
+ defer c.lock.Unlock()
+
+ for key, element := range c.entries {
+ if predicate(key) {
+ c.evictionList.Remove(element)
+ delete(c.entries, key)
+ }
+ }
+}
+
// Keys returns all unexpired keys in the cache.
//
// Keep in mind that subsequent calls to Get() for any of the returned keys
diff --git a/vendor/k8s.io/apimachinery/pkg/util/diff/diff.go b/vendor/k8s.io/apimachinery/pkg/util/diff/diff.go
index fa9ffa51b..fc0301844 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/diff/diff.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/diff/diff.go
@@ -23,34 +23,20 @@ import (
"strings"
"text/tabwriter"
- "github.com/davecgh/go-spew/spew"
"github.com/google/go-cmp/cmp"
+ "k8s.io/apimachinery/pkg/util/dump"
)
-// StringDiff diffs a and b and returns a human readable diff.
-func StringDiff(a, b string) string {
- ba := []byte(a)
- bb := []byte(b)
- out := []byte{}
- i := 0
- for ; i < len(ba) && i < len(bb); i++ {
- if ba[i] != bb[i] {
- break
- }
- out = append(out, ba[i])
- }
- out = append(out, []byte("\n\nA: ")...)
- out = append(out, ba[i:]...)
- out = append(out, []byte("\n\nB: ")...)
- out = append(out, bb[i:]...)
- out = append(out, []byte("\n\n")...)
- return string(out)
-}
-
func legacyDiff(a, b interface{}) string {
return cmp.Diff(a, b)
}
+// StringDiff diffs a and b and returns a human readable diff.
+// DEPRECATED: use github.com/google/go-cmp/cmp.Diff
+func StringDiff(a, b string) string {
+ return legacyDiff(a, b)
+}
+
// ObjectDiff prints the diff of two go objects and fails if the objects
// contain unhandled unexported fields.
// DEPRECATED: use github.com/google/go-cmp/cmp.Diff
@@ -75,13 +61,8 @@ func ObjectReflectDiff(a, b interface{}) string {
// ObjectGoPrintSideBySide prints a and b as textual dumps side by side,
// enabling easy visual scanning for mismatches.
func ObjectGoPrintSideBySide(a, b interface{}) string {
- s := spew.ConfigState{
- Indent: " ",
- // Extra deep spew.
- DisableMethods: true,
- }
- sA := s.Sdump(a)
- sB := s.Sdump(b)
+ sA := dump.Pretty(a)
+ sB := dump.Pretty(b)
linesA := strings.Split(sA, "\n")
linesB := strings.Split(sB, "\n")
@@ -135,7 +116,7 @@ func IgnoreUnset() cmp.Option {
if v2.Len() == 0 {
return true
}
- case reflect.Interface, reflect.Ptr:
+ case reflect.Interface, reflect.Pointer:
if v2.IsNil() {
return true
}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/dump/dump.go b/vendor/k8s.io/apimachinery/pkg/util/dump/dump.go
new file mode 100644
index 000000000..cf61ef76a
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/dump/dump.go
@@ -0,0 +1,54 @@
+/*
+Copyright 2021 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package dump
+
+import (
+ "github.com/davecgh/go-spew/spew"
+)
+
+var prettyPrintConfig = &spew.ConfigState{
+ Indent: " ",
+ DisableMethods: true,
+ DisablePointerAddresses: true,
+ DisableCapacities: true,
+}
+
+// The config MUST NOT be changed because that could change the result of a hash operation
+var prettyPrintConfigForHash = &spew.ConfigState{
+ Indent: " ",
+ SortKeys: true,
+ DisableMethods: true,
+ SpewKeys: true,
+ DisablePointerAddresses: true,
+ DisableCapacities: true,
+}
+
+// Pretty wrap the spew.Sdump with Indent, and disabled methods like error() and String()
+// The output may change over time, so for guaranteed output please take more direct control
+func Pretty(a interface{}) string {
+ return prettyPrintConfig.Sdump(a)
+}
+
+// ForHash keeps the original Spew.Sprintf format to ensure the same checksum
+func ForHash(a interface{}) string {
+ return prettyPrintConfigForHash.Sprintf("%#v", a)
+}
+
+// OneLine outputs the object in one line
+func OneLine(a interface{}) string {
+ return prettyPrintConfig.Sprintf("%#v", a)
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/errors/errors.go b/vendor/k8s.io/apimachinery/pkg/util/errors/errors.go
index 1f5a04fd4..1b60d145c 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/errors/errors.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/errors/errors.go
@@ -214,7 +214,7 @@ func CreateAggregateFromMessageCountMap(m MessageCountMap) Aggregate {
return NewAggregate(result)
}
-// Reduce will return err or, if err is an Aggregate and only has one item,
+// Reduce will return err or nil, if err is an Aggregate and only has one item,
// the first item in the aggregate.
func Reduce(err error) error {
if agg, ok := err.(Aggregate); ok && err != nil {
diff --git a/vendor/k8s.io/apimachinery/pkg/util/framer/framer.go b/vendor/k8s.io/apimachinery/pkg/util/framer/framer.go
index ca08f8561..1ab8fd396 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/framer/framer.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/framer/framer.go
@@ -32,7 +32,7 @@ func NewLengthDelimitedFrameWriter(w io.Writer) io.Writer {
return &lengthDelimitedFrameWriter{w: w}
}
-// Write writes a single frame to the nested writer, prepending it with the length in
+// Write writes a single frame to the nested writer, prepending it with the length
// in bytes of data (as a 4 byte, bigendian uint32).
func (w *lengthDelimitedFrameWriter) Write(data []byte) (int, error) {
binary.BigEndian.PutUint32(w.h[:], uint32(len(data)))
@@ -147,7 +147,6 @@ func (r *jsonFrameReader) Read(data []byte) (int, error) {
// RawMessage#Unmarshal appends to data - we reset the slice down to 0 and will either see
// data written to data, or be larger than data and a different array.
- n := len(data)
m := json.RawMessage(data[:0])
if err := r.decoder.Decode(&m); err != nil {
return 0, err
@@ -156,12 +155,19 @@ func (r *jsonFrameReader) Read(data []byte) (int, error) {
// If capacity of data is less than length of the message, decoder will allocate a new slice
// and set m to it, which means we need to copy the partial result back into data and preserve
// the remaining result for subsequent reads.
- if len(m) > n {
- //nolint:staticcheck // SA4006,SA4010 underlying array of data is modified here.
- data = append(data[0:0], m[:n]...)
- r.remaining = m[n:]
- return n, io.ErrShortBuffer
+ if len(m) > cap(data) {
+ copy(data, m)
+ r.remaining = m[len(data):]
+ return len(data), io.ErrShortBuffer
}
+
+ if len(m) > len(data) {
+ // The bytes beyond len(data) were stored in data's underlying array, which we do
+ // not own after this function returns.
+ r.remaining = append([]byte(nil), m[len(data):]...)
+ return len(data), io.ErrShortBuffer
+ }
+
return len(m), nil
}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/intstr/generated.pb.go b/vendor/k8s.io/apimachinery/pkg/util/intstr/generated.pb.go
index a4792034a..1f2877399 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/intstr/generated.pb.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/intstr/generated.pb.go
@@ -15,7 +15,7 @@ limitations under the License.
*/
// Code generated by protoc-gen-gogo. DO NOT EDIT.
-// source: k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/intstr/generated.proto
+// source: k8s.io/apimachinery/pkg/util/intstr/generated.proto
package intstr
@@ -43,7 +43,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
func (m *IntOrString) Reset() { *m = IntOrString{} }
func (*IntOrString) ProtoMessage() {}
func (*IntOrString) Descriptor() ([]byte, []int) {
- return fileDescriptor_94e046ae3ce6121c, []int{0}
+ return fileDescriptor_771bacc35a5ec189, []int{0}
}
func (m *IntOrString) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -73,30 +73,29 @@ func init() {
}
func init() {
- proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/intstr/generated.proto", fileDescriptor_94e046ae3ce6121c)
+ proto.RegisterFile("k8s.io/apimachinery/pkg/util/intstr/generated.proto", fileDescriptor_771bacc35a5ec189)
}
-var fileDescriptor_94e046ae3ce6121c = []byte{
- // 292 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x8f, 0x31, 0x4b, 0x33, 0x31,
- 0x1c, 0xc6, 0x93, 0xb7, 0x7d, 0x8b, 0x9e, 0xe0, 0x50, 0x1c, 0x8a, 0x43, 0x7a, 0x28, 0xc8, 0x0d,
- 0x9a, 0xac, 0xe2, 0xd8, 0xad, 0x20, 0x08, 0x57, 0x71, 0x70, 0xbb, 0x6b, 0x63, 0x1a, 0xae, 0x4d,
- 0x42, 0xee, 0x7f, 0xc2, 0x6d, 0xfd, 0x08, 0xba, 0x39, 0xfa, 0x71, 0x6e, 0xec, 0xd8, 0x41, 0x8a,
- 0x17, 0xbf, 0x85, 0x93, 0x5c, 0xee, 0x40, 0xa7, 0xe4, 0x79, 0x9e, 0xdf, 0x2f, 0x90, 0xe0, 0x36,
- 0xbb, 0xce, 0xa9, 0xd4, 0x2c, 0x2b, 0x52, 0x6e, 0x15, 0x07, 0x9e, 0xb3, 0x67, 0xae, 0x16, 0xda,
- 0xb2, 0x6e, 0x48, 0x8c, 0x5c, 0x27, 0xf3, 0xa5, 0x54, 0xdc, 0x96, 0xcc, 0x64, 0x82, 0x15, 0x20,
- 0x57, 0x4c, 0x2a, 0xc8, 0xc1, 0x32, 0xc1, 0x15, 0xb7, 0x09, 0xf0, 0x05, 0x35, 0x56, 0x83, 0x1e,
- 0x9e, 0xb7, 0x12, 0xfd, 0x2b, 0x51, 0x93, 0x09, 0xda, 0x48, 0xb4, 0x95, 0x4e, 0xaf, 0x84, 0x84,
- 0x65, 0x91, 0xd2, 0xb9, 0x5e, 0x33, 0xa1, 0x85, 0x66, 0xde, 0x4d, 0x8b, 0x27, 0x9f, 0x7c, 0xf0,
- 0xb7, 0xf6, 0xcd, 0xb3, 0x57, 0x1c, 0x1c, 0x4d, 0x15, 0xdc, 0xd9, 0x19, 0x58, 0xa9, 0xc4, 0x30,
- 0x0a, 0xfa, 0x50, 0x1a, 0x3e, 0xc2, 0x21, 0x8e, 0x7a, 0x93, 0x93, 0x6a, 0x3f, 0x46, 0x6e, 0x3f,
- 0xee, 0xdf, 0x97, 0x86, 0x7f, 0x77, 0x67, 0xec, 0x89, 0xe1, 0x45, 0x30, 0x90, 0x0a, 0x1e, 0x92,
- 0xd5, 0xe8, 0x5f, 0x88, 0xa3, 0xff, 0x93, 0xe3, 0x8e, 0x1d, 0x4c, 0x7d, 0x1b, 0x77, 0x6b, 0xc3,
- 0xe5, 0x60, 0x1b, 0xae, 0x17, 0xe2, 0xe8, 0xf0, 0x97, 0x9b, 0xf9, 0x36, 0xee, 0xd6, 0x9b, 0x83,
- 0xb7, 0xf7, 0x31, 0xda, 0x7c, 0x84, 0x68, 0x72, 0x59, 0xd5, 0x04, 0x6d, 0x6b, 0x82, 0x76, 0x35,
- 0x41, 0x1b, 0x47, 0x70, 0xe5, 0x08, 0xde, 0x3a, 0x82, 0x77, 0x8e, 0xe0, 0x4f, 0x47, 0xf0, 0xcb,
- 0x17, 0x41, 0x8f, 0x83, 0xf6, 0xc3, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x52, 0xa0, 0xb5, 0xc9,
- 0x64, 0x01, 0x00, 0x00,
+var fileDescriptor_771bacc35a5ec189 = []byte{
+ // 277 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0xce, 0xb6, 0x28, 0xd6,
+ 0xcb, 0xcc, 0xd7, 0x4f, 0x2c, 0xc8, 0xcc, 0x4d, 0x4c, 0xce, 0xc8, 0xcc, 0x4b, 0x2d, 0xaa, 0xd4,
+ 0x2f, 0xc8, 0x4e, 0xd7, 0x2f, 0x2d, 0xc9, 0xcc, 0xd1, 0xcf, 0xcc, 0x2b, 0x29, 0x2e, 0x29, 0xd2,
+ 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0x4a, 0x2c, 0x49, 0x4d, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17,
+ 0x52, 0x86, 0x68, 0xd2, 0x43, 0xd6, 0xa4, 0x57, 0x90, 0x9d, 0xae, 0x07, 0xd2, 0xa4, 0x07, 0xd1,
+ 0x24, 0xa5, 0x9b, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x9f, 0x9e, 0x9f,
+ 0x9e, 0xaf, 0x0f, 0xd6, 0x9b, 0x54, 0x9a, 0x06, 0xe6, 0x81, 0x39, 0x60, 0x16, 0xc4, 0x4c, 0xa5,
+ 0x89, 0x8c, 0x5c, 0xdc, 0x9e, 0x79, 0x25, 0xfe, 0x45, 0xc1, 0x25, 0x45, 0x99, 0x79, 0xe9, 0x42,
+ 0x1a, 0x5c, 0x2c, 0x25, 0x95, 0x05, 0xa9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xcc, 0x4e, 0x22, 0x27,
+ 0xee, 0xc9, 0x33, 0x3c, 0xba, 0x27, 0xcf, 0x12, 0x52, 0x59, 0x90, 0xfa, 0x0b, 0x4a, 0x07, 0x81,
+ 0x55, 0x08, 0xa9, 0x71, 0xb1, 0x65, 0xe6, 0x95, 0x84, 0x25, 0xe6, 0x48, 0x30, 0x29, 0x30, 0x6a,
+ 0xb0, 0x3a, 0xf1, 0x41, 0xd5, 0xb2, 0x79, 0x82, 0x45, 0x83, 0xa0, 0xb2, 0x20, 0x75, 0xc5, 0x25,
+ 0x45, 0x20, 0x75, 0xcc, 0x0a, 0x8c, 0x1a, 0x9c, 0x08, 0x75, 0xc1, 0x60, 0xd1, 0x20, 0xa8, 0xac,
+ 0x15, 0xc7, 0x8c, 0x05, 0xf2, 0x0c, 0x0d, 0x77, 0x14, 0x18, 0x9c, 0x3c, 0x4f, 0x3c, 0x94, 0x63,
+ 0xb8, 0xf0, 0x50, 0x8e, 0xe1, 0xc6, 0x43, 0x39, 0x86, 0x86, 0x47, 0x72, 0x8c, 0x27, 0x1e, 0xc9,
+ 0x31, 0x5e, 0x78, 0x24, 0xc7, 0x78, 0xe3, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e,
+ 0xcb, 0x31, 0x44, 0x29, 0x13, 0x11, 0x84, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x63, 0xa1, 0x0b,
+ 0x1e, 0x68, 0x01, 0x00, 0x00,
}
func (m *IntOrString) Marshal() (dAtA []byte, err error) {
diff --git a/vendor/k8s.io/apimachinery/pkg/util/intstr/generated.proto b/vendor/k8s.io/apimachinery/pkg/util/intstr/generated.proto
index a76f79851..7c63c5e45 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/intstr/generated.proto
+++ b/vendor/k8s.io/apimachinery/pkg/util/intstr/generated.proto
@@ -22,7 +22,7 @@ syntax = "proto2";
package k8s.io.apimachinery.pkg.util.intstr;
// Package-wide variables from generator "generated".
-option go_package = "intstr";
+option go_package = "k8s.io/apimachinery/pkg/util/intstr";
// IntOrString is a type that can hold an int32 or a string. When used in
// JSON or YAML marshalling and unmarshalling, it produces or consumes the
diff --git a/vendor/k8s.io/apimachinery/pkg/util/intstr/intstr.go b/vendor/k8s.io/apimachinery/pkg/util/intstr/intstr.go
index c0e8927fe..5fd2e16c8 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/intstr/intstr.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/intstr/intstr.go
@@ -25,6 +25,7 @@ import (
"strconv"
"strings"
+ cbor "k8s.io/apimachinery/pkg/runtime/serializer/cbor/direct"
"k8s.io/klog/v2"
)
@@ -54,7 +55,7 @@ const (
// FromInt creates an IntOrString object with an int32 value. It is
// your responsibility not to call this method with a value greater
// than int32.
-// TODO: convert to (val int32)
+// Deprecated: use FromInt32 instead.
func FromInt(val int) IntOrString {
if val > math.MaxInt32 || val < math.MinInt32 {
klog.Errorf("value: %d overflows int32\n%s\n", val, debug.Stack())
@@ -62,19 +63,24 @@ func FromInt(val int) IntOrString {
return IntOrString{Type: Int, IntVal: int32(val)}
}
+// FromInt32 creates an IntOrString object with an int32 value.
+func FromInt32(val int32) IntOrString {
+ return IntOrString{Type: Int, IntVal: val}
+}
+
// FromString creates an IntOrString object with a string value.
func FromString(val string) IntOrString {
return IntOrString{Type: String, StrVal: val}
}
-// Parse the given string and try to convert it to an integer before
+// Parse the given string and try to convert it to an int32 integer before
// setting it as a string value.
func Parse(val string) IntOrString {
- i, err := strconv.Atoi(val)
+ i, err := strconv.ParseInt(val, 10, 32)
if err != nil {
return FromString(val)
}
- return FromInt(i)
+ return FromInt32(int32(i))
}
// UnmarshalJSON implements the json.Unmarshaller interface.
@@ -87,6 +93,20 @@ func (intstr *IntOrString) UnmarshalJSON(value []byte) error {
return json.Unmarshal(value, &intstr.IntVal)
}
+func (intstr *IntOrString) UnmarshalCBOR(value []byte) error {
+ if err := cbor.Unmarshal(value, &intstr.StrVal); err == nil {
+ intstr.Type = String
+ return nil
+ }
+
+ if err := cbor.Unmarshal(value, &intstr.IntVal); err != nil {
+ return err
+ }
+
+ intstr.Type = Int
+ return nil
+}
+
// String returns the string value, or the Itoa of the int value.
func (intstr *IntOrString) String() string {
if intstr == nil {
@@ -121,6 +141,17 @@ func (intstr IntOrString) MarshalJSON() ([]byte, error) {
}
}
+func (intstr IntOrString) MarshalCBOR() ([]byte, error) {
+ switch intstr.Type {
+ case Int:
+ return cbor.Marshal(intstr.IntVal)
+ case String:
+ return cbor.Marshal(intstr.StrVal)
+ default:
+ return nil, fmt.Errorf("impossible IntOrString.Type")
+ }
+}
+
// OpenAPISchemaType is used by the kube-openapi generator when constructing
// the OpenAPI spec of this type.
//
@@ -131,6 +162,10 @@ func (IntOrString) OpenAPISchemaType() []string { return []string{"string"} }
// the OpenAPI spec of this type.
func (IntOrString) OpenAPISchemaFormat() string { return "int-or-string" }
+// OpenAPIV3OneOfTypes is used by the kube-openapi generator when constructing
+// the OpenAPI v3 spec of this type.
+func (IntOrString) OpenAPIV3OneOfTypes() []string { return []string{"integer", "string"} }
+
func ValueOrDefault(intOrPercent *IntOrString, defaultValue IntOrString) *IntOrString {
if intOrPercent == nil {
return &defaultValue
@@ -141,7 +176,7 @@ func ValueOrDefault(intOrPercent *IntOrString, defaultValue IntOrString) *IntOrS
// GetScaledValueFromIntOrPercent is meant to replace GetValueFromIntOrPercent.
// This method returns a scaled value from an IntOrString type. If the IntOrString
// is a percentage string value it's treated as a percentage and scaled appropriately
-// in accordance to the total, if it's an int value it's treated as a a simple value and
+// in accordance to the total, if it's an int value it's treated as a simple value and
// if it is a string value which is either non-numeric or numeric but lacking a trailing '%' it returns an error.
func GetScaledValueFromIntOrPercent(intOrPercent *IntOrString, total int, roundUp bool) (int, error) {
if intOrPercent == nil {
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/endpoints.yaml b/vendor/k8s.io/apimachinery/pkg/util/managedfields/endpoints.yaml
new file mode 100644
index 000000000..a667e9834
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/endpoints.yaml
@@ -0,0 +1,7018 @@
+apiVersion: v1
+kind: Endpoints
+metadata:
+ creationTimestamp: '2016-10-04T17:45:58Z'
+ labels:
+ app: my-app
+ name: app-server
+ namespace: default
+ resourceVersion: '184597135'
+ selfLink: /self/link
+ uid: 6826f086-8a5a-11e6-8d09-42010a800005
+subsets:
+- addresses:
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0000
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0001
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0002
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0003
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0004
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0005
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0006
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0007
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0008
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0009
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0010
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0011
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0012
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0013
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0014
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0015
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0016
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0017
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0018
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0019
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0020
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0021
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0022
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0023
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0024
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0025
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0026
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0027
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0028
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0029
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0030
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0031
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0032
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0033
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0034
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0035
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0036
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0037
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0038
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0039
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0040
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0041
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0042
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0043
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0044
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0045
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0046
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0047
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0048
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0049
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0050
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0051
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0052
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0053
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0054
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0055
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0056
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0057
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0058
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0059
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0060
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0061
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0062
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0063
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0064
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0065
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0066
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0067
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0068
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0069
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0070
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0071
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0072
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0073
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0074
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0075
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0076
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0077
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0078
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0079
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0080
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0081
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0082
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0083
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0084
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0085
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0086
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0087
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0088
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0089
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0090
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0091
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0092
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0093
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0094
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0095
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0096
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0097
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0098
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0099
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0100
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0101
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0102
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0103
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0104
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0105
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0106
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0107
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0108
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0109
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0110
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0111
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0112
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0113
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0114
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0115
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0116
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0117
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0118
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0119
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0120
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0121
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0122
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0123
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0124
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0125
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0126
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0127
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0128
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0129
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0130
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0131
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0132
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0133
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0134
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0135
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0136
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0137
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0138
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0139
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0140
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0141
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0142
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0143
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0144
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0145
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0146
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0147
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0148
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0149
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0150
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0151
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0152
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0153
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0154
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0155
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0156
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0157
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0158
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0159
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0160
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0161
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0162
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0163
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0164
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0165
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0166
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0167
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0168
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0169
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0170
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0171
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0172
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0173
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0174
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0175
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0176
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0177
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0178
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0179
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0180
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0181
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0182
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0183
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0184
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0185
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0186
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0187
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0188
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0189
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0190
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0191
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0192
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0193
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0194
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0195
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0196
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0197
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0198
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0199
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0200
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0201
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0202
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0203
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0204
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0205
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0206
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0207
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0208
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0209
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0210
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0211
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0212
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0213
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0214
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0215
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0216
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0217
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0218
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0219
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0220
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0221
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0222
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0223
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0224
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0225
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0226
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0227
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0228
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0229
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0230
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0231
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0232
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0233
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0234
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0235
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0236
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0237
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0238
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0239
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0240
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0241
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0242
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0243
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0244
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0245
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0246
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0247
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0248
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0249
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0250
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0251
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0252
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0253
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0254
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0255
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0256
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0257
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0258
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0259
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0260
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0261
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0262
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0263
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0264
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0265
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0266
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0267
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0268
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0269
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0270
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0271
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0272
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0273
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0274
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0275
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0276
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0277
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0278
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0279
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0280
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0281
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0282
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0283
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0284
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0285
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0286
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0287
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0288
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0289
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0290
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0291
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0292
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0293
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0294
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0295
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0296
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0297
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0298
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0299
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0300
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0301
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0302
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0303
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0304
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0305
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0306
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0307
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0308
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0309
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0310
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0311
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0312
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0313
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0314
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0315
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0316
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0317
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0318
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0319
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0320
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0321
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0322
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0323
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0324
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0325
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0326
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0327
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0328
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0329
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0330
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0331
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0332
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0333
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0334
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0335
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0336
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0337
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0338
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0339
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0340
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0341
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0342
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0343
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0344
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0345
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0346
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0347
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0348
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0349
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0350
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0351
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0352
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0353
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0354
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0355
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0356
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0357
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0358
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0359
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0360
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0361
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0362
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0363
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0364
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0365
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0366
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0367
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0368
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0369
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0370
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0371
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0372
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0373
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0374
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0375
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0376
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0377
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0378
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0379
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0380
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0381
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0382
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0383
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0384
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0385
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0386
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0387
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0388
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0389
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0390
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0391
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0392
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0393
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0394
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0395
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0396
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0397
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0398
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0399
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0400
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0401
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0402
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0403
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0404
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0405
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0406
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0407
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0408
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0409
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0410
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0411
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0412
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0413
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0414
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0415
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0416
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0417
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0418
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0419
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0420
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0421
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0422
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0423
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0424
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0425
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0426
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0427
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0428
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0429
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0430
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0431
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0432
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0433
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0434
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0435
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0436
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0437
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0438
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0439
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0440
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0441
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0442
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0443
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0444
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0445
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0446
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0447
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0448
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0449
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0450
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0451
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0452
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0453
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0454
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0455
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0456
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0457
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0458
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0459
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0460
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0461
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0462
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0463
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0464
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0465
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0466
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0467
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0468
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0469
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0470
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0471
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0472
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0473
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0474
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0475
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0476
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0477
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0478
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0479
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0480
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0481
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0482
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0483
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0484
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0485
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0486
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0487
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0488
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0489
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0490
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0491
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0492
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0493
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0494
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0495
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0496
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0497
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0498
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0499
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0500
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0501
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0502
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0503
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0504
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0505
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0506
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0507
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0508
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0509
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0510
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0511
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0512
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0513
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0514
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0515
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0516
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0517
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0518
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0519
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0520
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0521
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0522
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0523
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0524
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0525
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0526
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0527
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0528
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0529
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0530
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0531
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0532
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0533
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0534
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0535
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0536
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0537
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0538
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0539
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0540
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0541
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0542
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0543
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0544
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0545
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0546
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0547
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0548
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0549
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0550
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0551
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0552
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0553
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0554
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0555
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0556
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0557
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0558
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0559
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0560
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0561
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0562
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0563
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0564
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0565
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0566
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0567
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0568
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0569
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0570
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0571
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0572
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0573
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0574
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0575
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0576
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0577
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0578
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0579
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0580
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0581
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0582
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0583
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0584
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0585
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0586
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0587
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0588
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0589
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0590
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0591
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0592
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0593
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0594
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0595
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0596
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0597
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0598
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0599
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0600
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0601
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0602
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0603
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0604
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0605
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0606
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0607
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0608
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0609
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0610
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0611
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0612
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0613
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0614
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0615
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0616
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0617
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0618
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0619
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0620
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0621
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0622
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0623
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0624
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0625
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0626
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0627
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0628
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0629
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0630
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0631
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0632
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0633
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0634
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0635
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0636
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0637
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0638
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0639
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0640
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0641
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0642
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0643
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0644
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0645
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0646
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0647
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0648
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0649
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0650
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0651
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0652
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0653
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0654
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0655
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0656
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0657
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0658
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0659
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0660
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0661
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0662
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0663
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0664
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0665
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0666
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0667
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0668
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0669
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0670
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0671
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0672
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0673
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0674
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0675
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0676
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0677
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0678
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0679
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0680
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0681
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0682
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0683
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0684
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0685
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0686
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0687
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0688
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0689
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0690
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0691
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0692
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0693
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0694
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0695
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0696
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0697
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0698
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0699
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0700
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0701
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0702
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0703
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0704
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0705
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0706
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0707
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0708
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0709
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0710
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0711
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0712
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0713
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0714
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0715
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0716
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0717
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0718
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0719
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0720
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0721
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0722
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0723
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0724
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0725
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0726
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0727
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0728
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0729
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0730
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0731
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0732
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0733
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0734
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0735
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0736
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0737
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0738
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0739
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0740
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0741
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0742
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0743
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0744
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0745
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0746
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0747
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0748
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0749
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0750
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0751
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0752
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0753
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0754
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0755
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0756
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0757
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0758
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0759
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0760
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0761
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0762
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0763
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0764
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0765
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0766
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0767
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0768
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0769
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0770
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0771
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0772
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0773
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0774
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0775
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0776
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0777
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0778
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0779
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0780
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0781
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0782
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0783
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0784
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0785
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0786
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0787
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0788
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0789
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0790
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0791
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0792
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0793
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0794
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0795
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0796
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0797
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0798
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0799
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0800
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0801
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0802
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0803
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0804
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0805
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0806
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0807
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0808
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0809
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0810
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0811
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0812
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0813
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0814
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0815
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0816
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0817
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0818
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0819
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0820
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0821
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0822
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0823
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0824
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0825
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0826
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0827
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0828
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0829
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0830
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0831
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0832
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0833
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0834
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0835
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0836
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0837
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0838
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0839
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0840
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0841
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0842
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0843
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0844
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0845
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0846
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0847
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0848
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0849
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0850
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0851
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0852
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0853
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0854
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0855
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0856
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0857
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0858
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0859
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0860
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0861
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0862
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0863
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0864
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0865
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0866
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0867
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0868
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0869
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0870
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0871
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0872
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0873
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0874
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0875
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0876
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0877
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0878
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0879
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0880
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0881
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0882
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0883
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0884
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0885
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0886
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0887
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0888
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0889
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0890
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0891
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0892
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0893
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0894
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0895
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0896
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0897
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0898
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0899
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0900
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0901
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0902
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0903
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0904
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0905
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0906
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0907
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0908
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0909
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0910
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0911
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0912
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0913
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0914
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0915
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0916
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0917
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0918
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0919
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0920
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0921
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0922
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0923
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0924
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0925
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0926
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0927
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0928
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0929
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0930
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0931
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0932
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0933
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0934
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0935
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0936
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0937
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0938
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0939
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0940
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0941
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0942
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0943
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0944
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0945
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0946
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0947
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0948
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0949
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0950
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0951
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0952
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0953
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0954
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0955
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0956
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0957
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0958
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0959
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0960
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0961
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0962
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0963
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0964
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0965
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0966
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0967
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0968
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0969
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0970
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0971
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0972
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0973
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0974
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0975
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0976
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0977
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0978
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0979
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0980
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0981
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0982
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0983
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0984
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0985
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0986
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0987
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0988
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0989
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0990
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0991
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0992
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0993
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0994
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0995
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0996
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0997
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0998
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0999
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ ports:
+ - name: port-name
+ port: 8080
+ protocol: TCP
+
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/extract.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/extract.go
index 792badbc3..d2ce66c1b 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/managedfields/extract.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/extract.go
@@ -45,7 +45,7 @@ import (
// and their field paths and types are exactly the same, then ExtractInto can be
// called with the root resource as the object and the subresource as the
// applyConfiguration. This works for "status", obviously, because status is
-// represented by the exact same object as the root resource. This this does NOT
+// represented by the exact same object as the root resource. This does NOT
// work, for example, with the "scale" subresources of Deployment, ReplicaSet and
// StatefulSet. While the spec.replicas, status.replicas fields are in the same
// exact field path locations as they are in autoscaling.Scale, the selector
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/fieldmanager.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/fieldmanager.go
new file mode 100644
index 000000000..978ffb3c3
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/fieldmanager.go
@@ -0,0 +1,57 @@
+/*
+Copyright 2018 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package managedfields
+
+import (
+ "fmt"
+
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ "k8s.io/apimachinery/pkg/util/managedfields/internal"
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+)
+
+// FieldManager updates the managed fields and merges applied
+// configurations.
+type FieldManager = internal.FieldManager
+
+// NewDefaultFieldManager creates a new FieldManager that merges apply requests
+// and update managed fields for other types of requests.
+func NewDefaultFieldManager(typeConverter TypeConverter, objectConverter runtime.ObjectConvertor, objectDefaulter runtime.ObjectDefaulter, objectCreater runtime.ObjectCreater, kind schema.GroupVersionKind, hub schema.GroupVersion, subresource string, resetFields map[fieldpath.APIVersion]*fieldpath.Set) (*FieldManager, error) {
+ f, err := internal.NewStructuredMergeManager(typeConverter, objectConverter, objectDefaulter, kind.GroupVersion(), hub, resetFields)
+ if err != nil {
+ return nil, fmt.Errorf("failed to create field manager: %v", err)
+ }
+ return internal.NewDefaultFieldManager(f, typeConverter, objectConverter, objectCreater, kind, subresource), nil
+}
+
+// NewDefaultCRDFieldManager creates a new FieldManager specifically for
+// CRDs. This allows for the possibility of fields which are not defined
+// in models, as well as having no models defined at all.
+func NewDefaultCRDFieldManager(typeConverter TypeConverter, objectConverter runtime.ObjectConvertor, objectDefaulter runtime.ObjectDefaulter, objectCreater runtime.ObjectCreater, kind schema.GroupVersionKind, hub schema.GroupVersion, subresource string, resetFields map[fieldpath.APIVersion]*fieldpath.Set) (_ *FieldManager, err error) {
+ f, err := internal.NewCRDStructuredMergeManager(typeConverter, objectConverter, objectDefaulter, kind.GroupVersion(), hub, resetFields)
+ if err != nil {
+ return nil, fmt.Errorf("failed to create field manager: %v", err)
+ }
+ return internal.NewDefaultFieldManager(f, typeConverter, objectConverter, objectCreater, kind, subresource), nil
+}
+
+func ValidateManagedFields(encodedManagedFields []metav1.ManagedFieldsEntry) error {
+ _, err := internal.DecodeManagedFields(encodedManagedFields)
+ return err
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/gvkparser.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/gvkparser.go
index 0cc228af9..408739c50 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/managedfields/gvkparser.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/gvkparser.go
@@ -22,6 +22,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/kube-openapi/pkg/schemaconv"
"k8s.io/kube-openapi/pkg/util/proto"
+ smdschema "sigs.k8s.io/structured-merge-diff/v4/schema"
"sigs.k8s.io/structured-merge-diff/v4/typed"
)
@@ -58,7 +59,7 @@ func NewGVKParser(models proto.Models, preserveUnknownFields bool) (*GvkParser,
parser := GvkParser{
gvks: map[schema.GroupVersionKind]string{},
}
- parser.parser = typed.Parser{Schema: *typeSchema}
+ parser.parser = typed.Parser{Schema: smdschema.Schema{Types: typeSchema.Types}}
for _, modelName := range models.ListModels() {
model := models.LookupModel(modelName)
if model == nil {
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/atmostevery.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/atmostevery.go
new file mode 100644
index 000000000..b75ef7416
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/atmostevery.go
@@ -0,0 +1,60 @@
+/*
+Copyright 2020 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "sync"
+ "time"
+)
+
+// AtMostEvery will never run the method more than once every specified
+// duration.
+type AtMostEvery struct {
+ delay time.Duration
+ lastCall time.Time
+ mutex sync.Mutex
+}
+
+// NewAtMostEvery creates a new AtMostEvery, that will run the method at
+// most every given duration.
+func NewAtMostEvery(delay time.Duration) *AtMostEvery {
+ return &AtMostEvery{
+ delay: delay,
+ }
+}
+
+// updateLastCall returns true if the lastCall time has been updated,
+// false if it was too early.
+func (s *AtMostEvery) updateLastCall() bool {
+ s.mutex.Lock()
+ defer s.mutex.Unlock()
+ if time.Since(s.lastCall) < s.delay {
+ return false
+ }
+ s.lastCall = time.Now()
+ return true
+}
+
+// Do will run the method if enough time has passed, and return true.
+// Otherwise, it does nothing and returns false.
+func (s *AtMostEvery) Do(fn func()) bool {
+ if !s.updateLastCall() {
+ return false
+ }
+ fn()
+ return true
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/buildmanagerinfo.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/buildmanagerinfo.go
new file mode 100644
index 000000000..fa342ca13
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/buildmanagerinfo.go
@@ -0,0 +1,74 @@
+/*
+Copyright 2019 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "fmt"
+
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+)
+
+type buildManagerInfoManager struct {
+ fieldManager Manager
+ groupVersion schema.GroupVersion
+ subresource string
+}
+
+var _ Manager = &buildManagerInfoManager{}
+
+// NewBuildManagerInfoManager creates a new Manager that converts the manager name into a unique identifier
+// combining operation and version for update requests, and just operation for apply requests.
+func NewBuildManagerInfoManager(f Manager, gv schema.GroupVersion, subresource string) Manager {
+ return &buildManagerInfoManager{
+ fieldManager: f,
+ groupVersion: gv,
+ subresource: subresource,
+ }
+}
+
+// Update implements Manager.
+func (f *buildManagerInfoManager) Update(liveObj, newObj runtime.Object, managed Managed, manager string) (runtime.Object, Managed, error) {
+ manager, err := f.buildManagerInfo(manager, metav1.ManagedFieldsOperationUpdate)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to build manager identifier: %v", err)
+ }
+ return f.fieldManager.Update(liveObj, newObj, managed, manager)
+}
+
+// Apply implements Manager.
+func (f *buildManagerInfoManager) Apply(liveObj, appliedObj runtime.Object, managed Managed, manager string, force bool) (runtime.Object, Managed, error) {
+ manager, err := f.buildManagerInfo(manager, metav1.ManagedFieldsOperationApply)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to build manager identifier: %v", err)
+ }
+ return f.fieldManager.Apply(liveObj, appliedObj, managed, manager, force)
+}
+
+func (f *buildManagerInfoManager) buildManagerInfo(prefix string, operation metav1.ManagedFieldsOperationType) (string, error) {
+ managerInfo := metav1.ManagedFieldsEntry{
+ Manager: prefix,
+ Operation: operation,
+ APIVersion: f.groupVersion.String(),
+ Subresource: f.subresource,
+ }
+ if managerInfo.Manager == "" {
+ managerInfo.Manager = "unknown"
+ }
+ return BuildManagerIdentifier(&managerInfo)
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/capmanagers.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/capmanagers.go
new file mode 100644
index 000000000..8951932ba
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/capmanagers.go
@@ -0,0 +1,133 @@
+/*
+Copyright 2019 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "fmt"
+ "sort"
+
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/runtime"
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+)
+
+type capManagersManager struct {
+ fieldManager Manager
+ maxUpdateManagers int
+ oldUpdatesManagerName string
+}
+
+var _ Manager = &capManagersManager{}
+
+// NewCapManagersManager creates a new wrapped FieldManager which ensures that the number of managers from updates
+// does not exceed maxUpdateManagers, by merging some of the oldest entries on each update.
+func NewCapManagersManager(fieldManager Manager, maxUpdateManagers int) Manager {
+ return &capManagersManager{
+ fieldManager: fieldManager,
+ maxUpdateManagers: maxUpdateManagers,
+ oldUpdatesManagerName: "ancient-changes",
+ }
+}
+
+// Update implements Manager.
+func (f *capManagersManager) Update(liveObj, newObj runtime.Object, managed Managed, manager string) (runtime.Object, Managed, error) {
+ object, managed, err := f.fieldManager.Update(liveObj, newObj, managed, manager)
+ if err != nil {
+ return object, managed, err
+ }
+ if managed, err = f.capUpdateManagers(managed); err != nil {
+ return nil, nil, fmt.Errorf("failed to cap update managers: %v", err)
+ }
+ return object, managed, nil
+}
+
+// Apply implements Manager.
+func (f *capManagersManager) Apply(liveObj, appliedObj runtime.Object, managed Managed, fieldManager string, force bool) (runtime.Object, Managed, error) {
+ return f.fieldManager.Apply(liveObj, appliedObj, managed, fieldManager, force)
+}
+
+// capUpdateManagers merges a number of the oldest update entries into versioned buckets,
+// such that the number of entries from updates does not exceed f.maxUpdateManagers.
+func (f *capManagersManager) capUpdateManagers(managed Managed) (newManaged Managed, err error) {
+ // Gather all entries from updates
+ updaters := []string{}
+ for manager, fields := range managed.Fields() {
+ if !fields.Applied() {
+ updaters = append(updaters, manager)
+ }
+ }
+ if len(updaters) <= f.maxUpdateManagers {
+ return managed, nil
+ }
+
+ // If we have more than the maximum, sort the update entries by time, oldest first.
+ sort.Slice(updaters, func(i, j int) bool {
+ iTime, jTime, iSeconds, jSeconds := managed.Times()[updaters[i]], managed.Times()[updaters[j]], int64(0), int64(0)
+ if iTime != nil {
+ iSeconds = iTime.Unix()
+ }
+ if jTime != nil {
+ jSeconds = jTime.Unix()
+ }
+ if iSeconds != jSeconds {
+ return iSeconds < jSeconds
+ }
+ return updaters[i] < updaters[j]
+ })
+
+ // Merge the oldest updaters with versioned bucket managers until the number of updaters is under the cap
+ versionToFirstManager := map[string]string{}
+ for i, length := 0, len(updaters); i < len(updaters) && length > f.maxUpdateManagers; i++ {
+ manager := updaters[i]
+ vs := managed.Fields()[manager]
+ time := managed.Times()[manager]
+ version := string(vs.APIVersion())
+
+ // Create a new manager identifier for the versioned bucket entry.
+ // The version for this manager comes from the version of the update being merged into the bucket.
+ bucket, err := BuildManagerIdentifier(&metav1.ManagedFieldsEntry{
+ Manager: f.oldUpdatesManagerName,
+ Operation: metav1.ManagedFieldsOperationUpdate,
+ APIVersion: version,
+ })
+ if err != nil {
+ return managed, fmt.Errorf("failed to create bucket manager for version %v: %v", version, err)
+ }
+
+ // Merge the fieldets if this is not the first time the version was seen.
+ // Otherwise just record the manager name in versionToFirstManager
+ if first, ok := versionToFirstManager[version]; ok {
+ // If the bucket doesn't exists yet, create one.
+ if _, ok := managed.Fields()[bucket]; !ok {
+ s := managed.Fields()[first]
+ delete(managed.Fields(), first)
+ managed.Fields()[bucket] = s
+ }
+
+ managed.Fields()[bucket] = fieldpath.NewVersionedSet(vs.Set().Union(managed.Fields()[bucket].Set()), vs.APIVersion(), vs.Applied())
+ delete(managed.Fields(), manager)
+ length--
+
+ // Use the time from the update being merged into the bucket, since it is more recent.
+ managed.Times()[bucket] = time
+ } else {
+ versionToFirstManager[version] = manager
+ }
+ }
+
+ return managed, nil
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/conflict.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/conflict.go
new file mode 100644
index 000000000..8c044c915
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/conflict.go
@@ -0,0 +1,89 @@
+/*
+Copyright 2019 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "encoding/json"
+ "fmt"
+ "sort"
+ "strings"
+ "time"
+
+ "k8s.io/apimachinery/pkg/api/errors"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+ "sigs.k8s.io/structured-merge-diff/v4/merge"
+)
+
+// NewConflictError returns an error including details on the requests apply conflicts
+func NewConflictError(conflicts merge.Conflicts) *errors.StatusError {
+ causes := []metav1.StatusCause{}
+ for _, conflict := range conflicts {
+ causes = append(causes, metav1.StatusCause{
+ Type: metav1.CauseTypeFieldManagerConflict,
+ Message: fmt.Sprintf("conflict with %v", printManager(conflict.Manager)),
+ Field: conflict.Path.String(),
+ })
+ }
+ return errors.NewApplyConflict(causes, getConflictMessage(conflicts))
+}
+
+func getConflictMessage(conflicts merge.Conflicts) string {
+ if len(conflicts) == 1 {
+ return fmt.Sprintf("Apply failed with 1 conflict: conflict with %v: %v", printManager(conflicts[0].Manager), conflicts[0].Path)
+ }
+
+ m := map[string][]fieldpath.Path{}
+ for _, conflict := range conflicts {
+ m[conflict.Manager] = append(m[conflict.Manager], conflict.Path)
+ }
+
+ uniqueManagers := []string{}
+ for manager := range m {
+ uniqueManagers = append(uniqueManagers, manager)
+ }
+
+ // Print conflicts by sorted managers.
+ sort.Strings(uniqueManagers)
+
+ messages := []string{}
+ for _, manager := range uniqueManagers {
+ messages = append(messages, fmt.Sprintf("conflicts with %v:", printManager(manager)))
+ for _, path := range m[manager] {
+ messages = append(messages, fmt.Sprintf("- %v", path))
+ }
+ }
+ return fmt.Sprintf("Apply failed with %d conflicts: %s", len(conflicts), strings.Join(messages, "\n"))
+}
+
+func printManager(manager string) string {
+ encodedManager := &metav1.ManagedFieldsEntry{}
+ if err := json.Unmarshal([]byte(manager), encodedManager); err != nil {
+ return fmt.Sprintf("%q", manager)
+ }
+ managerStr := fmt.Sprintf("%q", encodedManager.Manager)
+ if encodedManager.Subresource != "" {
+ managerStr = fmt.Sprintf("%s with subresource %q", managerStr, encodedManager.Subresource)
+ }
+ if encodedManager.Operation == metav1.ManagedFieldsOperationUpdate {
+ if encodedManager.Time == nil {
+ return fmt.Sprintf("%s using %v", managerStr, encodedManager.APIVersion)
+ }
+ return fmt.Sprintf("%s using %v at %v", managerStr, encodedManager.APIVersion, encodedManager.Time.UTC().Format(time.RFC3339))
+ }
+ return managerStr
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/fieldmanager.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/fieldmanager.go
new file mode 100644
index 000000000..eca04a711
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/fieldmanager.go
@@ -0,0 +1,209 @@
+/*
+Copyright 2022 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "fmt"
+ "reflect"
+ "time"
+
+ "k8s.io/apimachinery/pkg/api/meta"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ "k8s.io/klog/v2"
+ "sigs.k8s.io/structured-merge-diff/v4/merge"
+)
+
+// DefaultMaxUpdateManagers defines the default maximum retained number of managedFields entries from updates
+// if the number of update managers exceeds this, the oldest entries will be merged until the number is below the maximum.
+// TODO(jennybuckley): Determine if this is really the best value. Ideally we wouldn't unnecessarily merge too many entries.
+const DefaultMaxUpdateManagers int = 10
+
+// DefaultTrackOnCreateProbability defines the default probability that the field management of an object
+// starts being tracked from the object's creation, instead of from the first time the object is applied to.
+const DefaultTrackOnCreateProbability float32 = 1
+
+var atMostEverySecond = NewAtMostEvery(time.Second)
+
+// FieldManager updates the managed fields and merges applied
+// configurations.
+type FieldManager struct {
+ fieldManager Manager
+ subresource string
+}
+
+// NewFieldManager creates a new FieldManager that decodes, manages, then re-encodes managedFields
+// on update and apply requests.
+func NewFieldManager(f Manager, subresource string) *FieldManager {
+ return &FieldManager{fieldManager: f, subresource: subresource}
+}
+
+// newDefaultFieldManager is a helper function which wraps a Manager with certain default logic.
+func NewDefaultFieldManager(f Manager, typeConverter TypeConverter, objectConverter runtime.ObjectConvertor, objectCreater runtime.ObjectCreater, kind schema.GroupVersionKind, subresource string) *FieldManager {
+ return NewFieldManager(
+ NewVersionCheckManager(
+ NewLastAppliedUpdater(
+ NewLastAppliedManager(
+ NewProbabilisticSkipNonAppliedManager(
+ NewCapManagersManager(
+ NewBuildManagerInfoManager(
+ NewManagedFieldsUpdater(
+ NewStripMetaManager(f),
+ ), kind.GroupVersion(), subresource,
+ ), DefaultMaxUpdateManagers,
+ ), objectCreater, DefaultTrackOnCreateProbability,
+ ), typeConverter, objectConverter, kind.GroupVersion(),
+ ),
+ ), kind,
+ ), subresource,
+ )
+}
+
+func decodeLiveOrNew(liveObj, newObj runtime.Object, ignoreManagedFieldsFromRequestObject bool) (Managed, error) {
+ liveAccessor, err := meta.Accessor(liveObj)
+ if err != nil {
+ return nil, err
+ }
+
+ // We take the managedFields of the live object in case the request tries to
+ // manually set managedFields via a subresource.
+ if ignoreManagedFieldsFromRequestObject {
+ return emptyManagedFieldsOnErr(DecodeManagedFields(liveAccessor.GetManagedFields()))
+ }
+
+ // If the object doesn't have metadata, we should just return without trying to
+ // set the managedFields at all, so creates/updates/patches will work normally.
+ newAccessor, err := meta.Accessor(newObj)
+ if err != nil {
+ return nil, err
+ }
+
+ if isResetManagedFields(newAccessor.GetManagedFields()) {
+ return NewEmptyManaged(), nil
+ }
+
+ // If the managed field is empty or we failed to decode it,
+ // let's try the live object. This is to prevent clients who
+ // don't understand managedFields from deleting it accidentally.
+ managed, err := DecodeManagedFields(newAccessor.GetManagedFields())
+ if err != nil || len(managed.Fields()) == 0 {
+ return emptyManagedFieldsOnErr(DecodeManagedFields(liveAccessor.GetManagedFields()))
+ }
+ return managed, nil
+}
+
+func emptyManagedFieldsOnErr(managed Managed, err error) (Managed, error) {
+ if err != nil {
+ return NewEmptyManaged(), nil
+ }
+ return managed, nil
+}
+
+// Update is used when the object has already been merged (non-apply
+// use-case), and simply updates the managed fields in the output
+// object.
+func (f *FieldManager) Update(liveObj, newObj runtime.Object, manager string) (object runtime.Object, err error) {
+ // First try to decode the managed fields provided in the update,
+ // This is necessary to allow directly updating managed fields.
+ isSubresource := f.subresource != ""
+ managed, err := decodeLiveOrNew(liveObj, newObj, isSubresource)
+ if err != nil {
+ return newObj, nil
+ }
+
+ RemoveObjectManagedFields(newObj)
+
+ if object, managed, err = f.fieldManager.Update(liveObj, newObj, managed, manager); err != nil {
+ return nil, err
+ }
+
+ if err = EncodeObjectManagedFields(object, managed); err != nil {
+ return nil, fmt.Errorf("failed to encode managed fields: %v", err)
+ }
+
+ return object, nil
+}
+
+// UpdateNoErrors is the same as Update, but it will not return
+// errors. If an error happens, the object is returned with
+// managedFields cleared.
+func (f *FieldManager) UpdateNoErrors(liveObj, newObj runtime.Object, manager string) runtime.Object {
+ obj, err := f.Update(liveObj, newObj, manager)
+ if err != nil {
+ atMostEverySecond.Do(func() {
+ ns, name := "unknown", "unknown"
+ if accessor, err := meta.Accessor(newObj); err == nil {
+ ns = accessor.GetNamespace()
+ name = accessor.GetName()
+ }
+
+ klog.ErrorS(err, "[SHOULD NOT HAPPEN] failed to update managedFields", "versionKind",
+ newObj.GetObjectKind().GroupVersionKind(), "namespace", ns, "name", name)
+ })
+ // Explicitly remove managedFields on failure, so that
+ // we can't have garbage in it.
+ RemoveObjectManagedFields(newObj)
+ return newObj
+ }
+ return obj
+}
+
+// Returns true if the managedFields indicate that the user is trying to
+// reset the managedFields, i.e. if the list is non-nil but empty, or if
+// the list has one empty item.
+func isResetManagedFields(managedFields []metav1.ManagedFieldsEntry) bool {
+ if len(managedFields) == 0 {
+ return managedFields != nil
+ }
+
+ if len(managedFields) == 1 {
+ return reflect.DeepEqual(managedFields[0], metav1.ManagedFieldsEntry{})
+ }
+
+ return false
+}
+
+// Apply is used when server-side apply is called, as it merges the
+// object and updates the managed fields.
+func (f *FieldManager) Apply(liveObj, appliedObj runtime.Object, manager string, force bool) (object runtime.Object, err error) {
+ // If the object doesn't have metadata, apply isn't allowed.
+ accessor, err := meta.Accessor(liveObj)
+ if err != nil {
+ return nil, fmt.Errorf("couldn't get accessor: %v", err)
+ }
+
+ // Decode the managed fields in the live object, since it isn't allowed in the patch.
+ managed, err := DecodeManagedFields(accessor.GetManagedFields())
+ if err != nil {
+ return nil, fmt.Errorf("failed to decode managed fields: %v", err)
+ }
+
+ object, managed, err = f.fieldManager.Apply(liveObj, appliedObj, managed, manager, force)
+ if err != nil {
+ if conflicts, ok := err.(merge.Conflicts); ok {
+ return nil, NewConflictError(conflicts)
+ }
+ return nil, err
+ }
+
+ if err = EncodeObjectManagedFields(object, managed); err != nil {
+ return nil, fmt.Errorf("failed to encode managed fields: %v", err)
+ }
+
+ return object, nil
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/fields.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/fields.go
new file mode 100644
index 000000000..08186191a
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/fields.go
@@ -0,0 +1,47 @@
+/*
+Copyright 2018 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "bytes"
+
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+)
+
+// EmptyFields represents a set with no paths
+// It looks like metav1.Fields{Raw: []byte("{}")}
+var EmptyFields = func() metav1.FieldsV1 {
+ f, err := SetToFields(*fieldpath.NewSet())
+ if err != nil {
+ panic("should never happen")
+ }
+ return f
+}()
+
+// FieldsToSet creates a set paths from an input trie of fields
+func FieldsToSet(f metav1.FieldsV1) (s fieldpath.Set, err error) {
+ err = s.FromJSON(bytes.NewReader(f.Raw))
+ return s, err
+}
+
+// SetToFields creates a trie of fields from an input set of paths
+func SetToFields(s fieldpath.Set) (f metav1.FieldsV1, err error) {
+ f.Raw, err = s.ToJSON()
+ return f, err
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/lastapplied.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/lastapplied.go
new file mode 100644
index 000000000..b00b6b829
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/lastapplied.go
@@ -0,0 +1,50 @@
+/*
+Copyright 2022 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "fmt"
+
+ "k8s.io/apimachinery/pkg/api/meta"
+ apimachineryvalidation "k8s.io/apimachinery/pkg/api/validation"
+ "k8s.io/apimachinery/pkg/runtime"
+)
+
+// LastAppliedConfigAnnotation is the annotation used to store the previous
+// configuration of a resource for use in a three way diff by UpdateApplyAnnotation.
+//
+// This is a copy of the corev1 annotation since we don't want to depend on the whole package.
+const LastAppliedConfigAnnotation = "kubectl.kubernetes.io/last-applied-configuration"
+
+// SetLastApplied sets the last-applied annotation the given value in
+// the object.
+func SetLastApplied(obj runtime.Object, value string) error {
+ accessor, err := meta.Accessor(obj)
+ if err != nil {
+ panic(fmt.Sprintf("couldn't get accessor: %v", err))
+ }
+ var annotations = accessor.GetAnnotations()
+ if annotations == nil {
+ annotations = map[string]string{}
+ }
+ annotations[LastAppliedConfigAnnotation] = value
+ if err := apimachineryvalidation.ValidateAnnotationsSize(annotations); err != nil {
+ delete(annotations, LastAppliedConfigAnnotation)
+ }
+ accessor.SetAnnotations(annotations)
+ return nil
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/lastappliedmanager.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/lastappliedmanager.go
new file mode 100644
index 000000000..3f6cf8821
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/lastappliedmanager.go
@@ -0,0 +1,171 @@
+/*
+Copyright 2020 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "encoding/json"
+ "fmt"
+
+ "k8s.io/apimachinery/pkg/api/meta"
+ "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+ "sigs.k8s.io/structured-merge-diff/v4/merge"
+)
+
+type lastAppliedManager struct {
+ fieldManager Manager
+ typeConverter TypeConverter
+ objectConverter runtime.ObjectConvertor
+ groupVersion schema.GroupVersion
+}
+
+var _ Manager = &lastAppliedManager{}
+
+// NewLastAppliedManager converts the client-side apply annotation to
+// server-side apply managed fields
+func NewLastAppliedManager(fieldManager Manager, typeConverter TypeConverter, objectConverter runtime.ObjectConvertor, groupVersion schema.GroupVersion) Manager {
+ return &lastAppliedManager{
+ fieldManager: fieldManager,
+ typeConverter: typeConverter,
+ objectConverter: objectConverter,
+ groupVersion: groupVersion,
+ }
+}
+
+// Update implements Manager.
+func (f *lastAppliedManager) Update(liveObj, newObj runtime.Object, managed Managed, manager string) (runtime.Object, Managed, error) {
+ return f.fieldManager.Update(liveObj, newObj, managed, manager)
+}
+
+// Apply will consider the last-applied annotation
+// for upgrading an object managed by client-side apply to server-side apply
+// without conflicts.
+func (f *lastAppliedManager) Apply(liveObj, newObj runtime.Object, managed Managed, manager string, force bool) (runtime.Object, Managed, error) {
+ newLiveObj, newManaged, newErr := f.fieldManager.Apply(liveObj, newObj, managed, manager, force)
+ // Upgrade the client-side apply annotation only from kubectl server-side-apply.
+ // To opt-out of this behavior, users may specify a different field manager.
+ if manager != "kubectl" {
+ return newLiveObj, newManaged, newErr
+ }
+
+ // Check if we have conflicts
+ if newErr == nil {
+ return newLiveObj, newManaged, newErr
+ }
+ conflicts, ok := newErr.(merge.Conflicts)
+ if !ok {
+ return newLiveObj, newManaged, newErr
+ }
+ conflictSet := conflictsToSet(conflicts)
+
+ // Check if conflicts are allowed due to client-side apply,
+ // and if so, then force apply
+ allowedConflictSet, err := f.allowedConflictsFromLastApplied(liveObj)
+ if err != nil {
+ return newLiveObj, newManaged, newErr
+ }
+ if !conflictSet.Difference(allowedConflictSet).Empty() {
+ newConflicts := conflictsDifference(conflicts, allowedConflictSet)
+ return newLiveObj, newManaged, newConflicts
+ }
+
+ return f.fieldManager.Apply(liveObj, newObj, managed, manager, true)
+}
+
+func (f *lastAppliedManager) allowedConflictsFromLastApplied(liveObj runtime.Object) (*fieldpath.Set, error) {
+ var accessor, err = meta.Accessor(liveObj)
+ if err != nil {
+ panic(fmt.Sprintf("couldn't get accessor: %v", err))
+ }
+
+ // If there is no client-side apply annotation, then there is nothing to do
+ var annotations = accessor.GetAnnotations()
+ if annotations == nil {
+ return nil, fmt.Errorf("no last applied annotation")
+ }
+ var lastApplied, ok = annotations[LastAppliedConfigAnnotation]
+ if !ok || lastApplied == "" {
+ return nil, fmt.Errorf("no last applied annotation")
+ }
+
+ liveObjVersioned, err := f.objectConverter.ConvertToVersion(liveObj, f.groupVersion)
+ if err != nil {
+ return nil, fmt.Errorf("failed to convert live obj to versioned: %v", err)
+ }
+
+ liveObjTyped, err := f.typeConverter.ObjectToTyped(liveObjVersioned)
+ if err != nil {
+ return nil, fmt.Errorf("failed to convert live obj to typed: %v", err)
+ }
+
+ var lastAppliedObj = &unstructured.Unstructured{Object: map[string]interface{}{}}
+ err = json.Unmarshal([]byte(lastApplied), lastAppliedObj)
+ if err != nil {
+ return nil, fmt.Errorf("failed to decode last applied obj: %v in '%s'", err, lastApplied)
+ }
+
+ if lastAppliedObj.GetAPIVersion() != f.groupVersion.String() {
+ return nil, fmt.Errorf("expected version of last applied to match live object '%s', but got '%s': %v", f.groupVersion.String(), lastAppliedObj.GetAPIVersion(), err)
+ }
+
+ lastAppliedObjTyped, err := f.typeConverter.ObjectToTyped(lastAppliedObj)
+ if err != nil {
+ return nil, fmt.Errorf("failed to convert last applied to typed: %v", err)
+ }
+
+ lastAppliedObjFieldSet, err := lastAppliedObjTyped.ToFieldSet()
+ if err != nil {
+ return nil, fmt.Errorf("failed to create fieldset for last applied object: %v", err)
+ }
+
+ comparison, err := lastAppliedObjTyped.Compare(liveObjTyped)
+ if err != nil {
+ return nil, fmt.Errorf("failed to compare last applied object and live object: %v", err)
+ }
+
+ // Remove fields in last applied that are different, added, or missing in
+ // the live object.
+ // Because last-applied fields don't match the live object fields,
+ // then we don't own these fields.
+ lastAppliedObjFieldSet = lastAppliedObjFieldSet.
+ Difference(comparison.Modified).
+ Difference(comparison.Added).
+ Difference(comparison.Removed)
+
+ return lastAppliedObjFieldSet, nil
+}
+
+// TODO: replace with merge.Conflicts.ToSet()
+func conflictsToSet(conflicts merge.Conflicts) *fieldpath.Set {
+ conflictSet := fieldpath.NewSet()
+ for _, conflict := range []merge.Conflict(conflicts) {
+ conflictSet.Insert(conflict.Path)
+ }
+ return conflictSet
+}
+
+func conflictsDifference(conflicts merge.Conflicts, s *fieldpath.Set) merge.Conflicts {
+ newConflicts := []merge.Conflict{}
+ for _, conflict := range []merge.Conflict(conflicts) {
+ if !s.Has(conflict.Path) {
+ newConflicts = append(newConflicts, conflict)
+ }
+ }
+ return newConflicts
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/lastappliedupdater.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/lastappliedupdater.go
new file mode 100644
index 000000000..06e6c5d8c
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/lastappliedupdater.go
@@ -0,0 +1,102 @@
+/*
+Copyright 2020 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "fmt"
+
+ "k8s.io/apimachinery/pkg/api/meta"
+ "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
+ "k8s.io/apimachinery/pkg/runtime"
+)
+
+type lastAppliedUpdater struct {
+ fieldManager Manager
+}
+
+var _ Manager = &lastAppliedUpdater{}
+
+// NewLastAppliedUpdater sets the client-side apply annotation up to date with
+// server-side apply managed fields
+func NewLastAppliedUpdater(fieldManager Manager) Manager {
+ return &lastAppliedUpdater{
+ fieldManager: fieldManager,
+ }
+}
+
+// Update implements Manager.
+func (f *lastAppliedUpdater) Update(liveObj, newObj runtime.Object, managed Managed, manager string) (runtime.Object, Managed, error) {
+ return f.fieldManager.Update(liveObj, newObj, managed, manager)
+}
+
+// server-side apply managed fields
+func (f *lastAppliedUpdater) Apply(liveObj, newObj runtime.Object, managed Managed, manager string, force bool) (runtime.Object, Managed, error) {
+ liveObj, managed, err := f.fieldManager.Apply(liveObj, newObj, managed, manager, force)
+ if err != nil {
+ return liveObj, managed, err
+ }
+
+ // Sync the client-side apply annotation only from kubectl server-side apply.
+ // To opt-out of this behavior, users may specify a different field manager.
+ //
+ // If the client-side apply annotation doesn't exist,
+ // then continue because we have no annotation to update
+ if manager == "kubectl" && hasLastApplied(liveObj) {
+ lastAppliedValue, err := buildLastApplied(newObj)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to build last-applied annotation: %v", err)
+ }
+ err = SetLastApplied(liveObj, lastAppliedValue)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to set last-applied annotation: %v", err)
+ }
+ }
+ return liveObj, managed, err
+}
+
+func hasLastApplied(obj runtime.Object) bool {
+ var accessor, err = meta.Accessor(obj)
+ if err != nil {
+ panic(fmt.Sprintf("couldn't get accessor: %v", err))
+ }
+ var annotations = accessor.GetAnnotations()
+ if annotations == nil {
+ return false
+ }
+ lastApplied, ok := annotations[LastAppliedConfigAnnotation]
+ return ok && len(lastApplied) > 0
+}
+
+func buildLastApplied(obj runtime.Object) (string, error) {
+ obj = obj.DeepCopyObject()
+
+ var accessor, err = meta.Accessor(obj)
+ if err != nil {
+ panic(fmt.Sprintf("couldn't get accessor: %v", err))
+ }
+
+ // Remove the annotation from the object before encoding the object
+ var annotations = accessor.GetAnnotations()
+ delete(annotations, LastAppliedConfigAnnotation)
+ accessor.SetAnnotations(annotations)
+
+ lastApplied, err := runtime.Encode(unstructured.UnstructuredJSONScheme, obj)
+ if err != nil {
+ return "", fmt.Errorf("couldn't encode object into last applied annotation: %v", err)
+ }
+ return string(lastApplied), nil
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/managedfields.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/managedfields.go
new file mode 100644
index 000000000..9b4c20326
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/managedfields.go
@@ -0,0 +1,248 @@
+/*
+Copyright 2018 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "encoding/json"
+ "fmt"
+ "sort"
+
+ "k8s.io/apimachinery/pkg/api/meta"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/runtime"
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+)
+
+// ManagedInterface groups a fieldpath.ManagedFields together with the timestamps associated with each operation.
+type ManagedInterface interface {
+ // Fields gets the fieldpath.ManagedFields.
+ Fields() fieldpath.ManagedFields
+
+ // Times gets the timestamps associated with each operation.
+ Times() map[string]*metav1.Time
+}
+
+type managedStruct struct {
+ fields fieldpath.ManagedFields
+ times map[string]*metav1.Time
+}
+
+var _ ManagedInterface = &managedStruct{}
+
+// Fields implements ManagedInterface.
+func (m *managedStruct) Fields() fieldpath.ManagedFields {
+ return m.fields
+}
+
+// Times implements ManagedInterface.
+func (m *managedStruct) Times() map[string]*metav1.Time {
+ return m.times
+}
+
+// NewEmptyManaged creates an empty ManagedInterface.
+func NewEmptyManaged() ManagedInterface {
+ return NewManaged(fieldpath.ManagedFields{}, map[string]*metav1.Time{})
+}
+
+// NewManaged creates a ManagedInterface from a fieldpath.ManagedFields and the timestamps associated with each operation.
+func NewManaged(f fieldpath.ManagedFields, t map[string]*metav1.Time) ManagedInterface {
+ return &managedStruct{
+ fields: f,
+ times: t,
+ }
+}
+
+// RemoveObjectManagedFields removes the ManagedFields from the object
+// before we merge so that it doesn't appear in the ManagedFields
+// recursively.
+func RemoveObjectManagedFields(obj runtime.Object) {
+ accessor, err := meta.Accessor(obj)
+ if err != nil {
+ panic(fmt.Sprintf("couldn't get accessor: %v", err))
+ }
+ accessor.SetManagedFields(nil)
+}
+
+// EncodeObjectManagedFields converts and stores the fieldpathManagedFields into the objects ManagedFields
+func EncodeObjectManagedFields(obj runtime.Object, managed ManagedInterface) error {
+ accessor, err := meta.Accessor(obj)
+ if err != nil {
+ panic(fmt.Sprintf("couldn't get accessor: %v", err))
+ }
+
+ encodedManagedFields, err := encodeManagedFields(managed)
+ if err != nil {
+ return fmt.Errorf("failed to convert back managed fields to API: %v", err)
+ }
+ accessor.SetManagedFields(encodedManagedFields)
+
+ return nil
+}
+
+// DecodeManagedFields converts ManagedFields from the wire format (api format)
+// to the format used by sigs.k8s.io/structured-merge-diff
+func DecodeManagedFields(encodedManagedFields []metav1.ManagedFieldsEntry) (ManagedInterface, error) {
+ managed := managedStruct{}
+ managed.fields = make(fieldpath.ManagedFields, len(encodedManagedFields))
+ managed.times = make(map[string]*metav1.Time, len(encodedManagedFields))
+
+ for i, encodedVersionedSet := range encodedManagedFields {
+ switch encodedVersionedSet.Operation {
+ case metav1.ManagedFieldsOperationApply, metav1.ManagedFieldsOperationUpdate:
+ default:
+ return nil, fmt.Errorf("operation must be `Apply` or `Update`")
+ }
+ if len(encodedVersionedSet.APIVersion) < 1 {
+ return nil, fmt.Errorf("apiVersion must not be empty")
+ }
+ switch encodedVersionedSet.FieldsType {
+ case "FieldsV1":
+ // Valid case.
+ case "":
+ return nil, fmt.Errorf("missing fieldsType in managed fields entry %d", i)
+ default:
+ return nil, fmt.Errorf("invalid fieldsType %q in managed fields entry %d", encodedVersionedSet.FieldsType, i)
+ }
+ manager, err := BuildManagerIdentifier(&encodedVersionedSet)
+ if err != nil {
+ return nil, fmt.Errorf("error decoding manager from %v: %v", encodedVersionedSet, err)
+ }
+ managed.fields[manager], err = decodeVersionedSet(&encodedVersionedSet)
+ if err != nil {
+ return nil, fmt.Errorf("error decoding versioned set from %v: %v", encodedVersionedSet, err)
+ }
+ managed.times[manager] = encodedVersionedSet.Time
+ }
+ return &managed, nil
+}
+
+// BuildManagerIdentifier creates a manager identifier string from a ManagedFieldsEntry
+func BuildManagerIdentifier(encodedManager *metav1.ManagedFieldsEntry) (manager string, err error) {
+ encodedManagerCopy := *encodedManager
+
+ // Never include fields type in the manager identifier
+ encodedManagerCopy.FieldsType = ""
+
+ // Never include the fields in the manager identifier
+ encodedManagerCopy.FieldsV1 = nil
+
+ // Never include the time in the manager identifier
+ encodedManagerCopy.Time = nil
+
+ // For appliers, don't include the APIVersion in the manager identifier,
+ // so it will always have the same manager identifier each time it applied.
+ if encodedManager.Operation == metav1.ManagedFieldsOperationApply {
+ encodedManagerCopy.APIVersion = ""
+ }
+
+ // Use the remaining fields to build the manager identifier
+ b, err := json.Marshal(&encodedManagerCopy)
+ if err != nil {
+ return "", fmt.Errorf("error marshalling manager identifier: %v", err)
+ }
+
+ return string(b), nil
+}
+
+func decodeVersionedSet(encodedVersionedSet *metav1.ManagedFieldsEntry) (versionedSet fieldpath.VersionedSet, err error) {
+ fields := EmptyFields
+ if encodedVersionedSet.FieldsV1 != nil {
+ fields = *encodedVersionedSet.FieldsV1
+ }
+ set, err := FieldsToSet(fields)
+ if err != nil {
+ return nil, fmt.Errorf("error decoding set: %v", err)
+ }
+ return fieldpath.NewVersionedSet(&set, fieldpath.APIVersion(encodedVersionedSet.APIVersion), encodedVersionedSet.Operation == metav1.ManagedFieldsOperationApply), nil
+}
+
+// encodeManagedFields converts ManagedFields from the format used by
+// sigs.k8s.io/structured-merge-diff to the wire format (api format)
+func encodeManagedFields(managed ManagedInterface) (encodedManagedFields []metav1.ManagedFieldsEntry, err error) {
+ if len(managed.Fields()) == 0 {
+ return nil, nil
+ }
+ encodedManagedFields = []metav1.ManagedFieldsEntry{}
+ for manager := range managed.Fields() {
+ versionedSet := managed.Fields()[manager]
+ v, err := encodeManagerVersionedSet(manager, versionedSet)
+ if err != nil {
+ return nil, fmt.Errorf("error encoding versioned set for %v: %v", manager, err)
+ }
+ if t, ok := managed.Times()[manager]; ok {
+ v.Time = t
+ }
+ encodedManagedFields = append(encodedManagedFields, *v)
+ }
+ return sortEncodedManagedFields(encodedManagedFields)
+}
+
+func sortEncodedManagedFields(encodedManagedFields []metav1.ManagedFieldsEntry) (sortedManagedFields []metav1.ManagedFieldsEntry, err error) {
+ sort.Slice(encodedManagedFields, func(i, j int) bool {
+ p, q := encodedManagedFields[i], encodedManagedFields[j]
+
+ if p.Operation != q.Operation {
+ return p.Operation < q.Operation
+ }
+
+ pSeconds, qSeconds := int64(0), int64(0)
+ if p.Time != nil {
+ pSeconds = p.Time.Unix()
+ }
+ if q.Time != nil {
+ qSeconds = q.Time.Unix()
+ }
+ if pSeconds != qSeconds {
+ return pSeconds < qSeconds
+ }
+
+ if p.Manager != q.Manager {
+ return p.Manager < q.Manager
+ }
+
+ if p.APIVersion != q.APIVersion {
+ return p.APIVersion < q.APIVersion
+ }
+ return p.Subresource < q.Subresource
+ })
+
+ return encodedManagedFields, nil
+}
+
+func encodeManagerVersionedSet(manager string, versionedSet fieldpath.VersionedSet) (encodedVersionedSet *metav1.ManagedFieldsEntry, err error) {
+ encodedVersionedSet = &metav1.ManagedFieldsEntry{}
+
+ // Get as many fields as we can from the manager identifier
+ err = json.Unmarshal([]byte(manager), encodedVersionedSet)
+ if err != nil {
+ return nil, fmt.Errorf("error unmarshalling manager identifier %v: %v", manager, err)
+ }
+
+ // Get the APIVersion, Operation, and Fields from the VersionedSet
+ encodedVersionedSet.APIVersion = string(versionedSet.APIVersion())
+ if versionedSet.Applied() {
+ encodedVersionedSet.Operation = metav1.ManagedFieldsOperationApply
+ }
+ encodedVersionedSet.FieldsType = "FieldsV1"
+ fields, err := SetToFields(*versionedSet.Set())
+ if err != nil {
+ return nil, fmt.Errorf("error encoding set: %v", err)
+ }
+ encodedVersionedSet.FieldsV1 = &fields
+
+ return encodedVersionedSet, nil
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/managedfieldsupdater.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/managedfieldsupdater.go
new file mode 100644
index 000000000..376eed6b2
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/managedfieldsupdater.go
@@ -0,0 +1,82 @@
+/*
+Copyright 2020 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "time"
+
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/runtime"
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+)
+
+type managedFieldsUpdater struct {
+ fieldManager Manager
+}
+
+var _ Manager = &managedFieldsUpdater{}
+
+// NewManagedFieldsUpdater is responsible for updating the managedfields
+// in the object, updating the time of the operation as necessary. For
+// updates, it uses a hard-coded manager to detect if things have
+// changed, and swaps back the correct manager after the operation is
+// done.
+func NewManagedFieldsUpdater(fieldManager Manager) Manager {
+ return &managedFieldsUpdater{
+ fieldManager: fieldManager,
+ }
+}
+
+// Update implements Manager.
+func (f *managedFieldsUpdater) Update(liveObj, newObj runtime.Object, managed Managed, manager string) (runtime.Object, Managed, error) {
+ self := "current-operation"
+ object, managed, err := f.fieldManager.Update(liveObj, newObj, managed, self)
+ if err != nil {
+ return object, managed, err
+ }
+
+ // If the current operation took any fields from anything, it means the object changed,
+ // so update the timestamp of the managedFieldsEntry and merge with any previous updates from the same manager
+ if vs, ok := managed.Fields()[self]; ok {
+ delete(managed.Fields(), self)
+
+ if previous, ok := managed.Fields()[manager]; ok {
+ managed.Fields()[manager] = fieldpath.NewVersionedSet(vs.Set().Union(previous.Set()), vs.APIVersion(), vs.Applied())
+ } else {
+ managed.Fields()[manager] = vs
+ }
+
+ managed.Times()[manager] = &metav1.Time{Time: time.Now().UTC()}
+ }
+
+ return object, managed, nil
+}
+
+// Apply implements Manager.
+func (f *managedFieldsUpdater) Apply(liveObj, appliedObj runtime.Object, managed Managed, fieldManager string, force bool) (runtime.Object, Managed, error) {
+ object, managed, err := f.fieldManager.Apply(liveObj, appliedObj, managed, fieldManager, force)
+ if err != nil {
+ return object, managed, err
+ }
+ if object != nil {
+ managed.Times()[fieldManager] = &metav1.Time{Time: time.Now().UTC()}
+ } else {
+ object = liveObj.DeepCopyObject()
+ RemoveObjectManagedFields(object)
+ }
+ return object, managed, nil
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/manager.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/manager.go
new file mode 100644
index 000000000..053936103
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/manager.go
@@ -0,0 +1,52 @@
+/*
+Copyright 2022 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/runtime"
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+)
+
+// Managed groups a fieldpath.ManagedFields together with the timestamps associated with each operation.
+type Managed interface {
+ // Fields gets the fieldpath.ManagedFields.
+ Fields() fieldpath.ManagedFields
+
+ // Times gets the timestamps associated with each operation.
+ Times() map[string]*metav1.Time
+}
+
+// Manager updates the managed fields and merges applied configurations.
+type Manager interface {
+ // Update is used when the object has already been merged (non-apply
+ // use-case), and simply updates the managed fields in the output
+ // object.
+ // * `liveObj` is not mutated by this function
+ // * `newObj` may be mutated by this function
+ // Returns the new object with managedFields removed, and the object's new
+ // proposed managedFields separately.
+ Update(liveObj, newObj runtime.Object, managed Managed, manager string) (runtime.Object, Managed, error)
+
+ // Apply is used when server-side apply is called, as it merges the
+ // object and updates the managed fields.
+ // * `liveObj` is not mutated by this function
+ // * `newObj` may be mutated by this function
+ // Returns the new object with managedFields removed, and the object's new
+ // proposed managedFields separately.
+ Apply(liveObj, appliedObj runtime.Object, managed Managed, fieldManager string, force bool) (runtime.Object, Managed, error)
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/pathelement.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/pathelement.go
new file mode 100644
index 000000000..1954d65d3
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/pathelement.go
@@ -0,0 +1,140 @@
+/*
+Copyright 2018 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "encoding/json"
+ "errors"
+ "fmt"
+ "strconv"
+ "strings"
+
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+ "sigs.k8s.io/structured-merge-diff/v4/value"
+)
+
+const (
+ // Field indicates that the content of this path element is a field's name
+ Field = "f"
+
+ // Value indicates that the content of this path element is a field's value
+ Value = "v"
+
+ // Index indicates that the content of this path element is an index in an array
+ Index = "i"
+
+ // Key indicates that the content of this path element is a key value map
+ Key = "k"
+
+ // Separator separates the type of a path element from the contents
+ Separator = ":"
+)
+
+// NewPathElement parses a serialized path element
+func NewPathElement(s string) (fieldpath.PathElement, error) {
+ split := strings.SplitN(s, Separator, 2)
+ if len(split) < 2 {
+ return fieldpath.PathElement{}, fmt.Errorf("missing colon: %v", s)
+ }
+ switch split[0] {
+ case Field:
+ return fieldpath.PathElement{
+ FieldName: &split[1],
+ }, nil
+ case Value:
+ val, err := value.FromJSON([]byte(split[1]))
+ if err != nil {
+ return fieldpath.PathElement{}, err
+ }
+ return fieldpath.PathElement{
+ Value: &val,
+ }, nil
+ case Index:
+ i, err := strconv.Atoi(split[1])
+ if err != nil {
+ return fieldpath.PathElement{}, err
+ }
+ return fieldpath.PathElement{
+ Index: &i,
+ }, nil
+ case Key:
+ kv := map[string]json.RawMessage{}
+ err := json.Unmarshal([]byte(split[1]), &kv)
+ if err != nil {
+ return fieldpath.PathElement{}, err
+ }
+ fields := value.FieldList{}
+ for k, v := range kv {
+ b, err := json.Marshal(v)
+ if err != nil {
+ return fieldpath.PathElement{}, err
+ }
+ val, err := value.FromJSON(b)
+ if err != nil {
+ return fieldpath.PathElement{}, err
+ }
+
+ fields = append(fields, value.Field{
+ Name: k,
+ Value: val,
+ })
+ }
+ return fieldpath.PathElement{
+ Key: &fields,
+ }, nil
+ default:
+ // Ignore unknown key types
+ return fieldpath.PathElement{}, nil
+ }
+}
+
+// PathElementString serializes a path element
+func PathElementString(pe fieldpath.PathElement) (string, error) {
+ switch {
+ case pe.FieldName != nil:
+ return Field + Separator + *pe.FieldName, nil
+ case pe.Key != nil:
+ kv := map[string]json.RawMessage{}
+ for _, k := range *pe.Key {
+ b, err := value.ToJSON(k.Value)
+ if err != nil {
+ return "", err
+ }
+ m := json.RawMessage{}
+ err = json.Unmarshal(b, &m)
+ if err != nil {
+ return "", err
+ }
+ kv[k.Name] = m
+ }
+ b, err := json.Marshal(kv)
+ if err != nil {
+ return "", err
+ }
+ return Key + ":" + string(b), nil
+ case pe.Value != nil:
+ b, err := value.ToJSON(*pe.Value)
+ if err != nil {
+ return "", err
+ }
+ return Value + ":" + string(b), nil
+ case pe.Index != nil:
+ return Index + ":" + strconv.Itoa(*pe.Index), nil
+ default:
+ return "", errors.New("Invalid type of path element")
+ }
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/skipnonapplied.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/skipnonapplied.go
new file mode 100644
index 000000000..f24c040ed
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/skipnonapplied.go
@@ -0,0 +1,89 @@
+/*
+Copyright 2019 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "fmt"
+ "math/rand"
+
+ "k8s.io/apimachinery/pkg/api/meta"
+ "k8s.io/apimachinery/pkg/runtime"
+)
+
+type skipNonAppliedManager struct {
+ fieldManager Manager
+ objectCreater runtime.ObjectCreater
+ beforeApplyManagerName string
+ probability float32
+}
+
+var _ Manager = &skipNonAppliedManager{}
+
+// NewSkipNonAppliedManager creates a new wrapped FieldManager that only starts tracking managers after the first apply.
+func NewSkipNonAppliedManager(fieldManager Manager, objectCreater runtime.ObjectCreater) Manager {
+ return NewProbabilisticSkipNonAppliedManager(fieldManager, objectCreater, 0.0)
+}
+
+// NewProbabilisticSkipNonAppliedManager creates a new wrapped FieldManager that starts tracking managers after the first apply,
+// or starts tracking on create with p probability.
+func NewProbabilisticSkipNonAppliedManager(fieldManager Manager, objectCreater runtime.ObjectCreater, p float32) Manager {
+ return &skipNonAppliedManager{
+ fieldManager: fieldManager,
+ objectCreater: objectCreater,
+ beforeApplyManagerName: "before-first-apply",
+ probability: p,
+ }
+}
+
+// Update implements Manager.
+func (f *skipNonAppliedManager) Update(liveObj, newObj runtime.Object, managed Managed, manager string) (runtime.Object, Managed, error) {
+ accessor, err := meta.Accessor(liveObj)
+ if err != nil {
+ return newObj, managed, nil
+ }
+
+ // If managed fields is empty, we need to determine whether to skip tracking managed fields.
+ if len(managed.Fields()) == 0 {
+ // Check if the operation is a create, by checking whether lastObj's UID is empty.
+ // If the operation is create, P(tracking managed fields) = f.probability
+ // If the operation is update, skip tracking managed fields, since we already know managed fields is empty.
+ if len(accessor.GetUID()) == 0 {
+ if f.probability <= rand.Float32() {
+ return newObj, managed, nil
+ }
+ } else {
+ return newObj, managed, nil
+ }
+ }
+ return f.fieldManager.Update(liveObj, newObj, managed, manager)
+}
+
+// Apply implements Manager.
+func (f *skipNonAppliedManager) Apply(liveObj, appliedObj runtime.Object, managed Managed, fieldManager string, force bool) (runtime.Object, Managed, error) {
+ if len(managed.Fields()) == 0 {
+ gvk := appliedObj.GetObjectKind().GroupVersionKind()
+ emptyObj, err := f.objectCreater.New(gvk)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to create empty object of type %v: %v", gvk, err)
+ }
+ liveObj, managed, err = f.fieldManager.Update(emptyObj, liveObj, managed, f.beforeApplyManagerName)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to create manager for existing fields: %v", err)
+ }
+ }
+ return f.fieldManager.Apply(liveObj, appliedObj, managed, fieldManager, force)
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/stripmeta.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/stripmeta.go
new file mode 100644
index 000000000..9b61f3a6f
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/stripmeta.go
@@ -0,0 +1,90 @@
+/*
+Copyright 2019 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "fmt"
+
+ "k8s.io/apimachinery/pkg/runtime"
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+)
+
+type stripMetaManager struct {
+ fieldManager Manager
+
+ // stripSet is the list of fields that should never be part of a mangedFields.
+ stripSet *fieldpath.Set
+}
+
+var _ Manager = &stripMetaManager{}
+
+// NewStripMetaManager creates a new Manager that strips metadata and typemeta fields from the manager's fieldset.
+func NewStripMetaManager(fieldManager Manager) Manager {
+ return &stripMetaManager{
+ fieldManager: fieldManager,
+ stripSet: fieldpath.NewSet(
+ fieldpath.MakePathOrDie("apiVersion"),
+ fieldpath.MakePathOrDie("kind"),
+ fieldpath.MakePathOrDie("metadata"),
+ fieldpath.MakePathOrDie("metadata", "name"),
+ fieldpath.MakePathOrDie("metadata", "namespace"),
+ fieldpath.MakePathOrDie("metadata", "creationTimestamp"),
+ fieldpath.MakePathOrDie("metadata", "selfLink"),
+ fieldpath.MakePathOrDie("metadata", "uid"),
+ fieldpath.MakePathOrDie("metadata", "clusterName"),
+ fieldpath.MakePathOrDie("metadata", "generation"),
+ fieldpath.MakePathOrDie("metadata", "managedFields"),
+ fieldpath.MakePathOrDie("metadata", "resourceVersion"),
+ ),
+ }
+}
+
+// Update implements Manager.
+func (f *stripMetaManager) Update(liveObj, newObj runtime.Object, managed Managed, manager string) (runtime.Object, Managed, error) {
+ newObj, managed, err := f.fieldManager.Update(liveObj, newObj, managed, manager)
+ if err != nil {
+ return nil, nil, err
+ }
+ f.stripFields(managed.Fields(), manager)
+ return newObj, managed, nil
+}
+
+// Apply implements Manager.
+func (f *stripMetaManager) Apply(liveObj, appliedObj runtime.Object, managed Managed, manager string, force bool) (runtime.Object, Managed, error) {
+ newObj, managed, err := f.fieldManager.Apply(liveObj, appliedObj, managed, manager, force)
+ if err != nil {
+ return nil, nil, err
+ }
+ f.stripFields(managed.Fields(), manager)
+ return newObj, managed, nil
+}
+
+// stripFields removes a predefined set of paths found in typed from managed
+func (f *stripMetaManager) stripFields(managed fieldpath.ManagedFields, manager string) {
+ vs, ok := managed[manager]
+ if ok {
+ if vs == nil {
+ panic(fmt.Sprintf("Found unexpected nil manager which should never happen: %s", manager))
+ }
+ newSet := vs.Set().Difference(f.stripSet)
+ if newSet.Empty() {
+ delete(managed, manager)
+ } else {
+ managed[manager] = fieldpath.NewVersionedSet(newSet, vs.APIVersion(), vs.Applied())
+ }
+ }
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/structuredmerge.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/structuredmerge.go
new file mode 100644
index 000000000..786ad991c
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/structuredmerge.go
@@ -0,0 +1,189 @@
+/*
+Copyright 2019 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "fmt"
+
+ "k8s.io/apimachinery/pkg/api/errors"
+ "k8s.io/apimachinery/pkg/api/meta"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+ "sigs.k8s.io/structured-merge-diff/v4/merge"
+ "sigs.k8s.io/structured-merge-diff/v4/typed"
+)
+
+type structuredMergeManager struct {
+ typeConverter TypeConverter
+ objectConverter runtime.ObjectConvertor
+ objectDefaulter runtime.ObjectDefaulter
+ groupVersion schema.GroupVersion
+ hubVersion schema.GroupVersion
+ updater merge.Updater
+}
+
+var _ Manager = &structuredMergeManager{}
+
+// NewStructuredMergeManager creates a new Manager that merges apply requests
+// and update managed fields for other types of requests.
+func NewStructuredMergeManager(typeConverter TypeConverter, objectConverter runtime.ObjectConvertor, objectDefaulter runtime.ObjectDefaulter, gv schema.GroupVersion, hub schema.GroupVersion, resetFields map[fieldpath.APIVersion]*fieldpath.Set) (Manager, error) {
+ if typeConverter == nil {
+ return nil, fmt.Errorf("typeconverter must not be nil")
+ }
+ return &structuredMergeManager{
+ typeConverter: typeConverter,
+ objectConverter: objectConverter,
+ objectDefaulter: objectDefaulter,
+ groupVersion: gv,
+ hubVersion: hub,
+ updater: merge.Updater{
+ Converter: newVersionConverter(typeConverter, objectConverter, hub), // This is the converter provided to SMD from k8s
+ IgnoredFields: resetFields,
+ },
+ }, nil
+}
+
+// NewCRDStructuredMergeManager creates a new Manager specifically for
+// CRDs. This allows for the possibility of fields which are not defined
+// in models, as well as having no models defined at all.
+func NewCRDStructuredMergeManager(typeConverter TypeConverter, objectConverter runtime.ObjectConvertor, objectDefaulter runtime.ObjectDefaulter, gv schema.GroupVersion, hub schema.GroupVersion, resetFields map[fieldpath.APIVersion]*fieldpath.Set) (_ Manager, err error) {
+ return &structuredMergeManager{
+ typeConverter: typeConverter,
+ objectConverter: objectConverter,
+ objectDefaulter: objectDefaulter,
+ groupVersion: gv,
+ hubVersion: hub,
+ updater: merge.Updater{
+ Converter: newCRDVersionConverter(typeConverter, objectConverter, hub),
+ IgnoredFields: resetFields,
+ },
+ }, nil
+}
+
+func objectGVKNN(obj runtime.Object) string {
+ name := ""
+ namespace := ""
+ if accessor, err := meta.Accessor(obj); err == nil {
+ name = accessor.GetName()
+ namespace = accessor.GetNamespace()
+ }
+
+ return fmt.Sprintf("%v/%v; %v", namespace, name, obj.GetObjectKind().GroupVersionKind())
+}
+
+// Update implements Manager.
+func (f *structuredMergeManager) Update(liveObj, newObj runtime.Object, managed Managed, manager string) (runtime.Object, Managed, error) {
+ newObjVersioned, err := f.toVersioned(newObj)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to convert new object (%v) to proper version (%v): %v", objectGVKNN(newObj), f.groupVersion, err)
+ }
+ liveObjVersioned, err := f.toVersioned(liveObj)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to convert live object (%v) to proper version: %v", objectGVKNN(liveObj), err)
+ }
+ newObjTyped, err := f.typeConverter.ObjectToTyped(newObjVersioned, typed.AllowDuplicates)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to convert new object (%v) to smd typed: %v", objectGVKNN(newObjVersioned), err)
+ }
+ liveObjTyped, err := f.typeConverter.ObjectToTyped(liveObjVersioned, typed.AllowDuplicates)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to convert live object (%v) to smd typed: %v", objectGVKNN(liveObjVersioned), err)
+ }
+ apiVersion := fieldpath.APIVersion(f.groupVersion.String())
+
+ // TODO(apelisse) use the first return value when unions are implemented
+ _, managedFields, err := f.updater.Update(liveObjTyped, newObjTyped, apiVersion, managed.Fields(), manager)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to update ManagedFields (%v): %v", objectGVKNN(newObjVersioned), err)
+ }
+ managed = NewManaged(managedFields, managed.Times())
+
+ return newObj, managed, nil
+}
+
+// Apply implements Manager.
+func (f *structuredMergeManager) Apply(liveObj, patchObj runtime.Object, managed Managed, manager string, force bool) (runtime.Object, Managed, error) {
+ // Check that the patch object has the same version as the live object
+ if patchVersion := patchObj.GetObjectKind().GroupVersionKind().GroupVersion(); patchVersion != f.groupVersion {
+ return nil, nil,
+ errors.NewBadRequest(
+ fmt.Sprintf("Incorrect version specified in apply patch. "+
+ "Specified patch version: %s, expected: %s",
+ patchVersion, f.groupVersion))
+ }
+
+ patchObjMeta, err := meta.Accessor(patchObj)
+ if err != nil {
+ return nil, nil, fmt.Errorf("couldn't get accessor: %v", err)
+ }
+ if patchObjMeta.GetManagedFields() != nil {
+ return nil, nil, errors.NewBadRequest("metadata.managedFields must be nil")
+ }
+
+ liveObjVersioned, err := f.toVersioned(liveObj)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to convert live object (%v) to proper version: %v", objectGVKNN(liveObj), err)
+ }
+
+ // Don't allow duplicates in the applied object.
+ patchObjTyped, err := f.typeConverter.ObjectToTyped(patchObj)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to create typed patch object (%v): %v", objectGVKNN(patchObj), err)
+ }
+
+ liveObjTyped, err := f.typeConverter.ObjectToTyped(liveObjVersioned, typed.AllowDuplicates)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to create typed live object (%v): %v", objectGVKNN(liveObjVersioned), err)
+ }
+
+ apiVersion := fieldpath.APIVersion(f.groupVersion.String())
+ newObjTyped, managedFields, err := f.updater.Apply(liveObjTyped, patchObjTyped, apiVersion, managed.Fields(), manager, force)
+ if err != nil {
+ return nil, nil, err
+ }
+ managed = NewManaged(managedFields, managed.Times())
+
+ if newObjTyped == nil {
+ return nil, managed, nil
+ }
+
+ newObj, err := f.typeConverter.TypedToObject(newObjTyped)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to convert new typed object (%v) to object: %v", objectGVKNN(patchObj), err)
+ }
+
+ newObjVersioned, err := f.toVersioned(newObj)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to convert new object (%v) to proper version: %v", objectGVKNN(patchObj), err)
+ }
+ f.objectDefaulter.Default(newObjVersioned)
+
+ newObjUnversioned, err := f.toUnversioned(newObjVersioned)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to convert to unversioned (%v): %v", objectGVKNN(patchObj), err)
+ }
+ return newObjUnversioned, managed, nil
+}
+
+func (f *structuredMergeManager) toVersioned(obj runtime.Object) (runtime.Object, error) {
+ return f.objectConverter.ConvertToVersion(obj, f.groupVersion)
+}
+
+func (f *structuredMergeManager) toUnversioned(obj runtime.Object) (runtime.Object, error) {
+ return f.objectConverter.ConvertToVersion(obj, f.hubVersion)
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/typeconverter.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/typeconverter.go
new file mode 100644
index 000000000..c6449467c
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/typeconverter.go
@@ -0,0 +1,193 @@
+/*
+Copyright 2022 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "fmt"
+
+ "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ "k8s.io/kube-openapi/pkg/schemaconv"
+ "k8s.io/kube-openapi/pkg/validation/spec"
+ smdschema "sigs.k8s.io/structured-merge-diff/v4/schema"
+ "sigs.k8s.io/structured-merge-diff/v4/typed"
+ "sigs.k8s.io/structured-merge-diff/v4/value"
+)
+
+// TypeConverter allows you to convert from runtime.Object to
+// typed.TypedValue and the other way around.
+type TypeConverter interface {
+ ObjectToTyped(runtime.Object, ...typed.ValidationOptions) (*typed.TypedValue, error)
+ TypedToObject(*typed.TypedValue) (runtime.Object, error)
+}
+
+type typeConverter struct {
+ parser map[schema.GroupVersionKind]*typed.ParseableType
+}
+
+var _ TypeConverter = &typeConverter{}
+
+func NewTypeConverter(openapiSpec map[string]*spec.Schema, preserveUnknownFields bool) (TypeConverter, error) {
+ typeSchema, err := schemaconv.ToSchemaFromOpenAPI(openapiSpec, preserveUnknownFields)
+ if err != nil {
+ return nil, fmt.Errorf("failed to convert models to schema: %v", err)
+ }
+
+ typeParser := typed.Parser{Schema: smdschema.Schema{Types: typeSchema.Types}}
+ tr := indexModels(&typeParser, openapiSpec)
+
+ return &typeConverter{parser: tr}, nil
+}
+
+func (c *typeConverter) ObjectToTyped(obj runtime.Object, opts ...typed.ValidationOptions) (*typed.TypedValue, error) {
+ gvk := obj.GetObjectKind().GroupVersionKind()
+ t := c.parser[gvk]
+ if t == nil {
+ return nil, NewNoCorrespondingTypeError(gvk)
+ }
+ switch o := obj.(type) {
+ case *unstructured.Unstructured:
+ return t.FromUnstructured(o.UnstructuredContent(), opts...)
+ default:
+ return t.FromStructured(obj, opts...)
+ }
+}
+
+func (c *typeConverter) TypedToObject(value *typed.TypedValue) (runtime.Object, error) {
+ return valueToObject(value.AsValue())
+}
+
+type deducedTypeConverter struct{}
+
+// DeducedTypeConverter is a TypeConverter for CRDs that don't have a
+// schema. It does implement the same interface though (and create the
+// same types of objects), so that everything can still work the same.
+// CRDs are merged with all their fields being "atomic" (lists
+// included).
+func NewDeducedTypeConverter() TypeConverter {
+ return deducedTypeConverter{}
+}
+
+// ObjectToTyped converts an object into a TypedValue with a "deduced type".
+func (deducedTypeConverter) ObjectToTyped(obj runtime.Object, opts ...typed.ValidationOptions) (*typed.TypedValue, error) {
+ switch o := obj.(type) {
+ case *unstructured.Unstructured:
+ return typed.DeducedParseableType.FromUnstructured(o.UnstructuredContent(), opts...)
+ default:
+ return typed.DeducedParseableType.FromStructured(obj, opts...)
+ }
+}
+
+// TypedToObject transforms the typed value into a runtime.Object. That
+// is not specific to deduced type.
+func (deducedTypeConverter) TypedToObject(value *typed.TypedValue) (runtime.Object, error) {
+ return valueToObject(value.AsValue())
+}
+
+func valueToObject(val value.Value) (runtime.Object, error) {
+ vu := val.Unstructured()
+ switch o := vu.(type) {
+ case map[string]interface{}:
+ return &unstructured.Unstructured{Object: o}, nil
+ default:
+ return nil, fmt.Errorf("failed to convert value to unstructured for type %T", vu)
+ }
+}
+
+func indexModels(
+ typeParser *typed.Parser,
+ openAPISchemas map[string]*spec.Schema,
+) map[schema.GroupVersionKind]*typed.ParseableType {
+ tr := map[schema.GroupVersionKind]*typed.ParseableType{}
+ for modelName, model := range openAPISchemas {
+ gvkList := parseGroupVersionKind(model.Extensions)
+ if len(gvkList) == 0 {
+ continue
+ }
+
+ parsedType := typeParser.Type(modelName)
+ for _, gvk := range gvkList {
+ if len(gvk.Kind) > 0 {
+ tr[schema.GroupVersionKind(gvk)] = &parsedType
+ }
+ }
+ }
+ return tr
+}
+
+// Get and parse GroupVersionKind from the extension. Returns empty if it doesn't have one.
+func parseGroupVersionKind(extensions map[string]interface{}) []schema.GroupVersionKind {
+ gvkListResult := []schema.GroupVersionKind{}
+
+ // Get the extensions
+ gvkExtension, ok := extensions["x-kubernetes-group-version-kind"]
+ if !ok {
+ return []schema.GroupVersionKind{}
+ }
+
+ // gvk extension must be a list of at least 1 element.
+ gvkList, ok := gvkExtension.([]interface{})
+ if !ok {
+ return []schema.GroupVersionKind{}
+ }
+
+ for _, gvk := range gvkList {
+ var group, version, kind string
+
+ // gvk extension list must be a map with group, version, and
+ // kind fields
+ if gvkMap, ok := gvk.(map[interface{}]interface{}); ok {
+ group, ok = gvkMap["group"].(string)
+ if !ok {
+ continue
+ }
+ version, ok = gvkMap["version"].(string)
+ if !ok {
+ continue
+ }
+ kind, ok = gvkMap["kind"].(string)
+ if !ok {
+ continue
+ }
+
+ } else if gvkMap, ok := gvk.(map[string]interface{}); ok {
+ group, ok = gvkMap["group"].(string)
+ if !ok {
+ continue
+ }
+ version, ok = gvkMap["version"].(string)
+ if !ok {
+ continue
+ }
+ kind, ok = gvkMap["kind"].(string)
+ if !ok {
+ continue
+ }
+ } else {
+ continue
+ }
+
+ gvkListResult = append(gvkListResult, schema.GroupVersionKind{
+ Group: group,
+ Version: version,
+ Kind: kind,
+ })
+ }
+
+ return gvkListResult
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/versioncheck.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/versioncheck.go
new file mode 100644
index 000000000..ee1e2bca7
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/versioncheck.go
@@ -0,0 +1,52 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "fmt"
+
+ "k8s.io/apimachinery/pkg/api/errors"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+)
+
+type versionCheckManager struct {
+ fieldManager Manager
+ gvk schema.GroupVersionKind
+}
+
+var _ Manager = &versionCheckManager{}
+
+// NewVersionCheckManager creates a manager that makes sure that the
+// applied object is in the proper version.
+func NewVersionCheckManager(fieldManager Manager, gvk schema.GroupVersionKind) Manager {
+ return &versionCheckManager{fieldManager: fieldManager, gvk: gvk}
+}
+
+// Update implements Manager.
+func (f *versionCheckManager) Update(liveObj, newObj runtime.Object, managed Managed, manager string) (runtime.Object, Managed, error) {
+ // Nothing to do for updates, this is checked in many other places.
+ return f.fieldManager.Update(liveObj, newObj, managed, manager)
+}
+
+// Apply implements Manager.
+func (f *versionCheckManager) Apply(liveObj, appliedObj runtime.Object, managed Managed, fieldManager string, force bool) (runtime.Object, Managed, error) {
+ if gvk := appliedObj.GetObjectKind().GroupVersionKind(); gvk != f.gvk {
+ return nil, nil, errors.NewBadRequest(fmt.Sprintf("invalid object type: %v", gvk))
+ }
+ return f.fieldManager.Apply(liveObj, appliedObj, managed, fieldManager, force)
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/versionconverter.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/versionconverter.go
new file mode 100644
index 000000000..45855fa4c
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/versionconverter.go
@@ -0,0 +1,123 @@
+/*
+Copyright 2018 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "fmt"
+
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+ "sigs.k8s.io/structured-merge-diff/v4/merge"
+ "sigs.k8s.io/structured-merge-diff/v4/typed"
+)
+
+// versionConverter is an implementation of
+// sigs.k8s.io/structured-merge-diff/merge.Converter
+type versionConverter struct {
+ typeConverter TypeConverter
+ objectConvertor runtime.ObjectConvertor
+ hubGetter func(from schema.GroupVersion) schema.GroupVersion
+}
+
+var _ merge.Converter = &versionConverter{}
+
+// NewVersionConverter builds a VersionConverter from a TypeConverter and an ObjectConvertor.
+func newVersionConverter(t TypeConverter, o runtime.ObjectConvertor, h schema.GroupVersion) merge.Converter {
+ return &versionConverter{
+ typeConverter: t,
+ objectConvertor: o,
+ hubGetter: func(from schema.GroupVersion) schema.GroupVersion {
+ return schema.GroupVersion{
+ Group: from.Group,
+ Version: h.Version,
+ }
+ },
+ }
+}
+
+// NewCRDVersionConverter builds a VersionConverter for CRDs from a TypeConverter and an ObjectConvertor.
+func newCRDVersionConverter(t TypeConverter, o runtime.ObjectConvertor, h schema.GroupVersion) merge.Converter {
+ return &versionConverter{
+ typeConverter: t,
+ objectConvertor: o,
+ hubGetter: func(from schema.GroupVersion) schema.GroupVersion {
+ return h
+ },
+ }
+}
+
+// Convert implements sigs.k8s.io/structured-merge-diff/merge.Converter
+func (v *versionConverter) Convert(object *typed.TypedValue, version fieldpath.APIVersion) (*typed.TypedValue, error) {
+ // Convert the smd typed value to a kubernetes object.
+ objectToConvert, err := v.typeConverter.TypedToObject(object)
+ if err != nil {
+ return object, err
+ }
+
+ // Parse the target groupVersion.
+ groupVersion, err := schema.ParseGroupVersion(string(version))
+ if err != nil {
+ return object, err
+ }
+
+ // If attempting to convert to the same version as we already have, just return it.
+ fromVersion := objectToConvert.GetObjectKind().GroupVersionKind().GroupVersion()
+ if fromVersion == groupVersion {
+ return object, nil
+ }
+
+ // Convert to internal
+ internalObject, err := v.objectConvertor.ConvertToVersion(objectToConvert, v.hubGetter(fromVersion))
+ if err != nil {
+ return object, err
+ }
+
+ // Convert the object into the target version
+ convertedObject, err := v.objectConvertor.ConvertToVersion(internalObject, groupVersion)
+ if err != nil {
+ return object, err
+ }
+
+ // Convert the object back to a smd typed value and return it.
+ return v.typeConverter.ObjectToTyped(convertedObject)
+}
+
+// IsMissingVersionError
+func (v *versionConverter) IsMissingVersionError(err error) bool {
+ return runtime.IsNotRegisteredError(err) || isNoCorrespondingTypeError(err)
+}
+
+type noCorrespondingTypeErr struct {
+ gvk schema.GroupVersionKind
+}
+
+func NewNoCorrespondingTypeError(gvk schema.GroupVersionKind) error {
+ return &noCorrespondingTypeErr{gvk: gvk}
+}
+
+func (k *noCorrespondingTypeErr) Error() string {
+ return fmt.Sprintf("no corresponding type for %v", k.gvk)
+}
+
+func isNoCorrespondingTypeError(err error) bool {
+ if err == nil {
+ return false
+ }
+ _, ok := err.(*noCorrespondingTypeErr)
+ return ok
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/node.yaml b/vendor/k8s.io/apimachinery/pkg/util/managedfields/node.yaml
new file mode 100644
index 000000000..a7f2d54fd
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/node.yaml
@@ -0,0 +1,261 @@
+apiVersion: v1
+kind: Node
+metadata:
+ annotations:
+ container.googleapis.com/instance_id: "123456789321654789"
+ node.alpha.kubernetes.io/ttl: "0"
+ volumes.kubernetes.io/controller-managed-attach-detach: "true"
+ creationTimestamp: "2019-07-09T16:17:29Z"
+ labels:
+ kubernetes.io/arch: amd64
+ beta.kubernetes.io/fluentd-ds-ready: "true"
+ beta.kubernetes.io/instance-type: n1-standard-4
+ kubernetes.io/os: linux
+ cloud.google.com/gke-nodepool: default-pool
+ cloud.google.com/gke-os-distribution: cos
+ failure-domain.beta.kubernetes.io/region: us-central1
+ failure-domain.beta.kubernetes.io/zone: us-central1-b
+ topology.kubernetes.io/region: us-central1
+ topology.kubernetes.io/zone: us-central1-b
+ kubernetes.io/hostname: node-default-pool-something
+ name: node-default-pool-something
+ resourceVersion: "211582541"
+ selfLink: /api/v1/nodes/node-default-pool-something
+ uid: 0c24d0e1-a265-11e9-abe4-42010a80026b
+spec:
+ podCIDR: 10.0.0.1/24
+ providerID: some-provider-id-of-some-sort
+status:
+ addresses:
+ - address: 10.0.0.1
+ type: InternalIP
+ - address: 192.168.0.1
+ type: ExternalIP
+ - address: node-default-pool-something
+ type: Hostname
+ allocatable:
+ cpu: 3920m
+ ephemeral-storage: "104638878617"
+ hugepages-2Mi: "0"
+ memory: 12700100Ki
+ pods: "110"
+ capacity:
+ cpu: "4"
+ ephemeral-storage: 202086868Ki
+ hugepages-2Mi: "0"
+ memory: 15399364Ki
+ pods: "110"
+ conditions:
+ - lastHeartbeatTime: "2019-09-20T19:32:08Z"
+ lastTransitionTime: "2019-07-09T16:22:08Z"
+ message: containerd is functioning properly
+ reason: FrequentContainerdRestart
+ status: "False"
+ type: FrequentContainerdRestart
+ - lastHeartbeatTime: "2019-09-20T19:32:08Z"
+ lastTransitionTime: "2019-07-09T16:22:06Z"
+ message: docker overlay2 is functioning properly
+ reason: CorruptDockerOverlay2
+ status: "False"
+ type: CorruptDockerOverlay2
+ - lastHeartbeatTime: "2019-09-20T19:32:08Z"
+ lastTransitionTime: "2019-07-09T16:22:06Z"
+ message: node is functioning properly
+ reason: UnregisterNetDevice
+ status: "False"
+ type: FrequentUnregisterNetDevice
+ - lastHeartbeatTime: "2019-09-20T19:32:08Z"
+ lastTransitionTime: "2019-07-09T16:17:04Z"
+ message: kernel has no deadlock
+ reason: KernelHasNoDeadlock
+ status: "False"
+ type: KernelDeadlock
+ - lastHeartbeatTime: "2019-09-20T19:32:08Z"
+ lastTransitionTime: "2019-07-09T16:17:04Z"
+ message: Filesystem is not read-only
+ reason: FilesystemIsNotReadOnly
+ status: "False"
+ type: ReadonlyFilesystem
+ - lastHeartbeatTime: "2019-09-20T19:32:08Z"
+ lastTransitionTime: "2019-07-09T16:22:05Z"
+ message: kubelet is functioning properly
+ reason: FrequentKubeletRestart
+ status: "False"
+ type: FrequentKubeletRestart
+ - lastHeartbeatTime: "2019-09-20T19:32:08Z"
+ lastTransitionTime: "2019-07-09T16:22:06Z"
+ message: docker is functioning properly
+ reason: FrequentDockerRestart
+ status: "False"
+ type: FrequentDockerRestart
+ - lastHeartbeatTime: "2019-07-09T16:17:47Z"
+ lastTransitionTime: "2019-07-09T16:17:47Z"
+ message: RouteController created a route
+ reason: RouteCreated
+ status: "False"
+ type: NetworkUnavailable
+ - lastHeartbeatTime: "2019-09-20T19:32:50Z"
+ lastTransitionTime: "2019-07-09T16:17:29Z"
+ message: kubelet has sufficient disk space available
+ reason: KubeletHasSufficientDisk
+ status: "False"
+ type: OutOfDisk
+ - lastHeartbeatTime: "2019-09-20T19:32:50Z"
+ lastTransitionTime: "2019-07-09T16:17:29Z"
+ message: kubelet has sufficient memory available
+ reason: KubeletHasSufficientMemory
+ status: "False"
+ type: MemoryPressure
+ - lastHeartbeatTime: "2019-09-20T19:32:50Z"
+ lastTransitionTime: "2019-07-09T16:17:29Z"
+ message: kubelet has no disk pressure
+ reason: KubeletHasNoDiskPressure
+ status: "False"
+ type: DiskPressure
+ - lastHeartbeatTime: "2019-09-20T19:32:50Z"
+ lastTransitionTime: "2019-07-09T16:17:29Z"
+ message: kubelet has sufficient PID available
+ reason: KubeletHasSufficientPID
+ status: "False"
+ type: PIDPressure
+ - lastHeartbeatTime: "2019-09-20T19:32:50Z"
+ lastTransitionTime: "2019-07-09T16:17:49Z"
+ message: kubelet is posting ready status
+ reason: KubeletReady
+ status: "True"
+ type: Ready
+ daemonEndpoints:
+ kubeletEndpoint:
+ Port: 10250
+ images:
+ - names:
+ - grafana/grafana@sha256:80e5e113a984d74836aa16f5b4524012099436b1a50df293f00ac6377fb512c8
+ - grafana/grafana:4.4.2
+ sizeBytes: 287008013
+ - names:
+ - registry.k8s.io/node-problem-detector@sha256:f95cab985c26b2f46e9bd43283e0bfa88860c14e0fb0649266babe8b65e9eb2b
+ - registry.k8s.io/node-problem-detector:v0.4.1
+ sizeBytes: 286572743
+ - names:
+ - grafana/grafana@sha256:7ff7f9b2501a5d55b55ce3f58d21771b1c5af1f2a4ab7dbf11bef7142aae7033
+ - grafana/grafana:4.2.0
+ sizeBytes: 277940263
+ - names:
+ - influxdb@sha256:7dddf03376348876ed4bdf33d6dfa3326f45a2bae0930dbd80781a374eb519bc
+ - influxdb:1.2.2
+ sizeBytes: 223948571
+ - names:
+ - gcr.io/stackdriver-agents/stackdriver-logging-agent@sha256:f8d5231b67b9c53f60068b535a11811d29d1b3efd53d2b79f2a2591ea338e4f2
+ - gcr.io/stackdriver-agents/stackdriver-logging-agent:0.6-1.6.0-1
+ sizeBytes: 223242132
+ - names:
+ - nginx@sha256:35779791c05d119df4fe476db8f47c0bee5943c83eba5656a15fc046db48178b
+ - nginx:1.10.1
+ sizeBytes: 180708613
+ - names:
+ - registry.k8s.io/fluentd-elasticsearch@sha256:b8c94527b489fb61d3d81ce5ad7f3ddbb7be71e9620a3a36e2bede2f2e487d73
+ - registry.k8s.io/fluentd-elasticsearch:v2.0.4
+ sizeBytes: 135716379
+ - names:
+ - nginx@sha256:00be67d6ba53d5318cd91c57771530f5251cfbe028b7be2c4b70526f988cfc9f
+ - nginx:latest
+ sizeBytes: 109357355
+ - names:
+ - registry.k8s.io/kubernetes-dashboard-amd64@sha256:dc4026c1b595435ef5527ca598e1e9c4343076926d7d62b365c44831395adbd0
+ - registry.k8s.io/kubernetes-dashboard-amd64:v1.8.3
+ sizeBytes: 102319441
+ - names:
+ - gcr.io/google_containers/kube-proxy:v1.11.10-gke.5
+ - registry.k8s.io/kube-proxy:v1.11.10-gke.5
+ sizeBytes: 102279340
+ - names:
+ - registry.k8s.io/event-exporter@sha256:7f9cd7cb04d6959b0aa960727d04fa86759008048c785397b7b0d9dff0007516
+ - registry.k8s.io/event-exporter:v0.2.3
+ sizeBytes: 94171943
+ - names:
+ - registry.k8s.io/prometheus-to-sd@sha256:6c0c742475363d537ff059136e5d5e4ab1f512ee0fd9b7ca42ea48bc309d1662
+ - registry.k8s.io/prometheus-to-sd:v0.3.1
+ sizeBytes: 88077694
+ - names:
+ - registry.k8s.io/fluentd-gcp-scaler@sha256:a5ace7506d393c4ed65eb2cbb6312c64ab357fcea16dff76b9055bc6e498e5ff
+ - registry.k8s.io/fluentd-gcp-scaler:0.5.1
+ sizeBytes: 86637208
+ - names:
+ - registry.k8s.io/heapster-amd64@sha256:9fae0af136ce0cf4f88393b3670f7139ffc464692060c374d2ae748e13144521
+ - registry.k8s.io/heapster-amd64:v1.6.0-beta.1
+ sizeBytes: 76016169
+ - names:
+ - registry.k8s.io/ingress-glbc-amd64@sha256:31d36bbd9c44caffa135fc78cf0737266fcf25e3cf0cd1c2fcbfbc4f7309cc52
+ - registry.k8s.io/ingress-glbc-amd64:v1.1.1
+ sizeBytes: 67801919
+ - names:
+ - registry.k8s.io/kube-addon-manager@sha256:d53486c3a0b49ebee019932878dc44232735d5622a51dbbdcec7124199020d09
+ - registry.k8s.io/kube-addon-manager:v8.7
+ sizeBytes: 63322109
+ - names:
+ - nginx@sha256:4aacdcf186934dcb02f642579314075910f1855590fd3039d8fa4c9f96e48315
+ - nginx:1.10-alpine
+ sizeBytes: 54042627
+ - names:
+ - registry.k8s.io/cpvpa-amd64@sha256:cfe7b0a11c9c8e18c87b1eb34fef9a7cbb8480a8da11fc2657f78dbf4739f869
+ - registry.k8s.io/cpvpa-amd64:v0.6.0
+ sizeBytes: 51785854
+ - names:
+ - registry.k8s.io/cluster-proportional-autoscaler-amd64@sha256:003f98d9f411ddfa6ff6d539196355e03ddd69fa4ed38c7ffb8fec6f729afe2d
+ - registry.k8s.io/cluster-proportional-autoscaler-amd64:1.1.2-r2
+ sizeBytes: 49648481
+ - names:
+ - registry.k8s.io/ip-masq-agent-amd64@sha256:1ffda57d87901bc01324c82ceb2145fe6a0448d3f0dd9cb65aa76a867cd62103
+ - registry.k8s.io/ip-masq-agent-amd64:v2.1.1
+ sizeBytes: 49612505
+ - names:
+ - registry.k8s.io/k8s-dns-kube-dns-amd64@sha256:b99fc3eee2a9f052f7eb4cc00f15eb12fc405fa41019baa2d6b79847ae7284a8
+ - registry.k8s.io/k8s-dns-kube-dns-amd64:1.14.10
+ sizeBytes: 49549457
+ - names:
+ - registry.k8s.io/rescheduler@sha256:156cfbfd05a5a815206fd2eeb6cbdaf1596d71ea4b415d3a6c43071dd7b99450
+ - registry.k8s.io/rescheduler:v0.4.0
+ sizeBytes: 48973149
+ - names:
+ - registry.k8s.io/event-exporter@sha256:16ca66e2b5dc7a1ce6a5aafcb21d0885828b75cdfc08135430480f7ad2364adc
+ - registry.k8s.io/event-exporter:v0.2.4
+ sizeBytes: 47261019
+ - names:
+ - registry.k8s.io/coredns@sha256:db2bf53126ed1c761d5a41f24a1b82a461c85f736ff6e90542e9522be4757848
+ - registry.k8s.io/coredns:1.1.3
+ sizeBytes: 45587362
+ - names:
+ - prom/prometheus@sha256:483f4c9d7733699ba79facca9f8bcce1cef1af43dfc3e7c5a1882aa85f53cb74
+ - prom/prometheus:v1.1.3
+ sizeBytes: 45493941
+ nodeInfo:
+ architecture: amd64
+ bootID: a32eca78-4ad4-4b76-9252-f143d6c2ae61
+ containerRuntimeVersion: docker://17.3.2
+ kernelVersion: 4.14.127+
+ kubeProxyVersion: v1.11.10-gke.5
+ kubeletVersion: v1.11.10-gke.5
+ machineID: 1739555e5b231057f0f9a0b5fa29511b
+ operatingSystem: linux
+ osImage: Container-Optimized OS from Google
+ systemUUID: 1739555E-5B23-1057-F0F9-A0B5FA29511B
+ volumesAttached:
+ - devicePath: /dev/disk/by-id/b9772-pvc-c787c67d-14d7-11e7-9baf-42010a800049
+ name: kubernetes.io/pd/some-random-clusterb9772-pvc-c787c67d-14d7-11e7-9baf-42010a800049
+ - devicePath: /dev/disk/by-id/b9772-pvc-8895a852-fd42-11e6-94d4-42010a800049
+ name: kubernetes.io/pd/some-random-clusterb9772-pvc-8895a852-fd42-11e6-94d4-42010a800049
+ - devicePath: /dev/disk/by-id/some-random-clusterb9772-pvc-72e1c7f1-fd41-11e6-94d4-42010a800049
+ name: kubernetes.io/pd/some-random-clusterb9772-pvc-72e1c7f1-fd41-11e6-94d4-42010a800049
+ - devicePath: /dev/disk/by-id/some-random-clusterb9772-pvc-c2435a06-14d7-11e7-9baf-42010a800049
+ name: kubernetes.io/pd/some-random-clusterb9772-pvc-c2435a06-14d7-11e7-9baf-42010a800049
+ - devicePath: /dev/disk/by-id/some-random-clusterb9772-pvc-8bf50554-fd42-11e6-94d4-42010a800049
+ name: kubernetes.io/pd/some-random-clusterb9772-pvc-8bf50554-fd42-11e6-94d4-42010a800049
+ - devicePath: /dev/disk/by-id/some-random-clusterb9772-pvc-8fb5e386-4641-11e7-a490-42010a800283
+ name: kubernetes.io/pd/some-random-clusterb9772-pvc-8fb5e386-4641-11e7-a490-42010a800283
+ volumesInUse:
+ - kubernetes.io/pd/some-random-clusterb9772-pvc-72e1c7f1-fd41-11e6-94d4-42010a800049
+ - kubernetes.io/pd/some-random-clusterb9772-pvc-8895a852-fd42-11e6-94d4-42010a800049
+ - kubernetes.io/pd/some-random-clusterb9772-pvc-8bf50554-fd42-11e6-94d4-42010a800049
+ - kubernetes.io/pd/some-random-clusterb9772-pvc-8fb5e386-4641-11e7-a490-42010a800283
+ - kubernetes.io/pd/some-random-clusterb9772-pvc-c2435a06-14d7-11e7-9baf-42010a800049
+ - kubernetes.io/pd/some-random-clusterb9772-pvc-c787c67d-14d7-11e7-9baf-42010a800049
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/pod.yaml b/vendor/k8s.io/apimachinery/pkg/util/managedfields/pod.yaml
new file mode 100644
index 000000000..3fb0877d6
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/pod.yaml
@@ -0,0 +1,121 @@
+apiVersion: v1
+kind: Pod
+metadata:
+ labels:
+ app: some-app
+ plugin1: some-value
+ plugin2: some-value
+ plugin3: some-value
+ plugin4: some-value
+ name: some-name
+ namespace: default
+ ownerReferences:
+ - apiVersion: apps/v1
+ blockOwnerDeletion: true
+ controller: true
+ kind: ReplicaSet
+ name: some-name
+ uid: 0a9d2b9e-779e-11e7-b422-42010a8001be
+spec:
+ containers:
+ - args:
+ - one
+ - two
+ - three
+ - four
+ - five
+ - six
+ - seven
+ - eight
+ - nine
+ env:
+ - name: VAR_3
+ valueFrom:
+ secretKeyRef:
+ key: some-other-key
+ name: some-oher-name
+ - name: VAR_2
+ valueFrom:
+ secretKeyRef:
+ key: other-key
+ name: other-name
+ - name: VAR_1
+ valueFrom:
+ secretKeyRef:
+ key: some-key
+ name: some-name
+ image: some-image-name
+ imagePullPolicy: IfNotPresent
+ name: some-name
+ resources:
+ requests:
+ cpu: '0'
+ terminationMessagePath: /dev/termination-log
+ terminationMessagePolicy: File
+ volumeMounts:
+ - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
+ name: default-token-hu5jz
+ readOnly: true
+ dnsPolicy: ClusterFirst
+ nodeName: node-name
+ priority: 0
+ restartPolicy: Always
+ schedulerName: default-scheduler
+ securityContext: {}
+ serviceAccount: default
+ serviceAccountName: default
+ terminationGracePeriodSeconds: 30
+ tolerations:
+ - effect: NoExecute
+ key: node.kubernetes.io/not-ready
+ operator: Exists
+ tolerationSeconds: 300
+ - effect: NoExecute
+ key: node.kubernetes.io/unreachable
+ operator: Exists
+ tolerationSeconds: 300
+ volumes:
+ - name: default-token-hu5jz
+ secret:
+ defaultMode: 420
+ secretName: default-token-hu5jz
+status:
+ conditions:
+ - lastProbeTime: null
+ lastTransitionTime: '2019-07-08T09:31:18Z'
+ status: 'True'
+ type: Initialized
+ - lastProbeTime: null
+ lastTransitionTime: '2019-07-08T09:41:59Z'
+ status: 'True'
+ type: Ready
+ - lastProbeTime: null
+ lastTransitionTime: null
+ status: 'True'
+ type: ContainersReady
+ - lastProbeTime: null
+ lastTransitionTime: '2019-07-08T09:31:18Z'
+ status: 'True'
+ type: PodScheduled
+ containerStatuses:
+ - containerID: docker://885e82a1ed0b7356541bb410a0126921ac42439607c09875cd8097dd5d7b5376
+ image: some-image-name
+ imageID: docker-pullable://some-image-id
+ lastState:
+ terminated:
+ containerID: docker://d57290f9e00fad626b20d2dd87a3cf69bbc22edae07985374f86a8b2b4e39565
+ exitCode: 255
+ finishedAt: '2019-07-08T09:39:09Z'
+ reason: Error
+ startedAt: '2019-07-08T09:38:54Z'
+ name: name
+ ready: true
+ restartCount: 6
+ state:
+ running:
+ startedAt: '2019-07-08T09:41:59Z'
+ hostIP: 10.0.0.1
+ phase: Running
+ podIP: 10.0.0.1
+ qosClass: BestEffort
+ startTime: '2019-07-08T09:31:18Z'
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/scalehandler.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/scalehandler.go
new file mode 100644
index 000000000..48b774cec
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/scalehandler.go
@@ -0,0 +1,174 @@
+/*
+Copyright 2021 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package managedfields
+
+import (
+ "fmt"
+
+ "k8s.io/apimachinery/pkg/api/meta"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ "k8s.io/apimachinery/pkg/util/managedfields/internal"
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+)
+
+var (
+ scaleGroupVersion = schema.GroupVersion{Group: "autoscaling", Version: "v1"}
+ replicasPathInScale = fieldpath.MakePathOrDie("spec", "replicas")
+)
+
+// ResourcePathMappings maps a group/version to its replicas path. The
+// assumption is that all the paths correspond to leaf fields.
+type ResourcePathMappings map[string]fieldpath.Path
+
+// ScaleHandler manages the conversion of managed fields between a main
+// resource and the scale subresource
+type ScaleHandler struct {
+ parentEntries []metav1.ManagedFieldsEntry
+ groupVersion schema.GroupVersion
+ mappings ResourcePathMappings
+}
+
+// NewScaleHandler creates a new ScaleHandler
+func NewScaleHandler(parentEntries []metav1.ManagedFieldsEntry, groupVersion schema.GroupVersion, mappings ResourcePathMappings) *ScaleHandler {
+ return &ScaleHandler{
+ parentEntries: parentEntries,
+ groupVersion: groupVersion,
+ mappings: mappings,
+ }
+}
+
+// ToSubresource filter the managed fields of the main resource and convert
+// them so that they can be handled by scale.
+// For the managed fields that have a replicas path it performs two changes:
+// 1. APIVersion is changed to the APIVersion of the scale subresource
+// 2. Replicas path of the main resource is transformed to the replicas path of
+// the scale subresource
+func (h *ScaleHandler) ToSubresource() ([]metav1.ManagedFieldsEntry, error) {
+ managed, err := internal.DecodeManagedFields(h.parentEntries)
+ if err != nil {
+ return nil, err
+ }
+
+ f := fieldpath.ManagedFields{}
+ t := map[string]*metav1.Time{}
+ for manager, versionedSet := range managed.Fields() {
+ path, ok := h.mappings[string(versionedSet.APIVersion())]
+ // Skip the entry if the APIVersion is unknown
+ if !ok || path == nil {
+ continue
+ }
+
+ if versionedSet.Set().Has(path) {
+ newVersionedSet := fieldpath.NewVersionedSet(
+ fieldpath.NewSet(replicasPathInScale),
+ fieldpath.APIVersion(scaleGroupVersion.String()),
+ versionedSet.Applied(),
+ )
+
+ f[manager] = newVersionedSet
+ t[manager] = managed.Times()[manager]
+ }
+ }
+
+ return managedFieldsEntries(internal.NewManaged(f, t))
+}
+
+// ToParent merges `scaleEntries` with the entries of the main resource and
+// transforms them accordingly
+func (h *ScaleHandler) ToParent(scaleEntries []metav1.ManagedFieldsEntry) ([]metav1.ManagedFieldsEntry, error) {
+ decodedParentEntries, err := internal.DecodeManagedFields(h.parentEntries)
+ if err != nil {
+ return nil, err
+ }
+ parentFields := decodedParentEntries.Fields()
+
+ decodedScaleEntries, err := internal.DecodeManagedFields(scaleEntries)
+ if err != nil {
+ return nil, err
+ }
+ scaleFields := decodedScaleEntries.Fields()
+
+ f := fieldpath.ManagedFields{}
+ t := map[string]*metav1.Time{}
+
+ for manager, versionedSet := range parentFields {
+ // Get the main resource "replicas" path
+ path, ok := h.mappings[string(versionedSet.APIVersion())]
+ // Drop the entry if the APIVersion is unknown.
+ if !ok {
+ continue
+ }
+
+ // If the parent entry does not have the replicas path or it is nil, just
+ // keep it as it is. The path is nil for Custom Resources without scale
+ // subresource.
+ if path == nil || !versionedSet.Set().Has(path) {
+ f[manager] = versionedSet
+ t[manager] = decodedParentEntries.Times()[manager]
+ continue
+ }
+
+ if _, ok := scaleFields[manager]; !ok {
+ // "Steal" the replicas path from the main resource entry
+ newSet := versionedSet.Set().Difference(fieldpath.NewSet(path))
+
+ if !newSet.Empty() {
+ newVersionedSet := fieldpath.NewVersionedSet(
+ newSet,
+ versionedSet.APIVersion(),
+ versionedSet.Applied(),
+ )
+ f[manager] = newVersionedSet
+ t[manager] = decodedParentEntries.Times()[manager]
+ }
+ } else {
+ // Field wasn't stolen, let's keep the entry as it is.
+ f[manager] = versionedSet
+ t[manager] = decodedParentEntries.Times()[manager]
+ delete(scaleFields, manager)
+ }
+ }
+
+ for manager, versionedSet := range scaleFields {
+ if !versionedSet.Set().Has(replicasPathInScale) {
+ continue
+ }
+ newVersionedSet := fieldpath.NewVersionedSet(
+ fieldpath.NewSet(h.mappings[h.groupVersion.String()]),
+ fieldpath.APIVersion(h.groupVersion.String()),
+ versionedSet.Applied(),
+ )
+ f[manager] = newVersionedSet
+ t[manager] = decodedParentEntries.Times()[manager]
+ }
+
+ return managedFieldsEntries(internal.NewManaged(f, t))
+}
+
+func managedFieldsEntries(entries internal.ManagedInterface) ([]metav1.ManagedFieldsEntry, error) {
+ obj := &unstructured.Unstructured{Object: map[string]interface{}{}}
+ if err := internal.EncodeObjectManagedFields(obj, entries); err != nil {
+ return nil, err
+ }
+ accessor, err := meta.Accessor(obj)
+ if err != nil {
+ panic(fmt.Sprintf("couldn't get accessor: %v", err))
+ }
+ return accessor.GetManagedFields(), nil
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/typeconverter.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/typeconverter.go
new file mode 100644
index 000000000..d031eefaa
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/typeconverter.go
@@ -0,0 +1,47 @@
+/*
+Copyright 2018 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package managedfields
+
+import (
+ "k8s.io/apimachinery/pkg/util/managedfields/internal"
+ "k8s.io/kube-openapi/pkg/validation/spec"
+)
+
+// TypeConverter allows you to convert from runtime.Object to
+// typed.TypedValue and the other way around.
+type TypeConverter = internal.TypeConverter
+
+// NewDeducedTypeConverter creates a TypeConverter for CRDs that don't
+// have a schema. It does implement the same interface though (and
+// create the same types of objects), so that everything can still work
+// the same. CRDs are merged with all their fields being "atomic" (lists
+// included).
+func NewDeducedTypeConverter() TypeConverter {
+ return internal.NewDeducedTypeConverter()
+}
+
+// NewTypeConverter builds a TypeConverter from a map of OpenAPIV3 schemas.
+// This will automatically find the proper version of the object, and the
+// corresponding schema information.
+// The keys to the map must be consistent with the names
+// used by Refs within the schemas.
+// The schemas should conform to the Kubernetes Structural Schema OpenAPI
+// restrictions found in docs:
+// https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#specifying-a-structural-schema
+func NewTypeConverter(openapiSpec map[string]*spec.Schema, preserveUnknownFields bool) (TypeConverter, error) {
+ return internal.NewTypeConverter(openapiSpec, preserveUnknownFields)
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/mergepatch/OWNERS b/vendor/k8s.io/apimachinery/pkg/util/mergepatch/OWNERS
index 3f72c69ba..349bc69d6 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/mergepatch/OWNERS
+++ b/vendor/k8s.io/apimachinery/pkg/util/mergepatch/OWNERS
@@ -1,7 +1,6 @@
# See the OWNERS docs at https://go.k8s.io/owners
approvers:
-- pwittrock
+ - pwittrock
reviewers:
-- mengqiy
-- apelisse
+ - apelisse
diff --git a/vendor/k8s.io/apimachinery/pkg/util/mergepatch/util.go b/vendor/k8s.io/apimachinery/pkg/util/mergepatch/util.go
index e39627568..25626cf3a 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/mergepatch/util.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/mergepatch/util.go
@@ -20,7 +20,7 @@ import (
"fmt"
"reflect"
- "github.com/davecgh/go-spew/spew"
+ "k8s.io/apimachinery/pkg/util/dump"
"sigs.k8s.io/yaml"
)
@@ -76,7 +76,7 @@ func ToYAMLOrError(v interface{}) string {
func toYAML(v interface{}) (string, error) {
y, err := yaml.Marshal(v)
if err != nil {
- return "", fmt.Errorf("yaml marshal failed:%v\n%v\n", err, spew.Sdump(v))
+ return "", fmt.Errorf("yaml marshal failed:%v\n%v\n", err, dump.Pretty(v))
}
return string(y), nil
@@ -88,8 +88,7 @@ func toYAML(v interface{}) (string, error) {
// supports JSON merge patch semantics.
//
// NOTE: Numbers with different types (e.g. int(0) vs int64(0)) will be detected as conflicts.
-//
-// Make sure the unmarshaling of left and right are consistent (e.g. use the same library).
+// Make sure the unmarshaling of left and right are consistent (e.g. use the same library).
func HasConflicts(left, right interface{}) (bool, error) {
switch typedLeft := left.(type) {
case map[string]interface{}:
diff --git a/vendor/k8s.io/apimachinery/pkg/util/net/http.go b/vendor/k8s.io/apimachinery/pkg/util/net/http.go
index 04432b175..8cc1810af 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/net/http.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/net/http.go
@@ -17,7 +17,6 @@ limitations under the License.
package net
import (
- "bufio"
"bytes"
"context"
"crypto/tls"
@@ -446,104 +445,6 @@ type Dialer interface {
Dial(req *http.Request) (net.Conn, error)
}
-// ConnectWithRedirects uses dialer to send req, following up to 10 redirects (relative to
-// originalLocation). It returns the opened net.Conn and the raw response bytes.
-// If requireSameHostRedirects is true, only redirects to the same host are permitted.
-func ConnectWithRedirects(originalMethod string, originalLocation *url.URL, header http.Header, originalBody io.Reader, dialer Dialer, requireSameHostRedirects bool) (net.Conn, []byte, error) {
- const (
- maxRedirects = 9 // Fail on the 10th redirect
- maxResponseSize = 16384 // play it safe to allow the potential for lots of / large headers
- )
-
- var (
- location = originalLocation
- method = originalMethod
- intermediateConn net.Conn
- rawResponse = bytes.NewBuffer(make([]byte, 0, 256))
- body = originalBody
- )
-
- defer func() {
- if intermediateConn != nil {
- intermediateConn.Close()
- }
- }()
-
-redirectLoop:
- for redirects := 0; ; redirects++ {
- if redirects > maxRedirects {
- return nil, nil, fmt.Errorf("too many redirects (%d)", redirects)
- }
-
- req, err := http.NewRequest(method, location.String(), body)
- if err != nil {
- return nil, nil, err
- }
-
- req.Header = header
-
- intermediateConn, err = dialer.Dial(req)
- if err != nil {
- return nil, nil, err
- }
-
- // Peek at the backend response.
- rawResponse.Reset()
- respReader := bufio.NewReader(io.TeeReader(
- io.LimitReader(intermediateConn, maxResponseSize), // Don't read more than maxResponseSize bytes.
- rawResponse)) // Save the raw response.
- resp, err := http.ReadResponse(respReader, nil)
- if err != nil {
- // Unable to read the backend response; let the client handle it.
- klog.Warningf("Error reading backend response: %v", err)
- break redirectLoop
- }
-
- switch resp.StatusCode {
- case http.StatusFound:
- // Redirect, continue.
- default:
- // Don't redirect.
- break redirectLoop
- }
-
- // Redirected requests switch to "GET" according to the HTTP spec:
- // https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3
- method = "GET"
- // don't send a body when following redirects
- body = nil
-
- resp.Body.Close() // not used
-
- // Prepare to follow the redirect.
- redirectStr := resp.Header.Get("Location")
- if redirectStr == "" {
- return nil, nil, fmt.Errorf("%d response missing Location header", resp.StatusCode)
- }
- // We have to parse relative to the current location, NOT originalLocation. For example,
- // if we request http://foo.com/a and get back "http://bar.com/b", the result should be
- // http://bar.com/b. If we then make that request and get back a redirect to "/c", the result
- // should be http://bar.com/c, not http://foo.com/c.
- location, err = location.Parse(redirectStr)
- if err != nil {
- return nil, nil, fmt.Errorf("malformed Location header: %v", err)
- }
-
- // Only follow redirects to the same host. Otherwise, propagate the redirect response back.
- if requireSameHostRedirects && location.Hostname() != originalLocation.Hostname() {
- return nil, nil, fmt.Errorf("hostname mismatch: expected %s, found %s", originalLocation.Hostname(), location.Hostname())
- }
-
- // Reset the connection.
- intermediateConn.Close()
- intermediateConn = nil
- }
-
- connToReturn := intermediateConn
- intermediateConn = nil // Don't close the connection when we return it.
- return connToReturn, rawResponse.Bytes(), nil
-}
-
// CloneRequest creates a shallow copy of the request along with a deep copy of the Headers.
func CloneRequest(req *http.Request) *http.Request {
r := new(http.Request)
diff --git a/vendor/k8s.io/apimachinery/pkg/util/net/interface.go b/vendor/k8s.io/apimachinery/pkg/util/net/interface.go
index 822416806..01d028e72 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/net/interface.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/net/interface.go
@@ -339,7 +339,7 @@ func chooseIPFromHostInterfaces(nw networkInterfacer, addressFamilies AddressFam
for _, addr := range addrs {
ip, _, err := netutils.ParseCIDRSloppy(addr.String())
if err != nil {
- return nil, fmt.Errorf("Unable to parse CIDR for interface %q: %s", intf.Name, err)
+ return nil, fmt.Errorf("unable to parse CIDR for interface %q: %s", intf.Name, err)
}
if !memberOf(ip, family) {
klog.V(4).Infof("Skipping: no address family match for %q on interface %q.", ip, intf.Name)
diff --git a/vendor/k8s.io/apimachinery/pkg/util/net/util.go b/vendor/k8s.io/apimachinery/pkg/util/net/util.go
index 1c2aba55f..1635e69a5 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/net/util.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/net/util.go
@@ -20,6 +20,7 @@ import (
"errors"
"net"
"reflect"
+ "strings"
"syscall"
)
@@ -47,6 +48,11 @@ func IsConnectionReset(err error) bool {
return false
}
+// Returns if the given err is "http2: client connection lost" error.
+func IsHTTP2ConnectionLost(err error) bool {
+ return err != nil && strings.Contains(err.Error(), "http2: client connection lost")
+}
+
// Returns if the given err is "connection refused" error
func IsConnectionRefused(err error) bool {
var errno syscall.Errno
diff --git a/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go b/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
index 035c52811..4fe0c5eb2 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
@@ -17,6 +17,7 @@ limitations under the License.
package runtime
import (
+ "context"
"fmt"
"net/http"
"runtime"
@@ -27,14 +28,15 @@ import (
)
var (
- // ReallyCrash controls the behavior of HandleCrash and now defaults
- // true. It's still exposed so components can optionally set to false
- // to restore prior behavior.
+ // ReallyCrash controls the behavior of HandleCrash and defaults to
+ // true. It's exposed so components can optionally set to false
+ // to restore prior behavior. This flag is mostly used for tests to validate
+ // crash conditions.
ReallyCrash = true
)
// PanicHandlers is a list of functions which will be invoked when a panic happens.
-var PanicHandlers = []func(interface{}){logPanic}
+var PanicHandlers = []func(context.Context, interface{}){logPanic}
// HandleCrash simply catches a crash and logs an error. Meant to be called via
// defer. Additional context-specific handlers can be provided, and will be
@@ -42,23 +44,54 @@ var PanicHandlers = []func(interface{}){logPanic}
// handlers and logging the panic message.
//
// E.g., you can provide one or more additional handlers for something like shutting down go routines gracefully.
+//
+// TODO(pohly): logcheck:context // HandleCrashWithContext should be used instead of HandleCrash in code which supports contextual logging.
func HandleCrash(additionalHandlers ...func(interface{})) {
if r := recover(); r != nil {
- for _, fn := range PanicHandlers {
- fn(r)
- }
- for _, fn := range additionalHandlers {
- fn(r)
- }
- if ReallyCrash {
- // Actually proceed to panic.
- panic(r)
+ additionalHandlersWithContext := make([]func(context.Context, interface{}), len(additionalHandlers))
+ for i, handler := range additionalHandlers {
+ handler := handler // capture loop variable
+ additionalHandlersWithContext[i] = func(_ context.Context, r interface{}) {
+ handler(r)
+ }
}
+
+ handleCrash(context.Background(), r, additionalHandlersWithContext...)
+ }
+}
+
+// HandleCrashWithContext simply catches a crash and logs an error. Meant to be called via
+// defer. Additional context-specific handlers can be provided, and will be
+// called in case of panic. HandleCrash actually crashes, after calling the
+// handlers and logging the panic message.
+//
+// E.g., you can provide one or more additional handlers for something like shutting down go routines gracefully.
+//
+// The context is used to determine how to log.
+func HandleCrashWithContext(ctx context.Context, additionalHandlers ...func(context.Context, interface{})) {
+ if r := recover(); r != nil {
+ handleCrash(ctx, r, additionalHandlers...)
+ }
+}
+
+// handleCrash is the common implementation of HandleCrash and HandleCrash.
+// Having those call a common implementation ensures that the stack depth
+// is the same regardless through which path the handlers get invoked.
+func handleCrash(ctx context.Context, r any, additionalHandlers ...func(context.Context, interface{})) {
+ for _, fn := range PanicHandlers {
+ fn(ctx, r)
+ }
+ for _, fn := range additionalHandlers {
+ fn(ctx, r)
+ }
+ if ReallyCrash {
+ // Actually proceed to panic.
+ panic(r)
}
}
// logPanic logs the caller tree when a panic occurs (except in the special case of http.ErrAbortHandler).
-func logPanic(r interface{}) {
+func logPanic(ctx context.Context, r interface{}) {
if r == http.ErrAbortHandler {
// honor the http.ErrAbortHandler sentinel panic value:
// ErrAbortHandler is a sentinel panic value to abort a handler.
@@ -72,10 +105,20 @@ func logPanic(r interface{}) {
const size = 64 << 10
stacktrace := make([]byte, size)
stacktrace = stacktrace[:runtime.Stack(stacktrace, false)]
+
+ // We don't really know how many call frames to skip because the Go
+ // panic handler is between us and the code where the panic occurred.
+ // If it's one function (as in Go 1.21), then skipping four levels
+ // gets us to the function which called the `defer HandleCrashWithontext(...)`.
+ logger := klog.FromContext(ctx).WithCallDepth(4)
+
+ // For backwards compatibility, conversion to string
+ // is handled here instead of defering to the logging
+ // backend.
if _, ok := r.(string); ok {
- klog.Errorf("Observed a panic: %s\n%s", r, stacktrace)
+ logger.Error(nil, "Observed a panic", "panic", r, "stacktrace", string(stacktrace))
} else {
- klog.Errorf("Observed a panic: %#v (%v)\n%s", r, r, stacktrace)
+ logger.Error(nil, "Observed a panic", "panic", fmt.Sprintf("%v", r), "panicGoValue", fmt.Sprintf("%#v", r), "stacktrace", string(stacktrace))
}
}
@@ -83,35 +126,76 @@ func logPanic(r interface{}) {
// error occurs.
// TODO(lavalamp): for testability, this and the below HandleError function
// should be packaged up into a testable and reusable object.
-var ErrorHandlers = []func(error){
+var ErrorHandlers = []ErrorHandler{
logError,
- (&rudimentaryErrorBackoff{
- lastErrorTime: time.Now(),
- // 1ms was the number folks were able to stomach as a global rate limit.
- // If you need to log errors more than 1000 times a second you
- // should probably consider fixing your code instead. :)
- minPeriod: time.Millisecond,
- }).OnError,
+ func(_ context.Context, _ error, _ string, _ ...interface{}) {
+ (&rudimentaryErrorBackoff{
+ lastErrorTime: time.Now(),
+ // 1ms was the number folks were able to stomach as a global rate limit.
+ // If you need to log errors more than 1000 times a second you
+ // should probably consider fixing your code instead. :)
+ minPeriod: time.Millisecond,
+ }).OnError()
+ },
}
+type ErrorHandler func(ctx context.Context, err error, msg string, keysAndValues ...interface{})
+
// HandlerError is a method to invoke when a non-user facing piece of code cannot
// return an error and needs to indicate it has been ignored. Invoking this method
// is preferable to logging the error - the default behavior is to log but the
// errors may be sent to a remote server for analysis.
+//
+// TODO(pohly): logcheck:context // HandleErrorWithContext should be used instead of HandleError in code which supports contextual logging.
func HandleError(err error) {
// this is sometimes called with a nil error. We probably shouldn't fail and should do nothing instead
if err == nil {
return
}
+ handleError(context.Background(), err, "Unhandled Error")
+}
+
+// HandlerErrorWithContext is a method to invoke when a non-user facing piece of code cannot
+// return an error and needs to indicate it has been ignored. Invoking this method
+// is preferable to logging the error - the default behavior is to log but the
+// errors may be sent to a remote server for analysis. The context is used to
+// determine how to log the error.
+//
+// If contextual logging is enabled, the default log output is equivalent to
+//
+// logr.FromContext(ctx).WithName("UnhandledError").Error(err, msg, keysAndValues...)
+//
+// Without contextual logging, it is equivalent to:
+//
+// klog.ErrorS(err, msg, keysAndValues...)
+//
+// In contrast to HandleError, passing nil for the error is still going to
+// trigger a log entry. Don't construct a new error or wrap an error
+// with fmt.Errorf. Instead, add additional information via the mssage
+// and key/value pairs.
+//
+// This variant should be used instead of HandleError because it supports
+// structured, contextual logging.
+func HandleErrorWithContext(ctx context.Context, err error, msg string, keysAndValues ...interface{}) {
+ handleError(ctx, err, msg, keysAndValues...)
+}
+
+// handleError is the common implementation of HandleError and HandleErrorWithContext.
+// Using this common implementation ensures that the stack depth
+// is the same regardless through which path the handlers get invoked.
+func handleError(ctx context.Context, err error, msg string, keysAndValues ...interface{}) {
for _, fn := range ErrorHandlers {
- fn(err)
+ fn(ctx, err, msg, keysAndValues...)
}
}
-// logError prints an error with the call stack of the location it was reported
-func logError(err error) {
- klog.ErrorDepth(2, err)
+// logError prints an error with the call stack of the location it was reported.
+// It expects to be called as -> HandleError[WithContext] -> handleError -> logError.
+func logError(ctx context.Context, err error, msg string, keysAndValues ...interface{}) {
+ logger := klog.FromContext(ctx).WithCallDepth(3)
+ logger = klog.LoggerWithName(logger, "UnhandledError")
+ logger.Error(err, msg, keysAndValues...) //nolint:logcheck // logcheck complains about unknown key/value pairs.
}
type rudimentaryErrorBackoff struct {
@@ -124,15 +208,18 @@ type rudimentaryErrorBackoff struct {
// OnError will block if it is called more often than the embedded period time.
// This will prevent overly tight hot error loops.
-func (r *rudimentaryErrorBackoff) OnError(error) {
+func (r *rudimentaryErrorBackoff) OnError() {
+ now := time.Now() // start the timer before acquiring the lock
r.lastErrorTimeLock.Lock()
- defer r.lastErrorTimeLock.Unlock()
- d := time.Since(r.lastErrorTime)
- if d < r.minPeriod {
- // If the time moves backwards for any reason, do nothing
- time.Sleep(r.minPeriod - d)
- }
+ d := now.Sub(r.lastErrorTime)
r.lastErrorTime = time.Now()
+ r.lastErrorTimeLock.Unlock()
+
+ // Do not sleep with the lock held because that causes all callers of HandleError to block.
+ // We only want the current goroutine to block.
+ // A negative or zero duration causes time.Sleep to return immediately.
+ // If the time moves backwards for any reason, do nothing.
+ time.Sleep(r.minPeriod - d)
}
// GetCaller returns the caller of the function that calls it.
@@ -141,7 +228,7 @@ func GetCaller() string {
runtime.Callers(3, pc[:])
f := runtime.FuncForPC(pc[0])
if f == nil {
- return fmt.Sprintf("Unable to find caller")
+ return "Unable to find caller"
}
return f.Name()
}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/sets/byte.go b/vendor/k8s.io/apimachinery/pkg/util/sets/byte.go
index 9bfa85d43..4d7a17c3a 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/sets/byte.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/sets/byte.go
@@ -1,5 +1,5 @@
/*
-Copyright The Kubernetes Authors.
+Copyright 2022 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -14,93 +14,75 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-// Code generated by set-gen. DO NOT EDIT.
-
package sets
-import (
- "reflect"
- "sort"
-)
-
-// sets.Byte is a set of bytes, implemented via map[byte]struct{} for minimal memory consumption.
+// Byte is a set of bytes, implemented via map[byte]struct{} for minimal memory consumption.
+//
+// Deprecated: use generic Set instead.
+// new ways:
+// s1 := Set[byte]{}
+// s2 := New[byte]()
type Byte map[byte]Empty
// NewByte creates a Byte from a list of values.
func NewByte(items ...byte) Byte {
- ss := Byte{}
- ss.Insert(items...)
- return ss
+ return Byte(New[byte](items...))
}
// ByteKeySet creates a Byte from a keys of a map[byte](? extends interface{}).
// If the value passed in is not actually a map, this will panic.
-func ByteKeySet(theMap interface{}) Byte {
- v := reflect.ValueOf(theMap)
- ret := Byte{}
-
- for _, keyValue := range v.MapKeys() {
- ret.Insert(keyValue.Interface().(byte))
- }
- return ret
+func ByteKeySet[T any](theMap map[byte]T) Byte {
+ return Byte(KeySet(theMap))
}
// Insert adds items to the set.
func (s Byte) Insert(items ...byte) Byte {
- for _, item := range items {
- s[item] = Empty{}
- }
- return s
+ return Byte(cast(s).Insert(items...))
}
// Delete removes all items from the set.
func (s Byte) Delete(items ...byte) Byte {
- for _, item := range items {
- delete(s, item)
- }
- return s
+ return Byte(cast(s).Delete(items...))
}
// Has returns true if and only if item is contained in the set.
func (s Byte) Has(item byte) bool {
- _, contained := s[item]
- return contained
+ return cast(s).Has(item)
}
// HasAll returns true if and only if all items are contained in the set.
func (s Byte) HasAll(items ...byte) bool {
- for _, item := range items {
- if !s.Has(item) {
- return false
- }
- }
- return true
+ return cast(s).HasAll(items...)
}
// HasAny returns true if any items are contained in the set.
func (s Byte) HasAny(items ...byte) bool {
- for _, item := range items {
- if s.Has(item) {
- return true
- }
- }
- return false
+ return cast(s).HasAny(items...)
}
-// Difference returns a set of objects that are not in s2
+// Clone returns a new set which is a copy of the current set.
+func (s Byte) Clone() Byte {
+ return Byte(cast(s).Clone())
+}
+
+// Difference returns a set of objects that are not in s2.
// For example:
// s1 = {a1, a2, a3}
// s2 = {a1, a2, a4, a5}
// s1.Difference(s2) = {a3}
// s2.Difference(s1) = {a4, a5}
-func (s Byte) Difference(s2 Byte) Byte {
- result := NewByte()
- for key := range s {
- if !s2.Has(key) {
- result.Insert(key)
- }
- }
- return result
+func (s1 Byte) Difference(s2 Byte) Byte {
+ return Byte(cast(s1).Difference(cast(s2)))
+}
+
+// SymmetricDifference returns a set of elements which are in either of the sets, but not in their intersection.
+// For example:
+// s1 = {a1, a2, a3}
+// s2 = {a1, a2, a4, a5}
+// s1.SymmetricDifference(s2) = {a3, a4, a5}
+// s2.SymmetricDifference(s1) = {a3, a4, a5}
+func (s1 Byte) SymmetricDifference(s2 Byte) Byte {
+ return Byte(cast(s1).SymmetricDifference(cast(s2)))
}
// Union returns a new set which includes items in either s1 or s2.
@@ -110,14 +92,7 @@ func (s Byte) Difference(s2 Byte) Byte {
// s1.Union(s2) = {a1, a2, a3, a4}
// s2.Union(s1) = {a1, a2, a3, a4}
func (s1 Byte) Union(s2 Byte) Byte {
- result := NewByte()
- for key := range s1 {
- result.Insert(key)
- }
- for key := range s2 {
- result.Insert(key)
- }
- return result
+ return Byte(cast(s1).Union(cast(s2)))
}
// Intersection returns a new set which includes the item in BOTH s1 and s2
@@ -126,80 +101,37 @@ func (s1 Byte) Union(s2 Byte) Byte {
// s2 = {a2, a3}
// s1.Intersection(s2) = {a2}
func (s1 Byte) Intersection(s2 Byte) Byte {
- var walk, other Byte
- result := NewByte()
- if s1.Len() < s2.Len() {
- walk = s1
- other = s2
- } else {
- walk = s2
- other = s1
- }
- for key := range walk {
- if other.Has(key) {
- result.Insert(key)
- }
- }
- return result
+ return Byte(cast(s1).Intersection(cast(s2)))
}
// IsSuperset returns true if and only if s1 is a superset of s2.
func (s1 Byte) IsSuperset(s2 Byte) bool {
- for item := range s2 {
- if !s1.Has(item) {
- return false
- }
- }
- return true
+ return cast(s1).IsSuperset(cast(s2))
}
// Equal returns true if and only if s1 is equal (as a set) to s2.
// Two sets are equal if their membership is identical.
// (In practice, this means same elements, order doesn't matter)
func (s1 Byte) Equal(s2 Byte) bool {
- return len(s1) == len(s2) && s1.IsSuperset(s2)
+ return cast(s1).Equal(cast(s2))
}
-type sortableSliceOfByte []byte
-
-func (s sortableSliceOfByte) Len() int { return len(s) }
-func (s sortableSliceOfByte) Less(i, j int) bool { return lessByte(s[i], s[j]) }
-func (s sortableSliceOfByte) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-
// List returns the contents as a sorted byte slice.
func (s Byte) List() []byte {
- res := make(sortableSliceOfByte, 0, len(s))
- for key := range s {
- res = append(res, key)
- }
- sort.Sort(res)
- return []byte(res)
+ return List(cast(s))
}
// UnsortedList returns the slice with contents in random order.
func (s Byte) UnsortedList() []byte {
- res := make([]byte, 0, len(s))
- for key := range s {
- res = append(res, key)
- }
- return res
+ return cast(s).UnsortedList()
}
-// Returns a single element from the set.
+// PopAny returns a single element from the set.
func (s Byte) PopAny() (byte, bool) {
- for key := range s {
- s.Delete(key)
- return key, true
- }
- var zeroValue byte
- return zeroValue, false
+ return cast(s).PopAny()
}
// Len returns the size of the set.
func (s Byte) Len() int {
return len(s)
}
-
-func lessByte(lhs, rhs byte) bool {
- return lhs < rhs
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/sets/doc.go b/vendor/k8s.io/apimachinery/pkg/util/sets/doc.go
index b152a0bf0..fd281bdb8 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/sets/doc.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/sets/doc.go
@@ -1,5 +1,5 @@
/*
-Copyright The Kubernetes Authors.
+Copyright 2022 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-// Code generated by set-gen. DO NOT EDIT.
-
-// Package sets has auto-generated set types.
-package sets
+// Package sets has generic set and specified sets. Generic set will
+// replace specified ones over time. And specific ones are deprecated.
+package sets // import "k8s.io/apimachinery/pkg/util/sets"
diff --git a/vendor/k8s.io/apimachinery/pkg/util/sets/empty.go b/vendor/k8s.io/apimachinery/pkg/util/sets/empty.go
index e11e622c5..fbb1df06d 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/sets/empty.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/sets/empty.go
@@ -1,5 +1,5 @@
/*
-Copyright The Kubernetes Authors.
+Copyright 2022 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -14,8 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-// Code generated by set-gen. DO NOT EDIT.
-
package sets
// Empty is public since it is used by some internal API objects for conversions between external
diff --git a/vendor/k8s.io/apimachinery/pkg/util/sets/int.go b/vendor/k8s.io/apimachinery/pkg/util/sets/int.go
index 88bd70967..5876fc9de 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/sets/int.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/sets/int.go
@@ -1,5 +1,5 @@
/*
-Copyright The Kubernetes Authors.
+Copyright 2022 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -14,93 +14,75 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-// Code generated by set-gen. DO NOT EDIT.
-
package sets
-import (
- "reflect"
- "sort"
-)
-
-// sets.Int is a set of ints, implemented via map[int]struct{} for minimal memory consumption.
+// Int is a set of ints, implemented via map[int]struct{} for minimal memory consumption.
+//
+// Deprecated: use generic Set instead.
+// new ways:
+// s1 := Set[int]{}
+// s2 := New[int]()
type Int map[int]Empty
// NewInt creates a Int from a list of values.
func NewInt(items ...int) Int {
- ss := Int{}
- ss.Insert(items...)
- return ss
+ return Int(New[int](items...))
}
// IntKeySet creates a Int from a keys of a map[int](? extends interface{}).
// If the value passed in is not actually a map, this will panic.
-func IntKeySet(theMap interface{}) Int {
- v := reflect.ValueOf(theMap)
- ret := Int{}
-
- for _, keyValue := range v.MapKeys() {
- ret.Insert(keyValue.Interface().(int))
- }
- return ret
+func IntKeySet[T any](theMap map[int]T) Int {
+ return Int(KeySet(theMap))
}
// Insert adds items to the set.
func (s Int) Insert(items ...int) Int {
- for _, item := range items {
- s[item] = Empty{}
- }
- return s
+ return Int(cast(s).Insert(items...))
}
// Delete removes all items from the set.
func (s Int) Delete(items ...int) Int {
- for _, item := range items {
- delete(s, item)
- }
- return s
+ return Int(cast(s).Delete(items...))
}
// Has returns true if and only if item is contained in the set.
func (s Int) Has(item int) bool {
- _, contained := s[item]
- return contained
+ return cast(s).Has(item)
}
// HasAll returns true if and only if all items are contained in the set.
func (s Int) HasAll(items ...int) bool {
- for _, item := range items {
- if !s.Has(item) {
- return false
- }
- }
- return true
+ return cast(s).HasAll(items...)
}
// HasAny returns true if any items are contained in the set.
func (s Int) HasAny(items ...int) bool {
- for _, item := range items {
- if s.Has(item) {
- return true
- }
- }
- return false
+ return cast(s).HasAny(items...)
}
-// Difference returns a set of objects that are not in s2
+// Clone returns a new set which is a copy of the current set.
+func (s Int) Clone() Int {
+ return Int(cast(s).Clone())
+}
+
+// Difference returns a set of objects that are not in s2.
// For example:
// s1 = {a1, a2, a3}
// s2 = {a1, a2, a4, a5}
// s1.Difference(s2) = {a3}
// s2.Difference(s1) = {a4, a5}
-func (s Int) Difference(s2 Int) Int {
- result := NewInt()
- for key := range s {
- if !s2.Has(key) {
- result.Insert(key)
- }
- }
- return result
+func (s1 Int) Difference(s2 Int) Int {
+ return Int(cast(s1).Difference(cast(s2)))
+}
+
+// SymmetricDifference returns a set of elements which are in either of the sets, but not in their intersection.
+// For example:
+// s1 = {a1, a2, a3}
+// s2 = {a1, a2, a4, a5}
+// s1.SymmetricDifference(s2) = {a3, a4, a5}
+// s2.SymmetricDifference(s1) = {a3, a4, a5}
+func (s1 Int) SymmetricDifference(s2 Int) Int {
+ return Int(cast(s1).SymmetricDifference(cast(s2)))
}
// Union returns a new set which includes items in either s1 or s2.
@@ -110,14 +92,7 @@ func (s Int) Difference(s2 Int) Int {
// s1.Union(s2) = {a1, a2, a3, a4}
// s2.Union(s1) = {a1, a2, a3, a4}
func (s1 Int) Union(s2 Int) Int {
- result := NewInt()
- for key := range s1 {
- result.Insert(key)
- }
- for key := range s2 {
- result.Insert(key)
- }
- return result
+ return Int(cast(s1).Union(cast(s2)))
}
// Intersection returns a new set which includes the item in BOTH s1 and s2
@@ -126,80 +101,37 @@ func (s1 Int) Union(s2 Int) Int {
// s2 = {a2, a3}
// s1.Intersection(s2) = {a2}
func (s1 Int) Intersection(s2 Int) Int {
- var walk, other Int
- result := NewInt()
- if s1.Len() < s2.Len() {
- walk = s1
- other = s2
- } else {
- walk = s2
- other = s1
- }
- for key := range walk {
- if other.Has(key) {
- result.Insert(key)
- }
- }
- return result
+ return Int(cast(s1).Intersection(cast(s2)))
}
// IsSuperset returns true if and only if s1 is a superset of s2.
func (s1 Int) IsSuperset(s2 Int) bool {
- for item := range s2 {
- if !s1.Has(item) {
- return false
- }
- }
- return true
+ return cast(s1).IsSuperset(cast(s2))
}
// Equal returns true if and only if s1 is equal (as a set) to s2.
// Two sets are equal if their membership is identical.
// (In practice, this means same elements, order doesn't matter)
func (s1 Int) Equal(s2 Int) bool {
- return len(s1) == len(s2) && s1.IsSuperset(s2)
+ return cast(s1).Equal(cast(s2))
}
-type sortableSliceOfInt []int
-
-func (s sortableSliceOfInt) Len() int { return len(s) }
-func (s sortableSliceOfInt) Less(i, j int) bool { return lessInt(s[i], s[j]) }
-func (s sortableSliceOfInt) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-
// List returns the contents as a sorted int slice.
func (s Int) List() []int {
- res := make(sortableSliceOfInt, 0, len(s))
- for key := range s {
- res = append(res, key)
- }
- sort.Sort(res)
- return []int(res)
+ return List(cast(s))
}
// UnsortedList returns the slice with contents in random order.
func (s Int) UnsortedList() []int {
- res := make([]int, 0, len(s))
- for key := range s {
- res = append(res, key)
- }
- return res
+ return cast(s).UnsortedList()
}
-// Returns a single element from the set.
+// PopAny returns a single element from the set.
func (s Int) PopAny() (int, bool) {
- for key := range s {
- s.Delete(key)
- return key, true
- }
- var zeroValue int
- return zeroValue, false
+ return cast(s).PopAny()
}
// Len returns the size of the set.
func (s Int) Len() int {
return len(s)
}
-
-func lessInt(lhs, rhs int) bool {
- return lhs < rhs
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/sets/int32.go b/vendor/k8s.io/apimachinery/pkg/util/sets/int32.go
index 96a485554..2c640c5d0 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/sets/int32.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/sets/int32.go
@@ -1,5 +1,5 @@
/*
-Copyright The Kubernetes Authors.
+Copyright 2022 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -14,93 +14,75 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-// Code generated by set-gen. DO NOT EDIT.
-
package sets
-import (
- "reflect"
- "sort"
-)
-
-// sets.Int32 is a set of int32s, implemented via map[int32]struct{} for minimal memory consumption.
+// Int32 is a set of int32s, implemented via map[int32]struct{} for minimal memory consumption.
+//
+// Deprecated: use generic Set instead.
+// new ways:
+// s1 := Set[int32]{}
+// s2 := New[int32]()
type Int32 map[int32]Empty
// NewInt32 creates a Int32 from a list of values.
func NewInt32(items ...int32) Int32 {
- ss := Int32{}
- ss.Insert(items...)
- return ss
+ return Int32(New[int32](items...))
}
// Int32KeySet creates a Int32 from a keys of a map[int32](? extends interface{}).
// If the value passed in is not actually a map, this will panic.
-func Int32KeySet(theMap interface{}) Int32 {
- v := reflect.ValueOf(theMap)
- ret := Int32{}
-
- for _, keyValue := range v.MapKeys() {
- ret.Insert(keyValue.Interface().(int32))
- }
- return ret
+func Int32KeySet[T any](theMap map[int32]T) Int32 {
+ return Int32(KeySet(theMap))
}
// Insert adds items to the set.
func (s Int32) Insert(items ...int32) Int32 {
- for _, item := range items {
- s[item] = Empty{}
- }
- return s
+ return Int32(cast(s).Insert(items...))
}
// Delete removes all items from the set.
func (s Int32) Delete(items ...int32) Int32 {
- for _, item := range items {
- delete(s, item)
- }
- return s
+ return Int32(cast(s).Delete(items...))
}
// Has returns true if and only if item is contained in the set.
func (s Int32) Has(item int32) bool {
- _, contained := s[item]
- return contained
+ return cast(s).Has(item)
}
// HasAll returns true if and only if all items are contained in the set.
func (s Int32) HasAll(items ...int32) bool {
- for _, item := range items {
- if !s.Has(item) {
- return false
- }
- }
- return true
+ return cast(s).HasAll(items...)
}
// HasAny returns true if any items are contained in the set.
func (s Int32) HasAny(items ...int32) bool {
- for _, item := range items {
- if s.Has(item) {
- return true
- }
- }
- return false
+ return cast(s).HasAny(items...)
}
-// Difference returns a set of objects that are not in s2
+// Clone returns a new set which is a copy of the current set.
+func (s Int32) Clone() Int32 {
+ return Int32(cast(s).Clone())
+}
+
+// Difference returns a set of objects that are not in s2.
// For example:
// s1 = {a1, a2, a3}
// s2 = {a1, a2, a4, a5}
// s1.Difference(s2) = {a3}
// s2.Difference(s1) = {a4, a5}
-func (s Int32) Difference(s2 Int32) Int32 {
- result := NewInt32()
- for key := range s {
- if !s2.Has(key) {
- result.Insert(key)
- }
- }
- return result
+func (s1 Int32) Difference(s2 Int32) Int32 {
+ return Int32(cast(s1).Difference(cast(s2)))
+}
+
+// SymmetricDifference returns a set of elements which are in either of the sets, but not in their intersection.
+// For example:
+// s1 = {a1, a2, a3}
+// s2 = {a1, a2, a4, a5}
+// s1.SymmetricDifference(s2) = {a3, a4, a5}
+// s2.SymmetricDifference(s1) = {a3, a4, a5}
+func (s1 Int32) SymmetricDifference(s2 Int32) Int32 {
+ return Int32(cast(s1).SymmetricDifference(cast(s2)))
}
// Union returns a new set which includes items in either s1 or s2.
@@ -110,14 +92,7 @@ func (s Int32) Difference(s2 Int32) Int32 {
// s1.Union(s2) = {a1, a2, a3, a4}
// s2.Union(s1) = {a1, a2, a3, a4}
func (s1 Int32) Union(s2 Int32) Int32 {
- result := NewInt32()
- for key := range s1 {
- result.Insert(key)
- }
- for key := range s2 {
- result.Insert(key)
- }
- return result
+ return Int32(cast(s1).Union(cast(s2)))
}
// Intersection returns a new set which includes the item in BOTH s1 and s2
@@ -126,80 +101,37 @@ func (s1 Int32) Union(s2 Int32) Int32 {
// s2 = {a2, a3}
// s1.Intersection(s2) = {a2}
func (s1 Int32) Intersection(s2 Int32) Int32 {
- var walk, other Int32
- result := NewInt32()
- if s1.Len() < s2.Len() {
- walk = s1
- other = s2
- } else {
- walk = s2
- other = s1
- }
- for key := range walk {
- if other.Has(key) {
- result.Insert(key)
- }
- }
- return result
+ return Int32(cast(s1).Intersection(cast(s2)))
}
// IsSuperset returns true if and only if s1 is a superset of s2.
func (s1 Int32) IsSuperset(s2 Int32) bool {
- for item := range s2 {
- if !s1.Has(item) {
- return false
- }
- }
- return true
+ return cast(s1).IsSuperset(cast(s2))
}
// Equal returns true if and only if s1 is equal (as a set) to s2.
// Two sets are equal if their membership is identical.
// (In practice, this means same elements, order doesn't matter)
func (s1 Int32) Equal(s2 Int32) bool {
- return len(s1) == len(s2) && s1.IsSuperset(s2)
+ return cast(s1).Equal(cast(s2))
}
-type sortableSliceOfInt32 []int32
-
-func (s sortableSliceOfInt32) Len() int { return len(s) }
-func (s sortableSliceOfInt32) Less(i, j int) bool { return lessInt32(s[i], s[j]) }
-func (s sortableSliceOfInt32) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-
// List returns the contents as a sorted int32 slice.
func (s Int32) List() []int32 {
- res := make(sortableSliceOfInt32, 0, len(s))
- for key := range s {
- res = append(res, key)
- }
- sort.Sort(res)
- return []int32(res)
+ return List(cast(s))
}
// UnsortedList returns the slice with contents in random order.
func (s Int32) UnsortedList() []int32 {
- res := make([]int32, 0, len(s))
- for key := range s {
- res = append(res, key)
- }
- return res
+ return cast(s).UnsortedList()
}
-// Returns a single element from the set.
+// PopAny returns a single element from the set.
func (s Int32) PopAny() (int32, bool) {
- for key := range s {
- s.Delete(key)
- return key, true
- }
- var zeroValue int32
- return zeroValue, false
+ return cast(s).PopAny()
}
// Len returns the size of the set.
func (s Int32) Len() int {
return len(s)
}
-
-func lessInt32(lhs, rhs int32) bool {
- return lhs < rhs
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/sets/int64.go b/vendor/k8s.io/apimachinery/pkg/util/sets/int64.go
index b375a1b06..bf3eb3ffa 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/sets/int64.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/sets/int64.go
@@ -1,5 +1,5 @@
/*
-Copyright The Kubernetes Authors.
+Copyright 2022 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -14,93 +14,75 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-// Code generated by set-gen. DO NOT EDIT.
-
package sets
-import (
- "reflect"
- "sort"
-)
-
-// sets.Int64 is a set of int64s, implemented via map[int64]struct{} for minimal memory consumption.
+// Int64 is a set of int64s, implemented via map[int64]struct{} for minimal memory consumption.
+//
+// Deprecated: use generic Set instead.
+// new ways:
+// s1 := Set[int64]{}
+// s2 := New[int64]()
type Int64 map[int64]Empty
// NewInt64 creates a Int64 from a list of values.
func NewInt64(items ...int64) Int64 {
- ss := Int64{}
- ss.Insert(items...)
- return ss
+ return Int64(New[int64](items...))
}
// Int64KeySet creates a Int64 from a keys of a map[int64](? extends interface{}).
// If the value passed in is not actually a map, this will panic.
-func Int64KeySet(theMap interface{}) Int64 {
- v := reflect.ValueOf(theMap)
- ret := Int64{}
-
- for _, keyValue := range v.MapKeys() {
- ret.Insert(keyValue.Interface().(int64))
- }
- return ret
+func Int64KeySet[T any](theMap map[int64]T) Int64 {
+ return Int64(KeySet(theMap))
}
// Insert adds items to the set.
func (s Int64) Insert(items ...int64) Int64 {
- for _, item := range items {
- s[item] = Empty{}
- }
- return s
+ return Int64(cast(s).Insert(items...))
}
// Delete removes all items from the set.
func (s Int64) Delete(items ...int64) Int64 {
- for _, item := range items {
- delete(s, item)
- }
- return s
+ return Int64(cast(s).Delete(items...))
}
// Has returns true if and only if item is contained in the set.
func (s Int64) Has(item int64) bool {
- _, contained := s[item]
- return contained
+ return cast(s).Has(item)
}
// HasAll returns true if and only if all items are contained in the set.
func (s Int64) HasAll(items ...int64) bool {
- for _, item := range items {
- if !s.Has(item) {
- return false
- }
- }
- return true
+ return cast(s).HasAll(items...)
}
// HasAny returns true if any items are contained in the set.
func (s Int64) HasAny(items ...int64) bool {
- for _, item := range items {
- if s.Has(item) {
- return true
- }
- }
- return false
+ return cast(s).HasAny(items...)
}
-// Difference returns a set of objects that are not in s2
+// Clone returns a new set which is a copy of the current set.
+func (s Int64) Clone() Int64 {
+ return Int64(cast(s).Clone())
+}
+
+// Difference returns a set of objects that are not in s2.
// For example:
// s1 = {a1, a2, a3}
// s2 = {a1, a2, a4, a5}
// s1.Difference(s2) = {a3}
// s2.Difference(s1) = {a4, a5}
-func (s Int64) Difference(s2 Int64) Int64 {
- result := NewInt64()
- for key := range s {
- if !s2.Has(key) {
- result.Insert(key)
- }
- }
- return result
+func (s1 Int64) Difference(s2 Int64) Int64 {
+ return Int64(cast(s1).Difference(cast(s2)))
+}
+
+// SymmetricDifference returns a set of elements which are in either of the sets, but not in their intersection.
+// For example:
+// s1 = {a1, a2, a3}
+// s2 = {a1, a2, a4, a5}
+// s1.SymmetricDifference(s2) = {a3, a4, a5}
+// s2.SymmetricDifference(s1) = {a3, a4, a5}
+func (s1 Int64) SymmetricDifference(s2 Int64) Int64 {
+ return Int64(cast(s1).SymmetricDifference(cast(s2)))
}
// Union returns a new set which includes items in either s1 or s2.
@@ -110,14 +92,7 @@ func (s Int64) Difference(s2 Int64) Int64 {
// s1.Union(s2) = {a1, a2, a3, a4}
// s2.Union(s1) = {a1, a2, a3, a4}
func (s1 Int64) Union(s2 Int64) Int64 {
- result := NewInt64()
- for key := range s1 {
- result.Insert(key)
- }
- for key := range s2 {
- result.Insert(key)
- }
- return result
+ return Int64(cast(s1).Union(cast(s2)))
}
// Intersection returns a new set which includes the item in BOTH s1 and s2
@@ -126,80 +101,37 @@ func (s1 Int64) Union(s2 Int64) Int64 {
// s2 = {a2, a3}
// s1.Intersection(s2) = {a2}
func (s1 Int64) Intersection(s2 Int64) Int64 {
- var walk, other Int64
- result := NewInt64()
- if s1.Len() < s2.Len() {
- walk = s1
- other = s2
- } else {
- walk = s2
- other = s1
- }
- for key := range walk {
- if other.Has(key) {
- result.Insert(key)
- }
- }
- return result
+ return Int64(cast(s1).Intersection(cast(s2)))
}
// IsSuperset returns true if and only if s1 is a superset of s2.
func (s1 Int64) IsSuperset(s2 Int64) bool {
- for item := range s2 {
- if !s1.Has(item) {
- return false
- }
- }
- return true
+ return cast(s1).IsSuperset(cast(s2))
}
// Equal returns true if and only if s1 is equal (as a set) to s2.
// Two sets are equal if their membership is identical.
// (In practice, this means same elements, order doesn't matter)
func (s1 Int64) Equal(s2 Int64) bool {
- return len(s1) == len(s2) && s1.IsSuperset(s2)
+ return cast(s1).Equal(cast(s2))
}
-type sortableSliceOfInt64 []int64
-
-func (s sortableSliceOfInt64) Len() int { return len(s) }
-func (s sortableSliceOfInt64) Less(i, j int) bool { return lessInt64(s[i], s[j]) }
-func (s sortableSliceOfInt64) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-
// List returns the contents as a sorted int64 slice.
func (s Int64) List() []int64 {
- res := make(sortableSliceOfInt64, 0, len(s))
- for key := range s {
- res = append(res, key)
- }
- sort.Sort(res)
- return []int64(res)
+ return List(cast(s))
}
// UnsortedList returns the slice with contents in random order.
func (s Int64) UnsortedList() []int64 {
- res := make([]int64, 0, len(s))
- for key := range s {
- res = append(res, key)
- }
- return res
+ return cast(s).UnsortedList()
}
-// Returns a single element from the set.
+// PopAny returns a single element from the set.
func (s Int64) PopAny() (int64, bool) {
- for key := range s {
- s.Delete(key)
- return key, true
- }
- var zeroValue int64
- return zeroValue, false
+ return cast(s).PopAny()
}
// Len returns the size of the set.
func (s Int64) Len() int {
return len(s)
}
-
-func lessInt64(lhs, rhs int64) bool {
- return lhs < rhs
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/sets/set.go b/vendor/k8s.io/apimachinery/pkg/util/sets/set.go
new file mode 100644
index 000000000..cd961c8c5
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/sets/set.go
@@ -0,0 +1,236 @@
+/*
+Copyright 2022 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package sets
+
+import (
+ "cmp"
+ "sort"
+)
+
+// Set is a set of the same type elements, implemented via map[comparable]struct{} for minimal memory consumption.
+type Set[T comparable] map[T]Empty
+
+// cast transforms specified set to generic Set[T].
+func cast[T comparable](s map[T]Empty) Set[T] { return s }
+
+// New creates a Set from a list of values.
+// NOTE: type param must be explicitly instantiated if given items are empty.
+func New[T comparable](items ...T) Set[T] {
+ ss := make(Set[T], len(items))
+ ss.Insert(items...)
+ return ss
+}
+
+// KeySet creates a Set from a keys of a map[comparable](? extends interface{}).
+// If the value passed in is not actually a map, this will panic.
+func KeySet[T comparable, V any](theMap map[T]V) Set[T] {
+ ret := make(Set[T], len(theMap))
+ for keyValue := range theMap {
+ ret.Insert(keyValue)
+ }
+ return ret
+}
+
+// Insert adds items to the set.
+func (s Set[T]) Insert(items ...T) Set[T] {
+ for _, item := range items {
+ s[item] = Empty{}
+ }
+ return s
+}
+
+func Insert[T comparable](set Set[T], items ...T) Set[T] {
+ return set.Insert(items...)
+}
+
+// Delete removes all items from the set.
+func (s Set[T]) Delete(items ...T) Set[T] {
+ for _, item := range items {
+ delete(s, item)
+ }
+ return s
+}
+
+// Clear empties the set.
+// It is preferable to replace the set with a newly constructed set,
+// but not all callers can do that (when there are other references to the map).
+func (s Set[T]) Clear() Set[T] {
+ clear(s)
+ return s
+}
+
+// Has returns true if and only if item is contained in the set.
+func (s Set[T]) Has(item T) bool {
+ _, contained := s[item]
+ return contained
+}
+
+// HasAll returns true if and only if all items are contained in the set.
+func (s Set[T]) HasAll(items ...T) bool {
+ for _, item := range items {
+ if !s.Has(item) {
+ return false
+ }
+ }
+ return true
+}
+
+// HasAny returns true if any items are contained in the set.
+func (s Set[T]) HasAny(items ...T) bool {
+ for _, item := range items {
+ if s.Has(item) {
+ return true
+ }
+ }
+ return false
+}
+
+// Clone returns a new set which is a copy of the current set.
+func (s Set[T]) Clone() Set[T] {
+ result := make(Set[T], len(s))
+ for key := range s {
+ result.Insert(key)
+ }
+ return result
+}
+
+// Difference returns a set of objects that are not in s2.
+// For example:
+// s1 = {a1, a2, a3}
+// s2 = {a1, a2, a4, a5}
+// s1.Difference(s2) = {a3}
+// s2.Difference(s1) = {a4, a5}
+func (s1 Set[T]) Difference(s2 Set[T]) Set[T] {
+ result := New[T]()
+ for key := range s1 {
+ if !s2.Has(key) {
+ result.Insert(key)
+ }
+ }
+ return result
+}
+
+// SymmetricDifference returns a set of elements which are in either of the sets, but not in their intersection.
+// For example:
+// s1 = {a1, a2, a3}
+// s2 = {a1, a2, a4, a5}
+// s1.SymmetricDifference(s2) = {a3, a4, a5}
+// s2.SymmetricDifference(s1) = {a3, a4, a5}
+func (s1 Set[T]) SymmetricDifference(s2 Set[T]) Set[T] {
+ return s1.Difference(s2).Union(s2.Difference(s1))
+}
+
+// Union returns a new set which includes items in either s1 or s2.
+// For example:
+// s1 = {a1, a2}
+// s2 = {a3, a4}
+// s1.Union(s2) = {a1, a2, a3, a4}
+// s2.Union(s1) = {a1, a2, a3, a4}
+func (s1 Set[T]) Union(s2 Set[T]) Set[T] {
+ result := s1.Clone()
+ for key := range s2 {
+ result.Insert(key)
+ }
+ return result
+}
+
+// Intersection returns a new set which includes the item in BOTH s1 and s2
+// For example:
+// s1 = {a1, a2}
+// s2 = {a2, a3}
+// s1.Intersection(s2) = {a2}
+func (s1 Set[T]) Intersection(s2 Set[T]) Set[T] {
+ var walk, other Set[T]
+ result := New[T]()
+ if s1.Len() < s2.Len() {
+ walk = s1
+ other = s2
+ } else {
+ walk = s2
+ other = s1
+ }
+ for key := range walk {
+ if other.Has(key) {
+ result.Insert(key)
+ }
+ }
+ return result
+}
+
+// IsSuperset returns true if and only if s1 is a superset of s2.
+func (s1 Set[T]) IsSuperset(s2 Set[T]) bool {
+ for item := range s2 {
+ if !s1.Has(item) {
+ return false
+ }
+ }
+ return true
+}
+
+// Equal returns true if and only if s1 is equal (as a set) to s2.
+// Two sets are equal if their membership is identical.
+// (In practice, this means same elements, order doesn't matter)
+func (s1 Set[T]) Equal(s2 Set[T]) bool {
+ return len(s1) == len(s2) && s1.IsSuperset(s2)
+}
+
+type sortableSliceOfGeneric[T cmp.Ordered] []T
+
+func (g sortableSliceOfGeneric[T]) Len() int { return len(g) }
+func (g sortableSliceOfGeneric[T]) Less(i, j int) bool { return less[T](g[i], g[j]) }
+func (g sortableSliceOfGeneric[T]) Swap(i, j int) { g[i], g[j] = g[j], g[i] }
+
+// List returns the contents as a sorted T slice.
+//
+// This is a separate function and not a method because not all types supported
+// by Generic are ordered and only those can be sorted.
+func List[T cmp.Ordered](s Set[T]) []T {
+ res := make(sortableSliceOfGeneric[T], 0, len(s))
+ for key := range s {
+ res = append(res, key)
+ }
+ sort.Sort(res)
+ return res
+}
+
+// UnsortedList returns the slice with contents in random order.
+func (s Set[T]) UnsortedList() []T {
+ res := make([]T, 0, len(s))
+ for key := range s {
+ res = append(res, key)
+ }
+ return res
+}
+
+// PopAny returns a single element from the set.
+func (s Set[T]) PopAny() (T, bool) {
+ for key := range s {
+ s.Delete(key)
+ return key, true
+ }
+ var zeroValue T
+ return zeroValue, false
+}
+
+// Len returns the size of the set.
+func (s Set[T]) Len() int {
+ return len(s)
+}
+
+func less[T cmp.Ordered](lhs, rhs T) bool {
+ return lhs < rhs
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/sets/string.go b/vendor/k8s.io/apimachinery/pkg/util/sets/string.go
index e6f37db88..1dab6d13c 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/sets/string.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/sets/string.go
@@ -1,5 +1,5 @@
/*
-Copyright The Kubernetes Authors.
+Copyright 2022 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -14,93 +14,75 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-// Code generated by set-gen. DO NOT EDIT.
-
package sets
-import (
- "reflect"
- "sort"
-)
-
-// sets.String is a set of strings, implemented via map[string]struct{} for minimal memory consumption.
+// String is a set of strings, implemented via map[string]struct{} for minimal memory consumption.
+//
+// Deprecated: use generic Set instead.
+// new ways:
+// s1 := Set[string]{}
+// s2 := New[string]()
type String map[string]Empty
// NewString creates a String from a list of values.
func NewString(items ...string) String {
- ss := String{}
- ss.Insert(items...)
- return ss
+ return String(New[string](items...))
}
// StringKeySet creates a String from a keys of a map[string](? extends interface{}).
// If the value passed in is not actually a map, this will panic.
-func StringKeySet(theMap interface{}) String {
- v := reflect.ValueOf(theMap)
- ret := String{}
-
- for _, keyValue := range v.MapKeys() {
- ret.Insert(keyValue.Interface().(string))
- }
- return ret
+func StringKeySet[T any](theMap map[string]T) String {
+ return String(KeySet(theMap))
}
// Insert adds items to the set.
func (s String) Insert(items ...string) String {
- for _, item := range items {
- s[item] = Empty{}
- }
- return s
+ return String(cast(s).Insert(items...))
}
// Delete removes all items from the set.
func (s String) Delete(items ...string) String {
- for _, item := range items {
- delete(s, item)
- }
- return s
+ return String(cast(s).Delete(items...))
}
// Has returns true if and only if item is contained in the set.
func (s String) Has(item string) bool {
- _, contained := s[item]
- return contained
+ return cast(s).Has(item)
}
// HasAll returns true if and only if all items are contained in the set.
func (s String) HasAll(items ...string) bool {
- for _, item := range items {
- if !s.Has(item) {
- return false
- }
- }
- return true
+ return cast(s).HasAll(items...)
}
// HasAny returns true if any items are contained in the set.
func (s String) HasAny(items ...string) bool {
- for _, item := range items {
- if s.Has(item) {
- return true
- }
- }
- return false
+ return cast(s).HasAny(items...)
}
-// Difference returns a set of objects that are not in s2
+// Clone returns a new set which is a copy of the current set.
+func (s String) Clone() String {
+ return String(cast(s).Clone())
+}
+
+// Difference returns a set of objects that are not in s2.
// For example:
// s1 = {a1, a2, a3}
// s2 = {a1, a2, a4, a5}
// s1.Difference(s2) = {a3}
// s2.Difference(s1) = {a4, a5}
-func (s String) Difference(s2 String) String {
- result := NewString()
- for key := range s {
- if !s2.Has(key) {
- result.Insert(key)
- }
- }
- return result
+func (s1 String) Difference(s2 String) String {
+ return String(cast(s1).Difference(cast(s2)))
+}
+
+// SymmetricDifference returns a set of elements which are in either of the sets, but not in their intersection.
+// For example:
+// s1 = {a1, a2, a3}
+// s2 = {a1, a2, a4, a5}
+// s1.SymmetricDifference(s2) = {a3, a4, a5}
+// s2.SymmetricDifference(s1) = {a3, a4, a5}
+func (s1 String) SymmetricDifference(s2 String) String {
+ return String(cast(s1).SymmetricDifference(cast(s2)))
}
// Union returns a new set which includes items in either s1 or s2.
@@ -110,14 +92,7 @@ func (s String) Difference(s2 String) String {
// s1.Union(s2) = {a1, a2, a3, a4}
// s2.Union(s1) = {a1, a2, a3, a4}
func (s1 String) Union(s2 String) String {
- result := NewString()
- for key := range s1 {
- result.Insert(key)
- }
- for key := range s2 {
- result.Insert(key)
- }
- return result
+ return String(cast(s1).Union(cast(s2)))
}
// Intersection returns a new set which includes the item in BOTH s1 and s2
@@ -126,80 +101,37 @@ func (s1 String) Union(s2 String) String {
// s2 = {a2, a3}
// s1.Intersection(s2) = {a2}
func (s1 String) Intersection(s2 String) String {
- var walk, other String
- result := NewString()
- if s1.Len() < s2.Len() {
- walk = s1
- other = s2
- } else {
- walk = s2
- other = s1
- }
- for key := range walk {
- if other.Has(key) {
- result.Insert(key)
- }
- }
- return result
+ return String(cast(s1).Intersection(cast(s2)))
}
// IsSuperset returns true if and only if s1 is a superset of s2.
func (s1 String) IsSuperset(s2 String) bool {
- for item := range s2 {
- if !s1.Has(item) {
- return false
- }
- }
- return true
+ return cast(s1).IsSuperset(cast(s2))
}
// Equal returns true if and only if s1 is equal (as a set) to s2.
// Two sets are equal if their membership is identical.
// (In practice, this means same elements, order doesn't matter)
func (s1 String) Equal(s2 String) bool {
- return len(s1) == len(s2) && s1.IsSuperset(s2)
+ return cast(s1).Equal(cast(s2))
}
-type sortableSliceOfString []string
-
-func (s sortableSliceOfString) Len() int { return len(s) }
-func (s sortableSliceOfString) Less(i, j int) bool { return lessString(s[i], s[j]) }
-func (s sortableSliceOfString) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-
// List returns the contents as a sorted string slice.
func (s String) List() []string {
- res := make(sortableSliceOfString, 0, len(s))
- for key := range s {
- res = append(res, key)
- }
- sort.Sort(res)
- return []string(res)
+ return List(cast(s))
}
// UnsortedList returns the slice with contents in random order.
func (s String) UnsortedList() []string {
- res := make([]string, 0, len(s))
- for key := range s {
- res = append(res, key)
- }
- return res
+ return cast(s).UnsortedList()
}
-// Returns a single element from the set.
+// PopAny returns a single element from the set.
func (s String) PopAny() (string, bool) {
- for key := range s {
- s.Delete(key)
- return key, true
- }
- var zeroValue string
- return zeroValue, false
+ return cast(s).PopAny()
}
// Len returns the size of the set.
func (s String) Len() int {
return len(s)
}
-
-func lessString(lhs, rhs string) bool {
- return lhs < rhs
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/OWNERS b/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/OWNERS
index cfee199fa..73244449f 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/OWNERS
+++ b/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/OWNERS
@@ -1,8 +1,9 @@
# See the OWNERS docs at https://go.k8s.io/owners
approvers:
-- pwittrock
-- mengqiy
+ - apelisse
+ - pwittrock
reviewers:
-- mengqiy
-- apelisse
+ - apelisse
+emeritus_approvers:
+ - mengqiy
diff --git a/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/meta.go b/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/meta.go
index d49a56536..85b0cfc07 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/meta.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/meta.go
@@ -20,12 +20,17 @@ import (
"errors"
"fmt"
"reflect"
+ "strings"
"k8s.io/apimachinery/pkg/util/mergepatch"
forkedjson "k8s.io/apimachinery/third_party/forked/golang/json"
openapi "k8s.io/kube-openapi/pkg/util/proto"
+ "k8s.io/kube-openapi/pkg/validation/spec"
)
+const patchMergeKey = "x-kubernetes-patch-merge-key"
+const patchStrategy = "x-kubernetes-patch-strategy"
+
type PatchMeta struct {
patchStrategies []string
patchMergeKey string
@@ -105,7 +110,7 @@ func (s PatchMetaFromStruct) LookupPatchMetadataForSlice(key string) (LookupPatc
// If the underlying element is neither an array nor a slice, the pointer is pointing to a slice,
// e.g. https://github.com/kubernetes/kubernetes/blob/bc22e206c79282487ea0bf5696d5ccec7e839a76/staging/src/k8s.io/apimachinery/pkg/util/strategicpatch/patch_test.go#L2782-L2822
// If the underlying element is either an array or a slice, return its element type.
- case reflect.Ptr:
+ case reflect.Pointer:
t = t.Elem()
if t.Kind() == reflect.Array || t.Kind() == reflect.Slice {
t = t.Elem()
@@ -129,7 +134,7 @@ func getTagStructType(dataStruct interface{}) (reflect.Type, error) {
t := reflect.TypeOf(dataStruct)
// Get the underlying type for pointers
- if t.Kind() == reflect.Ptr {
+ if t.Kind() == reflect.Pointer {
t = t.Elem()
}
@@ -148,6 +153,90 @@ func GetTagStructTypeOrDie(dataStruct interface{}) reflect.Type {
return t
}
+type PatchMetaFromOpenAPIV3 struct {
+ // SchemaList is required to resolve OpenAPI V3 references
+ SchemaList map[string]*spec.Schema
+ Schema *spec.Schema
+}
+
+func (s PatchMetaFromOpenAPIV3) traverse(key string) (PatchMetaFromOpenAPIV3, error) {
+ if s.Schema == nil {
+ return PatchMetaFromOpenAPIV3{}, nil
+ }
+ if len(s.Schema.Properties) == 0 {
+ return PatchMetaFromOpenAPIV3{}, fmt.Errorf("unable to find api field \"%s\"", key)
+ }
+ subschema, ok := s.Schema.Properties[key]
+ if !ok {
+ return PatchMetaFromOpenAPIV3{}, fmt.Errorf("unable to find api field \"%s\"", key)
+ }
+ return PatchMetaFromOpenAPIV3{SchemaList: s.SchemaList, Schema: &subschema}, nil
+}
+
+func resolve(l *PatchMetaFromOpenAPIV3) error {
+ if len(l.Schema.AllOf) > 0 {
+ l.Schema = &l.Schema.AllOf[0]
+ }
+ if refString := l.Schema.Ref.String(); refString != "" {
+ str := strings.TrimPrefix(refString, "#/components/schemas/")
+ sch, ok := l.SchemaList[str]
+ if ok {
+ l.Schema = sch
+ } else {
+ return fmt.Errorf("unable to resolve %s in OpenAPI V3", refString)
+ }
+ }
+ return nil
+}
+
+func (s PatchMetaFromOpenAPIV3) LookupPatchMetadataForStruct(key string) (LookupPatchMeta, PatchMeta, error) {
+ l, err := s.traverse(key)
+ if err != nil {
+ return l, PatchMeta{}, err
+ }
+ p := PatchMeta{}
+ f, ok := l.Schema.Extensions[patchMergeKey]
+ if ok {
+ p.SetPatchMergeKey(f.(string))
+ }
+ g, ok := l.Schema.Extensions[patchStrategy]
+ if ok {
+ p.SetPatchStrategies(strings.Split(g.(string), ","))
+ }
+
+ err = resolve(&l)
+ return l, p, err
+}
+
+func (s PatchMetaFromOpenAPIV3) LookupPatchMetadataForSlice(key string) (LookupPatchMeta, PatchMeta, error) {
+ l, err := s.traverse(key)
+ if err != nil {
+ return l, PatchMeta{}, err
+ }
+ p := PatchMeta{}
+ f, ok := l.Schema.Extensions[patchMergeKey]
+ if ok {
+ p.SetPatchMergeKey(f.(string))
+ }
+ g, ok := l.Schema.Extensions[patchStrategy]
+ if ok {
+ p.SetPatchStrategies(strings.Split(g.(string), ","))
+ }
+ if l.Schema.Items != nil {
+ l.Schema = l.Schema.Items.Schema
+ }
+ err = resolve(&l)
+ return l, p, err
+}
+
+func (s PatchMetaFromOpenAPIV3) Name() string {
+ schema := s.Schema
+ if len(schema.Type) > 0 {
+ return strings.Join(schema.Type, "")
+ }
+ return "Struct"
+}
+
type PatchMetaFromOpenAPI struct {
Schema openapi.Schema
}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go b/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go
index 1aedaa156..6825a808e 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go
@@ -1106,7 +1106,7 @@ func applyRetainKeysDirective(original, patch map[string]interface{}, options Me
// Then, sort them by the relative order in setElementOrder, patch list and live list.
// The precedence is $setElementOrder > order in patch list > order in live list.
// This function will delete the item after merging it to prevent process it again in the future.
-// Ref: https://git.k8s.io/community/contributors/design-proposals/cli/preserve-order-in-strategic-merge-patch.md
+// Ref: https://git.k8s.io/design-proposals-archive/cli/preserve-order-in-strategic-merge-patch.md
func mergePatchIntoOriginal(original, patch map[string]interface{}, schema LookupPatchMeta, mergeOptions MergeOptions) error {
for key, patchV := range patch {
// Do nothing if there is no ordering directive
@@ -1182,7 +1182,13 @@ func mergePatchIntoOriginal(original, patch map[string]interface{}, schema Looku
merged = originalFieldValue
case !foundOriginal && foundPatch:
// list was added
- merged = patchFieldValue
+ v, keep := removeDirectives(patchFieldValue)
+ if !keep {
+ // Shouldn't be possible since patchFieldValue is a slice
+ continue
+ }
+
+ merged = v.([]interface{})
case foundOriginal && foundPatch:
merged, err = mergeSliceHandler(originalList, patchList, subschema,
patchStrategy, patchMeta.GetPatchMergeKey(), false, mergeOptions)
@@ -1270,6 +1276,42 @@ func partitionMapsByPresentInList(original, partitionBy []interface{}, mergeKey
return patch, serverOnly, nil
}
+// Removes directives from an object and returns value to use instead and whether
+// or not the field/index should even be kept
+// May modify input
+func removeDirectives(obj interface{}) (interface{}, bool) {
+ if obj == nil {
+ return obj, true
+ } else if typedV, ok := obj.(map[string]interface{}); ok {
+ if _, hasDirective := typedV[directiveMarker]; hasDirective {
+ return nil, false
+ }
+
+ for k, v := range typedV {
+ var keep bool
+ typedV[k], keep = removeDirectives(v)
+ if !keep {
+ delete(typedV, k)
+ }
+ }
+ return typedV, true
+ } else if typedV, ok := obj.([]interface{}); ok {
+ var res []interface{}
+ if typedV != nil {
+ // Make sure res is non-nil if patch is non-nil
+ res = []interface{}{}
+ }
+ for _, v := range typedV {
+ if newV, keep := removeDirectives(v); keep {
+ res = append(res, newV)
+ }
+ }
+ return res, true
+ } else {
+ return obj, true
+ }
+}
+
// Merge fields from a patch map into the original map. Note: This may modify
// both the original map and the patch because getting a deep copy of a map in
// golang is highly non-trivial.
@@ -1319,6 +1361,10 @@ func mergeMap(original, patch map[string]interface{}, schema LookupPatchMeta, me
// original. Otherwise, check if we want to preserve it or skip it.
// Preserving the null value is useful when we want to send an explicit
// delete to the API server.
+ // In some cases, this may lead to inconsistent behavior with create.
+ // ref: https://github.com/kubernetes/kubernetes/issues/123304
+ // To avoid breaking compatibility,
+ // we made corresponding changes on the client side to ensure that the create and patch behaviors are idempotent.
if patchV == nil {
delete(original, k)
if mergeOptions.IgnoreUnmatchedNulls {
@@ -1330,7 +1376,13 @@ func mergeMap(original, patch map[string]interface{}, schema LookupPatchMeta, me
if !ok {
if !isDeleteList {
// If it's not in the original document, just take the patch value.
- original[k] = patchV
+ if mergeOptions.IgnoreUnmatchedNulls {
+ discardNullValuesFromPatch(patchV)
+ }
+ original[k], ok = removeDirectives(patchV)
+ if !ok {
+ delete(original, k)
+ }
}
continue
}
@@ -1339,7 +1391,13 @@ func mergeMap(original, patch map[string]interface{}, schema LookupPatchMeta, me
patchType := reflect.TypeOf(patchV)
if originalType != patchType {
if !isDeleteList {
- original[k] = patchV
+ if mergeOptions.IgnoreUnmatchedNulls {
+ discardNullValuesFromPatch(patchV)
+ }
+ original[k], ok = removeDirectives(patchV)
+ if !ok {
+ delete(original, k)
+ }
}
continue
}
@@ -1366,7 +1424,11 @@ func mergeMap(original, patch map[string]interface{}, schema LookupPatchMeta, me
}
original[k], err = mergeSliceHandler(original[k], patchV, subschema, patchStrategy, patchMeta.GetPatchMergeKey(), isDeleteList, mergeOptions)
default:
- original[k] = patchV
+ original[k], ok = removeDirectives(patchV)
+ if !ok {
+ // if patchV itself is a directive, then don't keep it
+ delete(original, k)
+ }
}
if err != nil {
return nil, err
@@ -1375,6 +1437,25 @@ func mergeMap(original, patch map[string]interface{}, schema LookupPatchMeta, me
return original, nil
}
+// discardNullValuesFromPatch discards all null property values from patch.
+// It traverses all slices and map types.
+func discardNullValuesFromPatch(patchV interface{}) {
+ switch patchV := patchV.(type) {
+ case map[string]interface{}:
+ for k, v := range patchV {
+ if v == nil {
+ delete(patchV, k)
+ } else {
+ discardNullValuesFromPatch(v)
+ }
+ }
+ case []interface{}:
+ for _, v := range patchV {
+ discardNullValuesFromPatch(v)
+ }
+ }
+}
+
// mergeMapHandler handles how to merge `patchV` whose key is `key` with `original` respecting
// fieldPatchStrategy and mergeOptions.
func mergeMapHandler(original, patch interface{}, schema LookupPatchMeta,
@@ -1400,7 +1481,8 @@ func mergeSliceHandler(original, patch interface{}, schema LookupPatchMeta,
return nil, err
}
- if fieldPatchStrategy == mergeDirective {
+ // Delete lists are handled the same way regardless of what the field's patch strategy is
+ if fieldPatchStrategy == mergeDirective || isDeleteList {
return mergeSlice(typedOriginal, typedPatch, schema, fieldPatchMergeKey, mergeOptions, isDeleteList)
} else {
return typedPatch, nil
diff --git a/vendor/k8s.io/apimachinery/pkg/util/validation/OWNERS b/vendor/k8s.io/apimachinery/pkg/util/validation/OWNERS
new file mode 100644
index 000000000..402373247
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/validation/OWNERS
@@ -0,0 +1,11 @@
+# See the OWNERS docs at https://go.k8s.io/owners
+
+# Disable inheritance as this is an api owners file
+options:
+ no_parent_owners: true
+approvers:
+ - api-approvers
+reviewers:
+ - api-reviewers
+labels:
+ - kind/api-change
diff --git a/vendor/k8s.io/apimachinery/pkg/util/validation/field/errors.go b/vendor/k8s.io/apimachinery/pkg/util/validation/field/errors.go
index 2ed368f56..bc387d011 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/validation/field/errors.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/validation/field/errors.go
@@ -42,19 +42,31 @@ func (v *Error) Error() string {
return fmt.Sprintf("%s: %s", v.Field, v.ErrorBody())
}
+type OmitValueType struct{}
+
+var omitValue = OmitValueType{}
+
// ErrorBody returns the error message without the field name. This is useful
// for building nice-looking higher-level error reporting.
func (v *Error) ErrorBody() string {
var s string
- switch v.Type {
- case ErrorTypeRequired, ErrorTypeForbidden, ErrorTypeTooLong, ErrorTypeInternal:
+ switch {
+ case v.Type == ErrorTypeRequired:
+ s = v.Type.String()
+ case v.Type == ErrorTypeForbidden:
+ s = v.Type.String()
+ case v.Type == ErrorTypeTooLong:
+ s = v.Type.String()
+ case v.Type == ErrorTypeInternal:
+ s = v.Type.String()
+ case v.BadValue == omitValue:
s = v.Type.String()
default:
value := v.BadValue
valueType := reflect.TypeOf(value)
if value == nil || valueType == nil {
value = "null"
- } else if valueType.Kind() == reflect.Ptr {
+ } else if valueType.Kind() == reflect.Pointer {
if reflectValue := reflect.ValueOf(value); reflectValue.IsNil() {
value = "null"
} else {
@@ -123,6 +135,8 @@ const (
// ErrorTypeInternal is used to report other errors that are not related
// to user input. See InternalError().
ErrorTypeInternal ErrorType = "InternalError"
+ // ErrorTypeTypeInvalid is for the value did not match the schema type for that field
+ ErrorTypeTypeInvalid ErrorType = "FieldValueTypeInvalid"
)
// String converts a ErrorType into its corresponding canonical error message.
@@ -146,11 +160,18 @@ func (t ErrorType) String() string {
return "Too many"
case ErrorTypeInternal:
return "Internal error"
+ case ErrorTypeTypeInvalid:
+ return "Invalid value"
default:
panic(fmt.Sprintf("unrecognized validation error: %q", string(t)))
}
}
+// TypeInvalid returns a *Error indicating "type is invalid"
+func TypeInvalid(field *Path, value interface{}, detail string) *Error {
+ return &Error{ErrorTypeTypeInvalid, field.String(), value, detail}
+}
+
// NotFound returns a *Error indicating "value not found". This is
// used to report failure to find a requested value (e.g. looking up an ID).
func NotFound(field *Path, value interface{}) *Error {
@@ -179,12 +200,12 @@ func Invalid(field *Path, value interface{}, detail string) *Error {
// NotSupported returns a *Error indicating "unsupported value".
// This is used to report unknown values for enumerated fields (e.g. a list of
// valid values).
-func NotSupported(field *Path, value interface{}, validValues []string) *Error {
+func NotSupported[T ~string](field *Path, value interface{}, validValues []T) *Error {
detail := ""
if len(validValues) > 0 {
quotedValues := make([]string, len(validValues))
for i, v := range validValues {
- quotedValues[i] = strconv.Quote(v)
+ quotedValues[i] = strconv.Quote(fmt.Sprint(v))
}
detail = "supported values: " + strings.Join(quotedValues, ", ")
}
@@ -207,11 +228,40 @@ func TooLong(field *Path, value interface{}, maxLength int) *Error {
return &Error{ErrorTypeTooLong, field.String(), value, fmt.Sprintf("must have at most %d bytes", maxLength)}
}
+// TooLongMaxLength returns a *Error indicating "too long". This is used to
+// report that the given value is too long. This is similar to
+// Invalid, but the returned error will not include the too-long
+// value. If maxLength is negative, no max length will be included in the message.
+func TooLongMaxLength(field *Path, value interface{}, maxLength int) *Error {
+ var msg string
+ if maxLength >= 0 {
+ msg = fmt.Sprintf("may not be longer than %d", maxLength)
+ } else {
+ msg = "value is too long"
+ }
+ return &Error{ErrorTypeTooLong, field.String(), value, msg}
+}
+
// TooMany returns a *Error indicating "too many". This is used to
// report that a given list has too many items. This is similar to TooLong,
// but the returned error indicates quantity instead of length.
func TooMany(field *Path, actualQuantity, maxQuantity int) *Error {
- return &Error{ErrorTypeTooMany, field.String(), actualQuantity, fmt.Sprintf("must have at most %d items", maxQuantity)}
+ var msg string
+
+ if maxQuantity >= 0 {
+ msg = fmt.Sprintf("must have at most %d items", maxQuantity)
+ } else {
+ msg = "has too many items"
+ }
+
+ var actual interface{}
+ if actualQuantity >= 0 {
+ actual = actualQuantity
+ } else {
+ actual = omitValue
+ }
+
+ return &Error{ErrorTypeTooMany, field.String(), actual, msg}
}
// InternalError returns a *Error indicating "internal error". This is used
diff --git a/vendor/k8s.io/apimachinery/pkg/util/validation/validation.go b/vendor/k8s.io/apimachinery/pkg/util/validation/validation.go
index 83df4fb8d..b32644902 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/validation/validation.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/validation/validation.go
@@ -19,10 +19,9 @@ package validation
import (
"fmt"
"math"
- "net"
"regexp"
- "strconv"
"strings"
+ "unicode"
"k8s.io/apimachinery/pkg/util/validation/field"
netutils "k8s.io/utils/net"
@@ -191,7 +190,13 @@ func IsDNS1123Label(value string) []string {
errs = append(errs, MaxLenError(DNS1123LabelMaxLength))
}
if !dns1123LabelRegexp.MatchString(value) {
- errs = append(errs, RegexError(dns1123LabelErrMsg, dns1123LabelFmt, "my-name", "123-abc"))
+ if dns1123SubdomainRegexp.MatchString(value) {
+ // It was a valid subdomain and not a valid label. Since we
+ // already checked length, it must be dots.
+ errs = append(errs, "must not contain dots")
+ } else {
+ errs = append(errs, RegexError(dns1123LabelErrMsg, dns1123LabelFmt, "my-name", "123-abc"))
+ }
}
return errs
}
@@ -334,7 +339,7 @@ func IsValidPortName(port string) []string {
errs = append(errs, "must contain only alpha-numeric characters (a-z, 0-9), and hyphens (-)")
}
if !portNameOneLetterRegexp.MatchString(port) {
- errs = append(errs, "must contain at least one letter or number (a-z, 0-9)")
+ errs = append(errs, "must contain at least one letter (a-z)")
}
if strings.Contains(port, "--") {
errs = append(errs, "must not contain consecutive hyphens")
@@ -346,11 +351,12 @@ func IsValidPortName(port string) []string {
}
// IsValidIP tests that the argument is a valid IP address.
-func IsValidIP(value string) []string {
+func IsValidIP(fldPath *field.Path, value string) field.ErrorList {
+ var allErrors field.ErrorList
if netutils.ParseIPSloppy(value) == nil {
- return []string{"must be a valid IP address, (e.g. 10.9.8.7 or 2001:db8::ffff)"}
+ allErrors = append(allErrors, field.Invalid(fldPath, value, "must be a valid IP address, (e.g. 10.9.8.7 or 2001:db8::ffff)"))
}
- return nil
+ return allErrors
}
// IsValidIPv4Address tests that the argument is a valid IPv4 address.
@@ -373,6 +379,16 @@ func IsValidIPv6Address(fldPath *field.Path, value string) field.ErrorList {
return allErrors
}
+// IsValidCIDR tests that the argument is a valid CIDR value.
+func IsValidCIDR(fldPath *field.Path, value string) field.ErrorList {
+ var allErrors field.ErrorList
+ _, _, err := netutils.ParseCIDRSloppy(value)
+ if err != nil {
+ allErrors = append(allErrors, field.Invalid(fldPath, value, "must be a valid CIDR value, (e.g. 10.9.8.0/24 or 2001:db8::/64)"))
+ }
+ return allErrors
+}
+
const percentFmt string = "[0-9]+%"
const percentErrMsg string = "a valid percent string must be a numeric string followed by an ending '%'"
@@ -403,6 +419,9 @@ func IsHTTPHeaderName(value string) []string {
const envVarNameFmt = "[-._a-zA-Z][-._a-zA-Z0-9]*"
const envVarNameFmtErrMsg string = "a valid environment variable name must consist of alphabetic characters, digits, '_', '-', or '.', and must not start with a digit"
+// TODO(hirazawaui): Rename this when the RelaxedEnvironmentVariableValidation gate is removed.
+const relaxedEnvVarNameFmtErrMsg string = "a valid environment variable name must consist only of printable ASCII characters other than '='"
+
var envVarNameRegexp = regexp.MustCompile("^" + envVarNameFmt + "$")
// IsEnvVarName tests if a string is a valid environment variable name.
@@ -416,6 +435,24 @@ func IsEnvVarName(value string) []string {
return errs
}
+// IsRelaxedEnvVarName tests if a string is a valid environment variable name.
+func IsRelaxedEnvVarName(value string) []string {
+ var errs []string
+
+ if len(value) == 0 {
+ errs = append(errs, "environment variable name "+EmptyError())
+ }
+
+ for _, r := range value {
+ if r > unicode.MaxASCII || !unicode.IsPrint(r) || r == '=' {
+ errs = append(errs, relaxedEnvVarNameFmtErrMsg)
+ break
+ }
+ }
+
+ return errs
+}
+
const configMapKeyFmt = `[-._a-zA-Z0-9]+`
const configMapKeyErrMsg string = "a valid config key must consist of alphanumeric characters, '-', '_' or '.'"
@@ -487,18 +524,3 @@ func hasChDirPrefix(value string) []string {
}
return errs
}
-
-// IsValidSocketAddr checks that string represents a valid socket address
-// as defined in RFC 789. (e.g 0.0.0.0:10254 or [::]:10254))
-func IsValidSocketAddr(value string) []string {
- var errs []string
- ip, port, err := net.SplitHostPort(value)
- if err != nil {
- errs = append(errs, "must be a valid socket address format, (e.g. 0.0.0.0:10254 or [::]:10254)")
- return errs
- }
- portInt, _ := strconv.Atoi(port)
- errs = append(errs, IsValidPortNum(portInt)...)
- errs = append(errs, IsValidIP(ip)...)
- return errs
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/wait/backoff.go b/vendor/k8s.io/apimachinery/pkg/util/wait/backoff.go
new file mode 100644
index 000000000..418761925
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/wait/backoff.go
@@ -0,0 +1,502 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package wait
+
+import (
+ "context"
+ "math"
+ "sync"
+ "time"
+
+ "k8s.io/apimachinery/pkg/util/runtime"
+ "k8s.io/utils/clock"
+)
+
+// Backoff holds parameters applied to a Backoff function.
+type Backoff struct {
+ // The initial duration.
+ Duration time.Duration
+ // Duration is multiplied by factor each iteration, if factor is not zero
+ // and the limits imposed by Steps and Cap have not been reached.
+ // Should not be negative.
+ // The jitter does not contribute to the updates to the duration parameter.
+ Factor float64
+ // The sleep at each iteration is the duration plus an additional
+ // amount chosen uniformly at random from the interval between
+ // zero and `jitter*duration`.
+ Jitter float64
+ // The remaining number of iterations in which the duration
+ // parameter may change (but progress can be stopped earlier by
+ // hitting the cap). If not positive, the duration is not
+ // changed. Used for exponential backoff in combination with
+ // Factor and Cap.
+ Steps int
+ // A limit on revised values of the duration parameter. If a
+ // multiplication by the factor parameter would make the duration
+ // exceed the cap then the duration is set to the cap and the
+ // steps parameter is set to zero.
+ Cap time.Duration
+}
+
+// Step returns an amount of time to sleep determined by the original
+// Duration and Jitter. The backoff is mutated to update its Steps and
+// Duration. A nil Backoff always has a zero-duration step.
+func (b *Backoff) Step() time.Duration {
+ if b == nil {
+ return 0
+ }
+ var nextDuration time.Duration
+ nextDuration, b.Duration, b.Steps = delay(b.Steps, b.Duration, b.Cap, b.Factor, b.Jitter)
+ return nextDuration
+}
+
+// DelayFunc returns a function that will compute the next interval to
+// wait given the arguments in b. It does not mutate the original backoff
+// but the function is safe to use only from a single goroutine.
+func (b Backoff) DelayFunc() DelayFunc {
+ steps := b.Steps
+ duration := b.Duration
+ cap := b.Cap
+ factor := b.Factor
+ jitter := b.Jitter
+
+ return func() time.Duration {
+ var nextDuration time.Duration
+ // jitter is applied per step and is not cumulative over multiple steps
+ nextDuration, duration, steps = delay(steps, duration, cap, factor, jitter)
+ return nextDuration
+ }
+}
+
+// Timer returns a timer implementation appropriate to this backoff's parameters
+// for use with wait functions.
+func (b Backoff) Timer() Timer {
+ if b.Steps > 1 || b.Jitter != 0 {
+ return &variableTimer{new: internalClock.NewTimer, fn: b.DelayFunc()}
+ }
+ if b.Duration > 0 {
+ return &fixedTimer{new: internalClock.NewTicker, interval: b.Duration}
+ }
+ return newNoopTimer()
+}
+
+// delay implements the core delay algorithm used in this package.
+func delay(steps int, duration, cap time.Duration, factor, jitter float64) (_ time.Duration, next time.Duration, nextSteps int) {
+ // when steps is non-positive, do not alter the base duration
+ if steps < 1 {
+ if jitter > 0 {
+ return Jitter(duration, jitter), duration, 0
+ }
+ return duration, duration, 0
+ }
+ steps--
+
+ // calculate the next step's interval
+ if factor != 0 {
+ next = time.Duration(float64(duration) * factor)
+ if cap > 0 && next > cap {
+ next = cap
+ steps = 0
+ }
+ } else {
+ next = duration
+ }
+
+ // add jitter for this step
+ if jitter > 0 {
+ duration = Jitter(duration, jitter)
+ }
+
+ return duration, next, steps
+
+}
+
+// DelayWithReset returns a DelayFunc that will return the appropriate next interval to
+// wait. Every resetInterval the backoff parameters are reset to their initial state.
+// This method is safe to invoke from multiple goroutines, but all calls will advance
+// the backoff state when Factor is set. If Factor is zero, this method is the same as
+// invoking b.DelayFunc() since Steps has no impact without Factor. If resetInterval is
+// zero no backoff will be performed as the same calling DelayFunc with a zero factor
+// and steps.
+func (b Backoff) DelayWithReset(c clock.Clock, resetInterval time.Duration) DelayFunc {
+ if b.Factor <= 0 {
+ return b.DelayFunc()
+ }
+ if resetInterval <= 0 {
+ b.Steps = 0
+ b.Factor = 0
+ return b.DelayFunc()
+ }
+ return (&backoffManager{
+ backoff: b,
+ initialBackoff: b,
+ resetInterval: resetInterval,
+
+ clock: c,
+ lastStart: c.Now(),
+ timer: nil,
+ }).Step
+}
+
+// Until loops until stop channel is closed, running f every period.
+//
+// Until is syntactic sugar on top of JitterUntil with zero jitter factor and
+// with sliding = true (which means the timer for period starts after the f
+// completes).
+func Until(f func(), period time.Duration, stopCh <-chan struct{}) {
+ JitterUntil(f, period, 0.0, true, stopCh)
+}
+
+// UntilWithContext loops until context is done, running f every period.
+//
+// UntilWithContext is syntactic sugar on top of JitterUntilWithContext
+// with zero jitter factor and with sliding = true (which means the timer
+// for period starts after the f completes).
+func UntilWithContext(ctx context.Context, f func(context.Context), period time.Duration) {
+ JitterUntilWithContext(ctx, f, period, 0.0, true)
+}
+
+// NonSlidingUntil loops until stop channel is closed, running f every
+// period.
+//
+// NonSlidingUntil is syntactic sugar on top of JitterUntil with zero jitter
+// factor, with sliding = false (meaning the timer for period starts at the same
+// time as the function starts).
+func NonSlidingUntil(f func(), period time.Duration, stopCh <-chan struct{}) {
+ JitterUntil(f, period, 0.0, false, stopCh)
+}
+
+// NonSlidingUntilWithContext loops until context is done, running f every
+// period.
+//
+// NonSlidingUntilWithContext is syntactic sugar on top of JitterUntilWithContext
+// with zero jitter factor, with sliding = false (meaning the timer for period
+// starts at the same time as the function starts).
+func NonSlidingUntilWithContext(ctx context.Context, f func(context.Context), period time.Duration) {
+ JitterUntilWithContext(ctx, f, period, 0.0, false)
+}
+
+// JitterUntil loops until stop channel is closed, running f every period.
+//
+// If jitterFactor is positive, the period is jittered before every run of f.
+// If jitterFactor is not positive, the period is unchanged and not jittered.
+//
+// If sliding is true, the period is computed after f runs. If it is false then
+// period includes the runtime for f.
+//
+// Close stopCh to stop. f may not be invoked if stop channel is already
+// closed. Pass NeverStop to if you don't want it stop.
+func JitterUntil(f func(), period time.Duration, jitterFactor float64, sliding bool, stopCh <-chan struct{}) {
+ BackoffUntil(f, NewJitteredBackoffManager(period, jitterFactor, &clock.RealClock{}), sliding, stopCh)
+}
+
+// BackoffUntil loops until stop channel is closed, run f every duration given by BackoffManager.
+//
+// If sliding is true, the period is computed after f runs. If it is false then
+// period includes the runtime for f.
+func BackoffUntil(f func(), backoff BackoffManager, sliding bool, stopCh <-chan struct{}) {
+ var t clock.Timer
+ for {
+ select {
+ case <-stopCh:
+ return
+ default:
+ }
+
+ if !sliding {
+ t = backoff.Backoff()
+ }
+
+ func() {
+ defer runtime.HandleCrash()
+ f()
+ }()
+
+ if sliding {
+ t = backoff.Backoff()
+ }
+
+ // NOTE: b/c there is no priority selection in golang
+ // it is possible for this to race, meaning we could
+ // trigger t.C and stopCh, and t.C select falls through.
+ // In order to mitigate we re-check stopCh at the beginning
+ // of every loop to prevent extra executions of f().
+ select {
+ case <-stopCh:
+ if !t.Stop() {
+ <-t.C()
+ }
+ return
+ case <-t.C():
+ }
+ }
+}
+
+// JitterUntilWithContext loops until context is done, running f every period.
+//
+// If jitterFactor is positive, the period is jittered before every run of f.
+// If jitterFactor is not positive, the period is unchanged and not jittered.
+//
+// If sliding is true, the period is computed after f runs. If it is false then
+// period includes the runtime for f.
+//
+// Cancel context to stop. f may not be invoked if context is already expired.
+func JitterUntilWithContext(ctx context.Context, f func(context.Context), period time.Duration, jitterFactor float64, sliding bool) {
+ JitterUntil(func() { f(ctx) }, period, jitterFactor, sliding, ctx.Done())
+}
+
+// backoffManager provides simple backoff behavior in a threadsafe manner to a caller.
+type backoffManager struct {
+ backoff Backoff
+ initialBackoff Backoff
+ resetInterval time.Duration
+
+ clock clock.Clock
+
+ lock sync.Mutex
+ lastStart time.Time
+ timer clock.Timer
+}
+
+// Step returns the expected next duration to wait.
+func (b *backoffManager) Step() time.Duration {
+ b.lock.Lock()
+ defer b.lock.Unlock()
+
+ switch {
+ case b.resetInterval == 0:
+ b.backoff = b.initialBackoff
+ case b.clock.Now().Sub(b.lastStart) > b.resetInterval:
+ b.backoff = b.initialBackoff
+ b.lastStart = b.clock.Now()
+ }
+ return b.backoff.Step()
+}
+
+// Backoff implements BackoffManager.Backoff, it returns a timer so caller can block on the timer
+// for exponential backoff. The returned timer must be drained before calling Backoff() the second
+// time.
+func (b *backoffManager) Backoff() clock.Timer {
+ b.lock.Lock()
+ defer b.lock.Unlock()
+ if b.timer == nil {
+ b.timer = b.clock.NewTimer(b.Step())
+ } else {
+ b.timer.Reset(b.Step())
+ }
+ return b.timer
+}
+
+// Timer returns a new Timer instance that shares the clock and the reset behavior with all other
+// timers.
+func (b *backoffManager) Timer() Timer {
+ return DelayFunc(b.Step).Timer(b.clock)
+}
+
+// BackoffManager manages backoff with a particular scheme based on its underlying implementation.
+type BackoffManager interface {
+ // Backoff returns a shared clock.Timer that is Reset on every invocation. This method is not
+ // safe for use from multiple threads. It returns a timer for backoff, and caller shall backoff
+ // until Timer.C() drains. If the second Backoff() is called before the timer from the first
+ // Backoff() call finishes, the first timer will NOT be drained and result in undetermined
+ // behavior.
+ Backoff() clock.Timer
+}
+
+// Deprecated: Will be removed when the legacy polling functions are removed.
+type exponentialBackoffManagerImpl struct {
+ backoff *Backoff
+ backoffTimer clock.Timer
+ lastBackoffStart time.Time
+ initialBackoff time.Duration
+ backoffResetDuration time.Duration
+ clock clock.Clock
+}
+
+// NewExponentialBackoffManager returns a manager for managing exponential backoff. Each backoff is jittered and
+// backoff will not exceed the given max. If the backoff is not called within resetDuration, the backoff is reset.
+// This backoff manager is used to reduce load during upstream unhealthiness.
+//
+// Deprecated: Will be removed when the legacy Poll methods are removed. Callers should construct a
+// Backoff struct, use DelayWithReset() to get a DelayFunc that periodically resets itself, and then
+// invoke Timer() when calling wait.BackoffUntil.
+//
+// Instead of:
+//
+// bm := wait.NewExponentialBackoffManager(init, max, reset, factor, jitter, clock)
+// ...
+// wait.BackoffUntil(..., bm.Backoff, ...)
+//
+// Use:
+//
+// delayFn := wait.Backoff{
+// Duration: init,
+// Cap: max,
+// Steps: int(math.Ceil(float64(max) / float64(init))), // now a required argument
+// Factor: factor,
+// Jitter: jitter,
+// }.DelayWithReset(reset, clock)
+// wait.BackoffUntil(..., delayFn.Timer(), ...)
+func NewExponentialBackoffManager(initBackoff, maxBackoff, resetDuration time.Duration, backoffFactor, jitter float64, c clock.Clock) BackoffManager {
+ return &exponentialBackoffManagerImpl{
+ backoff: &Backoff{
+ Duration: initBackoff,
+ Factor: backoffFactor,
+ Jitter: jitter,
+
+ // the current impl of wait.Backoff returns Backoff.Duration once steps are used up, which is not
+ // what we ideally need here, we set it to max int and assume we will never use up the steps
+ Steps: math.MaxInt32,
+ Cap: maxBackoff,
+ },
+ backoffTimer: nil,
+ initialBackoff: initBackoff,
+ lastBackoffStart: c.Now(),
+ backoffResetDuration: resetDuration,
+ clock: c,
+ }
+}
+
+func (b *exponentialBackoffManagerImpl) getNextBackoff() time.Duration {
+ if b.clock.Now().Sub(b.lastBackoffStart) > b.backoffResetDuration {
+ b.backoff.Steps = math.MaxInt32
+ b.backoff.Duration = b.initialBackoff
+ }
+ b.lastBackoffStart = b.clock.Now()
+ return b.backoff.Step()
+}
+
+// Backoff implements BackoffManager.Backoff, it returns a timer so caller can block on the timer for exponential backoff.
+// The returned timer must be drained before calling Backoff() the second time
+func (b *exponentialBackoffManagerImpl) Backoff() clock.Timer {
+ if b.backoffTimer == nil {
+ b.backoffTimer = b.clock.NewTimer(b.getNextBackoff())
+ } else {
+ b.backoffTimer.Reset(b.getNextBackoff())
+ }
+ return b.backoffTimer
+}
+
+// Deprecated: Will be removed when the legacy polling functions are removed.
+type jitteredBackoffManagerImpl struct {
+ clock clock.Clock
+ duration time.Duration
+ jitter float64
+ backoffTimer clock.Timer
+}
+
+// NewJitteredBackoffManager returns a BackoffManager that backoffs with given duration plus given jitter. If the jitter
+// is negative, backoff will not be jittered.
+//
+// Deprecated: Will be removed when the legacy Poll methods are removed. Callers should construct a
+// Backoff struct and invoke Timer() when calling wait.BackoffUntil.
+//
+// Instead of:
+//
+// bm := wait.NewJitteredBackoffManager(duration, jitter, clock)
+// ...
+// wait.BackoffUntil(..., bm.Backoff, ...)
+//
+// Use:
+//
+// wait.BackoffUntil(..., wait.Backoff{Duration: duration, Jitter: jitter}.Timer(), ...)
+func NewJitteredBackoffManager(duration time.Duration, jitter float64, c clock.Clock) BackoffManager {
+ return &jitteredBackoffManagerImpl{
+ clock: c,
+ duration: duration,
+ jitter: jitter,
+ backoffTimer: nil,
+ }
+}
+
+func (j *jitteredBackoffManagerImpl) getNextBackoff() time.Duration {
+ jitteredPeriod := j.duration
+ if j.jitter > 0.0 {
+ jitteredPeriod = Jitter(j.duration, j.jitter)
+ }
+ return jitteredPeriod
+}
+
+// Backoff implements BackoffManager.Backoff, it returns a timer so caller can block on the timer for jittered backoff.
+// The returned timer must be drained before calling Backoff() the second time
+func (j *jitteredBackoffManagerImpl) Backoff() clock.Timer {
+ backoff := j.getNextBackoff()
+ if j.backoffTimer == nil {
+ j.backoffTimer = j.clock.NewTimer(backoff)
+ } else {
+ j.backoffTimer.Reset(backoff)
+ }
+ return j.backoffTimer
+}
+
+// ExponentialBackoff repeats a condition check with exponential backoff.
+//
+// It repeatedly checks the condition and then sleeps, using `backoff.Step()`
+// to determine the length of the sleep and adjust Duration and Steps.
+// Stops and returns as soon as:
+// 1. the condition check returns true or an error,
+// 2. `backoff.Steps` checks of the condition have been done, or
+// 3. a sleep truncated by the cap on duration has been completed.
+// In case (1) the returned error is what the condition function returned.
+// In all other cases, ErrWaitTimeout is returned.
+//
+// Since backoffs are often subject to cancellation, we recommend using
+// ExponentialBackoffWithContext and passing a context to the method.
+func ExponentialBackoff(backoff Backoff, condition ConditionFunc) error {
+ for backoff.Steps > 0 {
+ if ok, err := runConditionWithCrashProtection(condition); err != nil || ok {
+ return err
+ }
+ if backoff.Steps == 1 {
+ break
+ }
+ time.Sleep(backoff.Step())
+ }
+ return ErrWaitTimeout
+}
+
+// ExponentialBackoffWithContext repeats a condition check with exponential backoff.
+// It immediately returns an error if the condition returns an error, the context is cancelled
+// or hits the deadline, or if the maximum attempts defined in backoff is exceeded (ErrWaitTimeout).
+// If an error is returned by the condition the backoff stops immediately. The condition will
+// never be invoked more than backoff.Steps times.
+func ExponentialBackoffWithContext(ctx context.Context, backoff Backoff, condition ConditionWithContextFunc) error {
+ for backoff.Steps > 0 {
+ select {
+ case <-ctx.Done():
+ return ctx.Err()
+ default:
+ }
+
+ if ok, err := runConditionWithCrashProtectionWithContext(ctx, condition); err != nil || ok {
+ return err
+ }
+
+ if backoff.Steps == 1 {
+ break
+ }
+
+ waitBeforeRetry := backoff.Step()
+ select {
+ case <-ctx.Done():
+ return ctx.Err()
+ case <-time.After(waitBeforeRetry):
+ }
+ }
+
+ return ErrWaitTimeout
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/wait/delay.go b/vendor/k8s.io/apimachinery/pkg/util/wait/delay.go
new file mode 100644
index 000000000..1d3dcaa74
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/wait/delay.go
@@ -0,0 +1,51 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package wait
+
+import (
+ "context"
+ "sync"
+ "time"
+
+ "k8s.io/utils/clock"
+)
+
+// DelayFunc returns the next time interval to wait.
+type DelayFunc func() time.Duration
+
+// Timer takes an arbitrary delay function and returns a timer that can handle arbitrary interval changes.
+// Use Backoff{...}.Timer() for simple delays and more efficient timers.
+func (fn DelayFunc) Timer(c clock.Clock) Timer {
+ return &variableTimer{fn: fn, new: c.NewTimer}
+}
+
+// Until takes an arbitrary delay function and runs until cancelled or the condition indicates exit. This
+// offers all of the functionality of the methods in this package.
+func (fn DelayFunc) Until(ctx context.Context, immediate, sliding bool, condition ConditionWithContextFunc) error {
+ return loopConditionUntilContext(ctx, &variableTimer{fn: fn, new: internalClock.NewTimer}, immediate, sliding, condition)
+}
+
+// Concurrent returns a version of this DelayFunc that is safe for use by multiple goroutines that
+// wish to share a single delay timer.
+func (fn DelayFunc) Concurrent() DelayFunc {
+ var lock sync.Mutex
+ return func() time.Duration {
+ lock.Lock()
+ defer lock.Unlock()
+ return fn()
+ }
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/wait/error.go b/vendor/k8s.io/apimachinery/pkg/util/wait/error.go
new file mode 100644
index 000000000..dd75801d8
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/wait/error.go
@@ -0,0 +1,96 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package wait
+
+import (
+ "context"
+ "errors"
+)
+
+// ErrWaitTimeout is returned when the condition was not satisfied in time.
+//
+// Deprecated: This type will be made private in favor of Interrupted()
+// for checking errors or ErrorInterrupted(err) for returning a wrapped error.
+var ErrWaitTimeout = ErrorInterrupted(errors.New("timed out waiting for the condition"))
+
+// Interrupted returns true if the error indicates a Poll, ExponentialBackoff, or
+// Until loop exited for any reason besides the condition returning true or an
+// error. A loop is considered interrupted if the calling context is cancelled,
+// the context reaches its deadline, or a backoff reaches its maximum allowed
+// steps.
+//
+// Callers should use this method instead of comparing the error value directly to
+// ErrWaitTimeout, as methods that cancel a context may not return that error.
+//
+// Instead of:
+//
+// err := wait.Poll(...)
+// if err == wait.ErrWaitTimeout {
+// log.Infof("Wait for operation exceeded")
+// } else ...
+//
+// Use:
+//
+// err := wait.Poll(...)
+// if wait.Interrupted(err) {
+// log.Infof("Wait for operation exceeded")
+// } else ...
+func Interrupted(err error) bool {
+ switch {
+ case errors.Is(err, errWaitTimeout),
+ errors.Is(err, context.Canceled),
+ errors.Is(err, context.DeadlineExceeded):
+ return true
+ default:
+ return false
+ }
+}
+
+// errInterrupted
+type errInterrupted struct {
+ cause error
+}
+
+// ErrorInterrupted returns an error that indicates the wait was ended
+// early for a given reason. If no cause is provided a generic error
+// will be used but callers are encouraged to provide a real cause for
+// clarity in debugging.
+func ErrorInterrupted(cause error) error {
+ switch cause.(type) {
+ case errInterrupted:
+ // no need to wrap twice since errInterrupted is only needed
+ // once in a chain
+ return cause
+ default:
+ return errInterrupted{cause}
+ }
+}
+
+// errWaitTimeout is the private version of the previous ErrWaitTimeout
+// and is private to prevent direct comparison. Use ErrorInterrupted(err)
+// to get an error that will return true for Interrupted(err).
+var errWaitTimeout = errInterrupted{}
+
+func (e errInterrupted) Unwrap() error { return e.cause }
+func (e errInterrupted) Is(target error) bool { return target == errWaitTimeout }
+func (e errInterrupted) Error() string {
+ if e.cause == nil {
+ // returns the same error message as historical behavior
+ return "timed out waiting for the condition"
+ }
+ return e.cause.Error()
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/wait/loop.go b/vendor/k8s.io/apimachinery/pkg/util/wait/loop.go
new file mode 100644
index 000000000..107bfc132
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/wait/loop.go
@@ -0,0 +1,95 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package wait
+
+import (
+ "context"
+ "time"
+
+ "k8s.io/apimachinery/pkg/util/runtime"
+)
+
+// loopConditionUntilContext executes the provided condition at intervals defined by
+// the provided timer until the provided context is cancelled, the condition returns
+// true, or the condition returns an error. If sliding is true, the period is computed
+// after condition runs. If it is false then period includes the runtime for condition.
+// If immediate is false the first delay happens before any call to condition, if
+// immediate is true the condition will be invoked before waiting and guarantees that
+// the condition is invoked at least once, regardless of whether the context has been
+// cancelled. The returned error is the error returned by the last condition or the
+// context error if the context was terminated.
+//
+// This is the common loop construct for all polling in the wait package.
+func loopConditionUntilContext(ctx context.Context, t Timer, immediate, sliding bool, condition ConditionWithContextFunc) error {
+ defer t.Stop()
+
+ var timeCh <-chan time.Time
+ doneCh := ctx.Done()
+
+ if !sliding {
+ timeCh = t.C()
+ }
+
+ // if immediate is true the condition is
+ // guaranteed to be executed at least once,
+ // if we haven't requested immediate execution, delay once
+ if immediate {
+ if ok, err := func() (bool, error) {
+ defer runtime.HandleCrash()
+ return condition(ctx)
+ }(); err != nil || ok {
+ return err
+ }
+ }
+
+ if sliding {
+ timeCh = t.C()
+ }
+
+ for {
+
+ // Wait for either the context to be cancelled or the next invocation be called
+ select {
+ case <-doneCh:
+ return ctx.Err()
+ case <-timeCh:
+ }
+
+ // IMPORTANT: Because there is no channel priority selection in golang
+ // it is possible for very short timers to "win" the race in the previous select
+ // repeatedly even when the context has been canceled. We therefore must
+ // explicitly check for context cancellation on every loop and exit if true to
+ // guarantee that we don't invoke condition more than once after context has
+ // been cancelled.
+ if err := ctx.Err(); err != nil {
+ return err
+ }
+
+ if !sliding {
+ t.Next()
+ }
+ if ok, err := func() (bool, error) {
+ defer runtime.HandleCrash()
+ return condition(ctx)
+ }(); err != nil || ok {
+ return err
+ }
+ if sliding {
+ t.Next()
+ }
+ }
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/wait/poll.go b/vendor/k8s.io/apimachinery/pkg/util/wait/poll.go
new file mode 100644
index 000000000..231d4c384
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/wait/poll.go
@@ -0,0 +1,315 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package wait
+
+import (
+ "context"
+ "time"
+)
+
+// PollUntilContextCancel tries a condition func until it returns true, an error, or the context
+// is cancelled or hits a deadline. condition will be invoked after the first interval if the
+// context is not cancelled first. The returned error will be from ctx.Err(), the condition's
+// err return value, or nil. If invoking condition takes longer than interval the next condition
+// will be invoked immediately. When using very short intervals, condition may be invoked multiple
+// times before a context cancellation is detected. If immediate is true, condition will be
+// invoked before waiting and guarantees that condition is invoked at least once, regardless of
+// whether the context has been cancelled.
+func PollUntilContextCancel(ctx context.Context, interval time.Duration, immediate bool, condition ConditionWithContextFunc) error {
+ return loopConditionUntilContext(ctx, Backoff{Duration: interval}.Timer(), immediate, false, condition)
+}
+
+// PollUntilContextTimeout will terminate polling after timeout duration by setting a context
+// timeout. This is provided as a convenience function for callers not currently executing under
+// a deadline and is equivalent to:
+//
+// deadlineCtx, deadlineCancel := context.WithTimeout(ctx, timeout)
+// err := PollUntilContextCancel(deadlineCtx, interval, immediate, condition)
+//
+// The deadline context will be cancelled if the Poll succeeds before the timeout, simplifying
+// inline usage. All other behavior is identical to PollUntilContextCancel.
+func PollUntilContextTimeout(ctx context.Context, interval, timeout time.Duration, immediate bool, condition ConditionWithContextFunc) error {
+ deadlineCtx, deadlineCancel := context.WithTimeout(ctx, timeout)
+ defer deadlineCancel()
+ return loopConditionUntilContext(deadlineCtx, Backoff{Duration: interval}.Timer(), immediate, false, condition)
+}
+
+// Poll tries a condition func until it returns true, an error, or the timeout
+// is reached.
+//
+// Poll always waits the interval before the run of 'condition'.
+// 'condition' will always be invoked at least once.
+//
+// Some intervals may be missed if the condition takes too long or the time
+// window is too short.
+//
+// If you want to Poll something forever, see PollInfinite.
+//
+// Deprecated: This method does not return errors from context, use PollUntilContextTimeout.
+// Note that the new method will no longer return ErrWaitTimeout and instead return errors
+// defined by the context package. Will be removed in a future release.
+func Poll(interval, timeout time.Duration, condition ConditionFunc) error {
+ return PollWithContext(context.Background(), interval, timeout, condition.WithContext())
+}
+
+// PollWithContext tries a condition func until it returns true, an error,
+// or when the context expires or the timeout is reached, whichever
+// happens first.
+//
+// PollWithContext always waits the interval before the run of 'condition'.
+// 'condition' will always be invoked at least once.
+//
+// Some intervals may be missed if the condition takes too long or the time
+// window is too short.
+//
+// If you want to Poll something forever, see PollInfinite.
+//
+// Deprecated: This method does not return errors from context, use PollUntilContextTimeout.
+// Note that the new method will no longer return ErrWaitTimeout and instead return errors
+// defined by the context package. Will be removed in a future release.
+func PollWithContext(ctx context.Context, interval, timeout time.Duration, condition ConditionWithContextFunc) error {
+ return poll(ctx, false, poller(interval, timeout), condition)
+}
+
+// PollUntil tries a condition func until it returns true, an error or stopCh is
+// closed.
+//
+// PollUntil always waits interval before the first run of 'condition'.
+// 'condition' will always be invoked at least once.
+//
+// Deprecated: This method does not return errors from context, use PollUntilContextCancel.
+// Note that the new method will no longer return ErrWaitTimeout and instead return errors
+// defined by the context package. Will be removed in a future release.
+func PollUntil(interval time.Duration, condition ConditionFunc, stopCh <-chan struct{}) error {
+ return PollUntilWithContext(ContextForChannel(stopCh), interval, condition.WithContext())
+}
+
+// PollUntilWithContext tries a condition func until it returns true,
+// an error or the specified context is cancelled or expired.
+//
+// PollUntilWithContext always waits interval before the first run of 'condition'.
+// 'condition' will always be invoked at least once.
+//
+// Deprecated: This method does not return errors from context, use PollUntilContextCancel.
+// Note that the new method will no longer return ErrWaitTimeout and instead return errors
+// defined by the context package. Will be removed in a future release.
+func PollUntilWithContext(ctx context.Context, interval time.Duration, condition ConditionWithContextFunc) error {
+ return poll(ctx, false, poller(interval, 0), condition)
+}
+
+// PollInfinite tries a condition func until it returns true or an error
+//
+// PollInfinite always waits the interval before the run of 'condition'.
+//
+// Some intervals may be missed if the condition takes too long or the time
+// window is too short.
+//
+// Deprecated: This method does not return errors from context, use PollUntilContextCancel.
+// Note that the new method will no longer return ErrWaitTimeout and instead return errors
+// defined by the context package. Will be removed in a future release.
+func PollInfinite(interval time.Duration, condition ConditionFunc) error {
+ return PollInfiniteWithContext(context.Background(), interval, condition.WithContext())
+}
+
+// PollInfiniteWithContext tries a condition func until it returns true or an error
+//
+// PollInfiniteWithContext always waits the interval before the run of 'condition'.
+//
+// Some intervals may be missed if the condition takes too long or the time
+// window is too short.
+//
+// Deprecated: This method does not return errors from context, use PollUntilContextCancel.
+// Note that the new method will no longer return ErrWaitTimeout and instead return errors
+// defined by the context package. Will be removed in a future release.
+func PollInfiniteWithContext(ctx context.Context, interval time.Duration, condition ConditionWithContextFunc) error {
+ return poll(ctx, false, poller(interval, 0), condition)
+}
+
+// PollImmediate tries a condition func until it returns true, an error, or the timeout
+// is reached.
+//
+// PollImmediate always checks 'condition' before waiting for the interval. 'condition'
+// will always be invoked at least once.
+//
+// Some intervals may be missed if the condition takes too long or the time
+// window is too short.
+//
+// If you want to immediately Poll something forever, see PollImmediateInfinite.
+//
+// Deprecated: This method does not return errors from context, use PollUntilContextTimeout.
+// Note that the new method will no longer return ErrWaitTimeout and instead return errors
+// defined by the context package. Will be removed in a future release.
+func PollImmediate(interval, timeout time.Duration, condition ConditionFunc) error {
+ return PollImmediateWithContext(context.Background(), interval, timeout, condition.WithContext())
+}
+
+// PollImmediateWithContext tries a condition func until it returns true, an error,
+// or the timeout is reached or the specified context expires, whichever happens first.
+//
+// PollImmediateWithContext always checks 'condition' before waiting for the interval.
+// 'condition' will always be invoked at least once.
+//
+// Some intervals may be missed if the condition takes too long or the time
+// window is too short.
+//
+// If you want to immediately Poll something forever, see PollImmediateInfinite.
+//
+// Deprecated: This method does not return errors from context, use PollUntilContextTimeout.
+// Note that the new method will no longer return ErrWaitTimeout and instead return errors
+// defined by the context package. Will be removed in a future release.
+func PollImmediateWithContext(ctx context.Context, interval, timeout time.Duration, condition ConditionWithContextFunc) error {
+ return poll(ctx, true, poller(interval, timeout), condition)
+}
+
+// PollImmediateUntil tries a condition func until it returns true, an error or stopCh is closed.
+//
+// PollImmediateUntil runs the 'condition' before waiting for the interval.
+// 'condition' will always be invoked at least once.
+//
+// Deprecated: This method does not return errors from context, use PollUntilContextCancel.
+// Note that the new method will no longer return ErrWaitTimeout and instead return errors
+// defined by the context package. Will be removed in a future release.
+func PollImmediateUntil(interval time.Duration, condition ConditionFunc, stopCh <-chan struct{}) error {
+ return PollImmediateUntilWithContext(ContextForChannel(stopCh), interval, condition.WithContext())
+}
+
+// PollImmediateUntilWithContext tries a condition func until it returns true,
+// an error or the specified context is cancelled or expired.
+//
+// PollImmediateUntilWithContext runs the 'condition' before waiting for the interval.
+// 'condition' will always be invoked at least once.
+//
+// Deprecated: This method does not return errors from context, use PollUntilContextCancel.
+// Note that the new method will no longer return ErrWaitTimeout and instead return errors
+// defined by the context package. Will be removed in a future release.
+func PollImmediateUntilWithContext(ctx context.Context, interval time.Duration, condition ConditionWithContextFunc) error {
+ return poll(ctx, true, poller(interval, 0), condition)
+}
+
+// PollImmediateInfinite tries a condition func until it returns true or an error
+//
+// PollImmediateInfinite runs the 'condition' before waiting for the interval.
+//
+// Some intervals may be missed if the condition takes too long or the time
+// window is too short.
+//
+// Deprecated: This method does not return errors from context, use PollUntilContextCancel.
+// Note that the new method will no longer return ErrWaitTimeout and instead return errors
+// defined by the context package. Will be removed in a future release.
+func PollImmediateInfinite(interval time.Duration, condition ConditionFunc) error {
+ return PollImmediateInfiniteWithContext(context.Background(), interval, condition.WithContext())
+}
+
+// PollImmediateInfiniteWithContext tries a condition func until it returns true
+// or an error or the specified context gets cancelled or expired.
+//
+// PollImmediateInfiniteWithContext runs the 'condition' before waiting for the interval.
+//
+// Some intervals may be missed if the condition takes too long or the time
+// window is too short.
+//
+// Deprecated: This method does not return errors from context, use PollUntilContextCancel.
+// Note that the new method will no longer return ErrWaitTimeout and instead return errors
+// defined by the context package. Will be removed in a future release.
+func PollImmediateInfiniteWithContext(ctx context.Context, interval time.Duration, condition ConditionWithContextFunc) error {
+ return poll(ctx, true, poller(interval, 0), condition)
+}
+
+// Internally used, each of the public 'Poll*' function defined in this
+// package should invoke this internal function with appropriate parameters.
+// ctx: the context specified by the caller, for infinite polling pass
+// a context that never gets cancelled or expired.
+// immediate: if true, the 'condition' will be invoked before waiting for the interval,
+// in this case 'condition' will always be invoked at least once.
+// wait: user specified WaitFunc function that controls at what interval the condition
+// function should be invoked periodically and whether it is bound by a timeout.
+// condition: user specified ConditionWithContextFunc function.
+//
+// Deprecated: will be removed in favor of loopConditionUntilContext.
+func poll(ctx context.Context, immediate bool, wait waitWithContextFunc, condition ConditionWithContextFunc) error {
+ if immediate {
+ done, err := runConditionWithCrashProtectionWithContext(ctx, condition)
+ if err != nil {
+ return err
+ }
+ if done {
+ return nil
+ }
+ }
+
+ select {
+ case <-ctx.Done():
+ // returning ctx.Err() will break backward compatibility, use new PollUntilContext*
+ // methods instead
+ return ErrWaitTimeout
+ default:
+ return waitForWithContext(ctx, wait, condition)
+ }
+}
+
+// poller returns a WaitFunc that will send to the channel every interval until
+// timeout has elapsed and then closes the channel.
+//
+// Over very short intervals you may receive no ticks before the channel is
+// closed. A timeout of 0 is interpreted as an infinity, and in such a case
+// it would be the caller's responsibility to close the done channel.
+// Failure to do so would result in a leaked goroutine.
+//
+// Output ticks are not buffered. If the channel is not ready to receive an
+// item, the tick is skipped.
+//
+// Deprecated: Will be removed in a future release.
+func poller(interval, timeout time.Duration) waitWithContextFunc {
+ return waitWithContextFunc(func(ctx context.Context) <-chan struct{} {
+ ch := make(chan struct{})
+
+ go func() {
+ defer close(ch)
+
+ tick := time.NewTicker(interval)
+ defer tick.Stop()
+
+ var after <-chan time.Time
+ if timeout != 0 {
+ // time.After is more convenient, but it
+ // potentially leaves timers around much longer
+ // than necessary if we exit early.
+ timer := time.NewTimer(timeout)
+ after = timer.C
+ defer timer.Stop()
+ }
+
+ for {
+ select {
+ case <-tick.C:
+ // If the consumer isn't ready for this signal drop it and
+ // check the other channels.
+ select {
+ case ch <- struct{}{}:
+ default:
+ }
+ case <-after:
+ return
+ case <-ctx.Done():
+ return
+ }
+ }
+ }()
+
+ return ch
+ })
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/wait/timer.go b/vendor/k8s.io/apimachinery/pkg/util/wait/timer.go
new file mode 100644
index 000000000..3efba3213
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/wait/timer.go
@@ -0,0 +1,121 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package wait
+
+import (
+ "time"
+
+ "k8s.io/utils/clock"
+)
+
+// Timer abstracts how wait functions interact with time runtime efficiently. Test
+// code may implement this interface directly but package consumers are encouraged
+// to use the Backoff type as the primary mechanism for acquiring a Timer. The
+// interface is a simplification of clock.Timer to prevent misuse. Timers are not
+// expected to be safe for calls from multiple goroutines.
+type Timer interface {
+ // C returns a channel that will receive a struct{} each time the timer fires.
+ // The channel should not be waited on after Stop() is invoked. It is allowed
+ // to cache the returned value of C() for the lifetime of the Timer.
+ C() <-chan time.Time
+ // Next is invoked by wait functions to signal timers that the next interval
+ // should begin. You may only use Next() if you have drained the channel C().
+ // You should not call Next() after Stop() is invoked.
+ Next()
+ // Stop releases the timer. It is safe to invoke if no other methods have been
+ // called.
+ Stop()
+}
+
+type noopTimer struct {
+ closedCh <-chan time.Time
+}
+
+// newNoopTimer creates a timer with a unique channel to avoid contention
+// for the channel's lock across multiple unrelated timers.
+func newNoopTimer() noopTimer {
+ ch := make(chan time.Time)
+ close(ch)
+ return noopTimer{closedCh: ch}
+}
+
+func (t noopTimer) C() <-chan time.Time {
+ return t.closedCh
+}
+func (noopTimer) Next() {}
+func (noopTimer) Stop() {}
+
+type variableTimer struct {
+ fn DelayFunc
+ t clock.Timer
+ new func(time.Duration) clock.Timer
+}
+
+func (t *variableTimer) C() <-chan time.Time {
+ if t.t == nil {
+ d := t.fn()
+ t.t = t.new(d)
+ }
+ return t.t.C()
+}
+func (t *variableTimer) Next() {
+ if t.t == nil {
+ return
+ }
+ d := t.fn()
+ t.t.Reset(d)
+}
+func (t *variableTimer) Stop() {
+ if t.t == nil {
+ return
+ }
+ t.t.Stop()
+ t.t = nil
+}
+
+type fixedTimer struct {
+ interval time.Duration
+ t clock.Ticker
+ new func(time.Duration) clock.Ticker
+}
+
+func (t *fixedTimer) C() <-chan time.Time {
+ if t.t == nil {
+ t.t = t.new(t.interval)
+ }
+ return t.t.C()
+}
+func (t *fixedTimer) Next() {
+ // no-op for fixed timers
+}
+func (t *fixedTimer) Stop() {
+ if t.t == nil {
+ return
+ }
+ t.t.Stop()
+ t.t = nil
+}
+
+var (
+ // RealTimer can be passed to methods that need a clock.Timer.
+ RealTimer = clock.RealClock{}.NewTimer
+)
+
+var (
+ // internalClock is used for test injection of clocks
+ internalClock = clock.RealClock{}
+)
diff --git a/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go b/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go
index 9268064af..6805e8cf9 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go
@@ -18,14 +18,11 @@ package wait
import (
"context"
- "errors"
- "math"
"math/rand"
"sync"
"time"
"k8s.io/apimachinery/pkg/util/runtime"
- "k8s.io/utils/clock"
)
// For any test of the style:
@@ -83,113 +80,6 @@ func Forever(f func(), period time.Duration) {
Until(f, period, NeverStop)
}
-// Until loops until stop channel is closed, running f every period.
-//
-// Until is syntactic sugar on top of JitterUntil with zero jitter factor and
-// with sliding = true (which means the timer for period starts after the f
-// completes).
-func Until(f func(), period time.Duration, stopCh <-chan struct{}) {
- JitterUntil(f, period, 0.0, true, stopCh)
-}
-
-// UntilWithContext loops until context is done, running f every period.
-//
-// UntilWithContext is syntactic sugar on top of JitterUntilWithContext
-// with zero jitter factor and with sliding = true (which means the timer
-// for period starts after the f completes).
-func UntilWithContext(ctx context.Context, f func(context.Context), period time.Duration) {
- JitterUntilWithContext(ctx, f, period, 0.0, true)
-}
-
-// NonSlidingUntil loops until stop channel is closed, running f every
-// period.
-//
-// NonSlidingUntil is syntactic sugar on top of JitterUntil with zero jitter
-// factor, with sliding = false (meaning the timer for period starts at the same
-// time as the function starts).
-func NonSlidingUntil(f func(), period time.Duration, stopCh <-chan struct{}) {
- JitterUntil(f, period, 0.0, false, stopCh)
-}
-
-// NonSlidingUntilWithContext loops until context is done, running f every
-// period.
-//
-// NonSlidingUntilWithContext is syntactic sugar on top of JitterUntilWithContext
-// with zero jitter factor, with sliding = false (meaning the timer for period
-// starts at the same time as the function starts).
-func NonSlidingUntilWithContext(ctx context.Context, f func(context.Context), period time.Duration) {
- JitterUntilWithContext(ctx, f, period, 0.0, false)
-}
-
-// JitterUntil loops until stop channel is closed, running f every period.
-//
-// If jitterFactor is positive, the period is jittered before every run of f.
-// If jitterFactor is not positive, the period is unchanged and not jittered.
-//
-// If sliding is true, the period is computed after f runs. If it is false then
-// period includes the runtime for f.
-//
-// Close stopCh to stop. f may not be invoked if stop channel is already
-// closed. Pass NeverStop to if you don't want it stop.
-func JitterUntil(f func(), period time.Duration, jitterFactor float64, sliding bool, stopCh <-chan struct{}) {
- BackoffUntil(f, NewJitteredBackoffManager(period, jitterFactor, &clock.RealClock{}), sliding, stopCh)
-}
-
-// BackoffUntil loops until stop channel is closed, run f every duration given by BackoffManager.
-//
-// If sliding is true, the period is computed after f runs. If it is false then
-// period includes the runtime for f.
-func BackoffUntil(f func(), backoff BackoffManager, sliding bool, stopCh <-chan struct{}) {
- var t clock.Timer
- for {
- select {
- case <-stopCh:
- return
- default:
- }
-
- if !sliding {
- t = backoff.Backoff()
- }
-
- func() {
- defer runtime.HandleCrash()
- f()
- }()
-
- if sliding {
- t = backoff.Backoff()
- }
-
- // NOTE: b/c there is no priority selection in golang
- // it is possible for this to race, meaning we could
- // trigger t.C and stopCh, and t.C select falls through.
- // In order to mitigate we re-check stopCh at the beginning
- // of every loop to prevent extra executions of f().
- select {
- case <-stopCh:
- if !t.Stop() {
- <-t.C()
- }
- return
- case <-t.C():
- }
- }
-}
-
-// JitterUntilWithContext loops until context is done, running f every period.
-//
-// If jitterFactor is positive, the period is jittered before every run of f.
-// If jitterFactor is not positive, the period is unchanged and not jittered.
-//
-// If sliding is true, the period is computed after f runs. If it is false then
-// period includes the runtime for f.
-//
-// Cancel context to stop. f may not be invoked if context is already expired.
-func JitterUntilWithContext(ctx context.Context, f func(context.Context), period time.Duration, jitterFactor float64, sliding bool) {
- JitterUntil(func() { f(ctx) }, period, jitterFactor, sliding, ctx.Done())
-}
-
// Jitter returns a time.Duration between duration and duration + maxFactor *
// duration.
//
@@ -203,9 +93,6 @@ func Jitter(duration time.Duration, maxFactor float64) time.Duration {
return wait
}
-// ErrWaitTimeout is returned when the condition exited without success.
-var ErrWaitTimeout = errors.New("timed out waiting for the condition")
-
// ConditionFunc returns true if the condition is satisfied, or an error
// if the loop should be aborted.
type ConditionFunc func() (done bool, err error)
@@ -223,425 +110,80 @@ func (cf ConditionFunc) WithContext() ConditionWithContextFunc {
}
}
-// runConditionWithCrashProtection runs a ConditionFunc with crash protection
-func runConditionWithCrashProtection(condition ConditionFunc) (bool, error) {
- return runConditionWithCrashProtectionWithContext(context.TODO(), condition.WithContext())
-}
-
-// runConditionWithCrashProtectionWithContext runs a
-// ConditionWithContextFunc with crash protection.
-func runConditionWithCrashProtectionWithContext(ctx context.Context, condition ConditionWithContextFunc) (bool, error) {
- defer runtime.HandleCrash()
- return condition(ctx)
-}
-
-// Backoff holds parameters applied to a Backoff function.
-type Backoff struct {
- // The initial duration.
- Duration time.Duration
- // Duration is multiplied by factor each iteration, if factor is not zero
- // and the limits imposed by Steps and Cap have not been reached.
- // Should not be negative.
- // The jitter does not contribute to the updates to the duration parameter.
- Factor float64
- // The sleep at each iteration is the duration plus an additional
- // amount chosen uniformly at random from the interval between
- // zero and `jitter*duration`.
- Jitter float64
- // The remaining number of iterations in which the duration
- // parameter may change (but progress can be stopped earlier by
- // hitting the cap). If not positive, the duration is not
- // changed. Used for exponential backoff in combination with
- // Factor and Cap.
- Steps int
- // A limit on revised values of the duration parameter. If a
- // multiplication by the factor parameter would make the duration
- // exceed the cap then the duration is set to the cap and the
- // steps parameter is set to zero.
- Cap time.Duration
-}
-
-// Step (1) returns an amount of time to sleep determined by the
-// original Duration and Jitter and (2) mutates the provided Backoff
-// to update its Steps and Duration.
-func (b *Backoff) Step() time.Duration {
- if b.Steps < 1 {
- if b.Jitter > 0 {
- return Jitter(b.Duration, b.Jitter)
- }
- return b.Duration
- }
- b.Steps--
-
- duration := b.Duration
-
- // calculate the next step
- if b.Factor != 0 {
- b.Duration = time.Duration(float64(b.Duration) * b.Factor)
- if b.Cap > 0 && b.Duration > b.Cap {
- b.Duration = b.Cap
- b.Steps = 0
- }
- }
-
- if b.Jitter > 0 {
- duration = Jitter(duration, b.Jitter)
- }
- return duration
-}
-
-// contextForChannel derives a child context from a parent channel.
-//
-// The derived context's Done channel is closed when the returned cancel function
-// is called or when the parent channel is closed, whichever happens first.
-//
-// Note the caller must *always* call the CancelFunc, otherwise resources may be leaked.
-func contextForChannel(parentCh <-chan struct{}) (context.Context, context.CancelFunc) {
- ctx, cancel := context.WithCancel(context.Background())
-
- go func() {
- select {
- case <-parentCh:
- cancel()
- case <-ctx.Done():
- }
- }()
- return ctx, cancel
-}
-
-// BackoffManager manages backoff with a particular scheme based on its underlying implementation. It provides
-// an interface to return a timer for backoff, and caller shall backoff until Timer.C() drains. If the second Backoff()
-// is called before the timer from the first Backoff() call finishes, the first timer will NOT be drained and result in
-// undetermined behavior.
-// The BackoffManager is supposed to be called in a single-threaded environment.
-type BackoffManager interface {
- Backoff() clock.Timer
-}
-
-type exponentialBackoffManagerImpl struct {
- backoff *Backoff
- backoffTimer clock.Timer
- lastBackoffStart time.Time
- initialBackoff time.Duration
- backoffResetDuration time.Duration
- clock clock.Clock
-}
-
-// NewExponentialBackoffManager returns a manager for managing exponential backoff. Each backoff is jittered and
-// backoff will not exceed the given max. If the backoff is not called within resetDuration, the backoff is reset.
-// This backoff manager is used to reduce load during upstream unhealthiness.
-func NewExponentialBackoffManager(initBackoff, maxBackoff, resetDuration time.Duration, backoffFactor, jitter float64, c clock.Clock) BackoffManager {
- return &exponentialBackoffManagerImpl{
- backoff: &Backoff{
- Duration: initBackoff,
- Factor: backoffFactor,
- Jitter: jitter,
-
- // the current impl of wait.Backoff returns Backoff.Duration once steps are used up, which is not
- // what we ideally need here, we set it to max int and assume we will never use up the steps
- Steps: math.MaxInt32,
- Cap: maxBackoff,
- },
- backoffTimer: nil,
- initialBackoff: initBackoff,
- lastBackoffStart: c.Now(),
- backoffResetDuration: resetDuration,
- clock: c,
- }
-}
-
-func (b *exponentialBackoffManagerImpl) getNextBackoff() time.Duration {
- if b.clock.Now().Sub(b.lastBackoffStart) > b.backoffResetDuration {
- b.backoff.Steps = math.MaxInt32
- b.backoff.Duration = b.initialBackoff
- }
- b.lastBackoffStart = b.clock.Now()
- return b.backoff.Step()
-}
-
-// Backoff implements BackoffManager.Backoff, it returns a timer so caller can block on the timer for exponential backoff.
-// The returned timer must be drained before calling Backoff() the second time
-func (b *exponentialBackoffManagerImpl) Backoff() clock.Timer {
- if b.backoffTimer == nil {
- b.backoffTimer = b.clock.NewTimer(b.getNextBackoff())
- } else {
- b.backoffTimer.Reset(b.getNextBackoff())
- }
- return b.backoffTimer
-}
-
-type jitteredBackoffManagerImpl struct {
- clock clock.Clock
- duration time.Duration
- jitter float64
- backoffTimer clock.Timer
-}
-
-// NewJitteredBackoffManager returns a BackoffManager that backoffs with given duration plus given jitter. If the jitter
-// is negative, backoff will not be jittered.
-func NewJitteredBackoffManager(duration time.Duration, jitter float64, c clock.Clock) BackoffManager {
- return &jitteredBackoffManagerImpl{
- clock: c,
- duration: duration,
- jitter: jitter,
- backoffTimer: nil,
- }
-}
-
-func (j *jitteredBackoffManagerImpl) getNextBackoff() time.Duration {
- jitteredPeriod := j.duration
- if j.jitter > 0.0 {
- jitteredPeriod = Jitter(j.duration, j.jitter)
- }
- return jitteredPeriod
+// ContextForChannel provides a context that will be treated as cancelled
+// when the provided parentCh is closed. The implementation returns
+// context.Canceled for Err() if and only if the parentCh is closed.
+func ContextForChannel(parentCh <-chan struct{}) context.Context {
+ return channelContext{stopCh: parentCh}
}
-// Backoff implements BackoffManager.Backoff, it returns a timer so caller can block on the timer for jittered backoff.
-// The returned timer must be drained before calling Backoff() the second time
-func (j *jitteredBackoffManagerImpl) Backoff() clock.Timer {
- backoff := j.getNextBackoff()
- if j.backoffTimer == nil {
- j.backoffTimer = j.clock.NewTimer(backoff)
- } else {
- j.backoffTimer.Reset(backoff)
- }
- return j.backoffTimer
-}
+var _ context.Context = channelContext{}
-// ExponentialBackoff repeats a condition check with exponential backoff.
-//
-// It repeatedly checks the condition and then sleeps, using `backoff.Step()`
-// to determine the length of the sleep and adjust Duration and Steps.
-// Stops and returns as soon as:
-// 1. the condition check returns true or an error,
-// 2. `backoff.Steps` checks of the condition have been done, or
-// 3. a sleep truncated by the cap on duration has been completed.
-// In case (1) the returned error is what the condition function returned.
-// In all other cases, ErrWaitTimeout is returned.
-func ExponentialBackoff(backoff Backoff, condition ConditionFunc) error {
- for backoff.Steps > 0 {
- if ok, err := runConditionWithCrashProtection(condition); err != nil || ok {
- return err
- }
- if backoff.Steps == 1 {
- break
- }
- time.Sleep(backoff.Step())
- }
- return ErrWaitTimeout
-}
-
-// Poll tries a condition func until it returns true, an error, or the timeout
-// is reached.
-//
-// Poll always waits the interval before the run of 'condition'.
-// 'condition' will always be invoked at least once.
-//
-// Some intervals may be missed if the condition takes too long or the time
-// window is too short.
-//
-// If you want to Poll something forever, see PollInfinite.
-func Poll(interval, timeout time.Duration, condition ConditionFunc) error {
- return PollWithContext(context.Background(), interval, timeout, condition.WithContext())
-}
-
-// PollWithContext tries a condition func until it returns true, an error,
-// or when the context expires or the timeout is reached, whichever
-// happens first.
-//
-// PollWithContext always waits the interval before the run of 'condition'.
-// 'condition' will always be invoked at least once.
-//
-// Some intervals may be missed if the condition takes too long or the time
-// window is too short.
-//
-// If you want to Poll something forever, see PollInfinite.
-func PollWithContext(ctx context.Context, interval, timeout time.Duration, condition ConditionWithContextFunc) error {
- return poll(ctx, false, poller(interval, timeout), condition)
-}
-
-// PollUntil tries a condition func until it returns true, an error or stopCh is
+// channelContext will behave as if the context were cancelled when stopCh is
// closed.
-//
-// PollUntil always waits interval before the first run of 'condition'.
-// 'condition' will always be invoked at least once.
-func PollUntil(interval time.Duration, condition ConditionFunc, stopCh <-chan struct{}) error {
- ctx, cancel := contextForChannel(stopCh)
- defer cancel()
- return PollUntilWithContext(ctx, interval, condition.WithContext())
-}
-
-// PollUntilWithContext tries a condition func until it returns true,
-// an error or the specified context is cancelled or expired.
-//
-// PollUntilWithContext always waits interval before the first run of 'condition'.
-// 'condition' will always be invoked at least once.
-func PollUntilWithContext(ctx context.Context, interval time.Duration, condition ConditionWithContextFunc) error {
- return poll(ctx, false, poller(interval, 0), condition)
-}
-
-// PollInfinite tries a condition func until it returns true or an error
-//
-// PollInfinite always waits the interval before the run of 'condition'.
-//
-// Some intervals may be missed if the condition takes too long or the time
-// window is too short.
-func PollInfinite(interval time.Duration, condition ConditionFunc) error {
- return PollInfiniteWithContext(context.Background(), interval, condition.WithContext())
-}
-
-// PollInfiniteWithContext tries a condition func until it returns true or an error
-//
-// PollInfiniteWithContext always waits the interval before the run of 'condition'.
-//
-// Some intervals may be missed if the condition takes too long or the time
-// window is too short.
-func PollInfiniteWithContext(ctx context.Context, interval time.Duration, condition ConditionWithContextFunc) error {
- return poll(ctx, false, poller(interval, 0), condition)
+type channelContext struct {
+ stopCh <-chan struct{}
}
-// PollImmediate tries a condition func until it returns true, an error, or the timeout
-// is reached.
-//
-// PollImmediate always checks 'condition' before waiting for the interval. 'condition'
-// will always be invoked at least once.
-//
-// Some intervals may be missed if the condition takes too long or the time
-// window is too short.
-//
-// If you want to immediately Poll something forever, see PollImmediateInfinite.
-func PollImmediate(interval, timeout time.Duration, condition ConditionFunc) error {
- return PollImmediateWithContext(context.Background(), interval, timeout, condition.WithContext())
-}
-
-// PollImmediateWithContext tries a condition func until it returns true, an error,
-// or the timeout is reached or the specified context expires, whichever happens first.
-//
-// PollImmediateWithContext always checks 'condition' before waiting for the interval.
-// 'condition' will always be invoked at least once.
-//
-// Some intervals may be missed if the condition takes too long or the time
-// window is too short.
-//
-// If you want to immediately Poll something forever, see PollImmediateInfinite.
-func PollImmediateWithContext(ctx context.Context, interval, timeout time.Duration, condition ConditionWithContextFunc) error {
- return poll(ctx, true, poller(interval, timeout), condition)
-}
-
-// PollImmediateUntil tries a condition func until it returns true, an error or stopCh is closed.
-//
-// PollImmediateUntil runs the 'condition' before waiting for the interval.
-// 'condition' will always be invoked at least once.
-func PollImmediateUntil(interval time.Duration, condition ConditionFunc, stopCh <-chan struct{}) error {
- ctx, cancel := contextForChannel(stopCh)
- defer cancel()
- return PollImmediateUntilWithContext(ctx, interval, condition.WithContext())
-}
-
-// PollImmediateUntilWithContext tries a condition func until it returns true,
-// an error or the specified context is cancelled or expired.
-//
-// PollImmediateUntilWithContext runs the 'condition' before waiting for the interval.
-// 'condition' will always be invoked at least once.
-func PollImmediateUntilWithContext(ctx context.Context, interval time.Duration, condition ConditionWithContextFunc) error {
- return poll(ctx, true, poller(interval, 0), condition)
+func (c channelContext) Done() <-chan struct{} { return c.stopCh }
+func (c channelContext) Err() error {
+ select {
+ case <-c.stopCh:
+ return context.Canceled
+ default:
+ return nil
+ }
}
+func (c channelContext) Deadline() (time.Time, bool) { return time.Time{}, false }
+func (c channelContext) Value(key any) any { return nil }
-// PollImmediateInfinite tries a condition func until it returns true or an error
+// runConditionWithCrashProtection runs a ConditionFunc with crash protection.
//
-// PollImmediateInfinite runs the 'condition' before waiting for the interval.
-//
-// Some intervals may be missed if the condition takes too long or the time
-// window is too short.
-func PollImmediateInfinite(interval time.Duration, condition ConditionFunc) error {
- return PollImmediateInfiniteWithContext(context.Background(), interval, condition.WithContext())
+// Deprecated: Will be removed when the legacy polling methods are removed.
+func runConditionWithCrashProtection(condition ConditionFunc) (bool, error) {
+ defer runtime.HandleCrash()
+ return condition()
}
-// PollImmediateInfiniteWithContext tries a condition func until it returns true
-// or an error or the specified context gets cancelled or expired.
+// runConditionWithCrashProtectionWithContext runs a ConditionWithContextFunc
+// with crash protection.
//
-// PollImmediateInfiniteWithContext runs the 'condition' before waiting for the interval.
-//
-// Some intervals may be missed if the condition takes too long or the time
-// window is too short.
-func PollImmediateInfiniteWithContext(ctx context.Context, interval time.Duration, condition ConditionWithContextFunc) error {
- return poll(ctx, true, poller(interval, 0), condition)
-}
-
-// Internally used, each of the the public 'Poll*' function defined in this
-// package should invoke this internal function with appropriate parameters.
-// ctx: the context specified by the caller, for infinite polling pass
-// a context that never gets cancelled or expired.
-// immediate: if true, the 'condition' will be invoked before waiting for the interval,
-// in this case 'condition' will always be invoked at least once.
-// wait: user specified WaitFunc function that controls at what interval the condition
-// function should be invoked periodically and whether it is bound by a timeout.
-// condition: user specified ConditionWithContextFunc function.
-func poll(ctx context.Context, immediate bool, wait WaitWithContextFunc, condition ConditionWithContextFunc) error {
- if immediate {
- done, err := runConditionWithCrashProtectionWithContext(ctx, condition)
- if err != nil {
- return err
- }
- if done {
- return nil
- }
- }
-
- select {
- case <-ctx.Done():
- // returning ctx.Err() will break backward compatibility
- return ErrWaitTimeout
- default:
- return WaitForWithContext(ctx, wait, condition)
- }
+// Deprecated: Will be removed when the legacy polling methods are removed.
+func runConditionWithCrashProtectionWithContext(ctx context.Context, condition ConditionWithContextFunc) (bool, error) {
+ defer runtime.HandleCrash()
+ return condition(ctx)
}
-// WaitFunc creates a channel that receives an item every time a test
+// waitFunc creates a channel that receives an item every time a test
// should be executed and is closed when the last test should be invoked.
-type WaitFunc func(done <-chan struct{}) <-chan struct{}
+//
+// Deprecated: Will be removed in a future release in favor of
+// loopConditionUntilContext.
+type waitFunc func(done <-chan struct{}) <-chan struct{}
// WithContext converts the WaitFunc to an equivalent WaitWithContextFunc
-func (w WaitFunc) WithContext() WaitWithContextFunc {
+func (w waitFunc) WithContext() waitWithContextFunc {
return func(ctx context.Context) <-chan struct{} {
return w(ctx.Done())
}
}
-// WaitWithContextFunc creates a channel that receives an item every time a test
+// waitWithContextFunc creates a channel that receives an item every time a test
// should be executed and is closed when the last test should be invoked.
//
// When the specified context gets cancelled or expires the function
// stops sending item and returns immediately.
-type WaitWithContextFunc func(ctx context.Context) <-chan struct{}
-
-// WaitFor continually checks 'fn' as driven by 'wait'.
//
-// WaitFor gets a channel from 'wait()”, and then invokes 'fn' once for every value
-// placed on the channel and once more when the channel is closed. If the channel is closed
-// and 'fn' returns false without error, WaitFor returns ErrWaitTimeout.
-//
-// If 'fn' returns an error the loop ends and that error is returned. If
-// 'fn' returns true the loop ends and nil is returned.
-//
-// ErrWaitTimeout will be returned if the 'done' channel is closed without fn ever
-// returning true.
-//
-// When the done channel is closed, because the golang `select` statement is
-// "uniform pseudo-random", the `fn` might still run one or multiple time,
-// though eventually `WaitFor` will return.
-func WaitFor(wait WaitFunc, fn ConditionFunc, done <-chan struct{}) error {
- ctx, cancel := contextForChannel(done)
- defer cancel()
- return WaitForWithContext(ctx, wait.WithContext(), fn.WithContext())
-}
+// Deprecated: Will be removed in a future release in favor of
+// loopConditionUntilContext.
+type waitWithContextFunc func(ctx context.Context) <-chan struct{}
-// WaitForWithContext continually checks 'fn' as driven by 'wait'.
+// waitForWithContext continually checks 'fn' as driven by 'wait'.
//
-// WaitForWithContext gets a channel from 'wait()”, and then invokes 'fn'
+// waitForWithContext gets a channel from 'wait()”, and then invokes 'fn'
// once for every value placed on the channel and once more when the
// channel is closed. If the channel is closed and 'fn'
-// returns false without error, WaitForWithContext returns ErrWaitTimeout.
+// returns false without error, waitForWithContext returns ErrWaitTimeout.
//
// If 'fn' returns an error the loop ends and that error is returned. If
// 'fn' returns true the loop ends and nil is returned.
@@ -651,8 +193,11 @@ func WaitFor(wait WaitFunc, fn ConditionFunc, done <-chan struct{}) error {
//
// When the ctx.Done() channel is closed, because the golang `select` statement is
// "uniform pseudo-random", the `fn` might still run one or multiple times,
-// though eventually `WaitForWithContext` will return.
-func WaitForWithContext(ctx context.Context, wait WaitWithContextFunc, fn ConditionWithContextFunc) error {
+// though eventually `waitForWithContext` will return.
+//
+// Deprecated: Will be removed in a future release in favor of
+// loopConditionUntilContext.
+func waitForWithContext(ctx context.Context, wait waitWithContextFunc, fn ConditionWithContextFunc) error {
waitCtx, cancel := context.WithCancel(context.Background())
defer cancel()
c := wait(waitCtx)
@@ -670,88 +215,9 @@ func WaitForWithContext(ctx context.Context, wait WaitWithContextFunc, fn Condit
return ErrWaitTimeout
}
case <-ctx.Done():
- // returning ctx.Err() will break backward compatibility
+ // returning ctx.Err() will break backward compatibility, use new PollUntilContext*
+ // methods instead
return ErrWaitTimeout
}
}
}
-
-// poller returns a WaitFunc that will send to the channel every interval until
-// timeout has elapsed and then closes the channel.
-//
-// Over very short intervals you may receive no ticks before the channel is
-// closed. A timeout of 0 is interpreted as an infinity, and in such a case
-// it would be the caller's responsibility to close the done channel.
-// Failure to do so would result in a leaked goroutine.
-//
-// Output ticks are not buffered. If the channel is not ready to receive an
-// item, the tick is skipped.
-func poller(interval, timeout time.Duration) WaitWithContextFunc {
- return WaitWithContextFunc(func(ctx context.Context) <-chan struct{} {
- ch := make(chan struct{})
-
- go func() {
- defer close(ch)
-
- tick := time.NewTicker(interval)
- defer tick.Stop()
-
- var after <-chan time.Time
- if timeout != 0 {
- // time.After is more convenient, but it
- // potentially leaves timers around much longer
- // than necessary if we exit early.
- timer := time.NewTimer(timeout)
- after = timer.C
- defer timer.Stop()
- }
-
- for {
- select {
- case <-tick.C:
- // If the consumer isn't ready for this signal drop it and
- // check the other channels.
- select {
- case ch <- struct{}{}:
- default:
- }
- case <-after:
- return
- case <-ctx.Done():
- return
- }
- }
- }()
-
- return ch
- })
-}
-
-// ExponentialBackoffWithContext works with a request context and a Backoff. It ensures that the retry wait never
-// exceeds the deadline specified by the request context.
-func ExponentialBackoffWithContext(ctx context.Context, backoff Backoff, condition ConditionFunc) error {
- for backoff.Steps > 0 {
- select {
- case <-ctx.Done():
- return ctx.Err()
- default:
- }
-
- if ok, err := runConditionWithCrashProtection(condition); err != nil || ok {
- return err
- }
-
- if backoff.Steps == 1 {
- break
- }
-
- waitBeforeRetry := backoff.Step()
- select {
- case <-ctx.Done():
- return ctx.Err()
- case <-time.After(waitBeforeRetry):
- }
- }
-
- return ErrWaitTimeout
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/watch/mux.go b/vendor/k8s.io/apimachinery/pkg/watch/mux.go
index e01d51906..d51f9567e 100644
--- a/vendor/k8s.io/apimachinery/pkg/watch/mux.go
+++ b/vendor/k8s.io/apimachinery/pkg/watch/mux.go
@@ -17,6 +17,7 @@ limitations under the License.
package watch
import (
+ "fmt"
"sync"
"k8s.io/apimachinery/pkg/runtime"
@@ -44,8 +45,11 @@ type Broadcaster struct {
nextWatcher int64
distributing sync.WaitGroup
- incoming chan Event
- stopped chan struct{}
+ // incomingBlock allows us to ensure we don't race and end up sending events
+ // to a closed channel following a broadcaster shutdown.
+ incomingBlock sync.Mutex
+ incoming chan Event
+ stopped chan struct{}
// How large to make watcher's channel.
watchQueueLength int
@@ -111,6 +115,8 @@ func (obj functionFakeRuntimeObject) DeepCopyObject() runtime.Object {
// won't ever see that event, and will always see any event after they are
// added.
func (m *Broadcaster) blockQueue(f func()) {
+ m.incomingBlock.Lock()
+ defer m.incomingBlock.Unlock()
select {
case <-m.stopped:
return
@@ -132,7 +138,7 @@ func (m *Broadcaster) blockQueue(f func()) {
// Note: new watchers will only receive new events. They won't get an entire history
// of previous events. It will block until the watcher is actually added to the
// broadcaster.
-func (m *Broadcaster) Watch() Interface {
+func (m *Broadcaster) Watch() (Interface, error) {
var w *broadcasterWatcher
m.blockQueue(func() {
id := m.nextWatcher
@@ -146,11 +152,9 @@ func (m *Broadcaster) Watch() Interface {
m.watchers[id] = w
})
if w == nil {
- // The panic here is to be consistent with the previous interface behavior
- // we are willing to re-evaluate in the future.
- panic("broadcaster already stopped")
+ return nil, fmt.Errorf("broadcaster already stopped")
}
- return w
+ return w, nil
}
// WatchWithPrefix adds a new watcher to the list and returns an Interface for it. It sends
@@ -158,7 +162,7 @@ func (m *Broadcaster) Watch() Interface {
// The returned watch will have a queue length that is at least large enough to accommodate
// all of the items in queuedEvents. It will block until the watcher is actually added to
// the broadcaster.
-func (m *Broadcaster) WatchWithPrefix(queuedEvents []Event) Interface {
+func (m *Broadcaster) WatchWithPrefix(queuedEvents []Event) (Interface, error) {
var w *broadcasterWatcher
m.blockQueue(func() {
id := m.nextWatcher
@@ -179,11 +183,9 @@ func (m *Broadcaster) WatchWithPrefix(queuedEvents []Event) Interface {
}
})
if w == nil {
- // The panic here is to be consistent with the previous interface behavior
- // we are willing to re-evaluate in the future.
- panic("broadcaster already stopped")
+ return nil, fmt.Errorf("broadcaster already stopped")
}
- return w
+ return w, nil
}
// stopWatching stops the given watcher and removes it from the list.
@@ -210,19 +212,38 @@ func (m *Broadcaster) closeAll() {
}
// Action distributes the given event among all watchers.
-func (m *Broadcaster) Action(action EventType, obj runtime.Object) {
+func (m *Broadcaster) Action(action EventType, obj runtime.Object) error {
+ m.incomingBlock.Lock()
+ defer m.incomingBlock.Unlock()
+ select {
+ case <-m.stopped:
+ return fmt.Errorf("broadcaster already stopped")
+ default:
+ }
+
m.incoming <- Event{action, obj}
+ return nil
}
// Action distributes the given event among all watchers, or drops it on the floor
// if too many incoming actions are queued up. Returns true if the action was sent,
// false if dropped.
-func (m *Broadcaster) ActionOrDrop(action EventType, obj runtime.Object) bool {
+func (m *Broadcaster) ActionOrDrop(action EventType, obj runtime.Object) (bool, error) {
+ m.incomingBlock.Lock()
+ defer m.incomingBlock.Unlock()
+
+ // Ensure that if the broadcaster is stopped we do not send events to it.
+ select {
+ case <-m.stopped:
+ return false, fmt.Errorf("broadcaster already stopped")
+ default:
+ }
+
select {
case m.incoming <- Event{action, obj}:
- return true
+ return true, nil
default:
- return false
+ return false, nil
}
}
diff --git a/vendor/k8s.io/apimachinery/pkg/watch/watch.go b/vendor/k8s.io/apimachinery/pkg/watch/watch.go
index fd0550e4a..ce37fd8c1 100644
--- a/vendor/k8s.io/apimachinery/pkg/watch/watch.go
+++ b/vendor/k8s.io/apimachinery/pkg/watch/watch.go
@@ -27,13 +27,25 @@ import (
// Interface can be implemented by anything that knows how to watch and report changes.
type Interface interface {
- // Stops watching. Will close the channel returned by ResultChan(). Releases
- // any resources used by the watch.
+ // Stop tells the producer that the consumer is done watching, so the
+ // producer should stop sending events and close the result channel. The
+ // consumer should keep watching for events until the result channel is
+ // closed.
+ //
+ // Because some implementations may create channels when constructed, Stop
+ // must always be called, even if the consumer has not yet called
+ // ResultChan().
+ //
+ // Only the consumer should call Stop(), not the producer. If the producer
+ // errors and needs to stop the watch prematurely, it should instead send
+ // an error event and close the result channel.
Stop()
- // Returns a chan which will receive all the events. If an error occurs
- // or Stop() is called, the implementation will close this channel and
- // release any resources used by the watch.
+ // ResultChan returns a channel which will receive events from the event
+ // producer. If an error occurs or Stop() is called, the producer must
+ // close this channel and release any resources used by the watch.
+ // Closing the result channel tells the consumer that no more events will be
+ // sent.
ResultChan() <-chan Event
}
@@ -322,3 +334,21 @@ func (pw *ProxyWatcher) ResultChan() <-chan Event {
func (pw *ProxyWatcher) StopChan() <-chan struct{} {
return pw.stopCh
}
+
+// MockWatcher implements watch.Interface with mockable functions.
+type MockWatcher struct {
+ StopFunc func()
+ ResultChanFunc func() <-chan Event
+}
+
+var _ Interface = &MockWatcher{}
+
+// Stop calls StopFunc
+func (mw MockWatcher) Stop() {
+ mw.StopFunc()
+}
+
+// ResultChan calls ResultChanFunc
+func (mw MockWatcher) ResultChan() <-chan Event {
+ return mw.ResultChanFunc()
+}
diff --git a/vendor/k8s.io/apimachinery/third_party/forked/golang/json/OWNERS b/vendor/k8s.io/apimachinery/third_party/forked/golang/json/OWNERS
index 3f72c69ba..349bc69d6 100644
--- a/vendor/k8s.io/apimachinery/third_party/forked/golang/json/OWNERS
+++ b/vendor/k8s.io/apimachinery/third_party/forked/golang/json/OWNERS
@@ -1,7 +1,6 @@
# See the OWNERS docs at https://go.k8s.io/owners
approvers:
-- pwittrock
+ - pwittrock
reviewers:
-- mengqiy
-- apelisse
+ - apelisse
diff --git a/vendor/k8s.io/apimachinery/third_party/forked/golang/json/fields.go b/vendor/k8s.io/apimachinery/third_party/forked/golang/json/fields.go
index 8205a4dd1..5b8514b3f 100644
--- a/vendor/k8s.io/apimachinery/third_party/forked/golang/json/fields.go
+++ b/vendor/k8s.io/apimachinery/third_party/forked/golang/json/fields.go
@@ -28,7 +28,7 @@ const (
// TODO: fix the returned errors to be introspectable.
func LookupPatchMetadataForStruct(t reflect.Type, jsonField string) (
elemType reflect.Type, patchStrategies []string, patchMergeKey string, e error) {
- if t.Kind() == reflect.Ptr {
+ if t.Kind() == reflect.Pointer {
t = t.Elem()
}
@@ -183,7 +183,7 @@ func typeFields(t reflect.Type) []field {
index[len(f.index)] = i
ft := sf.Type
- if ft.Name() == "" && ft.Kind() == reflect.Ptr {
+ if ft.Name() == "" && ft.Kind() == reflect.Pointer {
// Follow pointer.
ft = ft.Elem()
}
diff --git a/vendor/k8s.io/apimachinery/third_party/forked/golang/reflect/deep_equal.go b/vendor/k8s.io/apimachinery/third_party/forked/golang/reflect/deep_equal.go
index 6be80349a..511e625b6 100644
--- a/vendor/k8s.io/apimachinery/third_party/forked/golang/reflect/deep_equal.go
+++ b/vendor/k8s.io/apimachinery/third_party/forked/golang/reflect/deep_equal.go
@@ -100,7 +100,8 @@ func makeUsefulPanic(v reflect.Value) {
// Tests for deep equality using reflected types. The map argument tracks
// comparisons that have already been seen, which allows short circuiting on
// recursive types.
-func (e Equalities) deepValueEqual(v1, v2 reflect.Value, visited map[visit]bool, depth int) bool {
+// equateNilAndEmpty controls whether empty maps/slices are equivalent to nil
+func (e Equalities) deepValueEqual(v1, v2 reflect.Value, visited map[visit]bool, equateNilAndEmpty bool, depth int) bool {
defer makeUsefulPanic(v1)
if !v1.IsValid() || !v2.IsValid() {
@@ -150,17 +151,36 @@ func (e Equalities) deepValueEqual(v1, v2 reflect.Value, visited map[visit]bool,
// We don't need to check length here because length is part of
// an array's type, which has already been filtered for.
for i := 0; i < v1.Len(); i++ {
- if !e.deepValueEqual(v1.Index(i), v2.Index(i), visited, depth+1) {
+ if !e.deepValueEqual(v1.Index(i), v2.Index(i), visited, equateNilAndEmpty, depth+1) {
return false
}
}
return true
case reflect.Slice:
- if (v1.IsNil() || v1.Len() == 0) != (v2.IsNil() || v2.Len() == 0) {
- return false
- }
- if v1.IsNil() || v1.Len() == 0 {
- return true
+ if equateNilAndEmpty {
+ if (v1.IsNil() || v1.Len() == 0) != (v2.IsNil() || v2.Len() == 0) {
+ return false
+ }
+
+ if v1.IsNil() || v1.Len() == 0 {
+ return true
+ }
+ } else {
+ if v1.IsNil() != v2.IsNil() {
+ return false
+ }
+
+ // Optimize nil and empty cases
+ // Two lists that are BOTH nil are equal
+ // No need to check v2 is nil since v1.IsNil == v2.IsNil from above
+ if v1.IsNil() {
+ return true
+ }
+
+ // Two lists that are both empty and both non nil are equal
+ if v1.Len() == 0 || v2.Len() == 0 {
+ return true
+ }
}
if v1.Len() != v2.Len() {
return false
@@ -169,7 +189,7 @@ func (e Equalities) deepValueEqual(v1, v2 reflect.Value, visited map[visit]bool,
return true
}
for i := 0; i < v1.Len(); i++ {
- if !e.deepValueEqual(v1.Index(i), v2.Index(i), visited, depth+1) {
+ if !e.deepValueEqual(v1.Index(i), v2.Index(i), visited, equateNilAndEmpty, depth+1) {
return false
}
}
@@ -178,22 +198,40 @@ func (e Equalities) deepValueEqual(v1, v2 reflect.Value, visited map[visit]bool,
if v1.IsNil() || v2.IsNil() {
return v1.IsNil() == v2.IsNil()
}
- return e.deepValueEqual(v1.Elem(), v2.Elem(), visited, depth+1)
+ return e.deepValueEqual(v1.Elem(), v2.Elem(), visited, equateNilAndEmpty, depth+1)
case reflect.Ptr:
- return e.deepValueEqual(v1.Elem(), v2.Elem(), visited, depth+1)
+ return e.deepValueEqual(v1.Elem(), v2.Elem(), visited, equateNilAndEmpty, depth+1)
case reflect.Struct:
for i, n := 0, v1.NumField(); i < n; i++ {
- if !e.deepValueEqual(v1.Field(i), v2.Field(i), visited, depth+1) {
+ if !e.deepValueEqual(v1.Field(i), v2.Field(i), visited, equateNilAndEmpty, depth+1) {
return false
}
}
return true
case reflect.Map:
- if (v1.IsNil() || v1.Len() == 0) != (v2.IsNil() || v2.Len() == 0) {
- return false
- }
- if v1.IsNil() || v1.Len() == 0 {
- return true
+ if equateNilAndEmpty {
+ if (v1.IsNil() || v1.Len() == 0) != (v2.IsNil() || v2.Len() == 0) {
+ return false
+ }
+ if v1.IsNil() || v1.Len() == 0 {
+ return true
+ }
+ } else {
+ if v1.IsNil() != v2.IsNil() {
+ return false
+ }
+
+ // Optimize nil and empty cases
+ // Two maps that are BOTH nil are equal
+ // No need to check v2 is nil since v1.IsNil == v2.IsNil from above
+ if v1.IsNil() {
+ return true
+ }
+
+ // Two maps that are both empty and both non nil are equal
+ if v1.Len() == 0 || v2.Len() == 0 {
+ return true
+ }
}
if v1.Len() != v2.Len() {
return false
@@ -202,7 +240,7 @@ func (e Equalities) deepValueEqual(v1, v2 reflect.Value, visited map[visit]bool,
return true
}
for _, k := range v1.MapKeys() {
- if !e.deepValueEqual(v1.MapIndex(k), v2.MapIndex(k), visited, depth+1) {
+ if !e.deepValueEqual(v1.MapIndex(k), v2.MapIndex(k), visited, equateNilAndEmpty, depth+1) {
return false
}
}
@@ -232,6 +270,14 @@ func (e Equalities) deepValueEqual(v1, v2 reflect.Value, visited map[visit]bool,
// Unexported field members cannot be compared and will cause an informative panic; you must add an Equality
// function for these types.
func (e Equalities) DeepEqual(a1, a2 interface{}) bool {
+ return e.deepEqual(a1, a2, true)
+}
+
+func (e Equalities) DeepEqualWithNilDifferentFromEmpty(a1, a2 interface{}) bool {
+ return e.deepEqual(a1, a2, false)
+}
+
+func (e Equalities) deepEqual(a1, a2 interface{}, equateNilAndEmpty bool) bool {
if a1 == nil || a2 == nil {
return a1 == a2
}
@@ -240,7 +286,7 @@ func (e Equalities) DeepEqual(a1, a2 interface{}) bool {
if v1.Type() != v2.Type() {
return false
}
- return e.deepValueEqual(v1, v2, make(map[visit]bool), 0)
+ return e.deepValueEqual(v1, v2, make(map[visit]bool), equateNilAndEmpty, 0)
}
func (e Equalities) deepValueDerive(v1, v2 reflect.Value, visited map[visit]bool, depth int) bool {
@@ -327,7 +373,7 @@ func (e Equalities) deepValueDerive(v1, v2 reflect.Value, visited map[visit]bool
return true
}
return e.deepValueDerive(v1.Elem(), v2.Elem(), visited, depth+1)
- case reflect.Ptr:
+ case reflect.Pointer:
if v1.IsNil() {
return true
}
diff --git a/vendor/k8s.io/klog/v2/.golangci.yaml b/vendor/k8s.io/klog/v2/.golangci.yaml
new file mode 100644
index 000000000..0d77d65f0
--- /dev/null
+++ b/vendor/k8s.io/klog/v2/.golangci.yaml
@@ -0,0 +1,6 @@
+linters:
+ disable-all: true
+ enable: # sorted alphabetical
+ - gofmt
+ - misspell
+ - revive
diff --git a/vendor/k8s.io/klog/v2/OWNERS b/vendor/k8s.io/klog/v2/OWNERS
index ad5063fdf..7500475a6 100644
--- a/vendor/k8s.io/klog/v2/OWNERS
+++ b/vendor/k8s.io/klog/v2/OWNERS
@@ -1,19 +1,16 @@
# See the OWNERS docs at https://go.k8s.io/owners
reviewers:
- - jayunit100
- - hoegaarden
- - andyxning
- - neolit123
+ - harshanarayana
+ - mengjiao-liu
- pohly
- - yagonobre
- - vincepri
- - detiber
approvers:
- dims
+ - pohly
- thockin
- - justinsb
- - tallclair
- - piosz
+emeritus_approvers:
- brancz
+ - justinsb
- lavalamp
+ - piosz
- serathius
+ - tallclair
diff --git a/vendor/k8s.io/klog/v2/README.md b/vendor/k8s.io/klog/v2/README.md
index 64d29622e..d45cbe172 100644
--- a/vendor/k8s.io/klog/v2/README.md
+++ b/vendor/k8s.io/klog/v2/README.md
@@ -23,6 +23,20 @@ Historical context is available here:
* https://groups.google.com/forum/#!msg/kubernetes-sig-architecture/wCWiWf3Juzs/hXRVBH90CgAJ
* https://groups.google.com/forum/#!msg/kubernetes-dev/7vnijOMhLS0/1oRiNtigBgAJ
+## Release versioning
+
+Semantic versioning is used in this repository. It contains several Go modules
+with different levels of stability:
+- `k8s.io/klog/v2` - stable API, `vX.Y.Z` tags
+- `examples` - no stable API, no tags, no intention to ever stabilize
+
+Exempt from the API stability guarantee are items (packages, functions, etc.)
+which are marked explicitly as `EXPERIMENTAL` in their docs comment. Those
+may still change in incompatible ways or get removed entirely. This can only
+be used for code that is used in tests to avoid situations where non-test
+code from two different Kubernetes dependencies depends on incompatible
+releases of klog because an experimental API was changed.
+
----
How to use klog
@@ -32,6 +46,7 @@ How to use klog
- You can now use `log_file` instead of `log_dir` for logging to a single file (See `examples/log_file/usage_log_file.go`)
- If you want to redirect everything logged using klog somewhere else (say syslog!), you can use `klog.SetOutput()` method and supply a `io.Writer`. (See `examples/set_output/usage_set_output.go`)
- For more logging conventions (See [Logging Conventions](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/logging.md))
+- See our documentation on [pkg.go.dev/k8s.io](https://pkg.go.dev/k8s.io/klog).
**NOTE**: please use the newer go versions that support semantic import versioning in modules, ideally go 1.11.4 or greater.
@@ -85,7 +100,7 @@ The comment from glog.go introduces the ideas:
glog.Fatalf("Initialization failed: %s", err)
- See the documentation for the V function for an explanation
+ See the documentation of the V function for an explanation
of these examples:
if glog.V(2) {
diff --git a/vendor/k8s.io/klog/v2/contextual.go b/vendor/k8s.io/klog/v2/contextual.go
new file mode 100644
index 000000000..005513f2a
--- /dev/null
+++ b/vendor/k8s.io/klog/v2/contextual.go
@@ -0,0 +1,212 @@
+/*
+Copyright 2021 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package klog
+
+import (
+ "context"
+
+ "github.com/go-logr/logr"
+)
+
+// This file provides the implementation of
+// https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/1602-structured-logging
+//
+// SetLogger and ClearLogger were originally added to klog.go and got moved
+// here. Contextual logging adds a way to retrieve a Logger for direct logging
+// without the logging calls in klog.go.
+//
+// The global variables are expected to be modified only during sequential
+// parts of a program (init, serial tests) and therefore are not protected by
+// mutex locking.
+
+var (
+ // klogLogger is used as fallback for logging through the normal klog code
+ // when no Logger is set.
+ klogLogger logr.Logger = logr.New(&klogger{})
+)
+
+// SetLogger sets a Logger implementation that will be used as backing
+// implementation of the traditional klog log calls. klog will do its own
+// verbosity checks before calling logger.V().Info. logger.Error is always
+// called, regardless of the klog verbosity settings.
+//
+// If set, all log lines will be suppressed from the regular output, and
+// redirected to the logr implementation.
+// Use as:
+//
+// ...
+// klog.SetLogger(zapr.NewLogger(zapLog))
+//
+// To remove a backing logr implemention, use ClearLogger. Setting an
+// empty logger with SetLogger(logr.Logger{}) does not work.
+//
+// Modifying the logger is not thread-safe and should be done while no other
+// goroutines invoke log calls, usually during program initialization.
+func SetLogger(logger logr.Logger) {
+ SetLoggerWithOptions(logger)
+}
+
+// SetLoggerWithOptions is a more flexible version of SetLogger. Without
+// additional options, it behaves exactly like SetLogger. By passing
+// ContextualLogger(true) as option, it can be used to set a logger that then
+// will also get called directly by applications which retrieve it via
+// FromContext, Background, or TODO.
+//
+// Supporting direct calls is recommended because it avoids the overhead of
+// routing log entries through klogr into klog and then into the actual Logger
+// backend.
+func SetLoggerWithOptions(logger logr.Logger, opts ...LoggerOption) {
+ logging.loggerOptions = loggerOptions{}
+ for _, opt := range opts {
+ opt(&logging.loggerOptions)
+ }
+ logging.logger = &logWriter{
+ Logger: logger,
+ writeKlogBuffer: logging.loggerOptions.writeKlogBuffer,
+ }
+}
+
+// ContextualLogger determines whether the logger passed to
+// SetLoggerWithOptions may also get called directly. Such a logger cannot rely
+// on verbosity checking in klog.
+func ContextualLogger(enabled bool) LoggerOption {
+ return func(o *loggerOptions) {
+ o.contextualLogger = enabled
+ }
+}
+
+// FlushLogger provides a callback for flushing data buffered by the logger.
+func FlushLogger(flush func()) LoggerOption {
+ return func(o *loggerOptions) {
+ o.flush = flush
+ }
+}
+
+// WriteKlogBuffer sets a callback that will be invoked by klog to write output
+// produced by non-structured log calls like Infof.
+//
+// The buffer will contain exactly the same data that klog normally would write
+// into its own output stream(s). In particular this includes the header, if
+// klog is configured to write one. The callback then can divert that data into
+// its own output streams. The buffer may or may not end in a line break.
+//
+// Without such a callback, klog will call the logger's Info or Error method
+// with just the message string (i.e. no header).
+func WriteKlogBuffer(write func([]byte)) LoggerOption {
+ return func(o *loggerOptions) {
+ o.writeKlogBuffer = write
+ }
+}
+
+// LoggerOption implements the functional parameter paradigm for
+// SetLoggerWithOptions.
+type LoggerOption func(o *loggerOptions)
+
+type loggerOptions struct {
+ contextualLogger bool
+ flush func()
+ writeKlogBuffer func([]byte)
+}
+
+// logWriter combines a logger (always set) with a write callback (optional).
+type logWriter struct {
+ Logger
+ writeKlogBuffer func([]byte)
+}
+
+// ClearLogger removes a backing Logger implementation if one was set earlier
+// with SetLogger.
+//
+// Modifying the logger is not thread-safe and should be done while no other
+// goroutines invoke log calls, usually during program initialization.
+func ClearLogger() {
+ logging.logger = nil
+ logging.loggerOptions = loggerOptions{}
+}
+
+// EnableContextualLogging controls whether contextual logging is enabled.
+// By default it is enabled. When disabled, FromContext avoids looking up
+// the logger in the context and always returns the global logger.
+// LoggerWithValues, LoggerWithName, and NewContext become no-ops
+// and return their input logger respectively context. This may be useful
+// to avoid the additional overhead for contextual logging.
+//
+// This must be called during initialization before goroutines are started.
+func EnableContextualLogging(enabled bool) {
+ logging.contextualLoggingEnabled = enabled
+}
+
+// FromContext retrieves a logger set by the caller or, if not set,
+// falls back to the program's global logger (a Logger instance or klog
+// itself).
+func FromContext(ctx context.Context) Logger {
+ if logging.contextualLoggingEnabled {
+ if logger, err := logr.FromContext(ctx); err == nil {
+ return logger
+ }
+ }
+
+ return Background()
+}
+
+// TODO can be used as a last resort by code that has no means of
+// receiving a logger from its caller. FromContext or an explicit logger
+// parameter should be used instead.
+func TODO() Logger {
+ return Background()
+}
+
+// Background retrieves the fallback logger. It should not be called before
+// that logger was initialized by the program and not by code that should
+// better receive a logger via its parameters. TODO can be used as a temporary
+// solution for such code.
+func Background() Logger {
+ if logging.loggerOptions.contextualLogger {
+ // Is non-nil because logging.loggerOptions.contextualLogger is
+ // only true if a logger was set.
+ return logging.logger.Logger
+ }
+
+ return klogLogger
+}
+
+// LoggerWithValues returns logger.WithValues(...kv) when
+// contextual logging is enabled, otherwise the logger.
+func LoggerWithValues(logger Logger, kv ...interface{}) Logger {
+ if logging.contextualLoggingEnabled {
+ return logger.WithValues(kv...)
+ }
+ return logger
+}
+
+// LoggerWithName returns logger.WithName(name) when contextual logging is
+// enabled, otherwise the logger.
+func LoggerWithName(logger Logger, name string) Logger {
+ if logging.contextualLoggingEnabled {
+ return logger.WithName(name)
+ }
+ return logger
+}
+
+// NewContext returns logr.NewContext(ctx, logger) when
+// contextual logging is enabled, otherwise ctx.
+func NewContext(ctx context.Context, logger Logger) context.Context {
+ if logging.contextualLoggingEnabled {
+ return logr.NewContext(ctx, logger)
+ }
+ return ctx
+}
diff --git a/vendor/k8s.io/klog/v2/contextual_slog.go b/vendor/k8s.io/klog/v2/contextual_slog.go
new file mode 100644
index 000000000..d3b562521
--- /dev/null
+++ b/vendor/k8s.io/klog/v2/contextual_slog.go
@@ -0,0 +1,31 @@
+//go:build go1.21
+// +build go1.21
+
+/*
+Copyright 2021 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package klog
+
+import (
+ "log/slog"
+
+ "github.com/go-logr/logr"
+)
+
+// SetSlogLogger reconfigures klog to log through the slog logger. The logger must not be nil.
+func SetSlogLogger(logger *slog.Logger) {
+ SetLoggerWithOptions(logr.FromSlogHandler(logger.Handler()), ContextualLogger(true))
+}
diff --git a/vendor/k8s.io/klog/v2/exit.go b/vendor/k8s.io/klog/v2/exit.go
new file mode 100644
index 000000000..320a14772
--- /dev/null
+++ b/vendor/k8s.io/klog/v2/exit.go
@@ -0,0 +1,69 @@
+// Go support for leveled logs, analogous to https://code.google.com/p/google-glog/
+//
+// Copyright 2013 Google Inc. All Rights Reserved.
+// Copyright 2022 The Kubernetes Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package klog
+
+import (
+ "fmt"
+ "os"
+ "time"
+)
+
+var (
+
+ // ExitFlushTimeout is the timeout that klog has traditionally used during
+ // calls like Fatal or Exit when flushing log data right before exiting.
+ // Applications that replace those calls and do not have some specific
+ // requirements like "exit immediately" can use this value as parameter
+ // for FlushAndExit.
+ //
+ // Can be set for testing purpose or to change the application's
+ // default.
+ ExitFlushTimeout = 10 * time.Second
+
+ // OsExit is the function called by FlushAndExit to terminate the program.
+ //
+ // Can be set for testing purpose or to change the application's
+ // default behavior. Note that the function should not simply return
+ // because callers of functions like Fatal will not expect that.
+ OsExit = os.Exit
+)
+
+// FlushAndExit flushes log data for a certain amount of time and then calls
+// os.Exit. Combined with some logging call it provides a replacement for
+// traditional calls like Fatal or Exit.
+func FlushAndExit(flushTimeout time.Duration, exitCode int) {
+ timeoutFlush(flushTimeout)
+ OsExit(exitCode)
+}
+
+// timeoutFlush calls Flush and returns when it completes or after timeout
+// elapses, whichever happens first. This is needed because the hooks invoked
+// by Flush may deadlock when klog.Fatal is called from a hook that holds
+// a lock. Flushing also might take too long.
+func timeoutFlush(timeout time.Duration) {
+ done := make(chan bool, 1)
+ go func() {
+ Flush() // calls logging.lockAndFlushAll()
+ done <- true
+ }()
+ select {
+ case <-done:
+ case <-time.After(timeout):
+ fmt.Fprintln(os.Stderr, "klog: Flush took longer than", timeout)
+ }
+}
diff --git a/vendor/k8s.io/klog/v2/format.go b/vendor/k8s.io/klog/v2/format.go
new file mode 100644
index 000000000..63995ca6d
--- /dev/null
+++ b/vendor/k8s.io/klog/v2/format.go
@@ -0,0 +1,65 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package klog
+
+import (
+ "encoding/json"
+ "fmt"
+ "strings"
+
+ "github.com/go-logr/logr"
+)
+
+// Format wraps a value of an arbitrary type and implement fmt.Stringer and
+// logr.Marshaler for them. Stringer returns pretty-printed JSON. MarshalLog
+// returns the original value with a type that has no special methods, in
+// particular no MarshalLog or MarshalJSON.
+//
+// Wrapping values like that is useful when the value has a broken
+// implementation of these special functions (for example, a type which
+// inherits String from TypeMeta, but then doesn't re-implement String) or the
+// implementation produces output that is less readable or unstructured (for
+// example, the generated String functions for Kubernetes API types).
+func Format(obj interface{}) interface{} {
+ return formatAny{Object: obj}
+}
+
+type formatAny struct {
+ Object interface{}
+}
+
+func (f formatAny) String() string {
+ var buffer strings.Builder
+ encoder := json.NewEncoder(&buffer)
+ encoder.SetIndent("", " ")
+ if err := encoder.Encode(&f.Object); err != nil {
+ return fmt.Sprintf("error marshaling %T to JSON: %v", f, err)
+ }
+ return buffer.String()
+}
+
+func (f formatAny) MarshalLog() interface{} {
+ // Returning a pointer to a pointer ensures that zapr doesn't find a
+ // fmt.Stringer or logr.Marshaler when it checks the type of the
+ // value. It then falls back to reflection, which dumps the value being
+ // pointed to (JSON doesn't have pointers).
+ ptr := &f.Object
+ return &ptr
+}
+
+var _ fmt.Stringer = formatAny{}
+var _ logr.Marshaler = formatAny{}
diff --git a/vendor/k8s.io/klog/v2/imports.go b/vendor/k8s.io/klog/v2/imports.go
new file mode 100644
index 000000000..602c3ed9e
--- /dev/null
+++ b/vendor/k8s.io/klog/v2/imports.go
@@ -0,0 +1,38 @@
+/*
+Copyright 2021 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package klog
+
+import (
+ "github.com/go-logr/logr"
+)
+
+// The reason for providing these aliases is to allow code to work with logr
+// without directly importing it.
+
+// Logger in this package is exactly the same as logr.Logger.
+type Logger = logr.Logger
+
+// LogSink in this package is exactly the same as logr.LogSink.
+type LogSink = logr.LogSink
+
+// Runtimeinfo in this package is exactly the same as logr.RuntimeInfo.
+type RuntimeInfo = logr.RuntimeInfo
+
+var (
+ // New is an alias for logr.New.
+ New = logr.New
+)
diff --git a/vendor/k8s.io/klog/v2/internal/buffer/buffer.go b/vendor/k8s.io/klog/v2/internal/buffer/buffer.go
new file mode 100644
index 000000000..46de00fb0
--- /dev/null
+++ b/vendor/k8s.io/klog/v2/internal/buffer/buffer.go
@@ -0,0 +1,184 @@
+// Copyright 2013 Google Inc. All Rights Reserved.
+// Copyright 2022 The Kubernetes Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package buffer provides a cache for byte.Buffer instances that can be reused
+// to avoid frequent allocation and deallocation. It also has utility code
+// for log header formatting that use these buffers.
+package buffer
+
+import (
+ "bytes"
+ "os"
+ "sync"
+ "time"
+
+ "k8s.io/klog/v2/internal/severity"
+)
+
+var (
+ // Pid is inserted into log headers. Can be overridden for tests.
+ Pid = os.Getpid()
+
+ // Time, if set, will be used instead of the actual current time.
+ Time *time.Time
+)
+
+// Buffer holds a single byte.Buffer for reuse. The zero value is ready for
+// use. It also provides some helper methods for output formatting.
+type Buffer struct {
+ bytes.Buffer
+ Tmp [64]byte // temporary byte array for creating headers.
+}
+
+var buffers = sync.Pool{
+ New: func() interface{} {
+ return new(Buffer)
+ },
+}
+
+// GetBuffer returns a new, ready-to-use buffer.
+func GetBuffer() *Buffer {
+ b := buffers.Get().(*Buffer)
+ b.Reset()
+ return b
+}
+
+// PutBuffer returns a buffer to the free list.
+func PutBuffer(b *Buffer) {
+ if b.Len() >= 256 {
+ // Let big buffers die a natural death, without relying on
+ // sync.Pool behavior. The documentation implies that items may
+ // get deallocated while stored there ("If the Pool holds the
+ // only reference when this [= be removed automatically]
+ // happens, the item might be deallocated."), but
+ // https://github.com/golang/go/issues/23199 leans more towards
+ // having such a size limit.
+ return
+ }
+
+ buffers.Put(b)
+}
+
+// Some custom tiny helper functions to print the log header efficiently.
+
+const digits = "0123456789"
+
+// twoDigits formats a zero-prefixed two-digit integer at buf.Tmp[i].
+func (buf *Buffer) twoDigits(i, d int) {
+ buf.Tmp[i+1] = digits[d%10]
+ d /= 10
+ buf.Tmp[i] = digits[d%10]
+}
+
+// nDigits formats an n-digit integer at buf.Tmp[i],
+// padding with pad on the left.
+// It assumes d >= 0.
+func (buf *Buffer) nDigits(n, i, d int, pad byte) {
+ j := n - 1
+ for ; j >= 0 && d > 0; j-- {
+ buf.Tmp[i+j] = digits[d%10]
+ d /= 10
+ }
+ for ; j >= 0; j-- {
+ buf.Tmp[i+j] = pad
+ }
+}
+
+// someDigits formats a zero-prefixed variable-width integer at buf.Tmp[i].
+func (buf *Buffer) someDigits(i, d int) int {
+ // Print into the top, then copy down. We know there's space for at least
+ // a 10-digit number.
+ j := len(buf.Tmp)
+ for {
+ j--
+ buf.Tmp[j] = digits[d%10]
+ d /= 10
+ if d == 0 {
+ break
+ }
+ }
+ return copy(buf.Tmp[i:], buf.Tmp[j:])
+}
+
+// FormatHeader formats a log header using the provided file name and line number
+// and writes it into the buffer.
+func (buf *Buffer) FormatHeader(s severity.Severity, file string, line int, now time.Time) {
+ if line < 0 {
+ line = 0 // not a real line number, but acceptable to someDigits
+ }
+ if s > severity.FatalLog {
+ s = severity.InfoLog // for safety.
+ }
+
+ // Avoid Fprintf, for speed. The format is so simple that we can do it quickly by hand.
+ // It's worth about 3X. Fprintf is hard.
+ if Time != nil {
+ now = *Time
+ }
+ _, month, day := now.Date()
+ hour, minute, second := now.Clock()
+ // Lmmdd hh:mm:ss.uuuuuu threadid file:line]
+ buf.Tmp[0] = severity.Char[s]
+ buf.twoDigits(1, int(month))
+ buf.twoDigits(3, day)
+ buf.Tmp[5] = ' '
+ buf.twoDigits(6, hour)
+ buf.Tmp[8] = ':'
+ buf.twoDigits(9, minute)
+ buf.Tmp[11] = ':'
+ buf.twoDigits(12, second)
+ buf.Tmp[14] = '.'
+ buf.nDigits(6, 15, now.Nanosecond()/1000, '0')
+ buf.Tmp[21] = ' '
+ buf.nDigits(7, 22, Pid, ' ') // TODO: should be TID
+ buf.Tmp[29] = ' '
+ buf.Write(buf.Tmp[:30])
+ buf.WriteString(file)
+ buf.Tmp[0] = ':'
+ n := buf.someDigits(1, line)
+ buf.Tmp[n+1] = ']'
+ buf.Tmp[n+2] = ' '
+ buf.Write(buf.Tmp[:n+3])
+}
+
+// SprintHeader formats a log header and returns a string. This is a simpler
+// version of FormatHeader for use in ktesting.
+func (buf *Buffer) SprintHeader(s severity.Severity, now time.Time) string {
+ if s > severity.FatalLog {
+ s = severity.InfoLog // for safety.
+ }
+
+ // Avoid Fprintf, for speed. The format is so simple that we can do it quickly by hand.
+ // It's worth about 3X. Fprintf is hard.
+ if Time != nil {
+ now = *Time
+ }
+ _, month, day := now.Date()
+ hour, minute, second := now.Clock()
+ // Lmmdd hh:mm:ss.uuuuuu threadid file:line]
+ buf.Tmp[0] = severity.Char[s]
+ buf.twoDigits(1, int(month))
+ buf.twoDigits(3, day)
+ buf.Tmp[5] = ' '
+ buf.twoDigits(6, hour)
+ buf.Tmp[8] = ':'
+ buf.twoDigits(9, minute)
+ buf.Tmp[11] = ':'
+ buf.twoDigits(12, second)
+ buf.Tmp[14] = '.'
+ buf.nDigits(6, 15, now.Nanosecond()/1000, '0')
+ buf.Tmp[21] = ']'
+ return string(buf.Tmp[:22])
+}
diff --git a/vendor/k8s.io/klog/v2/internal/clock/README.md b/vendor/k8s.io/klog/v2/internal/clock/README.md
new file mode 100644
index 000000000..03d692c8f
--- /dev/null
+++ b/vendor/k8s.io/klog/v2/internal/clock/README.md
@@ -0,0 +1,7 @@
+# Clock
+
+This package provides an interface for time-based operations. It allows
+mocking time for testing.
+
+This is a copy of k8s.io/utils/clock. We have to copy it to avoid a circular
+dependency (k8s.io/klog -> k8s.io/utils -> k8s.io/klog).
diff --git a/vendor/k8s.io/klog/v2/internal/clock/clock.go b/vendor/k8s.io/klog/v2/internal/clock/clock.go
new file mode 100644
index 000000000..cc11bb480
--- /dev/null
+++ b/vendor/k8s.io/klog/v2/internal/clock/clock.go
@@ -0,0 +1,161 @@
+/*
+Copyright 2014 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package clock
+
+import "time"
+
+// PassiveClock allows for injecting fake or real clocks into code
+// that needs to read the current time but does not support scheduling
+// activity in the future.
+type PassiveClock interface {
+ Now() time.Time
+ Since(time.Time) time.Duration
+}
+
+// Clock allows for injecting fake or real clocks into code that
+// needs to do arbitrary things based on time.
+type Clock interface {
+ PassiveClock
+ // After returns the channel of a new Timer.
+ // This method does not allow to free/GC the backing timer before it fires. Use
+ // NewTimer instead.
+ After(d time.Duration) <-chan time.Time
+ // NewTimer returns a new Timer.
+ NewTimer(d time.Duration) Timer
+ // Sleep sleeps for the provided duration d.
+ // Consider making the sleep interruptible by using 'select' on a context channel and a timer channel.
+ Sleep(d time.Duration)
+ // NewTicker returns a new Ticker.
+ NewTicker(time.Duration) Ticker
+}
+
+// WithDelayedExecution allows for injecting fake or real clocks into
+// code that needs to make use of AfterFunc functionality.
+type WithDelayedExecution interface {
+ Clock
+ // AfterFunc executes f in its own goroutine after waiting
+ // for d duration and returns a Timer whose channel can be
+ // closed by calling Stop() on the Timer.
+ AfterFunc(d time.Duration, f func()) Timer
+}
+
+// WithTickerAndDelayedExecution allows for injecting fake or real clocks
+// into code that needs Ticker and AfterFunc functionality
+type WithTickerAndDelayedExecution interface {
+ Clock
+ // AfterFunc executes f in its own goroutine after waiting
+ // for d duration and returns a Timer whose channel can be
+ // closed by calling Stop() on the Timer.
+ AfterFunc(d time.Duration, f func()) Timer
+}
+
+// Ticker defines the Ticker interface.
+type Ticker interface {
+ C() <-chan time.Time
+ Stop()
+}
+
+var _ Clock = RealClock{}
+
+// RealClock really calls time.Now()
+type RealClock struct{}
+
+// Now returns the current time.
+func (RealClock) Now() time.Time {
+ return time.Now()
+}
+
+// Since returns time since the specified timestamp.
+func (RealClock) Since(ts time.Time) time.Duration {
+ return time.Since(ts)
+}
+
+// After is the same as time.After(d).
+// This method does not allow to free/GC the backing timer before it fires. Use
+// NewTimer instead.
+func (RealClock) After(d time.Duration) <-chan time.Time {
+ return time.After(d)
+}
+
+// NewTimer is the same as time.NewTimer(d)
+func (RealClock) NewTimer(d time.Duration) Timer {
+ return &realTimer{
+ timer: time.NewTimer(d),
+ }
+}
+
+// AfterFunc is the same as time.AfterFunc(d, f).
+func (RealClock) AfterFunc(d time.Duration, f func()) Timer {
+ return &realTimer{
+ timer: time.AfterFunc(d, f),
+ }
+}
+
+// NewTicker returns a new Ticker.
+func (RealClock) NewTicker(d time.Duration) Ticker {
+ return &realTicker{
+ ticker: time.NewTicker(d),
+ }
+}
+
+// Sleep is the same as time.Sleep(d)
+// Consider making the sleep interruptible by using 'select' on a context channel and a timer channel.
+func (RealClock) Sleep(d time.Duration) {
+ time.Sleep(d)
+}
+
+// Timer allows for injecting fake or real timers into code that
+// needs to do arbitrary things based on time.
+type Timer interface {
+ C() <-chan time.Time
+ Stop() bool
+ Reset(d time.Duration) bool
+}
+
+var _ = Timer(&realTimer{})
+
+// realTimer is backed by an actual time.Timer.
+type realTimer struct {
+ timer *time.Timer
+}
+
+// C returns the underlying timer's channel.
+func (r *realTimer) C() <-chan time.Time {
+ return r.timer.C
+}
+
+// Stop calls Stop() on the underlying timer.
+func (r *realTimer) Stop() bool {
+ return r.timer.Stop()
+}
+
+// Reset calls Reset() on the underlying timer.
+func (r *realTimer) Reset(d time.Duration) bool {
+ return r.timer.Reset(d)
+}
+
+type realTicker struct {
+ ticker *time.Ticker
+}
+
+func (r *realTicker) C() <-chan time.Time {
+ return r.ticker.C
+}
+
+func (r *realTicker) Stop() {
+ r.ticker.Stop()
+}
diff --git a/vendor/k8s.io/klog/v2/internal/dbg/dbg.go b/vendor/k8s.io/klog/v2/internal/dbg/dbg.go
new file mode 100644
index 000000000..f27bd1447
--- /dev/null
+++ b/vendor/k8s.io/klog/v2/internal/dbg/dbg.go
@@ -0,0 +1,42 @@
+// Go support for leveled logs, analogous to https://code.google.com/p/google-glog/
+//
+// Copyright 2013 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package dbg provides some helper code for call traces.
+package dbg
+
+import (
+ "runtime"
+)
+
+// Stacks is a wrapper for runtime.Stack that attempts to recover the data for
+// all goroutines or the calling one.
+func Stacks(all bool) []byte {
+ // We don't know how big the traces are, so grow a few times if they don't fit. Start large, though.
+ n := 10000
+ if all {
+ n = 100000
+ }
+ var trace []byte
+ for i := 0; i < 5; i++ {
+ trace = make([]byte, n)
+ nbytes := runtime.Stack(trace, all)
+ if nbytes < len(trace) {
+ return trace[:nbytes]
+ }
+ n *= 2
+ }
+ return trace
+}
diff --git a/vendor/k8s.io/klog/v2/internal/serialize/keyvalues.go b/vendor/k8s.io/klog/v2/internal/serialize/keyvalues.go
new file mode 100644
index 000000000..d1a4751c9
--- /dev/null
+++ b/vendor/k8s.io/klog/v2/internal/serialize/keyvalues.go
@@ -0,0 +1,292 @@
+/*
+Copyright 2021 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package serialize
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "strconv"
+
+ "github.com/go-logr/logr"
+)
+
+type textWriter interface {
+ WriteText(*bytes.Buffer)
+}
+
+// WithValues implements LogSink.WithValues. The old key/value pairs are
+// assumed to be well-formed, the new ones are checked and padded if
+// necessary. It returns a new slice.
+func WithValues(oldKV, newKV []interface{}) []interface{} {
+ if len(newKV) == 0 {
+ return oldKV
+ }
+ newLen := len(oldKV) + len(newKV)
+ hasMissingValue := newLen%2 != 0
+ if hasMissingValue {
+ newLen++
+ }
+ // The new LogSink must have its own slice.
+ kv := make([]interface{}, 0, newLen)
+ kv = append(kv, oldKV...)
+ kv = append(kv, newKV...)
+ if hasMissingValue {
+ kv = append(kv, missingValue)
+ }
+ return kv
+}
+
+// MergeKVs deduplicates elements provided in two key/value slices.
+//
+// Keys in each slice are expected to be unique, so duplicates can only occur
+// when the first and second slice contain the same key. When that happens, the
+// key/value pair from the second slice is used. The first slice must be well-formed
+// (= even key/value pairs). The second one may have a missing value, in which
+// case the special "missing value" is added to the result.
+func MergeKVs(first, second []interface{}) []interface{} {
+ maxLength := len(first) + (len(second)+1)/2*2
+ if maxLength == 0 {
+ // Nothing to do at all.
+ return nil
+ }
+
+ if len(first) == 0 && len(second)%2 == 0 {
+ // Nothing to be overridden, second slice is well-formed
+ // and can be used directly.
+ return second
+ }
+
+ // Determine which keys are in the second slice so that we can skip
+ // them when iterating over the first one. The code intentionally
+ // favors performance over completeness: we assume that keys are string
+ // constants and thus compare equal when the string values are equal. A
+ // string constant being overridden by, for example, a fmt.Stringer is
+ // not handled.
+ overrides := map[interface{}]bool{}
+ for i := 0; i < len(second); i += 2 {
+ overrides[second[i]] = true
+ }
+ merged := make([]interface{}, 0, maxLength)
+ for i := 0; i+1 < len(first); i += 2 {
+ key := first[i]
+ if overrides[key] {
+ continue
+ }
+ merged = append(merged, key, first[i+1])
+ }
+ merged = append(merged, second...)
+ if len(merged)%2 != 0 {
+ merged = append(merged, missingValue)
+ }
+ return merged
+}
+
+type Formatter struct {
+ AnyToStringHook AnyToStringFunc
+}
+
+type AnyToStringFunc func(v interface{}) string
+
+// MergeKVsInto is a variant of MergeKVs which directly formats the key/value
+// pairs into a buffer.
+func (f Formatter) MergeAndFormatKVs(b *bytes.Buffer, first, second []interface{}) {
+ if len(first) == 0 && len(second) == 0 {
+ // Nothing to do at all.
+ return
+ }
+
+ if len(first) == 0 && len(second)%2 == 0 {
+ // Nothing to be overridden, second slice is well-formed
+ // and can be used directly.
+ for i := 0; i < len(second); i += 2 {
+ f.KVFormat(b, second[i], second[i+1])
+ }
+ return
+ }
+
+ // Determine which keys are in the second slice so that we can skip
+ // them when iterating over the first one. The code intentionally
+ // favors performance over completeness: we assume that keys are string
+ // constants and thus compare equal when the string values are equal. A
+ // string constant being overridden by, for example, a fmt.Stringer is
+ // not handled.
+ overrides := map[interface{}]bool{}
+ for i := 0; i < len(second); i += 2 {
+ overrides[second[i]] = true
+ }
+ for i := 0; i < len(first); i += 2 {
+ key := first[i]
+ if overrides[key] {
+ continue
+ }
+ f.KVFormat(b, key, first[i+1])
+ }
+ // Round down.
+ l := len(second)
+ l = l / 2 * 2
+ for i := 1; i < l; i += 2 {
+ f.KVFormat(b, second[i-1], second[i])
+ }
+ if len(second)%2 == 1 {
+ f.KVFormat(b, second[len(second)-1], missingValue)
+ }
+}
+
+func MergeAndFormatKVs(b *bytes.Buffer, first, second []interface{}) {
+ Formatter{}.MergeAndFormatKVs(b, first, second)
+}
+
+const missingValue = "(MISSING)"
+
+// KVListFormat serializes all key/value pairs into the provided buffer.
+// A space gets inserted before the first pair and between each pair.
+func (f Formatter) KVListFormat(b *bytes.Buffer, keysAndValues ...interface{}) {
+ for i := 0; i < len(keysAndValues); i += 2 {
+ var v interface{}
+ k := keysAndValues[i]
+ if i+1 < len(keysAndValues) {
+ v = keysAndValues[i+1]
+ } else {
+ v = missingValue
+ }
+ f.KVFormat(b, k, v)
+ }
+}
+
+func KVListFormat(b *bytes.Buffer, keysAndValues ...interface{}) {
+ Formatter{}.KVListFormat(b, keysAndValues...)
+}
+
+func KVFormat(b *bytes.Buffer, k, v interface{}) {
+ Formatter{}.KVFormat(b, k, v)
+}
+
+// formatAny is the fallback formatter for a value. It supports a hook (for
+// example, for YAML encoding) and itself uses JSON encoding.
+func (f Formatter) formatAny(b *bytes.Buffer, v interface{}) {
+ b.WriteRune('=')
+ if f.AnyToStringHook != nil {
+ b.WriteString(f.AnyToStringHook(v))
+ return
+ }
+ formatAsJSON(b, v)
+}
+
+func formatAsJSON(b *bytes.Buffer, v interface{}) {
+ encoder := json.NewEncoder(b)
+ l := b.Len()
+ if err := encoder.Encode(v); err != nil {
+ // This shouldn't happen. We discard whatever the encoder
+ // wrote and instead dump an error string.
+ b.Truncate(l)
+ b.WriteString(fmt.Sprintf(`""`, err))
+ return
+ }
+ // Remove trailing newline.
+ b.Truncate(b.Len() - 1)
+}
+
+// StringerToString converts a Stringer to a string,
+// handling panics if they occur.
+func StringerToString(s fmt.Stringer) (ret string) {
+ defer func() {
+ if err := recover(); err != nil {
+ ret = fmt.Sprintf("", err)
+ }
+ }()
+ ret = s.String()
+ return
+}
+
+// MarshalerToValue invokes a marshaler and catches
+// panics.
+func MarshalerToValue(m logr.Marshaler) (ret interface{}) {
+ defer func() {
+ if err := recover(); err != nil {
+ ret = fmt.Sprintf("", err)
+ }
+ }()
+ ret = m.MarshalLog()
+ return
+}
+
+// ErrorToString converts an error to a string,
+// handling panics if they occur.
+func ErrorToString(err error) (ret string) {
+ defer func() {
+ if err := recover(); err != nil {
+ ret = fmt.Sprintf("", err)
+ }
+ }()
+ ret = err.Error()
+ return
+}
+
+func writeTextWriterValue(b *bytes.Buffer, v textWriter) {
+ b.WriteByte('=')
+ defer func() {
+ if err := recover(); err != nil {
+ fmt.Fprintf(b, `""`, err)
+ }
+ }()
+ v.WriteText(b)
+}
+
+func writeStringValue(b *bytes.Buffer, v string) {
+ data := []byte(v)
+ index := bytes.IndexByte(data, '\n')
+ if index == -1 {
+ b.WriteByte('=')
+ // Simple string, quote quotation marks and non-printable characters.
+ b.WriteString(strconv.Quote(v))
+ return
+ }
+
+ // Complex multi-line string, show as-is with indention like this:
+ // I... "hello world" key=<
+ // line 1
+ // line 2
+ // >
+ //
+ // Tabs indent the lines of the value while the end of string delimiter
+ // is indented with a space. That has two purposes:
+ // - visual difference between the two for a human reader because indention
+ // will be different
+ // - no ambiguity when some value line starts with the end delimiter
+ //
+ // One downside is that the output cannot distinguish between strings that
+ // end with a line break and those that don't because the end delimiter
+ // will always be on the next line.
+ b.WriteString("=<\n")
+ for index != -1 {
+ b.WriteByte('\t')
+ b.Write(data[0 : index+1])
+ data = data[index+1:]
+ index = bytes.IndexByte(data, '\n')
+ }
+ if len(data) == 0 {
+ // String ended with line break, don't add another.
+ b.WriteString(" >")
+ } else {
+ // No line break at end of last line, write rest of string and
+ // add one.
+ b.WriteByte('\t')
+ b.Write(data)
+ b.WriteString("\n >")
+ }
+}
diff --git a/vendor/k8s.io/klog/v2/internal/serialize/keyvalues_no_slog.go b/vendor/k8s.io/klog/v2/internal/serialize/keyvalues_no_slog.go
new file mode 100644
index 000000000..d9c7d1546
--- /dev/null
+++ b/vendor/k8s.io/klog/v2/internal/serialize/keyvalues_no_slog.go
@@ -0,0 +1,97 @@
+//go:build !go1.21
+// +build !go1.21
+
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package serialize
+
+import (
+ "bytes"
+ "fmt"
+
+ "github.com/go-logr/logr"
+)
+
+// KVFormat serializes one key/value pair into the provided buffer.
+// A space gets inserted before the pair.
+func (f Formatter) KVFormat(b *bytes.Buffer, k, v interface{}) {
+ // This is the version without slog support. Must be kept in sync with
+ // the version in keyvalues_slog.go.
+
+ b.WriteByte(' ')
+ // Keys are assumed to be well-formed according to
+ // https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/migration-to-structured-logging.md#name-arguments
+ // for the sake of performance. Keys with spaces,
+ // special characters, etc. will break parsing.
+ if sK, ok := k.(string); ok {
+ // Avoid one allocation when the key is a string, which
+ // normally it should be.
+ b.WriteString(sK)
+ } else {
+ b.WriteString(fmt.Sprintf("%s", k))
+ }
+
+ // The type checks are sorted so that more frequently used ones
+ // come first because that is then faster in the common
+ // cases. In Kubernetes, ObjectRef (a Stringer) is more common
+ // than plain strings
+ // (https://github.com/kubernetes/kubernetes/pull/106594#issuecomment-975526235).
+ switch v := v.(type) {
+ case textWriter:
+ writeTextWriterValue(b, v)
+ case fmt.Stringer:
+ writeStringValue(b, StringerToString(v))
+ case string:
+ writeStringValue(b, v)
+ case error:
+ writeStringValue(b, ErrorToString(v))
+ case logr.Marshaler:
+ value := MarshalerToValue(v)
+ // A marshaler that returns a string is useful for
+ // delayed formatting of complex values. We treat this
+ // case like a normal string. This is useful for
+ // multi-line support.
+ //
+ // We could do this by recursively formatting a value,
+ // but that comes with the risk of infinite recursion
+ // if a marshaler returns itself. Instead we call it
+ // only once and rely on it returning the intended
+ // value directly.
+ switch value := value.(type) {
+ case string:
+ writeStringValue(b, value)
+ default:
+ f.formatAny(b, value)
+ }
+ case []byte:
+ // In https://github.com/kubernetes/klog/pull/237 it was decided
+ // to format byte slices with "%+q". The advantages of that are:
+ // - readable output if the bytes happen to be printable
+ // - non-printable bytes get represented as unicode escape
+ // sequences (\uxxxx)
+ //
+ // The downsides are that we cannot use the faster
+ // strconv.Quote here and that multi-line output is not
+ // supported. If developers know that a byte array is
+ // printable and they want multi-line output, they can
+ // convert the value to string before logging it.
+ b.WriteByte('=')
+ b.WriteString(fmt.Sprintf("%+q", v))
+ default:
+ f.formatAny(b, v)
+ }
+}
diff --git a/vendor/k8s.io/klog/v2/internal/serialize/keyvalues_slog.go b/vendor/k8s.io/klog/v2/internal/serialize/keyvalues_slog.go
new file mode 100644
index 000000000..89acf9772
--- /dev/null
+++ b/vendor/k8s.io/klog/v2/internal/serialize/keyvalues_slog.go
@@ -0,0 +1,155 @@
+//go:build go1.21
+// +build go1.21
+
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package serialize
+
+import (
+ "bytes"
+ "fmt"
+ "log/slog"
+ "strconv"
+
+ "github.com/go-logr/logr"
+)
+
+// KVFormat serializes one key/value pair into the provided buffer.
+// A space gets inserted before the pair.
+func (f Formatter) KVFormat(b *bytes.Buffer, k, v interface{}) {
+ // This is the version without slog support. Must be kept in sync with
+ // the version in keyvalues_slog.go.
+
+ b.WriteByte(' ')
+ // Keys are assumed to be well-formed according to
+ // https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/migration-to-structured-logging.md#name-arguments
+ // for the sake of performance. Keys with spaces,
+ // special characters, etc. will break parsing.
+ if sK, ok := k.(string); ok {
+ // Avoid one allocation when the key is a string, which
+ // normally it should be.
+ b.WriteString(sK)
+ } else {
+ b.WriteString(fmt.Sprintf("%s", k))
+ }
+
+ // The type checks are sorted so that more frequently used ones
+ // come first because that is then faster in the common
+ // cases. In Kubernetes, ObjectRef (a Stringer) is more common
+ // than plain strings
+ // (https://github.com/kubernetes/kubernetes/pull/106594#issuecomment-975526235).
+ //
+ // slog.LogValuer does not need to be handled here because the handler will
+ // already have resolved such special values to the final value for logging.
+ switch v := v.(type) {
+ case textWriter:
+ writeTextWriterValue(b, v)
+ case slog.Value:
+ // This must come before fmt.Stringer because slog.Value implements
+ // fmt.Stringer, but does not produce the output that we want.
+ b.WriteByte('=')
+ generateJSON(b, v)
+ case fmt.Stringer:
+ writeStringValue(b, StringerToString(v))
+ case string:
+ writeStringValue(b, v)
+ case error:
+ writeStringValue(b, ErrorToString(v))
+ case logr.Marshaler:
+ value := MarshalerToValue(v)
+ // A marshaler that returns a string is useful for
+ // delayed formatting of complex values. We treat this
+ // case like a normal string. This is useful for
+ // multi-line support.
+ //
+ // We could do this by recursively formatting a value,
+ // but that comes with the risk of infinite recursion
+ // if a marshaler returns itself. Instead we call it
+ // only once and rely on it returning the intended
+ // value directly.
+ switch value := value.(type) {
+ case string:
+ writeStringValue(b, value)
+ default:
+ f.formatAny(b, value)
+ }
+ case slog.LogValuer:
+ value := slog.AnyValue(v).Resolve()
+ if value.Kind() == slog.KindString {
+ writeStringValue(b, value.String())
+ } else {
+ b.WriteByte('=')
+ generateJSON(b, value)
+ }
+ case []byte:
+ // In https://github.com/kubernetes/klog/pull/237 it was decided
+ // to format byte slices with "%+q". The advantages of that are:
+ // - readable output if the bytes happen to be printable
+ // - non-printable bytes get represented as unicode escape
+ // sequences (\uxxxx)
+ //
+ // The downsides are that we cannot use the faster
+ // strconv.Quote here and that multi-line output is not
+ // supported. If developers know that a byte array is
+ // printable and they want multi-line output, they can
+ // convert the value to string before logging it.
+ b.WriteByte('=')
+ b.WriteString(fmt.Sprintf("%+q", v))
+ default:
+ f.formatAny(b, v)
+ }
+}
+
+// generateJSON has the same preference for plain strings as KVFormat.
+// In contrast to KVFormat it always produces valid JSON with no line breaks.
+func generateJSON(b *bytes.Buffer, v interface{}) {
+ switch v := v.(type) {
+ case slog.Value:
+ switch v.Kind() {
+ case slog.KindGroup:
+ // Format as a JSON group. We must not involve f.AnyToStringHook (if there is any),
+ // because there is no guarantee that it produces valid JSON.
+ b.WriteByte('{')
+ for i, attr := range v.Group() {
+ if i > 0 {
+ b.WriteByte(',')
+ }
+ b.WriteString(strconv.Quote(attr.Key))
+ b.WriteByte(':')
+ generateJSON(b, attr.Value)
+ }
+ b.WriteByte('}')
+ case slog.KindLogValuer:
+ generateJSON(b, v.Resolve())
+ default:
+ // Peel off the slog.Value wrapper and format the actual value.
+ generateJSON(b, v.Any())
+ }
+ case fmt.Stringer:
+ b.WriteString(strconv.Quote(StringerToString(v)))
+ case logr.Marshaler:
+ generateJSON(b, MarshalerToValue(v))
+ case slog.LogValuer:
+ generateJSON(b, slog.AnyValue(v).Resolve().Any())
+ case string:
+ b.WriteString(strconv.Quote(v))
+ case error:
+ b.WriteString(strconv.Quote(v.Error()))
+ default:
+ formatAsJSON(b, v)
+ }
+}
diff --git a/vendor/k8s.io/klog/v2/internal/severity/severity.go b/vendor/k8s.io/klog/v2/internal/severity/severity.go
new file mode 100644
index 000000000..30fa1834f
--- /dev/null
+++ b/vendor/k8s.io/klog/v2/internal/severity/severity.go
@@ -0,0 +1,58 @@
+// Copyright 2013 Google Inc. All Rights Reserved.
+// Copyright 2022 The Kubernetes Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package severity provides definitions for klog severity (info, warning, ...)
+package severity
+
+import (
+ "strings"
+)
+
+// severity identifies the sort of log: info, warning etc. The binding to flag.Value
+// is handled in klog.go
+type Severity int32 // sync/atomic int32
+
+// These constants identify the log levels in order of increasing severity.
+// A message written to a high-severity log file is also written to each
+// lower-severity log file.
+const (
+ InfoLog Severity = iota
+ WarningLog
+ ErrorLog
+ FatalLog
+ NumSeverity = 4
+)
+
+// Char contains one shortcut letter per severity level.
+const Char = "IWEF"
+
+// Name contains one name per severity level.
+var Name = []string{
+ InfoLog: "INFO",
+ WarningLog: "WARNING",
+ ErrorLog: "ERROR",
+ FatalLog: "FATAL",
+}
+
+// ByName looks up a severity level by name.
+func ByName(s string) (Severity, bool) {
+ s = strings.ToUpper(s)
+ for i, name := range Name {
+ if name == s {
+ return Severity(i), true
+ }
+ }
+ return 0, false
+}
diff --git a/vendor/k8s.io/klog/v2/internal/sloghandler/sloghandler_slog.go b/vendor/k8s.io/klog/v2/internal/sloghandler/sloghandler_slog.go
new file mode 100644
index 000000000..21f1697d0
--- /dev/null
+++ b/vendor/k8s.io/klog/v2/internal/sloghandler/sloghandler_slog.go
@@ -0,0 +1,96 @@
+//go:build go1.21
+// +build go1.21
+
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package sloghandler
+
+import (
+ "context"
+ "log/slog"
+ "runtime"
+ "strings"
+ "time"
+
+ "k8s.io/klog/v2/internal/severity"
+)
+
+func Handle(_ context.Context, record slog.Record, groups string, printWithInfos func(file string, line int, now time.Time, err error, s severity.Severity, msg string, kvList []interface{})) error {
+ now := record.Time
+ if now.IsZero() {
+ // This format doesn't support printing entries without a time.
+ now = time.Now()
+ }
+
+ // slog has numeric severity levels, with 0 as default "info", negative for debugging, and
+ // positive with some pre-defined levels for more important. Those ranges get mapped to
+ // the corresponding klog levels where possible, with "info" the default that is used
+ // also for negative debug levels.
+ level := record.Level
+ s := severity.InfoLog
+ switch {
+ case level >= slog.LevelError:
+ s = severity.ErrorLog
+ case level >= slog.LevelWarn:
+ s = severity.WarningLog
+ }
+
+ var file string
+ var line int
+ if record.PC != 0 {
+ // Same as https://cs.opensource.google/go/x/exp/+/642cacee:slog/record.go;drc=642cacee5cc05231f45555a333d07f1005ffc287;l=70
+ fs := runtime.CallersFrames([]uintptr{record.PC})
+ f, _ := fs.Next()
+ if f.File != "" {
+ file = f.File
+ if slash := strings.LastIndex(file, "/"); slash >= 0 {
+ file = file[slash+1:]
+ }
+ line = f.Line
+ }
+ } else {
+ file = "???"
+ line = 1
+ }
+
+ kvList := make([]interface{}, 0, 2*record.NumAttrs())
+ record.Attrs(func(attr slog.Attr) bool {
+ kvList = appendAttr(groups, kvList, attr)
+ return true
+ })
+
+ printWithInfos(file, line, now, nil, s, record.Message, kvList)
+ return nil
+}
+
+func Attrs2KVList(groups string, attrs []slog.Attr) []interface{} {
+ kvList := make([]interface{}, 0, 2*len(attrs))
+ for _, attr := range attrs {
+ kvList = appendAttr(groups, kvList, attr)
+ }
+ return kvList
+}
+
+func appendAttr(groups string, kvList []interface{}, attr slog.Attr) []interface{} {
+ var key string
+ if groups != "" {
+ key = groups + "." + attr.Key
+ } else {
+ key = attr.Key
+ }
+ return append(kvList, key, attr.Value)
+}
diff --git a/vendor/k8s.io/klog/v2/k8s_references.go b/vendor/k8s.io/klog/v2/k8s_references.go
new file mode 100644
index 000000000..786af74bf
--- /dev/null
+++ b/vendor/k8s.io/klog/v2/k8s_references.go
@@ -0,0 +1,212 @@
+/*
+Copyright 2021 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package klog
+
+import (
+ "bytes"
+ "fmt"
+ "reflect"
+ "strings"
+
+ "github.com/go-logr/logr"
+)
+
+// ObjectRef references a kubernetes object
+type ObjectRef struct {
+ Name string `json:"name"`
+ Namespace string `json:"namespace,omitempty"`
+}
+
+func (ref ObjectRef) String() string {
+ if ref.Namespace != "" {
+ var builder strings.Builder
+ builder.Grow(len(ref.Namespace) + len(ref.Name) + 1)
+ builder.WriteString(ref.Namespace)
+ builder.WriteRune('/')
+ builder.WriteString(ref.Name)
+ return builder.String()
+ }
+ return ref.Name
+}
+
+func (ref ObjectRef) WriteText(out *bytes.Buffer) {
+ out.WriteRune('"')
+ ref.writeUnquoted(out)
+ out.WriteRune('"')
+}
+
+func (ref ObjectRef) writeUnquoted(out *bytes.Buffer) {
+ if ref.Namespace != "" {
+ out.WriteString(ref.Namespace)
+ out.WriteRune('/')
+ }
+ out.WriteString(ref.Name)
+}
+
+// MarshalLog ensures that loggers with support for structured output will log
+// as a struct by removing the String method via a custom type.
+func (ref ObjectRef) MarshalLog() interface{} {
+ type or ObjectRef
+ return or(ref)
+}
+
+var _ logr.Marshaler = ObjectRef{}
+
+// KMetadata is a subset of the kubernetes k8s.io/apimachinery/pkg/apis/meta/v1.Object interface
+// this interface may expand in the future, but will always be a subset of the
+// kubernetes k8s.io/apimachinery/pkg/apis/meta/v1.Object interface
+type KMetadata interface {
+ GetName() string
+ GetNamespace() string
+}
+
+// KObj returns ObjectRef from ObjectMeta
+func KObj(obj KMetadata) ObjectRef {
+ if obj == nil {
+ return ObjectRef{}
+ }
+ if val := reflect.ValueOf(obj); val.Kind() == reflect.Ptr && val.IsNil() {
+ return ObjectRef{}
+ }
+
+ return ObjectRef{
+ Name: obj.GetName(),
+ Namespace: obj.GetNamespace(),
+ }
+}
+
+// KRef returns ObjectRef from name and namespace
+func KRef(namespace, name string) ObjectRef {
+ return ObjectRef{
+ Name: name,
+ Namespace: namespace,
+ }
+}
+
+// KObjs returns slice of ObjectRef from an slice of ObjectMeta
+//
+// DEPRECATED: Use KObjSlice instead, it has better performance.
+func KObjs(arg interface{}) []ObjectRef {
+ s := reflect.ValueOf(arg)
+ if s.Kind() != reflect.Slice {
+ return nil
+ }
+ objectRefs := make([]ObjectRef, 0, s.Len())
+ for i := 0; i < s.Len(); i++ {
+ if v, ok := s.Index(i).Interface().(KMetadata); ok {
+ objectRefs = append(objectRefs, KObj(v))
+ } else {
+ return nil
+ }
+ }
+ return objectRefs
+}
+
+// KObjSlice takes a slice of objects that implement the KMetadata interface
+// and returns an object that gets logged as a slice of ObjectRef values or a
+// string containing those values, depending on whether the logger prefers text
+// output or structured output.
+//
+// An error string is logged when KObjSlice is not passed a suitable slice.
+//
+// Processing of the argument is delayed until the value actually gets logged,
+// in contrast to KObjs where that overhead is incurred regardless of whether
+// the result is needed.
+func KObjSlice(arg interface{}) interface{} {
+ return kobjSlice{arg: arg}
+}
+
+type kobjSlice struct {
+ arg interface{}
+}
+
+var _ fmt.Stringer = kobjSlice{}
+var _ logr.Marshaler = kobjSlice{}
+
+func (ks kobjSlice) String() string {
+ objectRefs, errStr := ks.process()
+ if errStr != "" {
+ return errStr
+ }
+ return fmt.Sprintf("%v", objectRefs)
+}
+
+func (ks kobjSlice) MarshalLog() interface{} {
+ objectRefs, errStr := ks.process()
+ if errStr != "" {
+ return errStr
+ }
+ return objectRefs
+}
+
+func (ks kobjSlice) process() (objs []interface{}, err string) {
+ s := reflect.ValueOf(ks.arg)
+ switch s.Kind() {
+ case reflect.Invalid:
+ // nil parameter, print as nil.
+ return nil, ""
+ case reflect.Slice:
+ // Okay, handle below.
+ default:
+ return nil, fmt.Sprintf("", ks.arg)
+ }
+ objectRefs := make([]interface{}, 0, s.Len())
+ for i := 0; i < s.Len(); i++ {
+ item := s.Index(i).Interface()
+ if item == nil {
+ objectRefs = append(objectRefs, nil)
+ } else if v, ok := item.(KMetadata); ok {
+ objectRefs = append(objectRefs, KObj(v))
+ } else {
+ return nil, fmt.Sprintf("", item)
+ }
+ }
+ return objectRefs, ""
+}
+
+var nilToken = []byte("null")
+
+func (ks kobjSlice) WriteText(out *bytes.Buffer) {
+ s := reflect.ValueOf(ks.arg)
+ switch s.Kind() {
+ case reflect.Invalid:
+ // nil parameter, print as null.
+ out.Write(nilToken)
+ return
+ case reflect.Slice:
+ // Okay, handle below.
+ default:
+ fmt.Fprintf(out, `""`, ks.arg)
+ return
+ }
+ out.Write([]byte{'['})
+ defer out.Write([]byte{']'})
+ for i := 0; i < s.Len(); i++ {
+ if i > 0 {
+ out.Write([]byte{','})
+ }
+ item := s.Index(i).Interface()
+ if item == nil {
+ out.Write(nilToken)
+ } else if v, ok := item.(KMetadata); ok {
+ KObj(v).WriteText(out)
+ } else {
+ fmt.Fprintf(out, `""`, item)
+ return
+ }
+ }
+}
diff --git a/vendor/k8s.io/klog/v2/k8s_references_slog.go b/vendor/k8s.io/klog/v2/k8s_references_slog.go
new file mode 100644
index 000000000..5522c84c7
--- /dev/null
+++ b/vendor/k8s.io/klog/v2/k8s_references_slog.go
@@ -0,0 +1,39 @@
+//go:build go1.21
+// +build go1.21
+
+/*
+Copyright 2021 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package klog
+
+import (
+ "log/slog"
+)
+
+func (ref ObjectRef) LogValue() slog.Value {
+ if ref.Namespace != "" {
+ return slog.GroupValue(slog.String("name", ref.Name), slog.String("namespace", ref.Namespace))
+ }
+ return slog.GroupValue(slog.String("name", ref.Name))
+}
+
+var _ slog.LogValuer = ObjectRef{}
+
+func (ks kobjSlice) LogValue() slog.Value {
+ return slog.AnyValue(ks.MarshalLog())
+}
+
+var _ slog.LogValuer = kobjSlice{}
diff --git a/vendor/k8s.io/klog/v2/klog.go b/vendor/k8s.io/klog/v2/klog.go
index 45efbb075..47ec9466a 100644
--- a/vendor/k8s.io/klog/v2/klog.go
+++ b/vendor/k8s.io/klog/v2/klog.go
@@ -14,9 +14,26 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-// Package klog implements logging analogous to the Google-internal C++ INFO/ERROR/V setup.
-// It provides functions Info, Warning, Error, Fatal, plus formatting variants such as
-// Infof. It also provides V-style logging controlled by the -v and -vmodule=file=2 flags.
+// Package klog contains the following functionality:
+//
+// - output routing as defined via command line flags ([InitFlags])
+// - log formatting as text, either with a single, unstructured string ([Info], [Infof], etc.)
+// or as a structured log entry with message and key/value pairs ([InfoS], etc.)
+// - management of a go-logr [Logger] ([SetLogger], [Background], [TODO])
+// - helper functions for logging values ([Format]) and managing the state of klog ([CaptureState], [State.Restore])
+// - wrappers for [logr] APIs for contextual logging where the wrappers can
+// be turned into no-ops ([EnableContextualLogging], [NewContext], [FromContext],
+// [LoggerWithValues], [LoggerWithName]); if the ability to turn off
+// contextual logging is not needed, then go-logr can also be used directly
+// - type aliases for go-logr types to simplify imports in code which uses both (e.g. [Logger])
+// - [k8s.io/klog/v2/textlogger]: a logger which uses the same formatting as klog log with
+// simpler output routing; beware that it comes with its own command line flags
+// and does not use the ones from klog
+// - [k8s.io/klog/v2/ktesting]: per-test output in Go unit tests
+// - [k8s.io/klog/v2/klogr]: a deprecated, standalone [logr.Logger] on top of the main klog package;
+// use [Background] instead if klog output routing is needed, [k8s.io/klog/v2/textlogger] if not
+// - [k8s.io/klog/v2/examples]: demos of this functionality
+// - [k8s.io/klog/v2/test]: reusable tests for [logr.Logger] implementations
//
// Basic examples:
//
@@ -39,35 +56,38 @@
// This package provides several flags that modify this behavior.
// As a result, flag.Parse must be called before any logging is done.
//
-// -logtostderr=true
-// Logs are written to standard error instead of to files.
-// -alsologtostderr=false
-// Logs are written to standard error as well as to files.
-// -stderrthreshold=ERROR
-// Log events at or above this severity are logged to standard
-// error as well as to files.
-// -log_dir=""
-// Log files will be written to this directory instead of the
-// default temporary directory.
-//
-// Other flags provide aids to debugging.
+// -logtostderr=true
+// Logs are written to standard error instead of to files.
+// This shortcuts most of the usual output routing:
+// -alsologtostderr, -stderrthreshold and -log_dir have no
+// effect and output redirection at runtime with SetOutput is
+// ignored.
+// -alsologtostderr=false
+// Logs are written to standard error as well as to files.
+// -stderrthreshold=ERROR
+// Log events at or above this severity are logged to standard
+// error as well as to files.
+// -log_dir=""
+// Log files will be written to this directory instead of the
+// default temporary directory.
//
-// -log_backtrace_at=""
-// When set to a file and line number holding a logging statement,
-// such as
-// -log_backtrace_at=gopherflakes.go:234
-// a stack trace will be written to the Info log whenever execution
-// hits that statement. (Unlike with -vmodule, the ".go" must be
-// present.)
-// -v=0
-// Enable V-leveled logging at the specified level.
-// -vmodule=""
-// The syntax of the argument is a comma-separated list of pattern=N,
-// where pattern is a literal file name (minus the ".go" suffix) or
-// "glob" pattern and N is a V level. For instance,
-// -vmodule=gopher*=3
-// sets the V level to 3 in all Go files whose names begin "gopher".
+// Other flags provide aids to debugging.
//
+// -log_backtrace_at=""
+// When set to a file and line number holding a logging statement,
+// such as
+// -log_backtrace_at=gopherflakes.go:234
+// a stack trace will be written to the Info log whenever execution
+// hits that statement. (Unlike with -vmodule, the ".go" must be
+// present.)
+// -v=0
+// Enable V-leveled logging at the specified level.
+// -vmodule=""
+// The syntax of the argument is a comma-separated list of pattern=N,
+// where pattern is a literal file name (minus the ".go" suffix) or
+// "glob" pattern and N is a V level. For instance,
+// -vmodule=gopher*=3
+// sets the V level to 3 in all Go files whose names begin "gopher".
package klog
import (
@@ -81,7 +101,6 @@ import (
"math"
"os"
"path/filepath"
- "reflect"
"runtime"
"strconv"
"strings"
@@ -89,82 +108,58 @@ import (
"sync/atomic"
"time"
- "github.com/go-logr/logr"
+ "k8s.io/klog/v2/internal/buffer"
+ "k8s.io/klog/v2/internal/clock"
+ "k8s.io/klog/v2/internal/dbg"
+ "k8s.io/klog/v2/internal/serialize"
+ "k8s.io/klog/v2/internal/severity"
)
-// severity identifies the sort of log: info, warning etc. It also implements
+// severityValue identifies the sort of log: info, warning etc. It also implements
// the flag.Value interface. The -stderrthreshold flag is of type severity and
// should be modified only through the flag.Value interface. The values match
// the corresponding constants in C++.
-type severity int32 // sync/atomic int32
-
-// These constants identify the log levels in order of increasing severity.
-// A message written to a high-severity log file is also written to each
-// lower-severity log file.
-const (
- infoLog severity = iota
- warningLog
- errorLog
- fatalLog
- numSeverity = 4
-)
-
-const severityChar = "IWEF"
-
-var severityName = []string{
- infoLog: "INFO",
- warningLog: "WARNING",
- errorLog: "ERROR",
- fatalLog: "FATAL",
+type severityValue struct {
+ severity.Severity
}
// get returns the value of the severity.
-func (s *severity) get() severity {
- return severity(atomic.LoadInt32((*int32)(s)))
+func (s *severityValue) get() severity.Severity {
+ return severity.Severity(atomic.LoadInt32((*int32)(&s.Severity)))
}
// set sets the value of the severity.
-func (s *severity) set(val severity) {
- atomic.StoreInt32((*int32)(s), int32(val))
+func (s *severityValue) set(val severity.Severity) {
+ atomic.StoreInt32((*int32)(&s.Severity), int32(val))
}
// String is part of the flag.Value interface.
-func (s *severity) String() string {
- return strconv.FormatInt(int64(*s), 10)
+func (s *severityValue) String() string {
+ return strconv.FormatInt(int64(s.Severity), 10)
}
// Get is part of the flag.Getter interface.
-func (s *severity) Get() interface{} {
- return *s
+func (s *severityValue) Get() interface{} {
+ return s.Severity
}
// Set is part of the flag.Value interface.
-func (s *severity) Set(value string) error {
- var threshold severity
+func (s *severityValue) Set(value string) error {
+ var threshold severity.Severity
// Is it a known name?
- if v, ok := severityByName(value); ok {
+ if v, ok := severity.ByName(value); ok {
threshold = v
} else {
v, err := strconv.ParseInt(value, 10, 32)
if err != nil {
return err
}
- threshold = severity(v)
+ threshold = severity.Severity(v)
}
logging.stderrThreshold.set(threshold)
return nil
}
-func severityByName(s string) (severity, bool) {
- s = strings.ToUpper(s)
- for i, name := range severityName {
- if name == s {
- return severity(i), true
- }
- }
- return 0, false
-}
-
// OutputStats tracks the number of output lines and bytes written.
type OutputStats struct {
lines int64
@@ -187,10 +182,10 @@ var Stats struct {
Info, Warning, Error OutputStats
}
-var severityStats = [numSeverity]*OutputStats{
- infoLog: &Stats.Info,
- warningLog: &Stats.Warning,
- errorLog: &Stats.Error,
+var severityStats = [severity.NumSeverity]*OutputStats{
+ severity.InfoLog: &Stats.Info,
+ severity.WarningLog: &Stats.Warning,
+ severity.ErrorLog: &Stats.Error,
}
// Level is exported because it appears in the arguments to V and is
@@ -266,6 +261,10 @@ func (m *moduleSpec) String() string {
// Lock because the type is not atomic. TODO: clean this up.
logging.mu.Lock()
defer logging.mu.Unlock()
+ return m.serialize()
+}
+
+func (m *moduleSpec) serialize() string {
var b bytes.Buffer
for i, f := range m.filter {
if i > 0 {
@@ -287,6 +286,17 @@ var errVmoduleSyntax = errors.New("syntax error: expect comma-separated list of
// Set will sets module value
// Syntax: -vmodule=recordio=2,file=1,gfs*=3
func (m *moduleSpec) Set(value string) error {
+ filter, err := parseModuleSpec(value)
+ if err != nil {
+ return err
+ }
+ logging.mu.Lock()
+ defer logging.mu.Unlock()
+ logging.setVState(logging.verbosity, filter, true)
+ return nil
+}
+
+func parseModuleSpec(value string) ([]modulePat, error) {
var filter []modulePat
for _, pat := range strings.Split(value, ",") {
if len(pat) == 0 {
@@ -295,15 +305,15 @@ func (m *moduleSpec) Set(value string) error {
}
patLev := strings.Split(pat, "=")
if len(patLev) != 2 || len(patLev[0]) == 0 || len(patLev[1]) == 0 {
- return errVmoduleSyntax
+ return nil, errVmoduleSyntax
}
pattern := patLev[0]
v, err := strconv.ParseInt(patLev[1], 10, 32)
if err != nil {
- return errors.New("syntax error: expect comma-separated list of filename=N")
+ return nil, errors.New("syntax error: expect comma-separated list of filename=N")
}
if v < 0 {
- return errors.New("negative value for vmodule level")
+ return nil, errors.New("negative value for vmodule level")
}
if v == 0 {
continue // Ignore. It's harmless but no point in paying the overhead.
@@ -311,10 +321,7 @@ func (m *moduleSpec) Set(value string) error {
// TODO: check syntax of filter?
filter = append(filter, modulePat{pattern, isLiteral(pattern), Level(v)})
}
- logging.mu.Lock()
- defer logging.mu.Unlock()
- logging.setVState(logging.verbosity, filter, true)
- return nil
+ return filter, nil
}
// isLiteral reports whether the pattern is a literal string, that is, has no metacharacters
@@ -397,50 +404,48 @@ func (t *traceLocation) Set(value string) error {
return nil
}
-// flushSyncWriter is the interface satisfied by logging destinations.
-type flushSyncWriter interface {
- Flush() error
- Sync() error
- io.Writer
-}
+var logging loggingT
+var commandLine flag.FlagSet
-// init sets up the defaults and runs flushDaemon.
+// init sets up the defaults and creates command line flags.
func init() {
- logging.stderrThreshold = errorLog // Default stderrThreshold is ERROR.
+ commandLine.StringVar(&logging.logDir, "log_dir", "", "If non-empty, write log files in this directory (no effect when -logtostderr=true)")
+ commandLine.StringVar(&logging.logFile, "log_file", "", "If non-empty, use this log file (no effect when -logtostderr=true)")
+ commandLine.Uint64Var(&logging.logFileMaxSizeMB, "log_file_max_size", 1800,
+ "Defines the maximum size a log file can grow to (no effect when -logtostderr=true). Unit is megabytes. "+
+ "If the value is 0, the maximum file size is unlimited.")
+ commandLine.BoolVar(&logging.toStderr, "logtostderr", true, "log to standard error instead of files")
+ commandLine.BoolVar(&logging.alsoToStderr, "alsologtostderr", false, "log to standard error as well as files (no effect when -logtostderr=true)")
logging.setVState(0, nil, false)
- logging.logDir = ""
- logging.logFile = ""
- logging.logFileMaxSizeMB = 1800
- logging.toStderr = true
- logging.alsoToStderr = false
- logging.skipHeaders = false
- logging.addDirHeader = false
- logging.skipLogHeaders = false
- logging.oneOutput = false
- go logging.flushDaemon()
+ commandLine.Var(&logging.verbosity, "v", "number for the log level verbosity")
+ commandLine.BoolVar(&logging.addDirHeader, "add_dir_header", false, "If true, adds the file directory to the header of the log messages")
+ commandLine.BoolVar(&logging.skipHeaders, "skip_headers", false, "If true, avoid header prefixes in the log messages")
+ commandLine.BoolVar(&logging.oneOutput, "one_output", false, "If true, only write logs to their native severity level (vs also writing to each lower severity level; no effect when -logtostderr=true)")
+ commandLine.BoolVar(&logging.skipLogHeaders, "skip_log_headers", false, "If true, avoid headers when opening log files (no effect when -logtostderr=true)")
+ logging.stderrThreshold = severityValue{
+ Severity: severity.ErrorLog, // Default stderrThreshold is ERROR.
+ }
+ commandLine.Var(&logging.stderrThreshold, "stderrthreshold", "logs at or above this threshold go to stderr when writing to files and stderr (no effect when -logtostderr=true or -alsologtostderr=true)")
+ commandLine.Var(&logging.vmodule, "vmodule", "comma-separated list of pattern=N settings for file-filtered logging")
+ commandLine.Var(&logging.traceLocation, "log_backtrace_at", "when logging hits line file:N, emit a stack trace")
+
+ logging.settings.contextualLoggingEnabled = true
+ logging.flushD = newFlushDaemon(logging.lockAndFlushAll, nil)
}
// InitFlags is for explicitly initializing the flags.
+// It may get called repeatedly for different flagsets, but not
+// twice for the same one. May get called concurrently
+// to other goroutines using klog. However, only some flags
+// may get set concurrently (see implementation).
func InitFlags(flagset *flag.FlagSet) {
if flagset == nil {
flagset = flag.CommandLine
}
- flagset.StringVar(&logging.logDir, "log_dir", logging.logDir, "If non-empty, write log files in this directory")
- flagset.StringVar(&logging.logFile, "log_file", logging.logFile, "If non-empty, use this log file")
- flagset.Uint64Var(&logging.logFileMaxSizeMB, "log_file_max_size", logging.logFileMaxSizeMB,
- "Defines the maximum size a log file can grow to. Unit is megabytes. "+
- "If the value is 0, the maximum file size is unlimited.")
- flagset.BoolVar(&logging.toStderr, "logtostderr", logging.toStderr, "log to standard error instead of files")
- flagset.BoolVar(&logging.alsoToStderr, "alsologtostderr", logging.alsoToStderr, "log to standard error as well as files")
- flagset.Var(&logging.verbosity, "v", "number for the log level verbosity")
- flagset.BoolVar(&logging.addDirHeader, "add_dir_header", logging.addDirHeader, "If true, adds the file directory to the header of the log messages")
- flagset.BoolVar(&logging.skipHeaders, "skip_headers", logging.skipHeaders, "If true, avoid header prefixes in the log messages")
- flagset.BoolVar(&logging.oneOutput, "one_output", logging.oneOutput, "If true, only write logs to their native severity level (vs also writing to each lower severity level)")
- flagset.BoolVar(&logging.skipLogHeaders, "skip_log_headers", logging.skipLogHeaders, "If true, avoid headers when opening log files")
- flagset.Var(&logging.stderrThreshold, "stderrthreshold", "logs at or above this threshold go to stderr")
- flagset.Var(&logging.vmodule, "vmodule", "comma-separated list of pattern=N settings for file-filtered logging")
- flagset.Var(&logging.traceLocation, "log_backtrace_at", "when logging hits line file:N, emit a stack trace")
+ commandLine.VisitAll(func(f *flag.Flag) {
+ flagset.Var(f.Value, f.Name, f.Usage)
+ })
}
// Flush flushes all pending log I/O.
@@ -448,8 +453,20 @@ func Flush() {
logging.lockAndFlushAll()
}
-// loggingT collects all the global state of the logging setup.
-type loggingT struct {
+// settings collects global settings.
+type settings struct {
+ // contextualLoggingEnabled controls whether contextual logging is
+ // active. Disabling it may have some small performance benefit.
+ contextualLoggingEnabled bool
+
+ // logger is the global Logger chosen by users of klog, nil if
+ // none is available.
+ logger *logWriter
+
+ // loggerOptions contains the options that were supplied for
+ // globalLogger.
+ loggerOptions loggerOptions
+
// Boolean flags. Not handled atomically because the flag.Value interface
// does not let us avoid the =true, and that shorthand is necessary for
// compatibility. TODO: does this matter enough to fix? Seems unlikely.
@@ -457,25 +474,16 @@ type loggingT struct {
alsoToStderr bool // The -alsologtostderr flag.
// Level flag. Handled atomically.
- stderrThreshold severity // The -stderrthreshold flag.
+ stderrThreshold severityValue // The -stderrthreshold flag.
- // freeList is a list of byte buffers, maintained under freeListMu.
- freeList *buffer
- // freeListMu maintains the free list. It is separate from the main mutex
- // so buffers can be grabbed and printed to without holding the main lock,
- // for better parallelization.
- freeListMu sync.Mutex
+ // Access to all of the following fields must be protected via a mutex.
- // mu protects the remaining elements of this structure and is
- // used to synchronize logging.
- mu sync.Mutex
// file holds writer for each of the log types.
- file [numSeverity]flushSyncWriter
- // pcs is used in V to avoid an allocation when computing the caller's PC.
- pcs [1]uintptr
- // vmap is a cache of the V Level for each V() call site, identified by PC.
- // It is wiped whenever the vmodule flag changes state.
- vmap map[uintptr]Level
+ file [severity.NumSeverity]io.Writer
+ // flushInterval is the interval for periodic flushing. If zero,
+ // the global default will be used.
+ flushInterval time.Duration
+
// filterLength stores the length of the vmodule filter chain. If greater
// than zero, it means vmodule is enabled. It may be read safely
// using sync.LoadInt32, but is only modified under mu.
@@ -508,9 +516,6 @@ type loggingT struct {
// If true, add the file directory to the header
addDirHeader bool
- // If set, all output will be redirected unconditionally to the provided logr.Logger
- logr *logr.Logger
-
// If true, messages will not be propagated to lower severity log levels
oneOutput bool
@@ -518,14 +523,40 @@ type loggingT struct {
filter LogFilter
}
-// buffer holds a byte Buffer for reuse. The zero value is ready for use.
-type buffer struct {
- bytes.Buffer
- tmp [64]byte // temporary byte array for creating headers.
- next *buffer
+// deepCopy creates a copy that doesn't share anything with the original
+// instance.
+func (s settings) deepCopy() settings {
+ // vmodule is a slice and would be shared, so we have copy it.
+ filter := make([]modulePat, len(s.vmodule.filter))
+ copy(filter, s.vmodule.filter)
+ s.vmodule.filter = filter
+
+ if s.logger != nil {
+ logger := *s.logger
+ s.logger = &logger
+ }
+
+ return s
}
-var logging loggingT
+// loggingT collects all the global state of the logging setup.
+type loggingT struct {
+ settings
+
+ // flushD holds a flushDaemon that frequently flushes log file buffers.
+ // Uses its own mutex.
+ flushD *flushDaemon
+
+ // mu protects the remaining elements of this structure and the fields
+ // in settingsT which need a mutex lock.
+ mu sync.Mutex
+
+ // pcs is used in V to avoid an allocation when computing the caller's PC.
+ pcs [1]uintptr
+ // vmap is a cache of the V Level for each V() call site, identified by PC.
+ // It is wiped whenever the vmodule flag changes state.
+ vmap map[uintptr]Level
+}
// setVState sets a consistent state for V logging.
// l.mu is held.
@@ -547,36 +578,56 @@ func (l *loggingT) setVState(verbosity Level, filter []modulePat, setFilter bool
l.verbosity.set(verbosity)
}
-// getBuffer returns a new, ready-to-use buffer.
-func (l *loggingT) getBuffer() *buffer {
- l.freeListMu.Lock()
- b := l.freeList
- if b != nil {
- l.freeList = b.next
- }
- l.freeListMu.Unlock()
- if b == nil {
- b = new(buffer)
- } else {
- b.next = nil
- b.Reset()
+var timeNow = time.Now // Stubbed out for testing.
+
+// CaptureState gathers information about all current klog settings.
+// The result can be used to restore those settings.
+func CaptureState() State {
+ logging.mu.Lock()
+ defer logging.mu.Unlock()
+ return &state{
+ settings: logging.settings.deepCopy(),
+ flushDRunning: logging.flushD.isRunning(),
+ maxSize: MaxSize,
}
- return b
}
-// putBuffer returns a buffer to the free list.
-func (l *loggingT) putBuffer(b *buffer) {
- if b.Len() >= 256 {
- // Let big buffers die a natural death.
- return
- }
- l.freeListMu.Lock()
- b.next = l.freeList
- l.freeList = b
- l.freeListMu.Unlock()
+// State stores a snapshot of klog settings. It gets created with CaptureState
+// and can be used to restore the entire state. Modifying individual settings
+// is supported via the command line flags.
+type State interface {
+ // Restore restore the entire state. It may get called more than once.
+ Restore()
}
-var timeNow = time.Now // Stubbed out for testing.
+type state struct {
+ settings
+
+ flushDRunning bool
+ maxSize uint64
+}
+
+func (s *state) Restore() {
+ // This needs to be done before mutex locking.
+ if s.flushDRunning && !logging.flushD.isRunning() {
+ // This is not quite accurate: StartFlushDaemon might
+ // have been called with some different interval.
+ interval := s.flushInterval
+ if interval == 0 {
+ interval = flushInterval
+ }
+ logging.flushD.run(interval)
+ } else if !s.flushDRunning && logging.flushD.isRunning() {
+ logging.flushD.stop()
+ }
+
+ logging.mu.Lock()
+ defer logging.mu.Unlock()
+
+ logging.settings = s.settings
+ logging.setVState(s.verbosity, s.vmodule.filter, true)
+ MaxSize = s.maxSize
+}
/*
header formats a log header as defined by the C++ implementation.
@@ -584,8 +635,11 @@ It returns a buffer containing the formatted header and the user's file and line
The depth specifies how many stack frames above lives the source line to be identified in the log message.
Log lines have this form:
+
Lmmdd hh:mm:ss.uuuuuu threadid file:line] msg...
+
where the fields are defined as follows:
+
L A single character, representing the log level (eg 'I' for INFO)
mm The month (zero padded; ie May is '05')
dd The day (zero padded)
@@ -595,7 +649,7 @@ where the fields are defined as follows:
line The line number
msg The user-supplied message
*/
-func (l *loggingT) header(s severity, depth int) (*buffer, string, int) {
+func (l *loggingT) header(s severity.Severity, depth int) (*buffer.Buffer, string, int) {
_, file, line, ok := runtime.Caller(3 + depth)
if !ok {
file = "???"
@@ -611,137 +665,90 @@ func (l *loggingT) header(s severity, depth int) (*buffer, string, int) {
}
}
}
- return l.formatHeader(s, file, line), file, line
+ return l.formatHeader(s, file, line, timeNow()), file, line
}
// formatHeader formats a log header using the provided file name and line number.
-func (l *loggingT) formatHeader(s severity, file string, line int) *buffer {
- now := timeNow()
- if line < 0 {
- line = 0 // not a real line number, but acceptable to someDigits
- }
- if s > fatalLog {
- s = infoLog // for safety.
- }
- buf := l.getBuffer()
+func (l *loggingT) formatHeader(s severity.Severity, file string, line int, now time.Time) *buffer.Buffer {
+ buf := buffer.GetBuffer()
if l.skipHeaders {
return buf
}
-
- // Avoid Fprintf, for speed. The format is so simple that we can do it quickly by hand.
- // It's worth about 3X. Fprintf is hard.
- _, month, day := now.Date()
- hour, minute, second := now.Clock()
- // Lmmdd hh:mm:ss.uuuuuu threadid file:line]
- buf.tmp[0] = severityChar[s]
- buf.twoDigits(1, int(month))
- buf.twoDigits(3, day)
- buf.tmp[5] = ' '
- buf.twoDigits(6, hour)
- buf.tmp[8] = ':'
- buf.twoDigits(9, minute)
- buf.tmp[11] = ':'
- buf.twoDigits(12, second)
- buf.tmp[14] = '.'
- buf.nDigits(6, 15, now.Nanosecond()/1000, '0')
- buf.tmp[21] = ' '
- buf.nDigits(7, 22, pid, ' ') // TODO: should be TID
- buf.tmp[29] = ' '
- buf.Write(buf.tmp[:30])
- buf.WriteString(file)
- buf.tmp[0] = ':'
- n := buf.someDigits(1, line)
- buf.tmp[n+1] = ']'
- buf.tmp[n+2] = ' '
- buf.Write(buf.tmp[:n+3])
+ buf.FormatHeader(s, file, line, now)
return buf
}
-// Some custom tiny helper functions to print the log header efficiently.
-
-const digits = "0123456789"
-
-// twoDigits formats a zero-prefixed two-digit integer at buf.tmp[i].
-func (buf *buffer) twoDigits(i, d int) {
- buf.tmp[i+1] = digits[d%10]
- d /= 10
- buf.tmp[i] = digits[d%10]
-}
-
-// nDigits formats an n-digit integer at buf.tmp[i],
-// padding with pad on the left.
-// It assumes d >= 0.
-func (buf *buffer) nDigits(n, i, d int, pad byte) {
- j := n - 1
- for ; j >= 0 && d > 0; j-- {
- buf.tmp[i+j] = digits[d%10]
- d /= 10
- }
- for ; j >= 0; j-- {
- buf.tmp[i+j] = pad
- }
+func (l *loggingT) println(s severity.Severity, logger *logWriter, filter LogFilter, args ...interface{}) {
+ l.printlnDepth(s, logger, filter, 1, args...)
}
-// someDigits formats a zero-prefixed variable-width integer at buf.tmp[i].
-func (buf *buffer) someDigits(i, d int) int {
- // Print into the top, then copy down. We know there's space for at least
- // a 10-digit number.
- j := len(buf.tmp)
- for {
- j--
- buf.tmp[j] = digits[d%10]
- d /= 10
- if d == 0 {
- break
- }
+func (l *loggingT) printlnDepth(s severity.Severity, logger *logWriter, filter LogFilter, depth int, args ...interface{}) {
+ if false {
+ _ = fmt.Sprintln(args...) // cause vet to treat this function like fmt.Println
}
- return copy(buf.tmp[i:], buf.tmp[j:])
-}
-func (l *loggingT) println(s severity, logger *logr.Logger, filter LogFilter, args ...interface{}) {
- buf, file, line := l.header(s, 0)
- // if logger is set, we clear the generated header as we rely on the backing
- // logger implementation to print headers
- if logger != nil {
- l.putBuffer(buf)
- buf = l.getBuffer()
+ buf, file, line := l.header(s, depth)
+ // If a logger is set and doesn't support writing a formatted buffer,
+ // we clear the generated header as we rely on the backing
+ // logger implementation to print headers.
+ if logger != nil && logger.writeKlogBuffer == nil {
+ buffer.PutBuffer(buf)
+ buf = buffer.GetBuffer()
}
if filter != nil {
args = filter.Filter(args)
}
fmt.Fprintln(buf, args...)
- l.output(s, logger, buf, 0 /* depth */, file, line, false)
+ l.output(s, logger, buf, depth, file, line, false)
}
-func (l *loggingT) print(s severity, logger *logr.Logger, filter LogFilter, args ...interface{}) {
+func (l *loggingT) print(s severity.Severity, logger *logWriter, filter LogFilter, args ...interface{}) {
l.printDepth(s, logger, filter, 1, args...)
}
-func (l *loggingT) printDepth(s severity, logger *logr.Logger, filter LogFilter, depth int, args ...interface{}) {
+func (l *loggingT) printDepth(s severity.Severity, logger *logWriter, filter LogFilter, depth int, args ...interface{}) {
+ if false {
+ _ = fmt.Sprint(args...) // // cause vet to treat this function like fmt.Print
+ }
+
buf, file, line := l.header(s, depth)
- // if logr is set, we clear the generated header as we rely on the backing
- // logr implementation to print headers
- if logger != nil {
- l.putBuffer(buf)
- buf = l.getBuffer()
+ l.printWithInfos(buf, file, line, s, logger, filter, depth+1, args...)
+}
+
+func (l *loggingT) printWithInfos(buf *buffer.Buffer, file string, line int, s severity.Severity, logger *logWriter, filter LogFilter, depth int, args ...interface{}) {
+ // If a logger is set and doesn't support writing a formatted buffer,
+ // we clear the generated header as we rely on the backing
+ // logger implementation to print headers.
+ if logger != nil && logger.writeKlogBuffer == nil {
+ buffer.PutBuffer(buf)
+ buf = buffer.GetBuffer()
}
if filter != nil {
args = filter.Filter(args)
}
fmt.Fprint(buf, args...)
- if buf.Bytes()[buf.Len()-1] != '\n' {
+ if buf.Len() == 0 || buf.Bytes()[buf.Len()-1] != '\n' {
buf.WriteByte('\n')
}
l.output(s, logger, buf, depth, file, line, false)
}
-func (l *loggingT) printf(s severity, logger *logr.Logger, filter LogFilter, format string, args ...interface{}) {
- buf, file, line := l.header(s, 0)
- // if logr is set, we clear the generated header as we rely on the backing
- // logr implementation to print headers
- if logger != nil {
- l.putBuffer(buf)
- buf = l.getBuffer()
+func (l *loggingT) printf(s severity.Severity, logger *logWriter, filter LogFilter, format string, args ...interface{}) {
+ l.printfDepth(s, logger, filter, 1, format, args...)
+}
+
+func (l *loggingT) printfDepth(s severity.Severity, logger *logWriter, filter LogFilter, depth int, format string, args ...interface{}) {
+ if false {
+ _ = fmt.Sprintf(format, args...) // cause vet to treat this function like fmt.Printf
+ }
+
+ buf, file, line := l.header(s, depth)
+ // If a logger is set and doesn't support writing a formatted buffer,
+ // we clear the generated header as we rely on the backing
+ // logger implementation to print headers.
+ if logger != nil && logger.writeKlogBuffer == nil {
+ buffer.PutBuffer(buf)
+ buf = buffer.GetBuffer()
}
if filter != nil {
format, args = filter.FilterF(format, args)
@@ -750,19 +757,20 @@ func (l *loggingT) printf(s severity, logger *logr.Logger, filter LogFilter, for
if buf.Bytes()[buf.Len()-1] != '\n' {
buf.WriteByte('\n')
}
- l.output(s, logger, buf, 0 /* depth */, file, line, false)
+ l.output(s, logger, buf, depth, file, line, false)
}
// printWithFileLine behaves like print but uses the provided file and line number. If
// alsoLogToStderr is true, the log message always appears on standard error; it
// will also appear in the log file unless --logtostderr is set.
-func (l *loggingT) printWithFileLine(s severity, logger *logr.Logger, filter LogFilter, file string, line int, alsoToStderr bool, args ...interface{}) {
- buf := l.formatHeader(s, file, line)
- // if logr is set, we clear the generated header as we rely on the backing
- // logr implementation to print headers
- if logger != nil {
- l.putBuffer(buf)
- buf = l.getBuffer()
+func (l *loggingT) printWithFileLine(s severity.Severity, logger *logWriter, filter LogFilter, file string, line int, alsoToStderr bool, args ...interface{}) {
+ buf := l.formatHeader(s, file, line, timeNow())
+ // If a logger is set and doesn't support writing a formatted buffer,
+ // we clear the generated header as we rely on the backing
+ // logger implementation to print headers.
+ if logger != nil && logger.writeKlogBuffer == nil {
+ buffer.PutBuffer(buf)
+ buf = buffer.GetBuffer()
}
if filter != nil {
args = filter.Filter(args)
@@ -774,8 +782,8 @@ func (l *loggingT) printWithFileLine(s severity, logger *logr.Logger, filter Log
l.output(s, logger, buf, 2 /* depth */, file, line, alsoToStderr)
}
-// if loggr is specified, will call loggr.Error, otherwise output with logging module.
-func (l *loggingT) errorS(err error, logger *logr.Logger, filter LogFilter, depth int, msg string, keysAndValues ...interface{}) {
+// if logger is specified, will call logger.Error, otherwise output with logging module.
+func (l *loggingT) errorS(err error, logger *logWriter, filter LogFilter, depth int, msg string, keysAndValues ...interface{}) {
if filter != nil {
msg, keysAndValues = filter.FilterS(msg, keysAndValues)
}
@@ -783,11 +791,11 @@ func (l *loggingT) errorS(err error, logger *logr.Logger, filter LogFilter, dept
logger.WithCallDepth(depth+2).Error(err, msg, keysAndValues...)
return
}
- l.printS(err, errorLog, depth+1, msg, keysAndValues...)
+ l.printS(err, severity.ErrorLog, depth+1, msg, keysAndValues...)
}
-// if loggr is specified, will call loggr.Info, otherwise output with logging module.
-func (l *loggingT) infoS(logger *logr.Logger, filter LogFilter, depth int, msg string, keysAndValues ...interface{}) {
+// if logger is specified, will call logger.Info, otherwise output with logging module.
+func (l *loggingT) infoS(logger *logWriter, filter LogFilter, depth int, msg string, keysAndValues ...interface{}) {
if filter != nil {
msg, keysAndValues = filter.FilterS(msg, keysAndValues)
}
@@ -795,101 +803,33 @@ func (l *loggingT) infoS(logger *logr.Logger, filter LogFilter, depth int, msg s
logger.WithCallDepth(depth+2).Info(msg, keysAndValues...)
return
}
- l.printS(nil, infoLog, depth+1, msg, keysAndValues...)
+ l.printS(nil, severity.InfoLog, depth+1, msg, keysAndValues...)
}
-// printS is called from infoS and errorS if loggr is not specified.
+// printS is called from infoS and errorS if logger is not specified.
// set log severity by s
-func (l *loggingT) printS(err error, s severity, depth int, msg string, keysAndValues ...interface{}) {
- b := &bytes.Buffer{}
- b.WriteString(fmt.Sprintf("%q", msg))
+func (l *loggingT) printS(err error, s severity.Severity, depth int, msg string, keysAndValues ...interface{}) {
+ // Only create a new buffer if we don't have one cached.
+ b := buffer.GetBuffer()
+ // The message is always quoted, even if it contains line breaks.
+ // If developers want multi-line output, they should use a small, fixed
+ // message and put the multi-line output into a value.
+ b.WriteString(strconv.Quote(msg))
if err != nil {
- b.WriteByte(' ')
- b.WriteString(fmt.Sprintf("err=%q", err.Error()))
- }
- kvListFormat(b, keysAndValues...)
- l.printDepth(s, logging.logr, nil, depth+1, b)
-}
-
-const missingValue = "(MISSING)"
-
-func kvListFormat(b *bytes.Buffer, keysAndValues ...interface{}) {
- for i := 0; i < len(keysAndValues); i += 2 {
- var v interface{}
- k := keysAndValues[i]
- if i+1 < len(keysAndValues) {
- v = keysAndValues[i+1]
- } else {
- v = missingValue
- }
- b.WriteByte(' ')
-
- switch v.(type) {
- case string, error:
- b.WriteString(fmt.Sprintf("%s=%q", k, v))
- case []byte:
- b.WriteString(fmt.Sprintf("%s=%+q", k, v))
- default:
- if _, ok := v.(fmt.Stringer); ok {
- b.WriteString(fmt.Sprintf("%s=%q", k, v))
- } else {
- b.WriteString(fmt.Sprintf("%s=%+v", k, v))
- }
- }
+ serialize.KVListFormat(&b.Buffer, "err", err)
}
-}
-
-// redirectBuffer is used to set an alternate destination for the logs
-type redirectBuffer struct {
- w io.Writer
-}
-
-func (rb *redirectBuffer) Sync() error {
- return nil
-}
-
-func (rb *redirectBuffer) Flush() error {
- return nil
-}
-
-func (rb *redirectBuffer) Write(bytes []byte) (n int, err error) {
- return rb.w.Write(bytes)
-}
-
-// SetLogger will set the backing logr implementation for klog.
-// If set, all log lines will be suppressed from the regular Output, and
-// redirected to the logr implementation.
-// Use as:
-// ...
-// klog.SetLogger(zapr.NewLogger(zapLog))
-//
-// To remove a backing logr implemention, use ClearLogger. Setting an
-// empty logger with SetLogger(logr.Logger{}) does not work.
-func SetLogger(logr logr.Logger) {
- logging.mu.Lock()
- defer logging.mu.Unlock()
-
- logging.logr = &logr
-}
-
-// ClearLogger removes a backing logr implementation if one was set earlier
-// with SetLogger.
-func ClearLogger() {
- logging.mu.Lock()
- defer logging.mu.Unlock()
-
- logging.logr = nil
+ serialize.KVListFormat(&b.Buffer, keysAndValues...)
+ l.printDepth(s, nil, nil, depth+1, &b.Buffer)
+ // Make the buffer available for reuse.
+ buffer.PutBuffer(b)
}
// SetOutput sets the output destination for all severities
func SetOutput(w io.Writer) {
logging.mu.Lock()
defer logging.mu.Unlock()
- for s := fatalLog; s >= infoLog; s-- {
- rb := &redirectBuffer{
- w: w,
- }
- logging.file[s] = rb
+ for s := severity.FatalLog; s >= severity.InfoLog; s-- {
+ logging.file[s] = w
}
}
@@ -897,14 +837,11 @@ func SetOutput(w io.Writer) {
func SetOutputBySeverity(name string, w io.Writer) {
logging.mu.Lock()
defer logging.mu.Unlock()
- sev, ok := severityByName(name)
+ sev, ok := severity.ByName(name)
if !ok {
panic(fmt.Sprintf("SetOutputBySeverity(%q): unrecognized severity name", name))
}
- rb := &redirectBuffer{
- w: w,
- }
- logging.file[sev] = rb
+ logging.file[sev] = w
}
// LogToStderr sets whether to log exclusively to stderr, bypassing outputs
@@ -916,21 +853,36 @@ func LogToStderr(stderr bool) {
}
// output writes the data to the log files and releases the buffer.
-func (l *loggingT) output(s severity, log *logr.Logger, buf *buffer, depth int, file string, line int, alsoToStderr bool) {
+func (l *loggingT) output(s severity.Severity, logger *logWriter, buf *buffer.Buffer, depth int, file string, line int, alsoToStderr bool) {
+ var isLocked = true
l.mu.Lock()
+ defer func() {
+ if isLocked {
+ // Unlock before returning in case that it wasn't done already.
+ l.mu.Unlock()
+ }
+ }()
+
if l.traceLocation.isSet() {
if l.traceLocation.match(file, line) {
- buf.Write(stacks(false))
+ buf.Write(dbg.Stacks(false))
}
}
data := buf.Bytes()
- if log != nil {
- // TODO: set 'severity' and caller information as structured log info
- // keysAndValues := []interface{}{"severity", severityName[s], "file", file, "line", line}
- if s == errorLog {
- l.logr.WithCallDepth(depth+3).Error(nil, string(data))
+ if logger != nil {
+ if logger.writeKlogBuffer != nil {
+ logger.writeKlogBuffer(data)
} else {
- log.WithCallDepth(depth + 3).Info(string(data))
+ if len(data) > 0 && data[len(data)-1] == '\n' {
+ data = data[:len(data)-1]
+ }
+ // TODO: set 'severity' and caller information as structured log info
+ // keysAndValues := []interface{}{"severity", severityName[s], "file", file, "line", line}
+ if s == severity.ErrorLog {
+ logger.WithCallDepth(depth+3).Error(nil, string(data))
+ } else {
+ logger.WithCallDepth(depth + 3).Info(string(data))
+ }
}
} else if l.toStderr {
os.Stderr.Write(data)
@@ -942,13 +894,13 @@ func (l *loggingT) output(s severity, log *logr.Logger, buf *buffer, depth int,
if logging.logFile != "" {
// Since we are using a single log file, all of the items in l.file array
// will point to the same file, so just use one of them to write data.
- if l.file[infoLog] == nil {
- if err := l.createFiles(infoLog); err != nil {
+ if l.file[severity.InfoLog] == nil {
+ if err := l.createFiles(severity.InfoLog); err != nil {
os.Stderr.Write(data) // Make sure the message appears somewhere.
l.exit(err)
}
}
- l.file[infoLog].Write(data)
+ _, _ = l.file[severity.InfoLog].Write(data)
} else {
if l.file[s] == nil {
if err := l.createFiles(s); err != nil {
@@ -958,92 +910,61 @@ func (l *loggingT) output(s severity, log *logr.Logger, buf *buffer, depth int,
}
if l.oneOutput {
- l.file[s].Write(data)
+ _, _ = l.file[s].Write(data)
} else {
switch s {
- case fatalLog:
- l.file[fatalLog].Write(data)
+ case severity.FatalLog:
+ _, _ = l.file[severity.FatalLog].Write(data)
fallthrough
- case errorLog:
- l.file[errorLog].Write(data)
+ case severity.ErrorLog:
+ _, _ = l.file[severity.ErrorLog].Write(data)
fallthrough
- case warningLog:
- l.file[warningLog].Write(data)
+ case severity.WarningLog:
+ _, _ = l.file[severity.WarningLog].Write(data)
fallthrough
- case infoLog:
- l.file[infoLog].Write(data)
+ case severity.InfoLog:
+ _, _ = l.file[severity.InfoLog].Write(data)
}
}
}
}
- if s == fatalLog {
+ if s == severity.FatalLog {
// If we got here via Exit rather than Fatal, print no stacks.
if atomic.LoadUint32(&fatalNoStacks) > 0 {
l.mu.Unlock()
- timeoutFlush(10 * time.Second)
- os.Exit(1)
+ isLocked = false
+ timeoutFlush(ExitFlushTimeout)
+ OsExit(1)
}
// Dump all goroutine stacks before exiting.
- trace := stacks(true)
- // Write the stack trace for all goroutines to the stderr.
- if l.toStderr || l.alsoToStderr || s >= l.stderrThreshold.get() || alsoToStderr {
- os.Stderr.Write(trace)
+ // First, make sure we see the trace for the current goroutine on standard error.
+ // If -logtostderr has been specified, the loop below will do that anyway
+ // as the first stack in the full dump.
+ if !l.toStderr {
+ os.Stderr.Write(dbg.Stacks(false))
}
+
// Write the stack trace for all goroutines to the files.
+ trace := dbg.Stacks(true)
logExitFunc = func(error) {} // If we get a write error, we'll still exit below.
- for log := fatalLog; log >= infoLog; log-- {
+ for log := severity.FatalLog; log >= severity.InfoLog; log-- {
if f := l.file[log]; f != nil { // Can be nil if -logtostderr is set.
- f.Write(trace)
+ _, _ = f.Write(trace)
}
}
l.mu.Unlock()
- timeoutFlush(10 * time.Second)
- os.Exit(255) // C++ uses -1, which is silly because it's anded with 255 anyway.
+ isLocked = false
+ timeoutFlush(ExitFlushTimeout)
+ OsExit(255) // C++ uses -1, which is silly because it's anded with 255 anyway.
}
- l.putBuffer(buf)
- l.mu.Unlock()
+ buffer.PutBuffer(buf)
+
if stats := severityStats[s]; stats != nil {
atomic.AddInt64(&stats.lines, 1)
atomic.AddInt64(&stats.bytes, int64(len(data)))
}
}
-// timeoutFlush calls Flush and returns when it completes or after timeout
-// elapses, whichever happens first. This is needed because the hooks invoked
-// by Flush may deadlock when klog.Fatal is called from a hook that holds
-// a lock.
-func timeoutFlush(timeout time.Duration) {
- done := make(chan bool, 1)
- go func() {
- Flush() // calls logging.lockAndFlushAll()
- done <- true
- }()
- select {
- case <-done:
- case <-time.After(timeout):
- fmt.Fprintln(os.Stderr, "klog: Flush took longer than", timeout)
- }
-}
-
-// stacks is a wrapper for runtime.Stack that attempts to recover the data for all goroutines.
-func stacks(all bool) []byte {
- // We don't know how big the traces are, so grow a few times if they don't fit. Start large, though.
- n := 10000
- if all {
- n = 100000
- }
- var trace []byte
- for i := 0; i < 5; i++ {
- trace = make([]byte, n)
- nbytes := runtime.Stack(trace, all)
- if nbytes < len(trace) {
- return trace[:nbytes]
- }
- n *= 2
- }
- return trace
-}
-
// logExitFunc provides a simple mechanism to override the default behavior
// of exiting on error. Used in testing and to guarantee we reach a required exit
// for fatal logs. Instead, exit could be a function rather than a method but that
@@ -1060,8 +981,9 @@ func (l *loggingT) exit(err error) {
logExitFunc(err)
return
}
- l.flushAll()
- os.Exit(2)
+ needToSync := l.flushAll()
+ l.syncAll(needToSync)
+ OsExit(2)
}
// syncBuffer joins a bufio.Writer to its underlying file, providing access to the
@@ -1072,15 +994,11 @@ type syncBuffer struct {
logger *loggingT
*bufio.Writer
file *os.File
- sev severity
+ sev severity.Severity
nbytes uint64 // The number of bytes written to this file
maxbytes uint64 // The max number of bytes this syncBuffer.file can hold before cleaning up.
}
-func (sb *syncBuffer) Sync() error {
- return sb.file.Sync()
-}
-
// CalculateMaxSize returns the real max size in bytes after considering the default max size and the flag options.
func CalculateMaxSize() uint64 {
if logging.logFile != "" {
@@ -1118,7 +1036,7 @@ func (sb *syncBuffer) rotateFile(now time.Time, startup bool) error {
sb.file.Close()
}
var err error
- sb.file, _, err = create(severityName[sb.sev], now, startup)
+ sb.file, _, err = create(severity.Name[sb.sev], now, startup)
if err != nil {
return err
}
@@ -1156,11 +1074,16 @@ const bufferSize = 256 * 1024
// createFiles creates all the log files for severity from sev down to infoLog.
// l.mu is held.
-func (l *loggingT) createFiles(sev severity) error {
+func (l *loggingT) createFiles(sev severity.Severity) error {
+ interval := l.flushInterval
+ if interval == 0 {
+ interval = flushInterval
+ }
+ l.flushD.run(interval)
now := time.Now()
// Files are created in decreasing severity order, so as soon as we find one
// has already been created, we can stop.
- for s := sev; s >= infoLog && l.file[s] == nil; s-- {
+ for s := sev; s >= severity.InfoLog && l.file[s] == nil; s-- {
sb := &syncBuffer{
logger: l,
sev: s,
@@ -1177,30 +1100,135 @@ func (l *loggingT) createFiles(sev severity) error {
const flushInterval = 5 * time.Second
// flushDaemon periodically flushes the log file buffers.
-func (l *loggingT) flushDaemon() {
- for range time.NewTicker(flushInterval).C {
- l.lockAndFlushAll()
+type flushDaemon struct {
+ mu sync.Mutex
+ clock clock.Clock
+ flush func()
+ stopC chan struct{}
+ stopDone chan struct{}
+}
+
+// newFlushDaemon returns a new flushDaemon. If the passed clock is nil, a
+// clock.RealClock is used.
+func newFlushDaemon(flush func(), tickClock clock.Clock) *flushDaemon {
+ if tickClock == nil {
+ tickClock = clock.RealClock{}
+ }
+ return &flushDaemon{
+ flush: flush,
+ clock: tickClock,
+ }
+}
+
+// run starts a goroutine that periodically calls the daemons flush function.
+// Calling run on an already running daemon will have no effect.
+func (f *flushDaemon) run(interval time.Duration) {
+ f.mu.Lock()
+ defer f.mu.Unlock()
+
+ if f.stopC != nil { // daemon already running
+ return
}
+
+ f.stopC = make(chan struct{}, 1)
+ f.stopDone = make(chan struct{}, 1)
+
+ ticker := f.clock.NewTicker(interval)
+ go func() {
+ defer ticker.Stop()
+ defer func() { f.stopDone <- struct{}{} }()
+ for {
+ select {
+ case <-ticker.C():
+ f.flush()
+ case <-f.stopC:
+ f.flush()
+ return
+ }
+ }
+ }()
+}
+
+// stop stops the running flushDaemon and waits until the daemon has shut down.
+// Calling stop on a daemon that isn't running will have no effect.
+func (f *flushDaemon) stop() {
+ f.mu.Lock()
+ defer f.mu.Unlock()
+
+ if f.stopC == nil { // daemon not running
+ return
+ }
+
+ f.stopC <- struct{}{}
+ <-f.stopDone
+
+ f.stopC = nil
+ f.stopDone = nil
+}
+
+// isRunning returns true if the flush daemon is running.
+func (f *flushDaemon) isRunning() bool {
+ f.mu.Lock()
+ defer f.mu.Unlock()
+ return f.stopC != nil
+}
+
+// StopFlushDaemon stops the flush daemon, if running, and flushes once.
+// This prevents klog from leaking goroutines on shutdown. After stopping
+// the daemon, you can still manually flush buffers again by calling Flush().
+func StopFlushDaemon() {
+ logging.flushD.stop()
+}
+
+// StartFlushDaemon ensures that the flush daemon runs with the given delay
+// between flush calls. If it is already running, it gets restarted.
+func StartFlushDaemon(interval time.Duration) {
+ StopFlushDaemon()
+ logging.flushD.run(interval)
}
// lockAndFlushAll is like flushAll but locks l.mu first.
func (l *loggingT) lockAndFlushAll() {
l.mu.Lock()
- l.flushAll()
+ needToSync := l.flushAll()
l.mu.Unlock()
+ // Some environments are slow when syncing and holding the lock might cause contention.
+ l.syncAll(needToSync)
}
-// flushAll flushes all the logs and attempts to "sync" their data to disk.
+// flushAll flushes all the logs
// l.mu is held.
-func (l *loggingT) flushAll() {
+//
+// The result is the number of files which need to be synced and the pointers to them.
+func (l *loggingT) flushAll() fileArray {
+ var needToSync fileArray
+
// Flush from fatal down, in case there's trouble flushing.
- for s := fatalLog; s >= infoLog; s-- {
+ for s := severity.FatalLog; s >= severity.InfoLog; s-- {
file := l.file[s]
- if file != nil {
- file.Flush() // ignore error
- file.Sync() // ignore error
+ if sb, ok := file.(*syncBuffer); ok && sb.file != nil {
+ _ = sb.Flush() // ignore error
+ needToSync.files[needToSync.num] = sb.file
+ needToSync.num++
}
}
+ if logging.loggerOptions.flush != nil {
+ logging.loggerOptions.flush()
+ }
+ return needToSync
+}
+
+type fileArray struct {
+ num int
+ files [severity.NumSeverity]*os.File
+}
+
+// syncAll attempts to "sync" their data to disk.
+func (l *loggingT) syncAll(needToSync fileArray) {
+ // Flush from fatal down, in case there's trouble flushing.
+ for i := 0; i < needToSync.num; i++ {
+ _ = needToSync.files[i].Sync() // ignore error
+ }
}
// CopyStandardLogTo arranges for messages written to the Go "log" package's
@@ -1211,7 +1239,7 @@ func (l *loggingT) flushAll() {
// Valid names are "INFO", "WARNING", "ERROR", and "FATAL". If the name is not
// recognized, CopyStandardLogTo panics.
func CopyStandardLogTo(name string) {
- sev, ok := severityByName(name)
+ sev, ok := severity.ByName(name)
if !ok {
panic(fmt.Sprintf("log.CopyStandardLogTo(%q): unrecognized severity name", name))
}
@@ -1221,9 +1249,22 @@ func CopyStandardLogTo(name string) {
stdLog.SetOutput(logBridge(sev))
}
+// NewStandardLogger returns a Logger that writes to the klog logs for the
+// named and lower severities.
+//
+// Valid names are "INFO", "WARNING", "ERROR", and "FATAL". If the name is not
+// recognized, NewStandardLogger panics.
+func NewStandardLogger(name string) *stdLog.Logger {
+ sev, ok := severity.ByName(name)
+ if !ok {
+ panic(fmt.Sprintf("klog.NewStandardLogger(%q): unknown severity", name))
+ }
+ return stdLog.New(logBridge(sev), "", stdLog.Lshortfile)
+}
+
// logBridge provides the Write method that enables CopyStandardLogTo to connect
// Go's standard logs to the logs provided by this package.
-type logBridge severity
+type logBridge severity.Severity
// Write parses the standard logging line and passes its components to the
// logger for severity(lb).
@@ -1247,7 +1288,7 @@ func (lb logBridge) Write(b []byte) (n int, err error) {
}
// printWithFileLine with alsoToStderr=true, so standard log messages
// always appear on standard error.
- logging.printWithFileLine(severity(lb), logging.logr, logging.filter, file, line, true, text)
+ logging.printWithFileLine(severity.Severity(lb), logging.logger, logging.filter, file, line, true, text)
return len(b), nil
}
@@ -1261,9 +1302,7 @@ func (l *loggingT) setV(pc uintptr) Level {
fn := runtime.FuncForPC(pc)
file, _ := fn.FileLine(pc)
// The file is something like /a/b/c/d.go. We want just the d.
- if strings.HasSuffix(file, ".go") {
- file = file[:len(file)-3]
- }
+ file = strings.TrimSuffix(file, ".go")
if slash := strings.LastIndex(file, "/"); slash >= 0 {
file = file[slash+1:]
}
@@ -1281,25 +1320,28 @@ func (l *loggingT) setV(pc uintptr) Level {
// See the documentation of V for more information.
type Verbose struct {
enabled bool
- logr *logr.Logger
- filter LogFilter
+ logger *logWriter
}
func newVerbose(level Level, b bool) Verbose {
- if logging.logr == nil {
- return Verbose{b, nil, logging.filter}
+ if logging.logger == nil {
+ return Verbose{b, nil}
}
- v := logging.logr.V(int(level))
- return Verbose{b, &v, logging.filter}
+ v := logging.logger.V(int(level))
+ return Verbose{b, &logWriter{Logger: v, writeKlogBuffer: logging.loggerOptions.writeKlogBuffer}}
}
// V reports whether verbosity at the call site is at least the requested level.
// The returned value is a struct of type Verbose, which implements Info, Infoln
// and Infof. These methods will write to the Info log if called.
// Thus, one may write either
-// if glog.V(2).Enabled() { klog.Info("log this") }
+//
+// if klog.V(2).Enabled() { klog.Info("log this") }
+//
// or
+//
// klog.V(2).Info("log this")
+//
// The second form is shorter but the first is cheaper if logging is off because it does
// not evaluate its arguments.
//
@@ -1309,6 +1351,13 @@ func newVerbose(level Level, b bool) Verbose {
// less than or equal to the value of the -vmodule pattern matching the source file
// containing the call.
func V(level Level) Verbose {
+ return VDepth(1, level)
+}
+
+// VDepth is a variant of V that accepts a number of stack frames that will be
+// skipped when checking the -vmodule patterns. VDepth(0) is equivalent to
+// V().
+func VDepth(depth int, level Level) Verbose {
// This function tries hard to be cheap unless there's work to do.
// The fast path is two atomic loads and compares.
@@ -1325,7 +1374,7 @@ func V(level Level) Verbose {
// but if V logging is enabled we're slow anyway.
logging.mu.Lock()
defer logging.mu.Unlock()
- if runtime.Callers(2, logging.pcs[:]) == 0 {
+ if runtime.Callers(2+depth, logging.pcs[:]) == 0 {
return newVerbose(level, false)
}
// runtime.Callers returns "return PCs", but we want
@@ -1353,7 +1402,15 @@ func (v Verbose) Enabled() bool {
// See the documentation of V for usage.
func (v Verbose) Info(args ...interface{}) {
if v.enabled {
- logging.print(infoLog, v.logr, v.filter, args...)
+ logging.print(severity.InfoLog, v.logger, logging.filter, args...)
+ }
+}
+
+// InfoDepth is equivalent to the global InfoDepth function, guarded by the value of v.
+// See the documentation of V for usage.
+func (v Verbose) InfoDepth(depth int, args ...interface{}) {
+ if v.enabled {
+ logging.printDepth(severity.InfoLog, v.logger, logging.filter, depth, args...)
}
}
@@ -1361,7 +1418,15 @@ func (v Verbose) Info(args ...interface{}) {
// See the documentation of V for usage.
func (v Verbose) Infoln(args ...interface{}) {
if v.enabled {
- logging.println(infoLog, v.logr, v.filter, args...)
+ logging.println(severity.InfoLog, v.logger, logging.filter, args...)
+ }
+}
+
+// InfolnDepth is equivalent to the global InfolnDepth function, guarded by the value of v.
+// See the documentation of V for usage.
+func (v Verbose) InfolnDepth(depth int, args ...interface{}) {
+ if v.enabled {
+ logging.printlnDepth(severity.InfoLog, v.logger, logging.filter, depth, args...)
}
}
@@ -1369,7 +1434,15 @@ func (v Verbose) Infoln(args ...interface{}) {
// See the documentation of V for usage.
func (v Verbose) Infof(format string, args ...interface{}) {
if v.enabled {
- logging.printf(infoLog, v.logr, v.filter, format, args...)
+ logging.printf(severity.InfoLog, v.logger, logging.filter, format, args...)
+ }
+}
+
+// InfofDepth is equivalent to the global InfofDepth function, guarded by the value of v.
+// See the documentation of V for usage.
+func (v Verbose) InfofDepth(depth int, format string, args ...interface{}) {
+ if v.enabled {
+ logging.printfDepth(severity.InfoLog, v.logger, logging.filter, depth, format, args...)
}
}
@@ -1377,20 +1450,28 @@ func (v Verbose) Infof(format string, args ...interface{}) {
// See the documentation of V for usage.
func (v Verbose) InfoS(msg string, keysAndValues ...interface{}) {
if v.enabled {
- logging.infoS(v.logr, v.filter, 0, msg, keysAndValues...)
+ logging.infoS(v.logger, logging.filter, 0, msg, keysAndValues...)
}
}
// InfoSDepth acts as InfoS but uses depth to determine which call frame to log.
// InfoSDepth(0, "msg") is the same as InfoS("msg").
func InfoSDepth(depth int, msg string, keysAndValues ...interface{}) {
- logging.infoS(logging.logr, logging.filter, depth, msg, keysAndValues...)
+ logging.infoS(logging.logger, logging.filter, depth, msg, keysAndValues...)
+}
+
+// InfoSDepth is equivalent to the global InfoSDepth function, guarded by the value of v.
+// See the documentation of V for usage.
+func (v Verbose) InfoSDepth(depth int, msg string, keysAndValues ...interface{}) {
+ if v.enabled {
+ logging.infoS(v.logger, logging.filter, depth, msg, keysAndValues...)
+ }
}
// Deprecated: Use ErrorS instead.
func (v Verbose) Error(err error, msg string, args ...interface{}) {
if v.enabled {
- logging.errorS(err, v.logr, v.filter, 0, msg, args...)
+ logging.errorS(err, v.logger, logging.filter, 0, msg, args...)
}
}
@@ -1398,32 +1479,44 @@ func (v Verbose) Error(err error, msg string, args ...interface{}) {
// See the documentation of V for usage.
func (v Verbose) ErrorS(err error, msg string, keysAndValues ...interface{}) {
if v.enabled {
- logging.errorS(err, v.logr, v.filter, 0, msg, keysAndValues...)
+ logging.errorS(err, v.logger, logging.filter, 0, msg, keysAndValues...)
}
}
// Info logs to the INFO log.
// Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
func Info(args ...interface{}) {
- logging.print(infoLog, logging.logr, logging.filter, args...)
+ logging.print(severity.InfoLog, logging.logger, logging.filter, args...)
}
// InfoDepth acts as Info but uses depth to determine which call frame to log.
// InfoDepth(0, "msg") is the same as Info("msg").
func InfoDepth(depth int, args ...interface{}) {
- logging.printDepth(infoLog, logging.logr, logging.filter, depth, args...)
+ logging.printDepth(severity.InfoLog, logging.logger, logging.filter, depth, args...)
}
// Infoln logs to the INFO log.
// Arguments are handled in the manner of fmt.Println; a newline is always appended.
func Infoln(args ...interface{}) {
- logging.println(infoLog, logging.logr, logging.filter, args...)
+ logging.println(severity.InfoLog, logging.logger, logging.filter, args...)
+}
+
+// InfolnDepth acts as Infoln but uses depth to determine which call frame to log.
+// InfolnDepth(0, "msg") is the same as Infoln("msg").
+func InfolnDepth(depth int, args ...interface{}) {
+ logging.printlnDepth(severity.InfoLog, logging.logger, logging.filter, depth, args...)
}
// Infof logs to the INFO log.
// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
func Infof(format string, args ...interface{}) {
- logging.printf(infoLog, logging.logr, logging.filter, format, args...)
+ logging.printf(severity.InfoLog, logging.logger, logging.filter, format, args...)
+}
+
+// InfofDepth acts as Infof but uses depth to determine which call frame to log.
+// InfofDepth(0, "msg", args...) is the same as Infof("msg", args...).
+func InfofDepth(depth int, format string, args ...interface{}) {
+ logging.printfDepth(severity.InfoLog, logging.logger, logging.filter, depth, format, args...)
}
// InfoS structured logs to the INFO log.
@@ -1435,55 +1528,79 @@ func Infof(format string, args ...interface{}) {
// output:
// >> I1025 00:15:15.525108 1 controller_utils.go:116] "Pod status updated" pod="kubedns" status="ready"
func InfoS(msg string, keysAndValues ...interface{}) {
- logging.infoS(logging.logr, logging.filter, 0, msg, keysAndValues...)
+ logging.infoS(logging.logger, logging.filter, 0, msg, keysAndValues...)
}
// Warning logs to the WARNING and INFO logs.
// Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
func Warning(args ...interface{}) {
- logging.print(warningLog, logging.logr, logging.filter, args...)
+ logging.print(severity.WarningLog, logging.logger, logging.filter, args...)
}
// WarningDepth acts as Warning but uses depth to determine which call frame to log.
// WarningDepth(0, "msg") is the same as Warning("msg").
func WarningDepth(depth int, args ...interface{}) {
- logging.printDepth(warningLog, logging.logr, logging.filter, depth, args...)
+ logging.printDepth(severity.WarningLog, logging.logger, logging.filter, depth, args...)
}
// Warningln logs to the WARNING and INFO logs.
// Arguments are handled in the manner of fmt.Println; a newline is always appended.
func Warningln(args ...interface{}) {
- logging.println(warningLog, logging.logr, logging.filter, args...)
+ logging.println(severity.WarningLog, logging.logger, logging.filter, args...)
+}
+
+// WarninglnDepth acts as Warningln but uses depth to determine which call frame to log.
+// WarninglnDepth(0, "msg") is the same as Warningln("msg").
+func WarninglnDepth(depth int, args ...interface{}) {
+ logging.printlnDepth(severity.WarningLog, logging.logger, logging.filter, depth, args...)
}
// Warningf logs to the WARNING and INFO logs.
// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
func Warningf(format string, args ...interface{}) {
- logging.printf(warningLog, logging.logr, logging.filter, format, args...)
+ logging.printf(severity.WarningLog, logging.logger, logging.filter, format, args...)
+}
+
+// WarningfDepth acts as Warningf but uses depth to determine which call frame to log.
+// WarningfDepth(0, "msg", args...) is the same as Warningf("msg", args...).
+func WarningfDepth(depth int, format string, args ...interface{}) {
+ logging.printfDepth(severity.WarningLog, logging.logger, logging.filter, depth, format, args...)
}
// Error logs to the ERROR, WARNING, and INFO logs.
// Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
func Error(args ...interface{}) {
- logging.print(errorLog, logging.logr, logging.filter, args...)
+ logging.print(severity.ErrorLog, logging.logger, logging.filter, args...)
}
// ErrorDepth acts as Error but uses depth to determine which call frame to log.
// ErrorDepth(0, "msg") is the same as Error("msg").
func ErrorDepth(depth int, args ...interface{}) {
- logging.printDepth(errorLog, logging.logr, logging.filter, depth, args...)
+ logging.printDepth(severity.ErrorLog, logging.logger, logging.filter, depth, args...)
}
// Errorln logs to the ERROR, WARNING, and INFO logs.
// Arguments are handled in the manner of fmt.Println; a newline is always appended.
func Errorln(args ...interface{}) {
- logging.println(errorLog, logging.logr, logging.filter, args...)
+ logging.println(severity.ErrorLog, logging.logger, logging.filter, args...)
+}
+
+// ErrorlnDepth acts as Errorln but uses depth to determine which call frame to log.
+// ErrorlnDepth(0, "msg") is the same as Errorln("msg").
+func ErrorlnDepth(depth int, args ...interface{}) {
+ logging.printlnDepth(severity.ErrorLog, logging.logger, logging.filter, depth, args...)
}
// Errorf logs to the ERROR, WARNING, and INFO logs.
// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
func Errorf(format string, args ...interface{}) {
- logging.printf(errorLog, logging.logr, logging.filter, format, args...)
+ logging.printf(severity.ErrorLog, logging.logger, logging.filter, format, args...)
+}
+
+// ErrorfDepth acts as Errorf but uses depth to determine which call frame to log.
+// ErrorfDepth(0, "msg", args...) is the same as Errorf("msg", args...).
+func ErrorfDepth(depth int, format string, args ...interface{}) {
+ logging.printfDepth(severity.ErrorLog, logging.logger, logging.filter, depth, format, args...)
}
// ErrorS structured logs to the ERROR, WARNING, and INFO logs.
@@ -1496,71 +1613,108 @@ func Errorf(format string, args ...interface{}) {
// output:
// >> E1025 00:15:15.525108 1 controller_utils.go:114] "Failed to update pod status" err="timeout"
func ErrorS(err error, msg string, keysAndValues ...interface{}) {
- logging.errorS(err, logging.logr, logging.filter, 0, msg, keysAndValues...)
+ logging.errorS(err, logging.logger, logging.filter, 0, msg, keysAndValues...)
}
// ErrorSDepth acts as ErrorS but uses depth to determine which call frame to log.
// ErrorSDepth(0, "msg") is the same as ErrorS("msg").
func ErrorSDepth(depth int, err error, msg string, keysAndValues ...interface{}) {
- logging.errorS(err, logging.logr, logging.filter, depth, msg, keysAndValues...)
+ logging.errorS(err, logging.logger, logging.filter, depth, msg, keysAndValues...)
}
// Fatal logs to the FATAL, ERROR, WARNING, and INFO logs,
-// including a stack trace of all running goroutines, then calls os.Exit(255).
+// prints stack trace(s), then calls OsExit(255).
+//
+// Stderr only receives a dump of the current goroutine's stack trace. Log files,
+// if there are any, receive a dump of the stack traces in all goroutines.
+//
+// Callers who want more control over handling of fatal events may instead use a
+// combination of different functions:
+// - some info or error logging function, optionally with a stack trace
+// value generated by github.com/go-logr/lib/dbg.Backtrace
+// - Flush to flush pending log data
+// - panic, os.Exit or returning to the caller with an error
+//
// Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
func Fatal(args ...interface{}) {
- logging.print(fatalLog, logging.logr, logging.filter, args...)
+ logging.print(severity.FatalLog, logging.logger, logging.filter, args...)
}
// FatalDepth acts as Fatal but uses depth to determine which call frame to log.
// FatalDepth(0, "msg") is the same as Fatal("msg").
func FatalDepth(depth int, args ...interface{}) {
- logging.printDepth(fatalLog, logging.logr, logging.filter, depth, args...)
+ logging.printDepth(severity.FatalLog, logging.logger, logging.filter, depth, args...)
}
// Fatalln logs to the FATAL, ERROR, WARNING, and INFO logs,
-// including a stack trace of all running goroutines, then calls os.Exit(255).
+// including a stack trace of all running goroutines, then calls OsExit(255).
// Arguments are handled in the manner of fmt.Println; a newline is always appended.
func Fatalln(args ...interface{}) {
- logging.println(fatalLog, logging.logr, logging.filter, args...)
+ logging.println(severity.FatalLog, logging.logger, logging.filter, args...)
+}
+
+// FatallnDepth acts as Fatalln but uses depth to determine which call frame to log.
+// FatallnDepth(0, "msg") is the same as Fatalln("msg").
+func FatallnDepth(depth int, args ...interface{}) {
+ logging.printlnDepth(severity.FatalLog, logging.logger, logging.filter, depth, args...)
}
// Fatalf logs to the FATAL, ERROR, WARNING, and INFO logs,
-// including a stack trace of all running goroutines, then calls os.Exit(255).
+// including a stack trace of all running goroutines, then calls OsExit(255).
// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
func Fatalf(format string, args ...interface{}) {
- logging.printf(fatalLog, logging.logr, logging.filter, format, args...)
+ logging.printf(severity.FatalLog, logging.logger, logging.filter, format, args...)
+}
+
+// FatalfDepth acts as Fatalf but uses depth to determine which call frame to log.
+// FatalfDepth(0, "msg", args...) is the same as Fatalf("msg", args...).
+func FatalfDepth(depth int, format string, args ...interface{}) {
+ logging.printfDepth(severity.FatalLog, logging.logger, logging.filter, depth, format, args...)
}
// fatalNoStacks is non-zero if we are to exit without dumping goroutine stacks.
// It allows Exit and relatives to use the Fatal logs.
var fatalNoStacks uint32
-// Exit logs to the FATAL, ERROR, WARNING, and INFO logs, then calls os.Exit(1).
+// Exit logs to the FATAL, ERROR, WARNING, and INFO logs, then calls OsExit(1).
// Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
func Exit(args ...interface{}) {
atomic.StoreUint32(&fatalNoStacks, 1)
- logging.print(fatalLog, logging.logr, logging.filter, args...)
+ logging.print(severity.FatalLog, logging.logger, logging.filter, args...)
}
// ExitDepth acts as Exit but uses depth to determine which call frame to log.
// ExitDepth(0, "msg") is the same as Exit("msg").
func ExitDepth(depth int, args ...interface{}) {
atomic.StoreUint32(&fatalNoStacks, 1)
- logging.printDepth(fatalLog, logging.logr, logging.filter, depth, args...)
+ logging.printDepth(severity.FatalLog, logging.logger, logging.filter, depth, args...)
}
-// Exitln logs to the FATAL, ERROR, WARNING, and INFO logs, then calls os.Exit(1).
+// Exitln logs to the FATAL, ERROR, WARNING, and INFO logs, then calls OsExit(1).
func Exitln(args ...interface{}) {
atomic.StoreUint32(&fatalNoStacks, 1)
- logging.println(fatalLog, logging.logr, logging.filter, args...)
+ logging.println(severity.FatalLog, logging.logger, logging.filter, args...)
}
-// Exitf logs to the FATAL, ERROR, WARNING, and INFO logs, then calls os.Exit(1).
+// ExitlnDepth acts as Exitln but uses depth to determine which call frame to log.
+// ExitlnDepth(0, "msg") is the same as Exitln("msg").
+func ExitlnDepth(depth int, args ...interface{}) {
+ atomic.StoreUint32(&fatalNoStacks, 1)
+ logging.printlnDepth(severity.FatalLog, logging.logger, logging.filter, depth, args...)
+}
+
+// Exitf logs to the FATAL, ERROR, WARNING, and INFO logs, then calls OsExit(1).
// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
func Exitf(format string, args ...interface{}) {
atomic.StoreUint32(&fatalNoStacks, 1)
- logging.printf(fatalLog, logging.logr, logging.filter, format, args...)
+ logging.printf(severity.FatalLog, logging.logger, logging.filter, format, args...)
+}
+
+// ExitfDepth acts as Exitf but uses depth to determine which call frame to log.
+// ExitfDepth(0, "msg", args...) is the same as Exitf("msg", args...).
+func ExitfDepth(depth int, format string, args ...interface{}) {
+ atomic.StoreUint32(&fatalNoStacks, 1)
+ logging.printfDepth(severity.FatalLog, logging.logger, logging.filter, depth, format, args...)
}
// LogFilter is a collection of functions that can filter all logging calls,
@@ -1571,79 +1725,10 @@ type LogFilter interface {
FilterS(msg string, keysAndValues []interface{}) (string, []interface{})
}
+// SetLogFilter installs a filter that is used for all log calls.
+//
+// Modifying the filter is not thread-safe and should be done while no other
+// goroutines invoke log calls, usually during program initialization.
func SetLogFilter(filter LogFilter) {
- logging.mu.Lock()
- defer logging.mu.Unlock()
-
logging.filter = filter
}
-
-// ObjectRef references a kubernetes object
-type ObjectRef struct {
- Name string `json:"name"`
- Namespace string `json:"namespace,omitempty"`
-}
-
-func (ref ObjectRef) String() string {
- if ref.Namespace != "" {
- return fmt.Sprintf("%s/%s", ref.Namespace, ref.Name)
- }
- return ref.Name
-}
-
-// MarshalLog ensures that loggers with support for structured output will log
-// as a struct by removing the String method via a custom type.
-func (ref ObjectRef) MarshalLog() interface{} {
- type or ObjectRef
- return or(ref)
-}
-
-var _ logr.Marshaler = ObjectRef{}
-
-// KMetadata is a subset of the kubernetes k8s.io/apimachinery/pkg/apis/meta/v1.Object interface
-// this interface may expand in the future, but will always be a subset of the
-// kubernetes k8s.io/apimachinery/pkg/apis/meta/v1.Object interface
-type KMetadata interface {
- GetName() string
- GetNamespace() string
-}
-
-// KObj returns ObjectRef from ObjectMeta
-func KObj(obj KMetadata) ObjectRef {
- if obj == nil {
- return ObjectRef{}
- }
- if val := reflect.ValueOf(obj); val.Kind() == reflect.Ptr && val.IsNil() {
- return ObjectRef{}
- }
-
- return ObjectRef{
- Name: obj.GetName(),
- Namespace: obj.GetNamespace(),
- }
-}
-
-// KRef returns ObjectRef from name and namespace
-func KRef(namespace, name string) ObjectRef {
- return ObjectRef{
- Name: name,
- Namespace: namespace,
- }
-}
-
-// KObjs returns slice of ObjectRef from an slice of ObjectMeta
-func KObjs(arg interface{}) []ObjectRef {
- s := reflect.ValueOf(arg)
- if s.Kind() != reflect.Slice {
- return nil
- }
- objectRefs := make([]ObjectRef, 0, s.Len())
- for i := 0; i < s.Len(); i++ {
- if v, ok := s.Index(i).Interface().(KMetadata); ok {
- objectRefs = append(objectRefs, KObj(v))
- } else {
- return nil
- }
- }
- return objectRefs
-}
diff --git a/vendor/k8s.io/klog/v2/klog_file.go b/vendor/k8s.io/klog/v2/klog_file.go
index de830d922..8bee16204 100644
--- a/vendor/k8s.io/klog/v2/klog_file.go
+++ b/vendor/k8s.io/klog/v2/klog_file.go
@@ -22,9 +22,7 @@ import (
"errors"
"fmt"
"os"
- "os/user"
"path/filepath"
- "runtime"
"strings"
"sync"
"time"
@@ -57,38 +55,6 @@ func init() {
}
}
-func getUserName() string {
- userNameOnce.Do(func() {
- // On Windows, the Go 'user' package requires netapi32.dll.
- // This affects Windows Nano Server:
- // https://github.com/golang/go/issues/21867
- // Fallback to using environment variables.
- if runtime.GOOS == "windows" {
- u := os.Getenv("USERNAME")
- if len(u) == 0 {
- return
- }
- // Sanitize the USERNAME since it may contain filepath separators.
- u = strings.Replace(u, `\`, "_", -1)
-
- // user.Current().Username normally produces something like 'USERDOMAIN\USERNAME'
- d := os.Getenv("USERDOMAIN")
- if len(d) != 0 {
- userName = d + "_" + u
- } else {
- userName = u
- }
- } else {
- current, err := user.Current()
- if err == nil {
- userName = current.Username
- }
- }
- })
-
- return userName
-}
-
// shortHostname returns its argument, truncating at the first period.
// For instance, given "www.google.com" it returns "www".
func shortHostname(hostname string) string {
@@ -143,8 +109,8 @@ func create(tag string, t time.Time, startup bool) (f *os.File, filename string,
f, err := openOrCreate(fname, startup)
if err == nil {
symlink := filepath.Join(dir, link)
- os.Remove(symlink) // ignore err
- os.Symlink(name, symlink) // ignore err
+ _ = os.Remove(symlink) // ignore err
+ _ = os.Symlink(name, symlink) // ignore err
return f, fname, nil
}
lastErr = err
diff --git a/vendor/k8s.io/klog/v2/klog_file_others.go b/vendor/k8s.io/klog/v2/klog_file_others.go
new file mode 100644
index 000000000..aa4672685
--- /dev/null
+++ b/vendor/k8s.io/klog/v2/klog_file_others.go
@@ -0,0 +1,19 @@
+//go:build !windows
+// +build !windows
+
+package klog
+
+import (
+ "os/user"
+)
+
+func getUserName() string {
+ userNameOnce.Do(func() {
+ current, err := user.Current()
+ if err == nil {
+ userName = current.Username
+ }
+ })
+
+ return userName
+}
diff --git a/vendor/k8s.io/klog/v2/klog_file_windows.go b/vendor/k8s.io/klog/v2/klog_file_windows.go
new file mode 100644
index 000000000..2517f9c53
--- /dev/null
+++ b/vendor/k8s.io/klog/v2/klog_file_windows.go
@@ -0,0 +1,34 @@
+//go:build windows
+// +build windows
+
+package klog
+
+import (
+ "os"
+ "strings"
+)
+
+func getUserName() string {
+ userNameOnce.Do(func() {
+ // On Windows, the Go 'user' package requires netapi32.dll.
+ // This affects Windows Nano Server:
+ // https://github.com/golang/go/issues/21867
+ // Fallback to using environment variables.
+ u := os.Getenv("USERNAME")
+ if len(u) == 0 {
+ return
+ }
+ // Sanitize the USERNAME since it may contain filepath separators.
+ u = strings.Replace(u, `\`, "_", -1)
+
+ // user.Current().Username normally produces something like 'USERDOMAIN\USERNAME'
+ d := os.Getenv("USERDOMAIN")
+ if len(d) != 0 {
+ userName = d + "_" + u
+ } else {
+ userName = u
+ }
+ })
+
+ return userName
+}
diff --git a/vendor/k8s.io/klog/v2/klogr.go b/vendor/k8s.io/klog/v2/klogr.go
new file mode 100644
index 000000000..efec96fd4
--- /dev/null
+++ b/vendor/k8s.io/klog/v2/klogr.go
@@ -0,0 +1,105 @@
+/*
+Copyright 2021 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package klog
+
+import (
+ "github.com/go-logr/logr"
+
+ "k8s.io/klog/v2/internal/serialize"
+)
+
+const (
+ // nameKey is used to log the `WithName` values as an additional attribute.
+ nameKey = "logger"
+)
+
+// NewKlogr returns a logger that is functionally identical to
+// klogr.NewWithOptions(klogr.FormatKlog), i.e. it passes through to klog. The
+// difference is that it uses a simpler implementation.
+func NewKlogr() Logger {
+ return New(&klogger{})
+}
+
+// klogger is a subset of klogr/klogr.go. It had to be copied to break an
+// import cycle (klogr wants to use klog, and klog wants to use klogr).
+type klogger struct {
+ callDepth int
+
+ // hasPrefix is true if the first entry in values is the special
+ // nameKey key/value. Such an entry gets added and later updated in
+ // WithName.
+ hasPrefix bool
+
+ values []interface{}
+ groups string
+}
+
+func (l *klogger) Init(info logr.RuntimeInfo) {
+ l.callDepth += info.CallDepth
+}
+
+func (l *klogger) Info(level int, msg string, kvList ...interface{}) {
+ merged := serialize.MergeKVs(l.values, kvList)
+ // Skip this function.
+ VDepth(l.callDepth+1, Level(level)).InfoSDepth(l.callDepth+1, msg, merged...)
+}
+
+func (l *klogger) Enabled(level int) bool {
+ return VDepth(l.callDepth+1, Level(level)).Enabled()
+}
+
+func (l *klogger) Error(err error, msg string, kvList ...interface{}) {
+ merged := serialize.MergeKVs(l.values, kvList)
+ ErrorSDepth(l.callDepth+1, err, msg, merged...)
+}
+
+// WithName returns a new logr.Logger with the specified name appended. klogr
+// uses '.' characters to separate name elements. Callers should not pass '.'
+// in the provided name string, but this library does not actually enforce that.
+func (l klogger) WithName(name string) logr.LogSink {
+ if l.hasPrefix {
+ // Copy slice and modify value. No length checks and type
+ // assertions are needed because hasPrefix is only true if the
+ // first two elements exist and are key/value strings.
+ v := make([]interface{}, 0, len(l.values))
+ v = append(v, l.values...)
+ prefix, _ := v[1].(string)
+ v[1] = prefix + "." + name
+ l.values = v
+ } else {
+ // Preprend new key/value pair.
+ v := make([]interface{}, 0, 2+len(l.values))
+ v = append(v, nameKey, name)
+ v = append(v, l.values...)
+ l.values = v
+ l.hasPrefix = true
+ }
+ return &l
+}
+
+func (l klogger) WithValues(kvList ...interface{}) logr.LogSink {
+ l.values = serialize.WithValues(l.values, kvList)
+ return &l
+}
+
+func (l klogger) WithCallDepth(depth int) logr.LogSink {
+ l.callDepth += depth
+ return &l
+}
+
+var _ logr.LogSink = &klogger{}
+var _ logr.CallDepthLogSink = &klogger{}
diff --git a/vendor/k8s.io/klog/v2/klogr_slog.go b/vendor/k8s.io/klog/v2/klogr_slog.go
new file mode 100644
index 000000000..c77d7baaf
--- /dev/null
+++ b/vendor/k8s.io/klog/v2/klogr_slog.go
@@ -0,0 +1,96 @@
+//go:build go1.21
+// +build go1.21
+
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package klog
+
+import (
+ "context"
+ "log/slog"
+ "strconv"
+ "time"
+
+ "github.com/go-logr/logr"
+
+ "k8s.io/klog/v2/internal/buffer"
+ "k8s.io/klog/v2/internal/serialize"
+ "k8s.io/klog/v2/internal/severity"
+ "k8s.io/klog/v2/internal/sloghandler"
+)
+
+func (l *klogger) Handle(ctx context.Context, record slog.Record) error {
+ if logging.logger != nil {
+ if slogSink, ok := logging.logger.GetSink().(logr.SlogSink); ok {
+ // Let that logger do the work.
+ return slogSink.Handle(ctx, record)
+ }
+ }
+
+ return sloghandler.Handle(ctx, record, l.groups, slogOutput)
+}
+
+// slogOutput corresponds to several different functions in klog.go.
+// It goes through some of the same checks and formatting steps before
+// it ultimately converges by calling logging.printWithInfos.
+func slogOutput(file string, line int, now time.Time, err error, s severity.Severity, msg string, kvList []interface{}) {
+ // See infoS.
+ if logging.logger != nil {
+ // Taking this path happens when klog has a logger installed
+ // as backend which doesn't support slog. Not good, we have to
+ // guess about the call depth and drop the actual location.
+ logger := logging.logger.WithCallDepth(2)
+ if s > severity.ErrorLog {
+ logger.Error(err, msg, kvList...)
+ } else {
+ logger.Info(msg, kvList...)
+ }
+ return
+ }
+
+ // See printS.
+ b := buffer.GetBuffer()
+ b.WriteString(strconv.Quote(msg))
+ if err != nil {
+ serialize.KVListFormat(&b.Buffer, "err", err)
+ }
+ serialize.KVListFormat(&b.Buffer, kvList...)
+
+ // See print + header.
+ buf := logging.formatHeader(s, file, line, now)
+ logging.printWithInfos(buf, file, line, s, nil, nil, 0, &b.Buffer)
+
+ buffer.PutBuffer(b)
+}
+
+func (l *klogger) WithAttrs(attrs []slog.Attr) logr.SlogSink {
+ clone := *l
+ clone.values = serialize.WithValues(l.values, sloghandler.Attrs2KVList(l.groups, attrs))
+ return &clone
+}
+
+func (l *klogger) WithGroup(name string) logr.SlogSink {
+ clone := *l
+ if clone.groups != "" {
+ clone.groups += "." + name
+ } else {
+ clone.groups = name
+ }
+ return &clone
+}
+
+var _ logr.SlogSink = &klogger{}
diff --git a/vendor/k8s.io/klog/v2/safeptr.go b/vendor/k8s.io/klog/v2/safeptr.go
new file mode 100644
index 000000000..bbe24c2e8
--- /dev/null
+++ b/vendor/k8s.io/klog/v2/safeptr.go
@@ -0,0 +1,34 @@
+//go:build go1.18
+// +build go1.18
+
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package klog
+
+// SafePtr is a function that takes a pointer of any type (T) as an argument.
+// If the provided pointer is not nil, it returns the same pointer. If it is nil, it returns nil instead.
+//
+// This function is particularly useful to prevent nil pointer dereferencing when:
+//
+// - The type implements interfaces that are called by the logger, such as `fmt.Stringer`.
+// - And these interface implementations do not perform nil checks themselves.
+func SafePtr[T any](p *T) any {
+ if p == nil {
+ return nil
+ }
+ return p
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/flags.go b/vendor/k8s.io/kube-openapi/pkg/internal/flags.go
new file mode 100644
index 000000000..da5485f6a
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/flags.go
@@ -0,0 +1,25 @@
+/*
+Copyright 2022 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+// Used by tests to selectively disable experimental JSON unmarshaler
+var UseOptimizedJSONUnmarshaling bool = true
+var UseOptimizedJSONUnmarshalingV3 bool = true
+
+// Used by tests to selectively disable experimental JSON marshaler
+var UseOptimizedJSONMarshaling bool = true
+var UseOptimizedJSONMarshalingV3 bool = true
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/serialization.go b/vendor/k8s.io/kube-openapi/pkg/internal/serialization.go
new file mode 100644
index 000000000..7393bacf7
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/serialization.go
@@ -0,0 +1,65 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "github.com/go-openapi/jsonreference"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
+)
+
+// DeterministicMarshal calls the jsonv2 library with the deterministic
+// flag in order to have stable marshaling.
+func DeterministicMarshal(in any) ([]byte, error) {
+ return jsonv2.MarshalOptions{Deterministic: true}.Marshal(jsonv2.EncodeOptions{}, in)
+}
+
+// JSONRefFromMap populates a json reference object if the map v contains a $ref key.
+func JSONRefFromMap(jsonRef *jsonreference.Ref, v map[string]interface{}) error {
+ if v == nil {
+ return nil
+ }
+ if vv, ok := v["$ref"]; ok {
+ if str, ok := vv.(string); ok {
+ ref, err := jsonreference.New(str)
+ if err != nil {
+ return err
+ }
+ *jsonRef = ref
+ }
+ }
+ return nil
+}
+
+// SanitizeExtensions sanitizes the input map such that non extension
+// keys (non x-*, X-*) keys are dropped from the map. Returns the new
+// modified map, or nil if the map is now empty.
+func SanitizeExtensions(e map[string]interface{}) map[string]interface{} {
+ for k := range e {
+ if !IsExtensionKey(k) {
+ delete(e, k)
+ }
+ }
+ if len(e) == 0 {
+ e = nil
+ }
+ return e
+}
+
+// IsExtensionKey returns true if the input string is of format x-* or X-*
+func IsExtensionKey(k string) bool {
+ return len(k) > 1 && (k[0] == 'x' || k[0] == 'X') && k[1] == '-'
+}
diff --git a/vendor/golang.org/x/time/AUTHORS b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/AUTHORS
similarity index 74%
rename from vendor/golang.org/x/time/AUTHORS
rename to vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/AUTHORS
index 15167cd74..2b00ddba0 100644
--- a/vendor/golang.org/x/time/AUTHORS
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/AUTHORS
@@ -1,3 +1,3 @@
# This source code refers to The Go Authors for copyright purposes.
# The master list of authors is in the main Go distribution,
-# visible at http://tip.golang.org/AUTHORS.
+# visible at https://tip.golang.org/AUTHORS.
diff --git a/vendor/golang.org/x/time/CONTRIBUTORS b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/CONTRIBUTORS
similarity index 70%
rename from vendor/golang.org/x/time/CONTRIBUTORS
rename to vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/CONTRIBUTORS
index 1c4577e96..1fbd3e976 100644
--- a/vendor/golang.org/x/time/CONTRIBUTORS
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/CONTRIBUTORS
@@ -1,3 +1,3 @@
# This source code was written by the Go contributors.
# The master list of contributors is in the main Go distribution,
-# visible at http://tip.golang.org/CONTRIBUTORS.
+# visible at https://tip.golang.org/CONTRIBUTORS.
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/LICENSE b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/LICENSE
new file mode 100644
index 000000000..244127300
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/LICENSE
@@ -0,0 +1,27 @@
+Copyright (c) 2020 The Go Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/README.md b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/README.md
new file mode 100644
index 000000000..0349adf69
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/README.md
@@ -0,0 +1,321 @@
+# JSON Serialization (v2)
+
+[![GoDev](https://img.shields.io/static/v1?label=godev&message=reference&color=00add8)](https://pkg.go.dev/github.com/go-json-experiment/json)
+[![Build Status](https://github.com/go-json-experiment/json/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/go-json-experiment/json/actions)
+
+This module hosts an experimental implementation of v2 `encoding/json`.
+The API is unstable and breaking changes will regularly be made.
+Do not depend on this in publicly available modules.
+
+## Goals and objectives
+
+* **Mostly backwards compatible:** If possible, v2 should aim to be _mostly_
+compatible with v1 in terms of both API and default behavior to ease migration.
+For example, the `Marshal` and `Unmarshal` functions are the most widely used
+declarations in the v1 package. It seems sensible for equivalent functionality
+in v2 to be named the same and have the same signature.
+Behaviorally, we should aim for 95% to 99% backwards compatibility.
+We do not aim for 100% compatibility since we want the freedom to break
+certain behaviors that are now considered to have been a mistake.
+We may provide options that can bring the v2 implementation to 100% compatibility,
+but it will not be the default.
+
+* **More flexible:** There is a
+[long list of feature requests](https://github.com/golang/go/issues?q=is%3Aissue+is%3Aopen+encoding%2Fjson+in%3Atitle).
+We should aim to provide the most flexible features that addresses most usages.
+We do not want to over fit the v2 API to handle every possible use case.
+Ideally, the features provided should be orthogonal in nature such that
+any combination of features results in as few surprising edge cases as possible.
+
+* **More performant:** JSON serialization is widely used and any bit of extra
+performance gains will be greatly appreciated. Some rarely used behaviors of v1
+may be dropped in favor of better performance. For example,
+despite `Encoder` and `Decoder` operating on an `io.Writer` and `io.Reader`,
+they do not operate in a truly streaming manner,
+leading to a loss in performance. The v2 implementation should aim to be truly
+streaming by default (see [#33714](https://golang.org/issue/33714)).
+
+* **Easy to use (hard to misuse):** The v2 API should aim to make
+the common case easy and the less common case at least possible.
+The API should avoid behavior that goes contrary to user expectation,
+which may result in subtle bugs (see [#36225](https://golang.org/issue/36225)).
+
+* **v1 and v2 maintainability:** Since the v1 implementation must stay forever,
+it would be beneficial if v1 could be implemented under the hood with v2,
+allowing for less maintenance burden in the future. This probably implies that
+behavioral changes in v2 relative to v1 need to be exposed as options.
+
+* **Avoid unsafe:** Standard library packages generally avoid the use of
+package `unsafe` even if it could provide a performance boost.
+We aim to preserve this property.
+
+## Expectations
+
+While this module aims to possibly be the v2 implementation of `encoding/json`,
+there is no guarantee that this outcome will occur. As with any major change
+to the Go standard library, this will eventually go through the
+[Go proposal process](https://github.com/golang/proposal#readme).
+At the present moment, this is still in the design and experimentation phase
+and is not ready for a formal proposal.
+
+There are several possible outcomes from this experiment:
+1. We determine that a v2 `encoding/json` would not provide sufficient benefit
+over the existing v1 `encoding/json` package. Thus, we abandon this effort.
+2. We propose a v2 `encoding/json` design, but it is rejected in favor of some
+other design that is considered superior.
+3. We propose a v2 `encoding/json` design, but rather than adding an entirely
+new v2 `encoding/json` package, we decide to merge its functionality into
+the existing v1 `encoding/json` package.
+4. We propose a v2 `encoding/json` design and it is accepted, resulting in
+its addition to the standard library.
+5. Some other unforeseen outcome (among the infinite number of possibilities).
+
+## Development
+
+This module is primarily developed by
+[@dsnet](https://github.com/dsnet),
+[@mvdan](https://github.com/mvdan), and
+[@johanbrandhorst](https://github.com/johanbrandhorst)
+with feedback provided by
+[@rogpeppe](https://github.com/rogpeppe),
+[@ChrisHines](https://github.com/ChrisHines), and
+[@rsc](https://github.com/rsc).
+
+Discussion about semantics occur semi-regularly, where a
+[record of past meetings can be found here](https://docs.google.com/document/d/1rovrOTd-wTawGMPPlPuKhwXaYBg9VszTXR9AQQL5LfI/edit?usp=sharing).
+
+## Design overview
+
+This package aims to provide a clean separation between syntax and semantics.
+Syntax deals with the structural representation of JSON (as specified in
+[RFC 4627](https://tools.ietf.org/html/rfc4627),
+[RFC 7159](https://tools.ietf.org/html/rfc7159),
+[RFC 7493](https://tools.ietf.org/html/rfc7493),
+[RFC 8259](https://tools.ietf.org/html/rfc8259), and
+[RFC 8785](https://tools.ietf.org/html/rfc8785)).
+Semantics deals with the meaning of syntactic data as usable application data.
+
+The `Encoder` and `Decoder` types are streaming tokenizers concerned with the
+packing or parsing of JSON data. They operate on `Token` and `RawValue` types
+which represent the common data structures that are representable in JSON.
+`Encoder` and `Decoder` do not aim to provide any interpretation of the data.
+
+Functions like `Marshal`, `MarshalFull`, `MarshalNext`, `Unmarshal`,
+`UnmarshalFull`, and `UnmarshalNext` provide semantic meaning by correlating
+any arbitrary Go type with some JSON representation of that type (as stored in
+data types like `[]byte`, `io.Writer`, `io.Reader`, `Encoder`, or `Decoder`).
+
+![API overview](api.png)
+
+This diagram provides a high-level overview of the v2 `json` package.
+Purple blocks represent types, while blue blocks represent functions or methods.
+The arrows and their direction represent the approximate flow of data.
+The bottom half of the diagram contains functionality that is only concerned
+with syntax, while the upper half contains functionality that assigns
+semantic meaning to syntactic data handled by the bottom half.
+
+In contrast to v1 `encoding/json`, options are represented as separate types
+rather than being setter methods on the `Encoder` or `Decoder` types.
+
+## Behavior changes
+
+The v2 `json` package changes the default behavior of `Marshal` and `Unmarshal`
+relative to the v1 `json` package to be more sensible.
+Some of these behavior changes have options and workarounds to opt into
+behavior similar to what v1 provided.
+
+This table shows an overview of the changes:
+
+| v1 | v2 | Details |
+| -- | -- | ------- |
+| JSON object members are unmarshaled into a Go struct using a **case-insensitive name match**. | JSON object members are unmarshaled into a Go struct using a **case-sensitive name match**. | [CaseSensitivity](/diff_test.go#:~:text=TestCaseSensitivity) |
+| When marshaling a Go struct, a struct field marked as `omitempty` is omitted if **the field value is an empty Go value**, which is defined as false, 0, a nil pointer, a nil interface value, and any empty array, slice, map, or string. | When marshaling a Go struct, a struct field marked as `omitempty` is omitted if **the field value would encode as an empty JSON value**, which is defined as a JSON null, or an empty JSON string, object, or array. | [OmitEmptyOption](/diff_test.go#:~:text=TestOmitEmptyOption) |
+| The `string` option **does affect** Go bools. | The `string` option **does not affect** Go bools. | [StringOption](/diff_test.go#:~:text=TestStringOption) |
+| The `string` option **does not recursively affect** sub-values of the Go field value. | The `string` option **does recursively affect** sub-values of the Go field value. | [StringOption](/diff_test.go#:~:text=TestStringOption) |
+| The `string` option **sometimes accepts** a JSON null escaped within a JSON string. | The `string` option **never accepts** a JSON null escaped within a JSON string. | [StringOption](/diff_test.go#:~:text=TestStringOption) |
+| A nil Go slice is marshaled as a **JSON null**. | A nil Go slice is marshaled as an **empty JSON array**. | [NilSlicesAndMaps](/diff_test.go#:~:text=TestNilSlicesAndMaps) |
+| A nil Go map is marshaled as a **JSON null**. | A nil Go map is marshaled as an **empty JSON object**. | [NilSlicesAndMaps](/diff_test.go#:~:text=TestNilSlicesAndMaps) |
+| A Go array may be unmarshaled from a **JSON array of any length**. | A Go array must be unmarshaled from a **JSON array of the same length**. | [Arrays](/diff_test.go#:~:text=Arrays) |
+| A Go byte array is represented as a **JSON array of JSON numbers**. | A Go byte array is represented as a **Base64-encoded JSON string**. | [ByteArrays](/diff_test.go#:~:text=TestByteArrays) |
+| `MarshalJSON` and `UnmarshalJSON` methods declared on a pointer receiver are **inconsistently called**. | `MarshalJSON` and `UnmarshalJSON` methods declared on a pointer receiver are **consistently called**. | [PointerReceiver](/diff_test.go#:~:text=TestPointerReceiver) |
+| A Go map is marshaled in a **deterministic order**. | A Go map is marshaled in a **non-deterministic order**. | [MapDeterminism](/diff_test.go#:~:text=TestMapDeterminism) |
+| JSON strings are encoded **with HTML-specific characters being escaped**. | JSON strings are encoded **without any characters being escaped** (unless necessary). | [EscapeHTML](/diff_test.go#:~:text=TestEscapeHTML) |
+| When marshaling, invalid UTF-8 within a Go string **are silently replaced**. | When marshaling, invalid UTF-8 within a Go string **results in an error**. | [InvalidUTF8](/diff_test.go#:~:text=TestInvalidUTF8) |
+| When unmarshaling, invalid UTF-8 within a JSON string **are silently replaced**. | When unmarshaling, invalid UTF-8 within a JSON string **results in an error**. | [InvalidUTF8](/diff_test.go#:~:text=TestInvalidUTF8) |
+| When marshaling, **an error does not occur** if the output JSON value contains objects with duplicate names. | When marshaling, **an error does occur** if the output JSON value contains objects with duplicate names. | [DuplicateNames](/diff_test.go#:~:text=TestDuplicateNames) |
+| When unmarshaling, **an error does not occur** if the input JSON value contains objects with duplicate names. | When unmarshaling, **an error does occur** if the input JSON value contains objects with duplicate names. | [DuplicateNames](/diff_test.go#:~:text=TestDuplicateNames) |
+| Unmarshaling a JSON null into a non-empty Go value **inconsistently clears the value or does nothing**. | Unmarshaling a JSON null into a non-empty Go value **always clears the value**. | [MergeNull](/diff_test.go#:~:text=TestMergeNull) |
+| Unmarshaling a JSON value into a non-empty Go value **follows inconsistent and bizarre behavior**. | Unmarshaling a JSON value into a non-empty Go value **always merges if the input is an object, and otherwise replaces**. | [MergeComposite](/diff_test.go#:~:text=TestMergeComposite) |
+| A `time.Duration` is represented as a **JSON number containing the decimal number of nanoseconds**. | A `time.Duration` is represented as a **JSON string containing the formatted duration (e.g., "1h2m3.456s")**. | [TimeDurations](/diff_test.go#:~:text=TestTimeDurations) |
+| Unmarshaling a JSON number into a Go float beyond its representation **results in an error**. | Unmarshaling a JSON number into a Go float beyond its representation **uses the closest representable value (e.g., ±`math.MaxFloat`)**. | [MaxFloats](/diff_test.go#:~:text=TestMaxFloats) |
+| A Go struct with only unexported fields **can be serialized**. | A Go struct with only unexported fields **cannot be serialized**. | [EmptyStructs](/diff_test.go#:~:text=TestEmptyStructs) |
+| A Go struct that embeds an unexported struct type **can sometimes be serialized**. | A Go struct that embeds an unexported struct type **cannot be serialized**. | [EmbedUnexported](/diff_test.go#:~:text=TestEmbedUnexported) |
+
+See [diff_test.go](/diff_test.go) for details about every change.
+
+## Performance
+
+One of the goals of the v2 module is to be more performant than v1.
+
+Each of the charts below show the performance across
+several different JSON implementations:
+
+* `JSONv1` is `encoding/json` at `v1.18.2`
+* `JSONv2` is `github.com/go-json-experiment/json` at `v0.0.0-20220524042235-dd8be80fc4a7`
+* `JSONIterator` is `github.com/json-iterator/go` at `v1.1.12`
+* `SegmentJSON` is `github.com/segmentio/encoding/json` at `v0.3.5`
+* `GoJSON` is `github.com/goccy/go-json` at `v0.9.7`
+* `SonicJSON` is `github.com/bytedance/sonic` at `v1.3.0`
+
+Benchmarks were run across various datasets:
+
+* `CanadaGeometry` is a GeoJSON (RFC 7946) representation of Canada.
+ It contains many JSON arrays of arrays of two-element arrays of numbers.
+* `CITMCatalog` contains many JSON objects using numeric names.
+* `SyntheaFHIR` is sample JSON data from the healthcare industry.
+ It contains many nested JSON objects with mostly string values,
+ where the set of unique string values is relatively small.
+* `TwitterStatus` is the JSON response from the Twitter API.
+ It contains a mix of all different JSON kinds, where string values
+ are a mix of both single-byte ASCII and multi-byte Unicode.
+* `GolangSource` is a simple tree representing the Go source code.
+ It contains many nested JSON objects, each with the same schema.
+* `StringUnicode` contains many strings with multi-byte Unicode runes.
+
+All of the implementations other than `JSONv1` and `JSONv2` make
+extensive use of `unsafe`. As such, we expect those to generally be faster,
+but at the cost of memory and type safety. `SonicJSON` goes a step even further
+and uses just-in-time compilation to generate machine code specialized
+for the Go type being marshaled or unmarshaled.
+Also, `SonicJSON` does not validate JSON strings for valid UTF-8,
+and so gains a notable performance boost on datasets with multi-byte Unicode.
+Benchmarks are performed based on the default marshal and unmarshal behavior
+of each package. Note that `JSONv2` aims to be safe and correct by default,
+which may not be the most performant strategy.
+
+`JSONv2` has several semantic changes relative to `JSONv1` that
+impacts performance:
+
+1. When marshaling, `JSONv2` no longer sorts the keys of a Go map.
+ This will improve performance.
+2. When marshaling or unmarshaling, `JSONv2` always checks
+ to make sure JSON object names are unique.
+ This will hurt performance, but is more correct.
+3. When marshaling or unmarshaling, `JSONv2` always
+ shallow copies the underlying value for a Go interface and
+ shallow copies the key and value for entries in a Go map.
+ This is done to keep the value as addressable so that `JSONv2` can
+ call methods and functions that operate on a pointer receiver.
+ This will hurt performance, but is more correct.
+
+All of the charts are unit-less since the values are normalized
+relative to `JSONv1`, which is why `JSONv1` always has a value of 1.
+A lower value is better (i.e., runs faster).
+
+Benchmarks were performed on an AMD Ryzen 9 5900X.
+
+The code for the benchmarks is located at
+https://github.com/go-json-experiment/jsonbench.
+
+### Marshal Performance
+
+#### Concrete types
+
+![Benchmark Marshal Concrete](benchmark-marshal-concrete.png)
+
+* This compares marshal performance when serializing
+ [from concrete types](/testdata_test.go).
+* The `JSONv1` implementation is close to optimal (without the use of `unsafe`).
+* Relative to `JSONv1`, `JSONv2` is generally as fast or slightly faster.
+* Relative to `JSONIterator`, `JSONv2` is up to 1.3x faster.
+* Relative to `SegmentJSON`, `JSONv2` is up to 1.8x slower.
+* Relative to `GoJSON`, `JSONv2` is up to 2.0x slower.
+* Relative to `SonicJSON`, `JSONv2` is about 1.8x to 3.2x slower
+ (ignoring `StringUnicode` since `SonicJSON` does not validate UTF-8).
+* For `JSONv1` and `JSONv2`, marshaling from concrete types is
+ mostly limited by the performance of Go reflection.
+
+#### Interface types
+
+![Benchmark Marshal Interface](benchmark-marshal-interface.png)
+
+* This compares marshal performance when serializing from
+ `any`, `map[string]any`, and `[]any` types.
+* Relative to `JSONv1`, `JSONv2` is about 1.5x to 4.2x faster.
+* Relative to `JSONIterator`, `JSONv2` is about 1.1x to 2.4x faster.
+* Relative to `SegmentJSON`, `JSONv2` is about 1.2x to 1.8x faster.
+* Relative to `GoJSON`, `JSONv2` is about 1.1x to 2.5x faster.
+* Relative to `SonicJSON`, `JSONv2` is up to 1.5x slower
+ (ignoring `StringUnicode` since `SonicJSON` does not validate UTF-8).
+* `JSONv2` is faster than the alternatives.
+ One advantange is because it does not sort the keys for a `map[string]any`,
+ while alternatives (except `SonicJSON` and `JSONIterator`) do sort the keys.
+
+#### RawValue types
+
+![Benchmark Marshal Rawvalue](benchmark-marshal-rawvalue.png)
+
+* This compares performance when marshaling from a `json.RawValue`.
+ This mostly exercises the underlying encoder and
+ hides the cost of Go reflection.
+* Relative to `JSONv1`, `JSONv2` is about 3.5x to 7.8x faster.
+* `JSONIterator` is blazingly fast because
+ [it does not validate whether the raw value is valid](https://go.dev/play/p/bun9IXQCKRe)
+ and simply copies it to the output.
+* Relative to `SegmentJSON`, `JSONv2` is about 1.5x to 2.7x faster.
+* Relative to `GoJSON`, `JSONv2` is up to 2.2x faster.
+* Relative to `SonicJSON`, `JSONv2` is up to 1.5x faster.
+* Aside from `JSONIterator`, `JSONv2` is generally the fastest.
+
+### Unmarshal Performance
+
+#### Concrete types
+
+![Benchmark Unmarshal Concrete](benchmark-unmarshal-concrete.png)
+
+* This compares unmarshal performance when deserializing
+ [into concrete types](/testdata_test.go).
+* Relative to `JSONv1`, `JSONv2` is about 1.8x to 5.7x faster.
+* Relative to `JSONIterator`, `JSONv2` is about 1.1x to 1.6x slower.
+* Relative to `SegmentJSON`, `JSONv2` is up to 2.5x slower.
+* Relative to `GoJSON`, `JSONv2` is about 1.4x to 2.1x slower.
+* Relative to `SonicJSON`, `JSONv2` is up to 4.0x slower
+ (ignoring `StringUnicode` since `SonicJSON` does not validate UTF-8).
+* For `JSONv1` and `JSONv2`, unmarshaling into concrete types is
+ mostly limited by the performance of Go reflection.
+
+#### Interface types
+
+![Benchmark Unmarshal Interface](benchmark-unmarshal-interface.png)
+
+* This compares unmarshal performance when deserializing into
+ `any`, `map[string]any`, and `[]any` types.
+* Relative to `JSONv1`, `JSONv2` is about 1.tx to 4.3x faster.
+* Relative to `JSONIterator`, `JSONv2` is up to 1.5x faster.
+* Relative to `SegmentJSON`, `JSONv2` is about 1.5 to 3.7x faster.
+* Relative to `GoJSON`, `JSONv2` is up to 1.3x faster.
+* Relative to `SonicJSON`, `JSONv2` is up to 1.5x slower
+ (ignoring `StringUnicode` since `SonicJSON` does not validate UTF-8).
+* Aside from `SonicJSON`, `JSONv2` is generally just as fast
+ or faster than all the alternatives.
+
+#### RawValue types
+
+![Benchmark Unmarshal Rawvalue](benchmark-unmarshal-rawvalue.png)
+
+* This compares performance when unmarshaling into a `json.RawValue`.
+ This mostly exercises the underlying decoder and
+ hides away most of the cost of Go reflection.
+* Relative to `JSONv1`, `JSONv2` is about 8.3x to 17.0x faster.
+* Relative to `JSONIterator`, `JSONv2` is up to 2.0x faster.
+* Relative to `SegmentJSON`, `JSONv2` is up to 1.6x faster or 1.7x slower.
+* Relative to `GoJSON`, `JSONv2` is up to 1.9x faster or 2.1x slower.
+* Relative to `SonicJSON`, `JSONv2` is up to 2.0x faster
+ (ignoring `StringUnicode` since `SonicJSON` does not validate UTF-8).
+* `JSONv1` takes a
+ [lexical scanning approach](https://talks.golang.org/2011/lex.slide#1),
+ which performs a virtual function call for every byte of input.
+ In contrast, `JSONv2` makes heavy use of iterative and linear parsing logic
+ (with extra complexity to resume parsing when encountering segmented buffers).
+* `JSONv2` is comparable to the alternatives that use `unsafe`.
+ Generally it is faster, but sometimes it is slower.
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal.go
new file mode 100644
index 000000000..e6c6216ff
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal.go
@@ -0,0 +1,513 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package json
+
+import (
+ "errors"
+ "io"
+ "reflect"
+ "sync"
+)
+
+// MarshalOptions configures how Go data is serialized as JSON data.
+// The zero value is equivalent to the default marshal settings.
+type MarshalOptions struct {
+ requireKeyedLiterals
+ nonComparable
+
+ // Marshalers is a list of type-specific marshalers to use.
+ Marshalers *Marshalers
+
+ // StringifyNumbers specifies that numeric Go types should be serialized
+ // as a JSON string containing the equivalent JSON number value.
+ //
+ // According to RFC 8259, section 6, a JSON implementation may choose to
+ // limit the representation of a JSON number to an IEEE 754 binary64 value.
+ // This may cause decoders to lose precision for int64 and uint64 types.
+ // Escaping JSON numbers as a JSON string preserves the exact precision.
+ StringifyNumbers bool
+
+ // DiscardUnknownMembers specifies that marshaling should ignore any
+ // JSON object members stored in Go struct fields dedicated to storing
+ // unknown JSON object members.
+ DiscardUnknownMembers bool
+
+ // Deterministic specifies that the same input value will be serialized
+ // as the exact same output bytes. Different processes of
+ // the same program will serialize equal values to the same bytes,
+ // but different versions of the same program are not guaranteed
+ // to produce the exact same sequence of bytes.
+ Deterministic bool
+
+ // formatDepth is the depth at which we respect the format flag.
+ formatDepth int
+ // format is custom formatting for the value at the specified depth.
+ format string
+}
+
+// Marshal serializes a Go value as a []byte with default options.
+// It is a thin wrapper over MarshalOptions.Marshal.
+func Marshal(in any) (out []byte, err error) {
+ return MarshalOptions{}.Marshal(EncodeOptions{}, in)
+}
+
+// MarshalFull serializes a Go value into an io.Writer with default options.
+// It is a thin wrapper over MarshalOptions.MarshalFull.
+func MarshalFull(out io.Writer, in any) error {
+ return MarshalOptions{}.MarshalFull(EncodeOptions{}, out, in)
+}
+
+// Marshal serializes a Go value as a []byte according to the provided
+// marshal and encode options. It does not terminate the output with a newline.
+// See MarshalNext for details about the conversion of a Go value into JSON.
+func (mo MarshalOptions) Marshal(eo EncodeOptions, in any) (out []byte, err error) {
+ enc := getBufferedEncoder(eo)
+ defer putBufferedEncoder(enc)
+ enc.options.omitTopLevelNewline = true
+ err = mo.MarshalNext(enc, in)
+ // TODO(https://go.dev/issue/45038): Use bytes.Clone.
+ return append([]byte(nil), enc.buf...), err
+}
+
+// MarshalFull serializes a Go value into an io.Writer according to the provided
+// marshal and encode options. It does not terminate the output with a newline.
+// See MarshalNext for details about the conversion of a Go value into JSON.
+func (mo MarshalOptions) MarshalFull(eo EncodeOptions, out io.Writer, in any) error {
+ enc := getStreamingEncoder(out, eo)
+ defer putStreamingEncoder(enc)
+ enc.options.omitTopLevelNewline = true
+ err := mo.MarshalNext(enc, in)
+ return err
+}
+
+// MarshalNext encodes a Go value as the next JSON value according to
+// the provided marshal options.
+//
+// Type-specific marshal functions and methods take precedence
+// over the default representation of a value.
+// Functions or methods that operate on *T are only called when encoding
+// a value of type T (by taking its address) or a non-nil value of *T.
+// MarshalNext ensures that a value is always addressable
+// (by boxing it on the heap if necessary) so that
+// these functions and methods can be consistently called. For performance,
+// it is recommended that MarshalNext be passed a non-nil pointer to the value.
+//
+// The input value is encoded as JSON according the following rules:
+//
+// - If any type-specific functions in MarshalOptions.Marshalers match
+// the value type, then those functions are called to encode the value.
+// If all applicable functions return SkipFunc,
+// then the value is encoded according to subsequent rules.
+//
+// - If the value type implements MarshalerV2,
+// then the MarshalNextJSON method is called to encode the value.
+//
+// - If the value type implements MarshalerV1,
+// then the MarshalJSON method is called to encode the value.
+//
+// - If the value type implements encoding.TextMarshaler,
+// then the MarshalText method is called to encode the value and
+// subsequently encode its result as a JSON string.
+//
+// - Otherwise, the value is encoded according to the value's type
+// as described in detail below.
+//
+// Most Go types have a default JSON representation.
+// Certain types support specialized formatting according to
+// a format flag optionally specified in the Go struct tag
+// for the struct field that contains the current value
+// (see the “JSON Representation of Go structs” section for more details).
+//
+// The representation of each type is as follows:
+//
+// - A Go boolean is encoded as a JSON boolean (e.g., true or false).
+// It does not support any custom format flags.
+//
+// - A Go string is encoded as a JSON string.
+// It does not support any custom format flags.
+//
+// - A Go []byte or [N]byte is encoded as a JSON string containing
+// the binary value encoded using RFC 4648.
+// If the format is "base64" or unspecified, then this uses RFC 4648, section 4.
+// If the format is "base64url", then this uses RFC 4648, section 5.
+// If the format is "base32", then this uses RFC 4648, section 6.
+// If the format is "base32hex", then this uses RFC 4648, section 7.
+// If the format is "base16" or "hex", then this uses RFC 4648, section 8.
+// If the format is "array", then the bytes value is encoded as a JSON array
+// where each byte is recursively JSON-encoded as each JSON array element.
+//
+// - A Go integer is encoded as a JSON number without fractions or exponents.
+// If MarshalOptions.StringifyNumbers is specified, then the JSON number is
+// encoded within a JSON string. It does not support any custom format
+// flags.
+//
+// - A Go float is encoded as a JSON number.
+// If MarshalOptions.StringifyNumbers is specified,
+// then the JSON number is encoded within a JSON string.
+// If the format is "nonfinite", then NaN, +Inf, and -Inf are encoded as
+// the JSON strings "NaN", "Infinity", and "-Infinity", respectively.
+// Otherwise, the presence of non-finite numbers results in a SemanticError.
+//
+// - A Go map is encoded as a JSON object, where each Go map key and value
+// is recursively encoded as a name and value pair in the JSON object.
+// The Go map key must encode as a JSON string, otherwise this results
+// in a SemanticError. When encoding keys, MarshalOptions.StringifyNumbers
+// is automatically applied so that numeric keys encode as JSON strings.
+// The Go map is traversed in a non-deterministic order.
+// For deterministic encoding, consider using RawValue.Canonicalize.
+// If the format is "emitnull", then a nil map is encoded as a JSON null.
+// Otherwise by default, a nil map is encoded as an empty JSON object.
+//
+// - A Go struct is encoded as a JSON object.
+// See the “JSON Representation of Go structs” section
+// in the package-level documentation for more details.
+//
+// - A Go slice is encoded as a JSON array, where each Go slice element
+// is recursively JSON-encoded as the elements of the JSON array.
+// If the format is "emitnull", then a nil slice is encoded as a JSON null.
+// Otherwise by default, a nil slice is encoded as an empty JSON array.
+//
+// - A Go array is encoded as a JSON array, where each Go array element
+// is recursively JSON-encoded as the elements of the JSON array.
+// The JSON array length is always identical to the Go array length.
+// It does not support any custom format flags.
+//
+// - A Go pointer is encoded as a JSON null if nil, otherwise it is
+// the recursively JSON-encoded representation of the underlying value.
+// Format flags are forwarded to the encoding of the underlying value.
+//
+// - A Go interface is encoded as a JSON null if nil, otherwise it is
+// the recursively JSON-encoded representation of the underlying value.
+// It does not support any custom format flags.
+//
+// - A Go time.Time is encoded as a JSON string containing the timestamp
+// formatted in RFC 3339 with nanosecond resolution.
+// If the format matches one of the format constants declared
+// in the time package (e.g., RFC1123), then that format is used.
+// Otherwise, the format is used as-is with time.Time.Format if non-empty.
+//
+// - A Go time.Duration is encoded as a JSON string containing the duration
+// formatted according to time.Duration.String.
+// If the format is "nanos", it is encoded as a JSON number
+// containing the number of nanoseconds in the duration.
+//
+// - All other Go types (e.g., complex numbers, channels, and functions)
+// have no default representation and result in a SemanticError.
+//
+// JSON cannot represent cyclic data structures and
+// MarshalNext does not handle them.
+// Passing cyclic structures will result in an error.
+func (mo MarshalOptions) MarshalNext(out *Encoder, in any) error {
+ v := reflect.ValueOf(in)
+ if !v.IsValid() || (v.Kind() == reflect.Pointer && v.IsNil()) {
+ return out.WriteToken(Null)
+ }
+ // Shallow copy non-pointer values to obtain an addressable value.
+ // It is beneficial to performance to always pass pointers to avoid this.
+ if v.Kind() != reflect.Pointer {
+ v2 := reflect.New(v.Type())
+ v2.Elem().Set(v)
+ v = v2
+ }
+ va := addressableValue{v.Elem()} // dereferenced pointer is always addressable
+ t := va.Type()
+
+ // Lookup and call the marshal function for this type.
+ marshal := lookupArshaler(t).marshal
+ if mo.Marshalers != nil {
+ marshal, _ = mo.Marshalers.lookup(marshal, t)
+ }
+ if err := marshal(mo, out, va); err != nil {
+ if !out.options.AllowDuplicateNames {
+ out.tokens.invalidateDisabledNamespaces()
+ }
+ return err
+ }
+ return nil
+}
+
+// UnmarshalOptions configures how JSON data is deserialized as Go data.
+// The zero value is equivalent to the default unmarshal settings.
+type UnmarshalOptions struct {
+ requireKeyedLiterals
+ nonComparable
+
+ // Unmarshalers is a list of type-specific unmarshalers to use.
+ Unmarshalers *Unmarshalers
+
+ // StringifyNumbers specifies that numeric Go types can be deserialized
+ // from either a JSON number or a JSON string containing a JSON number
+ // without any surrounding whitespace.
+ StringifyNumbers bool
+
+ // RejectUnknownMembers specifies that unknown members should be rejected
+ // when unmarshaling a JSON object, regardless of whether there is a field
+ // to store unknown members.
+ RejectUnknownMembers bool
+
+ // formatDepth is the depth at which we respect the format flag.
+ formatDepth int
+ // format is custom formatting for the value at the specified depth.
+ format string
+}
+
+// Unmarshal deserializes a Go value from a []byte with default options.
+// It is a thin wrapper over UnmarshalOptions.Unmarshal.
+func Unmarshal(in []byte, out any) error {
+ return UnmarshalOptions{}.Unmarshal(DecodeOptions{}, in, out)
+}
+
+// UnmarshalFull deserializes a Go value from an io.Reader with default options.
+// It is a thin wrapper over UnmarshalOptions.UnmarshalFull.
+func UnmarshalFull(in io.Reader, out any) error {
+ return UnmarshalOptions{}.UnmarshalFull(DecodeOptions{}, in, out)
+}
+
+// Unmarshal deserializes a Go value from a []byte according to the
+// provided unmarshal and decode options. The output must be a non-nil pointer.
+// The input must be a single JSON value with optional whitespace interspersed.
+// See UnmarshalNext for details about the conversion of JSON into a Go value.
+func (uo UnmarshalOptions) Unmarshal(do DecodeOptions, in []byte, out any) error {
+ dec := getBufferedDecoder(in, do)
+ defer putBufferedDecoder(dec)
+ return uo.unmarshalFull(dec, out)
+}
+
+// UnmarshalFull deserializes a Go value from an io.Reader according to the
+// provided unmarshal and decode options. The output must be a non-nil pointer.
+// The input must be a single JSON value with optional whitespace interspersed.
+// It consumes the entirety of io.Reader until io.EOF is encountered.
+// See UnmarshalNext for details about the conversion of JSON into a Go value.
+func (uo UnmarshalOptions) UnmarshalFull(do DecodeOptions, in io.Reader, out any) error {
+ dec := getStreamingDecoder(in, do)
+ defer putStreamingDecoder(dec)
+ return uo.unmarshalFull(dec, out)
+}
+func (uo UnmarshalOptions) unmarshalFull(in *Decoder, out any) error {
+ switch err := uo.UnmarshalNext(in, out); err {
+ case nil:
+ return in.checkEOF()
+ case io.EOF:
+ return io.ErrUnexpectedEOF
+ default:
+ return err
+ }
+}
+
+// UnmarshalNext decodes the next JSON value into a Go value according to
+// the provided unmarshal options. The output must be a non-nil pointer.
+//
+// Type-specific unmarshal functions and methods take precedence
+// over the default representation of a value.
+// Functions or methods that operate on *T are only called when decoding
+// a value of type T (by taking its address) or a non-nil value of *T.
+// UnmarshalNext ensures that a value is always addressable
+// (by boxing it on the heap if necessary) so that
+// these functions and methods can be consistently called.
+//
+// The input is decoded into the output according the following rules:
+//
+// - If any type-specific functions in UnmarshalOptions.Unmarshalers match
+// the value type, then those functions are called to decode the JSON
+// value. If all applicable functions return SkipFunc,
+// then the input is decoded according to subsequent rules.
+//
+// - If the value type implements UnmarshalerV2,
+// then the UnmarshalNextJSON method is called to decode the JSON value.
+//
+// - If the value type implements UnmarshalerV1,
+// then the UnmarshalJSON method is called to decode the JSON value.
+//
+// - If the value type implements encoding.TextUnmarshaler,
+// then the input is decoded as a JSON string and
+// the UnmarshalText method is called with the decoded string value.
+// This fails with a SemanticError if the input is not a JSON string.
+//
+// - Otherwise, the JSON value is decoded according to the value's type
+// as described in detail below.
+//
+// Most Go types have a default JSON representation.
+// Certain types support specialized formatting according to
+// a format flag optionally specified in the Go struct tag
+// for the struct field that contains the current value
+// (see the “JSON Representation of Go structs” section for more details).
+// A JSON null may be decoded into every supported Go value where
+// it is equivalent to storing the zero value of the Go value.
+// If the input JSON kind is not handled by the current Go value type,
+// then this fails with a SemanticError. Unless otherwise specified,
+// the decoded value replaces any pre-existing value.
+//
+// The representation of each type is as follows:
+//
+// - A Go boolean is decoded from a JSON boolean (e.g., true or false).
+// It does not support any custom format flags.
+//
+// - A Go string is decoded from a JSON string.
+// It does not support any custom format flags.
+//
+// - A Go []byte or [N]byte is decoded from a JSON string
+// containing the binary value encoded using RFC 4648.
+// If the format is "base64" or unspecified, then this uses RFC 4648, section 4.
+// If the format is "base64url", then this uses RFC 4648, section 5.
+// If the format is "base32", then this uses RFC 4648, section 6.
+// If the format is "base32hex", then this uses RFC 4648, section 7.
+// If the format is "base16" or "hex", then this uses RFC 4648, section 8.
+// If the format is "array", then the Go slice or array is decoded from a
+// JSON array where each JSON element is recursively decoded for each byte.
+// When decoding into a non-nil []byte, the slice length is reset to zero
+// and the decoded input is appended to it.
+// When decoding into a [N]byte, the input must decode to exactly N bytes,
+// otherwise it fails with a SemanticError.
+//
+// - A Go integer is decoded from a JSON number.
+// It may also be decoded from a JSON string containing a JSON number
+// if UnmarshalOptions.StringifyNumbers is specified.
+// It fails with a SemanticError if the JSON number
+// has a fractional or exponent component.
+// It also fails if it overflows the representation of the Go integer type.
+// It does not support any custom format flags.
+//
+// - A Go float is decoded from a JSON number.
+// It may also be decoded from a JSON string containing a JSON number
+// if UnmarshalOptions.StringifyNumbers is specified.
+// The JSON number is parsed as the closest representable Go float value.
+// If the format is "nonfinite", then the JSON strings
+// "NaN", "Infinity", and "-Infinity" are decoded as NaN, +Inf, and -Inf.
+// Otherwise, the presence of such strings results in a SemanticError.
+//
+// - A Go map is decoded from a JSON object,
+// where each JSON object name and value pair is recursively decoded
+// as the Go map key and value. When decoding keys,
+// UnmarshalOptions.StringifyNumbers is automatically applied so that
+// numeric keys can decode from JSON strings. Maps are not cleared.
+// If the Go map is nil, then a new map is allocated to decode into.
+// If the decoded key matches an existing Go map entry, the entry value
+// is reused by decoding the JSON object value into it.
+// The only supported format is "emitnull" and has no effect when decoding.
+//
+// - A Go struct is decoded from a JSON object.
+// See the “JSON Representation of Go structs” section
+// in the package-level documentation for more details.
+//
+// - A Go slice is decoded from a JSON array, where each JSON element
+// is recursively decoded and appended to the Go slice.
+// Before appending into a Go slice, a new slice is allocated if it is nil,
+// otherwise the slice length is reset to zero.
+// The only supported format is "emitnull" and has no effect when decoding.
+//
+// - A Go array is decoded from a JSON array, where each JSON array element
+// is recursively decoded as each corresponding Go array element.
+// Each Go array element is zeroed before decoding into it.
+// It fails with a SemanticError if the JSON array does not contain
+// the exact same number of elements as the Go array.
+// It does not support any custom format flags.
+//
+// - A Go pointer is decoded based on the JSON kind and underlying Go type.
+// If the input is a JSON null, then this stores a nil pointer.
+// Otherwise, it allocates a new underlying value if the pointer is nil,
+// and recursively JSON decodes into the underlying value.
+// Format flags are forwarded to the decoding of the underlying type.
+//
+// - A Go interface is decoded based on the JSON kind and underlying Go type.
+// If the input is a JSON null, then this stores a nil interface value.
+// Otherwise, a nil interface value of an empty interface type is initialized
+// with a zero Go bool, string, float64, map[string]any, or []any if the
+// input is a JSON boolean, string, number, object, or array, respectively.
+// If the interface value is still nil, then this fails with a SemanticError
+// since decoding could not determine an appropriate Go type to decode into.
+// For example, unmarshaling into a nil io.Reader fails since
+// there is no concrete type to populate the interface value with.
+// Otherwise an underlying value exists and it recursively decodes
+// the JSON input into it. It does not support any custom format flags.
+//
+// - A Go time.Time is decoded from a JSON string containing the time
+// formatted in RFC 3339 with nanosecond resolution.
+// If the format matches one of the format constants declared in
+// the time package (e.g., RFC1123), then that format is used for parsing.
+// Otherwise, the format is used as-is with time.Time.Parse if non-empty.
+//
+// - A Go time.Duration is decoded from a JSON string by
+// passing the decoded string to time.ParseDuration.
+// If the format is "nanos", it is instead decoded from a JSON number
+// containing the number of nanoseconds in the duration.
+//
+// - All other Go types (e.g., complex numbers, channels, and functions)
+// have no default representation and result in a SemanticError.
+//
+// In general, unmarshaling follows merge semantics (similar to RFC 7396)
+// where the decoded Go value replaces the destination value
+// for any JSON kind other than an object.
+// For JSON objects, the input object is merged into the destination value
+// where matching object members recursively apply merge semantics.
+func (uo UnmarshalOptions) UnmarshalNext(in *Decoder, out any) error {
+ v := reflect.ValueOf(out)
+ if !v.IsValid() || v.Kind() != reflect.Pointer || v.IsNil() {
+ var t reflect.Type
+ if v.IsValid() {
+ t = v.Type()
+ if t.Kind() == reflect.Pointer {
+ t = t.Elem()
+ }
+ }
+ err := errors.New("value must be passed as a non-nil pointer reference")
+ return &SemanticError{action: "unmarshal", GoType: t, Err: err}
+ }
+ va := addressableValue{v.Elem()} // dereferenced pointer is always addressable
+ t := va.Type()
+
+ // Lookup and call the unmarshal function for this type.
+ unmarshal := lookupArshaler(t).unmarshal
+ if uo.Unmarshalers != nil {
+ unmarshal, _ = uo.Unmarshalers.lookup(unmarshal, t)
+ }
+ if err := unmarshal(uo, in, va); err != nil {
+ if !in.options.AllowDuplicateNames {
+ in.tokens.invalidateDisabledNamespaces()
+ }
+ return err
+ }
+ return nil
+}
+
+// addressableValue is a reflect.Value that is guaranteed to be addressable
+// such that calling the Addr and Set methods do not panic.
+//
+// There is no compile magic that enforces this property,
+// but rather the need to construct this type makes it easier to examine each
+// construction site to ensure that this property is upheld.
+type addressableValue struct{ reflect.Value }
+
+// newAddressableValue constructs a new addressable value of type t.
+func newAddressableValue(t reflect.Type) addressableValue {
+ return addressableValue{reflect.New(t).Elem()}
+}
+
+// All marshal and unmarshal behavior is implemented using these signatures.
+type (
+ marshaler = func(MarshalOptions, *Encoder, addressableValue) error
+ unmarshaler = func(UnmarshalOptions, *Decoder, addressableValue) error
+)
+
+type arshaler struct {
+ marshal marshaler
+ unmarshal unmarshaler
+ nonDefault bool
+}
+
+var lookupArshalerCache sync.Map // map[reflect.Type]*arshaler
+
+func lookupArshaler(t reflect.Type) *arshaler {
+ if v, ok := lookupArshalerCache.Load(t); ok {
+ return v.(*arshaler)
+ }
+
+ fncs := makeDefaultArshaler(t)
+ fncs = makeMethodArshaler(fncs, t)
+ fncs = makeTimeArshaler(fncs, t)
+
+ // Use the last stored so that duplicate arshalers can be garbage collected.
+ v, _ := lookupArshalerCache.LoadOrStore(t, fncs)
+ return v.(*arshaler)
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_any.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_any.go
new file mode 100644
index 000000000..c62b1f320
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_any.go
@@ -0,0 +1,238 @@
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package json
+
+import "reflect"
+
+// This files contains an optimized marshal and unmarshal implementation
+// for the any type. This type is often used when the Go program has
+// no knowledge of the JSON schema. This is a common enough occurrence
+// to justify the complexity of adding logic for this.
+
+func marshalValueAny(mo MarshalOptions, enc *Encoder, val any) error {
+ switch val := val.(type) {
+ case nil:
+ return enc.WriteToken(Null)
+ case bool:
+ return enc.WriteToken(Bool(val))
+ case string:
+ return enc.WriteToken(String(val))
+ case float64:
+ return enc.WriteToken(Float(val))
+ case map[string]any:
+ return marshalObjectAny(mo, enc, val)
+ case []any:
+ return marshalArrayAny(mo, enc, val)
+ default:
+ v := newAddressableValue(reflect.TypeOf(val))
+ v.Set(reflect.ValueOf(val))
+ marshal := lookupArshaler(v.Type()).marshal
+ if mo.Marshalers != nil {
+ marshal, _ = mo.Marshalers.lookup(marshal, v.Type())
+ }
+ return marshal(mo, enc, v)
+ }
+}
+
+func unmarshalValueAny(uo UnmarshalOptions, dec *Decoder) (any, error) {
+ switch k := dec.PeekKind(); k {
+ case '{':
+ return unmarshalObjectAny(uo, dec)
+ case '[':
+ return unmarshalArrayAny(uo, dec)
+ default:
+ var flags valueFlags
+ val, err := dec.readValue(&flags)
+ if err != nil {
+ return nil, err
+ }
+ switch val.Kind() {
+ case 'n':
+ return nil, nil
+ case 'f':
+ return false, nil
+ case 't':
+ return true, nil
+ case '"':
+ val = unescapeStringMayCopy(val, flags.isVerbatim())
+ if dec.stringCache == nil {
+ dec.stringCache = new(stringCache)
+ }
+ return dec.stringCache.make(val), nil
+ case '0':
+ fv, _ := parseFloat(val, 64) // ignore error since readValue guarantees val is valid
+ return fv, nil
+ default:
+ panic("BUG: invalid kind: " + k.String())
+ }
+ }
+}
+
+func marshalObjectAny(mo MarshalOptions, enc *Encoder, obj map[string]any) error {
+ // Check for cycles.
+ if enc.tokens.depth() > startDetectingCyclesAfter {
+ v := reflect.ValueOf(obj)
+ if err := enc.seenPointers.visit(v); err != nil {
+ return err
+ }
+ defer enc.seenPointers.leave(v)
+ }
+
+ // Optimize for marshaling an empty map without any preceding whitespace.
+ if len(obj) == 0 && !enc.options.multiline && !enc.tokens.last.needObjectName() {
+ enc.buf = enc.tokens.mayAppendDelim(enc.buf, '{')
+ enc.buf = append(enc.buf, "{}"...)
+ enc.tokens.last.increment()
+ if enc.needFlush() {
+ return enc.flush()
+ }
+ return nil
+ }
+
+ if err := enc.WriteToken(ObjectStart); err != nil {
+ return err
+ }
+ // A Go map guarantees that each entry has a unique key
+ // The only possibility of duplicates is due to invalid UTF-8.
+ if !enc.options.AllowInvalidUTF8 {
+ enc.tokens.last.disableNamespace()
+ }
+ if !mo.Deterministic || len(obj) <= 1 {
+ for name, val := range obj {
+ if err := enc.WriteToken(String(name)); err != nil {
+ return err
+ }
+ if err := marshalValueAny(mo, enc, val); err != nil {
+ return err
+ }
+ }
+ } else {
+ names := getStrings(len(obj))
+ var i int
+ for name := range obj {
+ (*names)[i] = name
+ i++
+ }
+ names.Sort()
+ for _, name := range *names {
+ if err := enc.WriteToken(String(name)); err != nil {
+ return err
+ }
+ if err := marshalValueAny(mo, enc, obj[name]); err != nil {
+ return err
+ }
+ }
+ putStrings(names)
+ }
+ if err := enc.WriteToken(ObjectEnd); err != nil {
+ return err
+ }
+ return nil
+}
+
+func unmarshalObjectAny(uo UnmarshalOptions, dec *Decoder) (map[string]any, error) {
+ tok, err := dec.ReadToken()
+ if err != nil {
+ return nil, err
+ }
+ k := tok.Kind()
+ switch k {
+ case 'n':
+ return nil, nil
+ case '{':
+ obj := make(map[string]any)
+ // A Go map guarantees that each entry has a unique key
+ // The only possibility of duplicates is due to invalid UTF-8.
+ if !dec.options.AllowInvalidUTF8 {
+ dec.tokens.last.disableNamespace()
+ }
+ for dec.PeekKind() != '}' {
+ tok, err := dec.ReadToken()
+ if err != nil {
+ return obj, err
+ }
+ name := tok.String()
+
+ // Manually check for duplicate names.
+ if _, ok := obj[name]; ok {
+ name := dec.previousBuffer()
+ err := &SyntacticError{str: "duplicate name " + string(name) + " in object"}
+ return obj, err.withOffset(dec.InputOffset() - int64(len(name)))
+ }
+
+ val, err := unmarshalValueAny(uo, dec)
+ obj[name] = val
+ if err != nil {
+ return obj, err
+ }
+ }
+ if _, err := dec.ReadToken(); err != nil {
+ return obj, err
+ }
+ return obj, nil
+ }
+ return nil, &SemanticError{action: "unmarshal", JSONKind: k, GoType: mapStringAnyType}
+}
+
+func marshalArrayAny(mo MarshalOptions, enc *Encoder, arr []any) error {
+ // Check for cycles.
+ if enc.tokens.depth() > startDetectingCyclesAfter {
+ v := reflect.ValueOf(arr)
+ if err := enc.seenPointers.visit(v); err != nil {
+ return err
+ }
+ defer enc.seenPointers.leave(v)
+ }
+
+ // Optimize for marshaling an empty slice without any preceding whitespace.
+ if len(arr) == 0 && !enc.options.multiline && !enc.tokens.last.needObjectName() {
+ enc.buf = enc.tokens.mayAppendDelim(enc.buf, '[')
+ enc.buf = append(enc.buf, "[]"...)
+ enc.tokens.last.increment()
+ if enc.needFlush() {
+ return enc.flush()
+ }
+ return nil
+ }
+
+ if err := enc.WriteToken(ArrayStart); err != nil {
+ return err
+ }
+ for _, val := range arr {
+ if err := marshalValueAny(mo, enc, val); err != nil {
+ return err
+ }
+ }
+ if err := enc.WriteToken(ArrayEnd); err != nil {
+ return err
+ }
+ return nil
+}
+
+func unmarshalArrayAny(uo UnmarshalOptions, dec *Decoder) ([]any, error) {
+ tok, err := dec.ReadToken()
+ if err != nil {
+ return nil, err
+ }
+ k := tok.Kind()
+ switch k {
+ case 'n':
+ return nil, nil
+ case '[':
+ arr := []any{}
+ for dec.PeekKind() != ']' {
+ val, err := unmarshalValueAny(uo, dec)
+ arr = append(arr, val)
+ if err != nil {
+ return arr, err
+ }
+ }
+ if _, err := dec.ReadToken(); err != nil {
+ return arr, err
+ }
+ return arr, nil
+ }
+ return nil, &SemanticError{action: "unmarshal", JSONKind: k, GoType: sliceAnyType}
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_default.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_default.go
new file mode 100644
index 000000000..fd26eba35
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_default.go
@@ -0,0 +1,1485 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package json
+
+import (
+ "bytes"
+ "encoding/base32"
+ "encoding/base64"
+ "encoding/hex"
+ "errors"
+ "fmt"
+ "math"
+ "reflect"
+ "sort"
+ "strconv"
+ "sync"
+)
+
+// optimizeCommon specifies whether to use optimizations targeted for certain
+// common patterns, rather than using the slower, but more general logic.
+// All tests should pass regardless of whether this is true or not.
+const optimizeCommon = true
+
+var (
+ // Most natural Go type that correspond with each JSON type.
+ anyType = reflect.TypeOf((*any)(nil)).Elem() // JSON value
+ boolType = reflect.TypeOf((*bool)(nil)).Elem() // JSON bool
+ stringType = reflect.TypeOf((*string)(nil)).Elem() // JSON string
+ float64Type = reflect.TypeOf((*float64)(nil)).Elem() // JSON number
+ mapStringAnyType = reflect.TypeOf((*map[string]any)(nil)).Elem() // JSON object
+ sliceAnyType = reflect.TypeOf((*[]any)(nil)).Elem() // JSON array
+
+ bytesType = reflect.TypeOf((*[]byte)(nil)).Elem()
+ emptyStructType = reflect.TypeOf((*struct{})(nil)).Elem()
+)
+
+const startDetectingCyclesAfter = 1000
+
+type seenPointers map[typedPointer]struct{}
+
+type typedPointer struct {
+ typ reflect.Type
+ ptr any // always stores unsafe.Pointer, but avoids depending on unsafe
+}
+
+// visit visits pointer p of type t, reporting an error if seen before.
+// If successfully visited, then the caller must eventually call leave.
+func (m *seenPointers) visit(v reflect.Value) error {
+ p := typedPointer{v.Type(), v.UnsafePointer()}
+ if _, ok := (*m)[p]; ok {
+ return &SemanticError{action: "marshal", GoType: p.typ, Err: errors.New("encountered a cycle")}
+ }
+ if *m == nil {
+ *m = make(map[typedPointer]struct{})
+ }
+ (*m)[p] = struct{}{}
+ return nil
+}
+func (m *seenPointers) leave(v reflect.Value) {
+ p := typedPointer{v.Type(), v.UnsafePointer()}
+ delete(*m, p)
+}
+
+func makeDefaultArshaler(t reflect.Type) *arshaler {
+ switch t.Kind() {
+ case reflect.Bool:
+ return makeBoolArshaler(t)
+ case reflect.String:
+ return makeStringArshaler(t)
+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+ return makeIntArshaler(t)
+ case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
+ return makeUintArshaler(t)
+ case reflect.Float32, reflect.Float64:
+ return makeFloatArshaler(t)
+ case reflect.Map:
+ return makeMapArshaler(t)
+ case reflect.Struct:
+ return makeStructArshaler(t)
+ case reflect.Slice:
+ fncs := makeSliceArshaler(t)
+ if t.AssignableTo(bytesType) {
+ return makeBytesArshaler(t, fncs)
+ }
+ return fncs
+ case reflect.Array:
+ fncs := makeArrayArshaler(t)
+ if reflect.SliceOf(t.Elem()).AssignableTo(bytesType) {
+ return makeBytesArshaler(t, fncs)
+ }
+ return fncs
+ case reflect.Pointer:
+ return makePointerArshaler(t)
+ case reflect.Interface:
+ return makeInterfaceArshaler(t)
+ default:
+ return makeInvalidArshaler(t)
+ }
+}
+
+func makeBoolArshaler(t reflect.Type) *arshaler {
+ var fncs arshaler
+ fncs.marshal = func(mo MarshalOptions, enc *Encoder, va addressableValue) error {
+ if mo.format != "" && mo.formatDepth == enc.tokens.depth() {
+ return newInvalidFormatError("marshal", t, mo.format)
+ }
+
+ // Optimize for marshaling without preceding whitespace.
+ if optimizeCommon && !enc.options.multiline && !enc.tokens.last.needObjectName() {
+ enc.buf = enc.tokens.mayAppendDelim(enc.buf, 't')
+ if va.Bool() {
+ enc.buf = append(enc.buf, "true"...)
+ } else {
+ enc.buf = append(enc.buf, "false"...)
+ }
+ enc.tokens.last.increment()
+ if enc.needFlush() {
+ return enc.flush()
+ }
+ return nil
+ }
+
+ return enc.WriteToken(Bool(va.Bool()))
+ }
+ fncs.unmarshal = func(uo UnmarshalOptions, dec *Decoder, va addressableValue) error {
+ if uo.format != "" && uo.formatDepth == dec.tokens.depth() {
+ return newInvalidFormatError("unmarshal", t, uo.format)
+ }
+ tok, err := dec.ReadToken()
+ if err != nil {
+ return err
+ }
+ k := tok.Kind()
+ switch k {
+ case 'n':
+ va.SetBool(false)
+ return nil
+ case 't', 'f':
+ va.SetBool(tok.Bool())
+ return nil
+ }
+ return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t}
+ }
+ return &fncs
+}
+
+func makeStringArshaler(t reflect.Type) *arshaler {
+ var fncs arshaler
+ fncs.marshal = func(mo MarshalOptions, enc *Encoder, va addressableValue) error {
+ if mo.format != "" && mo.formatDepth == enc.tokens.depth() {
+ return newInvalidFormatError("marshal", t, mo.format)
+ }
+ return enc.WriteToken(String(va.String()))
+ }
+ fncs.unmarshal = func(uo UnmarshalOptions, dec *Decoder, va addressableValue) error {
+ if uo.format != "" && uo.formatDepth == dec.tokens.depth() {
+ return newInvalidFormatError("unmarshal", t, uo.format)
+ }
+ var flags valueFlags
+ val, err := dec.readValue(&flags)
+ if err != nil {
+ return err
+ }
+ k := val.Kind()
+ switch k {
+ case 'n':
+ va.SetString("")
+ return nil
+ case '"':
+ val = unescapeStringMayCopy(val, flags.isVerbatim())
+ if dec.stringCache == nil {
+ dec.stringCache = new(stringCache)
+ }
+ str := dec.stringCache.make(val)
+ va.SetString(str)
+ return nil
+ }
+ return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t}
+ }
+ return &fncs
+}
+
+var (
+ encodeBase16 = func(dst, src []byte) { hex.Encode(dst, src) }
+ encodeBase32 = base32.StdEncoding.Encode
+ encodeBase32Hex = base32.HexEncoding.Encode
+ encodeBase64 = base64.StdEncoding.Encode
+ encodeBase64URL = base64.URLEncoding.Encode
+ encodedLenBase16 = hex.EncodedLen
+ encodedLenBase32 = base32.StdEncoding.EncodedLen
+ encodedLenBase32Hex = base32.HexEncoding.EncodedLen
+ encodedLenBase64 = base64.StdEncoding.EncodedLen
+ encodedLenBase64URL = base64.URLEncoding.EncodedLen
+ decodeBase16 = hex.Decode
+ decodeBase32 = base32.StdEncoding.Decode
+ decodeBase32Hex = base32.HexEncoding.Decode
+ decodeBase64 = base64.StdEncoding.Decode
+ decodeBase64URL = base64.URLEncoding.Decode
+ decodedLenBase16 = hex.DecodedLen
+ decodedLenBase32 = base32.StdEncoding.WithPadding(base32.NoPadding).DecodedLen
+ decodedLenBase32Hex = base32.HexEncoding.WithPadding(base32.NoPadding).DecodedLen
+ decodedLenBase64 = base64.StdEncoding.WithPadding(base64.NoPadding).DecodedLen
+ decodedLenBase64URL = base64.URLEncoding.WithPadding(base64.NoPadding).DecodedLen
+)
+
+func makeBytesArshaler(t reflect.Type, fncs *arshaler) *arshaler {
+ // NOTE: This handles both []byte and [N]byte.
+ marshalDefault := fncs.marshal
+ fncs.marshal = func(mo MarshalOptions, enc *Encoder, va addressableValue) error {
+ encode, encodedLen := encodeBase64, encodedLenBase64
+ if mo.format != "" && mo.formatDepth == enc.tokens.depth() {
+ switch mo.format {
+ case "base64":
+ encode, encodedLen = encodeBase64, encodedLenBase64
+ case "base64url":
+ encode, encodedLen = encodeBase64URL, encodedLenBase64URL
+ case "base32":
+ encode, encodedLen = encodeBase32, encodedLenBase32
+ case "base32hex":
+ encode, encodedLen = encodeBase32Hex, encodedLenBase32Hex
+ case "base16", "hex":
+ encode, encodedLen = encodeBase16, encodedLenBase16
+ case "array":
+ mo.format = ""
+ return marshalDefault(mo, enc, va)
+ default:
+ return newInvalidFormatError("marshal", t, mo.format)
+ }
+ }
+ val := enc.UnusedBuffer()
+ b := va.Bytes()
+ n := len(`"`) + encodedLen(len(b)) + len(`"`)
+ if cap(val) < n {
+ val = make([]byte, n)
+ } else {
+ val = val[:n]
+ }
+ val[0] = '"'
+ encode(val[len(`"`):len(val)-len(`"`)], b)
+ val[len(val)-1] = '"'
+ return enc.WriteValue(val)
+ }
+ unmarshalDefault := fncs.unmarshal
+ fncs.unmarshal = func(uo UnmarshalOptions, dec *Decoder, va addressableValue) error {
+ decode, decodedLen, encodedLen := decodeBase64, decodedLenBase64, encodedLenBase64
+ if uo.format != "" && uo.formatDepth == dec.tokens.depth() {
+ switch uo.format {
+ case "base64":
+ decode, decodedLen, encodedLen = decodeBase64, decodedLenBase64, encodedLenBase64
+ case "base64url":
+ decode, decodedLen, encodedLen = decodeBase64URL, decodedLenBase64URL, encodedLenBase64URL
+ case "base32":
+ decode, decodedLen, encodedLen = decodeBase32, decodedLenBase32, encodedLenBase32
+ case "base32hex":
+ decode, decodedLen, encodedLen = decodeBase32Hex, decodedLenBase32Hex, encodedLenBase32Hex
+ case "base16", "hex":
+ decode, decodedLen, encodedLen = decodeBase16, decodedLenBase16, encodedLenBase16
+ case "array":
+ uo.format = ""
+ return unmarshalDefault(uo, dec, va)
+ default:
+ return newInvalidFormatError("unmarshal", t, uo.format)
+ }
+ }
+ var flags valueFlags
+ val, err := dec.readValue(&flags)
+ if err != nil {
+ return err
+ }
+ k := val.Kind()
+ switch k {
+ case 'n':
+ va.Set(reflect.Zero(t))
+ return nil
+ case '"':
+ val = unescapeStringMayCopy(val, flags.isVerbatim())
+
+ // For base64 and base32, decodedLen computes the maximum output size
+ // when given the original input size. To compute the exact size,
+ // adjust the input size by excluding trailing padding characters.
+ // This is unnecessary for base16, but also harmless.
+ n := len(val)
+ for n > 0 && val[n-1] == '=' {
+ n--
+ }
+ n = decodedLen(n)
+ b := va.Bytes()
+ if va.Kind() == reflect.Array {
+ if n != len(b) {
+ err := fmt.Errorf("decoded base64 length of %d mismatches array length of %d", n, len(b))
+ return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t, Err: err}
+ }
+ } else {
+ if b == nil || cap(b) < n {
+ b = make([]byte, n)
+ } else {
+ b = b[:n]
+ }
+ }
+ n2, err := decode(b, val)
+ if err == nil && len(val) != encodedLen(n2) {
+ // TODO(https://go.dev/issue/53845): RFC 4648, section 3.3,
+ // specifies that non-alphabet characters must be rejected.
+ // Unfortunately, the "base32" and "base64" packages allow
+ // '\r' and '\n' characters by default.
+ err = errors.New("illegal data at input byte " + strconv.Itoa(bytes.IndexAny(val, "\r\n")))
+ }
+ if err != nil {
+ return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t, Err: err}
+ }
+ if va.Kind() == reflect.Slice {
+ va.SetBytes(b)
+ }
+ return nil
+ }
+ return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t}
+ }
+ return fncs
+}
+
+func makeIntArshaler(t reflect.Type) *arshaler {
+ var fncs arshaler
+ bits := t.Bits()
+ fncs.marshal = func(mo MarshalOptions, enc *Encoder, va addressableValue) error {
+ if mo.format != "" && mo.formatDepth == enc.tokens.depth() {
+ return newInvalidFormatError("marshal", t, mo.format)
+ }
+
+ // Optimize for marshaling without preceding whitespace or string escaping.
+ if optimizeCommon && !enc.options.multiline && !mo.StringifyNumbers && !enc.tokens.last.needObjectName() {
+ enc.buf = enc.tokens.mayAppendDelim(enc.buf, '0')
+ enc.buf = strconv.AppendInt(enc.buf, va.Int(), 10)
+ enc.tokens.last.increment()
+ if enc.needFlush() {
+ return enc.flush()
+ }
+ return nil
+ }
+
+ x := math.Float64frombits(uint64(va.Int()))
+ return enc.writeNumber(x, rawIntNumber, mo.StringifyNumbers)
+ }
+ fncs.unmarshal = func(uo UnmarshalOptions, dec *Decoder, va addressableValue) error {
+ if uo.format != "" && uo.formatDepth == dec.tokens.depth() {
+ return newInvalidFormatError("unmarshal", t, uo.format)
+ }
+ var flags valueFlags
+ val, err := dec.readValue(&flags)
+ if err != nil {
+ return err
+ }
+ k := val.Kind()
+ switch k {
+ case 'n':
+ va.SetInt(0)
+ return nil
+ case '"':
+ if !uo.StringifyNumbers {
+ break
+ }
+ val = unescapeStringMayCopy(val, flags.isVerbatim())
+ fallthrough
+ case '0':
+ var negOffset int
+ neg := val[0] == '-'
+ if neg {
+ negOffset = 1
+ }
+ n, ok := parseDecUint(val[negOffset:])
+ maxInt := uint64(1) << (bits - 1)
+ overflow := (neg && n > maxInt) || (!neg && n > maxInt-1)
+ if !ok {
+ if n != math.MaxUint64 {
+ err := fmt.Errorf("cannot parse %q as signed integer: %w", val, strconv.ErrSyntax)
+ return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t, Err: err}
+ }
+ overflow = true
+ }
+ if overflow {
+ err := fmt.Errorf("cannot parse %q as signed integer: %w", val, strconv.ErrRange)
+ return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t, Err: err}
+ }
+ if neg {
+ va.SetInt(int64(-n))
+ } else {
+ va.SetInt(int64(+n))
+ }
+ return nil
+ }
+ return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t}
+ }
+ return &fncs
+}
+
+func makeUintArshaler(t reflect.Type) *arshaler {
+ var fncs arshaler
+ bits := t.Bits()
+ fncs.marshal = func(mo MarshalOptions, enc *Encoder, va addressableValue) error {
+ if mo.format != "" && mo.formatDepth == enc.tokens.depth() {
+ return newInvalidFormatError("marshal", t, mo.format)
+ }
+
+ // Optimize for marshaling without preceding whitespace or string escaping.
+ if optimizeCommon && !enc.options.multiline && !mo.StringifyNumbers && !enc.tokens.last.needObjectName() {
+ enc.buf = enc.tokens.mayAppendDelim(enc.buf, '0')
+ enc.buf = strconv.AppendUint(enc.buf, va.Uint(), 10)
+ enc.tokens.last.increment()
+ if enc.needFlush() {
+ return enc.flush()
+ }
+ return nil
+ }
+
+ x := math.Float64frombits(va.Uint())
+ return enc.writeNumber(x, rawUintNumber, mo.StringifyNumbers)
+ }
+ fncs.unmarshal = func(uo UnmarshalOptions, dec *Decoder, va addressableValue) error {
+ if uo.format != "" && uo.formatDepth == dec.tokens.depth() {
+ return newInvalidFormatError("unmarshal", t, uo.format)
+ }
+ var flags valueFlags
+ val, err := dec.readValue(&flags)
+ if err != nil {
+ return err
+ }
+ k := val.Kind()
+ switch k {
+ case 'n':
+ va.SetUint(0)
+ return nil
+ case '"':
+ if !uo.StringifyNumbers {
+ break
+ }
+ val = unescapeStringMayCopy(val, flags.isVerbatim())
+ fallthrough
+ case '0':
+ n, ok := parseDecUint(val)
+ maxUint := uint64(1) << bits
+ overflow := n > maxUint-1
+ if !ok {
+ if n != math.MaxUint64 {
+ err := fmt.Errorf("cannot parse %q as unsigned integer: %w", val, strconv.ErrSyntax)
+ return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t, Err: err}
+ }
+ overflow = true
+ }
+ if overflow {
+ err := fmt.Errorf("cannot parse %q as unsigned integer: %w", val, strconv.ErrRange)
+ return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t, Err: err}
+ }
+ va.SetUint(n)
+ return nil
+ }
+ return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t}
+ }
+ return &fncs
+}
+
+func makeFloatArshaler(t reflect.Type) *arshaler {
+ var fncs arshaler
+ bits := t.Bits()
+ fncs.marshal = func(mo MarshalOptions, enc *Encoder, va addressableValue) error {
+ var allowNonFinite bool
+ if mo.format != "" && mo.formatDepth == enc.tokens.depth() {
+ if mo.format == "nonfinite" {
+ allowNonFinite = true
+ } else {
+ return newInvalidFormatError("marshal", t, mo.format)
+ }
+ }
+
+ fv := va.Float()
+ if math.IsNaN(fv) || math.IsInf(fv, 0) {
+ if !allowNonFinite {
+ err := fmt.Errorf("invalid value: %v", fv)
+ return &SemanticError{action: "marshal", GoType: t, Err: err}
+ }
+ return enc.WriteToken(Float(fv))
+ }
+
+ // Optimize for marshaling without preceding whitespace or string escaping.
+ if optimizeCommon && !enc.options.multiline && !mo.StringifyNumbers && !enc.tokens.last.needObjectName() {
+ enc.buf = enc.tokens.mayAppendDelim(enc.buf, '0')
+ enc.buf = appendNumber(enc.buf, fv, bits)
+ enc.tokens.last.increment()
+ if enc.needFlush() {
+ return enc.flush()
+ }
+ return nil
+ }
+
+ return enc.writeNumber(fv, bits, mo.StringifyNumbers)
+ }
+ fncs.unmarshal = func(uo UnmarshalOptions, dec *Decoder, va addressableValue) error {
+ var allowNonFinite bool
+ if uo.format != "" && uo.formatDepth == dec.tokens.depth() {
+ if uo.format == "nonfinite" {
+ allowNonFinite = true
+ } else {
+ return newInvalidFormatError("unmarshal", t, uo.format)
+ }
+ }
+ var flags valueFlags
+ val, err := dec.readValue(&flags)
+ if err != nil {
+ return err
+ }
+ k := val.Kind()
+ switch k {
+ case 'n':
+ va.SetFloat(0)
+ return nil
+ case '"':
+ val = unescapeStringMayCopy(val, flags.isVerbatim())
+ if allowNonFinite {
+ switch string(val) {
+ case "NaN":
+ va.SetFloat(math.NaN())
+ return nil
+ case "Infinity":
+ va.SetFloat(math.Inf(+1))
+ return nil
+ case "-Infinity":
+ va.SetFloat(math.Inf(-1))
+ return nil
+ }
+ }
+ if !uo.StringifyNumbers {
+ break
+ }
+ if n, err := consumeNumber(val); n != len(val) || err != nil {
+ err := fmt.Errorf("cannot parse %q as JSON number: %w", val, strconv.ErrSyntax)
+ return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t, Err: err}
+ }
+ fallthrough
+ case '0':
+ // NOTE: Floating-point parsing is by nature a lossy operation.
+ // We never report an overflow condition since we can always
+ // round the input to the closest representable finite value.
+ // For extremely large numbers, the closest value is ±MaxFloat.
+ fv, _ := parseFloat(val, bits)
+ va.SetFloat(fv)
+ return nil
+ }
+ return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t}
+ }
+ return &fncs
+}
+
+func makeMapArshaler(t reflect.Type) *arshaler {
+ // NOTE: The logic below disables namespaces for tracking duplicate names
+ // when handling map keys with a unique representation.
+
+ // NOTE: Values retrieved from a map are not addressable,
+ // so we shallow copy the values to make them addressable and
+ // store them back into the map afterwards.
+
+ var fncs arshaler
+ var (
+ once sync.Once
+ keyFncs *arshaler
+ valFncs *arshaler
+ )
+ init := func() {
+ keyFncs = lookupArshaler(t.Key())
+ valFncs = lookupArshaler(t.Elem())
+ }
+ fncs.marshal = func(mo MarshalOptions, enc *Encoder, va addressableValue) error {
+ // Check for cycles.
+ if enc.tokens.depth() > startDetectingCyclesAfter {
+ if err := enc.seenPointers.visit(va.Value); err != nil {
+ return err
+ }
+ defer enc.seenPointers.leave(va.Value)
+ }
+
+ if mo.format != "" && mo.formatDepth == enc.tokens.depth() {
+ if mo.format == "emitnull" {
+ if va.IsNil() {
+ return enc.WriteToken(Null)
+ }
+ mo.format = ""
+ } else {
+ return newInvalidFormatError("marshal", t, mo.format)
+ }
+ }
+
+ // Optimize for marshaling an empty map without any preceding whitespace.
+ n := va.Len()
+ if optimizeCommon && n == 0 && !enc.options.multiline && !enc.tokens.last.needObjectName() {
+ enc.buf = enc.tokens.mayAppendDelim(enc.buf, '{')
+ enc.buf = append(enc.buf, "{}"...)
+ enc.tokens.last.increment()
+ if enc.needFlush() {
+ return enc.flush()
+ }
+ return nil
+ }
+
+ once.Do(init)
+ if err := enc.WriteToken(ObjectStart); err != nil {
+ return err
+ }
+ if n > 0 {
+ // Handle maps with numeric key types by stringifying them.
+ mko := mo
+ mko.StringifyNumbers = true
+
+ nonDefaultKey := keyFncs.nonDefault
+ marshalKey := keyFncs.marshal
+ marshalVal := valFncs.marshal
+ if mo.Marshalers != nil {
+ var ok bool
+ marshalKey, ok = mo.Marshalers.lookup(marshalKey, t.Key())
+ marshalVal, _ = mo.Marshalers.lookup(marshalVal, t.Elem())
+ nonDefaultKey = nonDefaultKey || ok
+ }
+ k := newAddressableValue(t.Key())
+ v := newAddressableValue(t.Elem())
+
+ // A Go map guarantees that each entry has a unique key.
+ // As such, disable the expensive duplicate name check if we know
+ // that every Go key will serialize as a unique JSON string.
+ if !nonDefaultKey && mapKeyWithUniqueRepresentation(k.Kind(), enc.options.AllowInvalidUTF8) {
+ enc.tokens.last.disableNamespace()
+ }
+
+ switch {
+ case !mo.Deterministic || n <= 1:
+ for iter := va.Value.MapRange(); iter.Next(); {
+ k.SetIterKey(iter)
+ if err := marshalKey(mko, enc, k); err != nil {
+ // TODO: If err is errMissingName, then wrap it as a
+ // SemanticError since this key type cannot be serialized
+ // as a JSON string.
+ return err
+ }
+ v.SetIterValue(iter)
+ if err := marshalVal(mo, enc, v); err != nil {
+ return err
+ }
+ }
+ case !nonDefaultKey && t.Key().Kind() == reflect.String:
+ names := getStrings(n)
+ for i, iter := 0, va.Value.MapRange(); i < n && iter.Next(); i++ {
+ k.SetIterKey(iter)
+ (*names)[i] = k.String()
+ }
+ names.Sort()
+ for _, name := range *names {
+ if err := enc.WriteToken(String(name)); err != nil {
+ return err
+ }
+ // TODO(https://go.dev/issue/57061): Use v.SetMapIndexOf.
+ k.SetString(name)
+ v.Set(va.MapIndex(k.Value))
+ if err := marshalVal(mo, enc, v); err != nil {
+ return err
+ }
+ }
+ putStrings(names)
+ default:
+ type member struct {
+ name string // unquoted name
+ key addressableValue
+ }
+ members := make([]member, n)
+ keys := reflect.MakeSlice(reflect.SliceOf(t.Key()), n, n)
+ for i, iter := 0, va.Value.MapRange(); i < n && iter.Next(); i++ {
+ // Marshal the member name.
+ k := addressableValue{keys.Index(i)} // indexed slice element is always addressable
+ k.SetIterKey(iter)
+ if err := marshalKey(mko, enc, k); err != nil {
+ // TODO: If err is errMissingName, then wrap it as a
+ // SemanticError since this key type cannot be serialized
+ // as a JSON string.
+ return err
+ }
+ name := enc.unwriteOnlyObjectMemberName()
+ members[i] = member{name, k}
+ }
+ // TODO: If AllowDuplicateNames is enabled, then sort according
+ // to reflect.Value as well if the names are equal.
+ // See internal/fmtsort.
+ // TODO(https://go.dev/issue/47619): Use slices.SortFunc instead.
+ sort.Slice(members, func(i, j int) bool {
+ return lessUTF16(members[i].name, members[j].name)
+ })
+ for _, member := range members {
+ if err := enc.WriteToken(String(member.name)); err != nil {
+ return err
+ }
+ // TODO(https://go.dev/issue/57061): Use v.SetMapIndexOf.
+ v.Set(va.MapIndex(member.key.Value))
+ if err := marshalVal(mo, enc, v); err != nil {
+ return err
+ }
+ }
+ }
+ }
+ if err := enc.WriteToken(ObjectEnd); err != nil {
+ return err
+ }
+ return nil
+ }
+ fncs.unmarshal = func(uo UnmarshalOptions, dec *Decoder, va addressableValue) error {
+ if uo.format != "" && uo.formatDepth == dec.tokens.depth() {
+ if uo.format == "emitnull" {
+ uo.format = "" // only relevant for marshaling
+ } else {
+ return newInvalidFormatError("unmarshal", t, uo.format)
+ }
+ }
+ tok, err := dec.ReadToken()
+ if err != nil {
+ return err
+ }
+ k := tok.Kind()
+ switch k {
+ case 'n':
+ va.Set(reflect.Zero(t))
+ return nil
+ case '{':
+ once.Do(init)
+ if va.IsNil() {
+ va.Set(reflect.MakeMap(t))
+ }
+
+ // Handle maps with numeric key types by stringifying them.
+ uko := uo
+ uko.StringifyNumbers = true
+
+ nonDefaultKey := keyFncs.nonDefault
+ unmarshalKey := keyFncs.unmarshal
+ unmarshalVal := valFncs.unmarshal
+ if uo.Unmarshalers != nil {
+ var ok bool
+ unmarshalKey, ok = uo.Unmarshalers.lookup(unmarshalKey, t.Key())
+ unmarshalVal, _ = uo.Unmarshalers.lookup(unmarshalVal, t.Elem())
+ nonDefaultKey = nonDefaultKey || ok
+ }
+ k := newAddressableValue(t.Key())
+ v := newAddressableValue(t.Elem())
+
+ // Manually check for duplicate entries by virtue of whether the
+ // unmarshaled key already exists in the destination Go map.
+ // Consequently, syntactically different names (e.g., "0" and "-0")
+ // will be rejected as duplicates since they semantically refer
+ // to the same Go value. This is an unusual interaction
+ // between syntax and semantics, but is more correct.
+ if !nonDefaultKey && mapKeyWithUniqueRepresentation(k.Kind(), dec.options.AllowInvalidUTF8) {
+ dec.tokens.last.disableNamespace()
+ }
+
+ // In the rare case where the map is not already empty,
+ // then we need to manually track which keys we already saw
+ // since existing presence alone is insufficient to indicate
+ // whether the input had a duplicate name.
+ var seen reflect.Value
+ if !dec.options.AllowDuplicateNames && va.Len() > 0 {
+ seen = reflect.MakeMap(reflect.MapOf(k.Type(), emptyStructType))
+ }
+
+ for dec.PeekKind() != '}' {
+ k.Set(reflect.Zero(t.Key()))
+ if err := unmarshalKey(uko, dec, k); err != nil {
+ return err
+ }
+ if k.Kind() == reflect.Interface && !k.IsNil() && !k.Elem().Type().Comparable() {
+ err := fmt.Errorf("invalid incomparable key type %v", k.Elem().Type())
+ return &SemanticError{action: "unmarshal", GoType: t, Err: err}
+ }
+
+ if v2 := va.MapIndex(k.Value); v2.IsValid() {
+ if !dec.options.AllowDuplicateNames && (!seen.IsValid() || seen.MapIndex(k.Value).IsValid()) {
+ // TODO: Unread the object name.
+ name := dec.previousBuffer()
+ err := &SyntacticError{str: "duplicate name " + string(name) + " in object"}
+ return err.withOffset(dec.InputOffset() - int64(len(name)))
+ }
+ v.Set(v2)
+ } else {
+ v.Set(reflect.Zero(v.Type()))
+ }
+ err := unmarshalVal(uo, dec, v)
+ va.SetMapIndex(k.Value, v.Value)
+ if seen.IsValid() {
+ seen.SetMapIndex(k.Value, reflect.Zero(emptyStructType))
+ }
+ if err != nil {
+ return err
+ }
+ }
+ if _, err := dec.ReadToken(); err != nil {
+ return err
+ }
+ return nil
+ }
+ return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t}
+ }
+ return &fncs
+}
+
+// mapKeyWithUniqueRepresentation reports whether all possible values of k
+// marshal to a different JSON value, and whether all possible JSON values
+// that can unmarshal into k unmarshal to different Go values.
+// In other words, the representation must be a bijective.
+func mapKeyWithUniqueRepresentation(k reflect.Kind, allowInvalidUTF8 bool) bool {
+ switch k {
+ case reflect.Bool,
+ reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
+ reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
+ return true
+ case reflect.String:
+ // For strings, we have to be careful since names with invalid UTF-8
+ // maybe unescape to the same Go string value.
+ return !allowInvalidUTF8
+ default:
+ // Floating-point kinds are not listed above since NaNs
+ // can appear multiple times and all serialize as "NaN".
+ return false
+ }
+}
+
+func makeStructArshaler(t reflect.Type) *arshaler {
+ // NOTE: The logic below disables namespaces for tracking duplicate names
+ // and does the tracking locally with an efficient bit-set based on which
+ // Go struct fields were seen.
+
+ var fncs arshaler
+ var (
+ once sync.Once
+ fields structFields
+ errInit *SemanticError
+ )
+ init := func() {
+ fields, errInit = makeStructFields(t)
+ }
+ fncs.marshal = func(mo MarshalOptions, enc *Encoder, va addressableValue) error {
+ if mo.format != "" && mo.formatDepth == enc.tokens.depth() {
+ return newInvalidFormatError("marshal", t, mo.format)
+ }
+ once.Do(init)
+ if errInit != nil {
+ err := *errInit // shallow copy SemanticError
+ err.action = "marshal"
+ return &err
+ }
+ if err := enc.WriteToken(ObjectStart); err != nil {
+ return err
+ }
+ var seenIdxs uintSet
+ prevIdx := -1
+ enc.tokens.last.disableNamespace() // we manually ensure unique names below
+ for i := range fields.flattened {
+ f := &fields.flattened[i]
+ v := addressableValue{va.Field(f.index[0])} // addressable if struct value is addressable
+ if len(f.index) > 1 {
+ v = v.fieldByIndex(f.index[1:], false)
+ if !v.IsValid() {
+ continue // implies a nil inlined field
+ }
+ }
+
+ // OmitZero skips the field if the Go value is zero,
+ // which we can determine up front without calling the marshaler.
+ if f.omitzero && ((f.isZero == nil && v.IsZero()) || (f.isZero != nil && f.isZero(v))) {
+ continue
+ }
+
+ marshal := f.fncs.marshal
+ nonDefault := f.fncs.nonDefault
+ if mo.Marshalers != nil {
+ var ok bool
+ marshal, ok = mo.Marshalers.lookup(marshal, f.typ)
+ nonDefault = nonDefault || ok
+ }
+
+ // OmitEmpty skips the field if the marshaled JSON value is empty,
+ // which we can know up front if there are no custom marshalers,
+ // otherwise we must marshal the value and unwrite it if empty.
+ if f.omitempty && !nonDefault && f.isEmpty != nil && f.isEmpty(v) {
+ continue // fast path for omitempty
+ }
+
+ // Write the object member name.
+ //
+ // The logic below is semantically equivalent to:
+ // enc.WriteToken(String(f.name))
+ // but specialized and simplified because:
+ // 1. The Encoder must be expecting an object name.
+ // 2. The object namespace is guaranteed to be disabled.
+ // 3. The object name is guaranteed to be valid and pre-escaped.
+ // 4. There is no need to flush the buffer (for unwrite purposes).
+ // 5. There is no possibility of an error occurring.
+ if optimizeCommon {
+ // Append any delimiters or optional whitespace.
+ if enc.tokens.last.length() > 0 {
+ enc.buf = append(enc.buf, ',')
+ }
+ if enc.options.multiline {
+ enc.buf = enc.appendIndent(enc.buf, enc.tokens.needIndent('"'))
+ }
+
+ // Append the token to the output and to the state machine.
+ n0 := len(enc.buf) // offset before calling appendString
+ if enc.options.EscapeRune == nil {
+ enc.buf = append(enc.buf, f.quotedName...)
+ } else {
+ enc.buf, _ = appendString(enc.buf, f.name, false, enc.options.EscapeRune)
+ }
+ if !enc.options.AllowDuplicateNames {
+ enc.names.replaceLastQuotedOffset(n0)
+ }
+ enc.tokens.last.increment()
+ } else {
+ if err := enc.WriteToken(String(f.name)); err != nil {
+ return err
+ }
+ }
+
+ // Write the object member value.
+ mo2 := mo
+ if f.string {
+ mo2.StringifyNumbers = true
+ }
+ if f.format != "" {
+ mo2.formatDepth = enc.tokens.depth()
+ mo2.format = f.format
+ }
+ if err := marshal(mo2, enc, v); err != nil {
+ return err
+ }
+
+ // Try unwriting the member if empty (slow path for omitempty).
+ if f.omitempty {
+ var prevName *string
+ if prevIdx >= 0 {
+ prevName = &fields.flattened[prevIdx].name
+ }
+ if enc.unwriteEmptyObjectMember(prevName) {
+ continue
+ }
+ }
+
+ // Remember the previous written object member.
+ // The set of seen fields only needs to be updated to detect
+ // duplicate names with those from the inlined fallback.
+ if !enc.options.AllowDuplicateNames && fields.inlinedFallback != nil {
+ seenIdxs.insert(uint(f.id))
+ }
+ prevIdx = f.id
+ }
+ if fields.inlinedFallback != nil && !(mo.DiscardUnknownMembers && fields.inlinedFallback.unknown) {
+ var insertUnquotedName func([]byte) bool
+ if !enc.options.AllowDuplicateNames {
+ insertUnquotedName = func(name []byte) bool {
+ // Check that the name from inlined fallback does not match
+ // one of the previously marshaled names from known fields.
+ if foldedFields := fields.byFoldedName[string(foldName(name))]; len(foldedFields) > 0 {
+ if f := fields.byActualName[string(name)]; f != nil {
+ return seenIdxs.insert(uint(f.id))
+ }
+ for _, f := range foldedFields {
+ if f.nocase {
+ return seenIdxs.insert(uint(f.id))
+ }
+ }
+ }
+
+ // Check that the name does not match any other name
+ // previously marshaled from the inlined fallback.
+ return enc.namespaces.last().insertUnquoted(name)
+ }
+ }
+ if err := marshalInlinedFallbackAll(mo, enc, va, fields.inlinedFallback, insertUnquotedName); err != nil {
+ return err
+ }
+ }
+ if err := enc.WriteToken(ObjectEnd); err != nil {
+ return err
+ }
+ return nil
+ }
+ fncs.unmarshal = func(uo UnmarshalOptions, dec *Decoder, va addressableValue) error {
+ if uo.format != "" && uo.formatDepth == dec.tokens.depth() {
+ return newInvalidFormatError("unmarshal", t, uo.format)
+ }
+ tok, err := dec.ReadToken()
+ if err != nil {
+ return err
+ }
+ k := tok.Kind()
+ switch k {
+ case 'n':
+ va.Set(reflect.Zero(t))
+ return nil
+ case '{':
+ once.Do(init)
+ if errInit != nil {
+ err := *errInit // shallow copy SemanticError
+ err.action = "unmarshal"
+ return &err
+ }
+ var seenIdxs uintSet
+ dec.tokens.last.disableNamespace()
+ for dec.PeekKind() != '}' {
+ // Process the object member name.
+ var flags valueFlags
+ val, err := dec.readValue(&flags)
+ if err != nil {
+ return err
+ }
+ name := unescapeStringMayCopy(val, flags.isVerbatim())
+ f := fields.byActualName[string(name)]
+ if f == nil {
+ for _, f2 := range fields.byFoldedName[string(foldName(name))] {
+ if f2.nocase {
+ f = f2
+ break
+ }
+ }
+ if f == nil {
+ if uo.RejectUnknownMembers && (fields.inlinedFallback == nil || fields.inlinedFallback.unknown) {
+ return &SemanticError{action: "unmarshal", GoType: t, Err: fmt.Errorf("unknown name %s", val)}
+ }
+ if !dec.options.AllowDuplicateNames && !dec.namespaces.last().insertUnquoted(name) {
+ // TODO: Unread the object name.
+ err := &SyntacticError{str: "duplicate name " + string(val) + " in object"}
+ return err.withOffset(dec.InputOffset() - int64(len(val)))
+ }
+
+ if fields.inlinedFallback == nil {
+ // Skip unknown value since we have no place to store it.
+ if err := dec.SkipValue(); err != nil {
+ return err
+ }
+ } else {
+ // Marshal into value capable of storing arbitrary object members.
+ if err := unmarshalInlinedFallbackNext(uo, dec, va, fields.inlinedFallback, val, name); err != nil {
+ return err
+ }
+ }
+ continue
+ }
+ }
+ if !dec.options.AllowDuplicateNames && !seenIdxs.insert(uint(f.id)) {
+ // TODO: Unread the object name.
+ err := &SyntacticError{str: "duplicate name " + string(val) + " in object"}
+ return err.withOffset(dec.InputOffset() - int64(len(val)))
+ }
+
+ // Process the object member value.
+ unmarshal := f.fncs.unmarshal
+ if uo.Unmarshalers != nil {
+ unmarshal, _ = uo.Unmarshalers.lookup(unmarshal, f.typ)
+ }
+ uo2 := uo
+ if f.string {
+ uo2.StringifyNumbers = true
+ }
+ if f.format != "" {
+ uo2.formatDepth = dec.tokens.depth()
+ uo2.format = f.format
+ }
+ v := addressableValue{va.Field(f.index[0])} // addressable if struct value is addressable
+ if len(f.index) > 1 {
+ v = v.fieldByIndex(f.index[1:], true)
+ }
+ if err := unmarshal(uo2, dec, v); err != nil {
+ return err
+ }
+ }
+ if _, err := dec.ReadToken(); err != nil {
+ return err
+ }
+ return nil
+ }
+ return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t}
+ }
+ return &fncs
+}
+
+func (va addressableValue) fieldByIndex(index []int, mayAlloc bool) addressableValue {
+ for _, i := range index {
+ va = va.indirect(mayAlloc)
+ if !va.IsValid() {
+ return va
+ }
+ va = addressableValue{va.Field(i)} // addressable if struct value is addressable
+ }
+ return va
+}
+
+func (va addressableValue) indirect(mayAlloc bool) addressableValue {
+ if va.Kind() == reflect.Pointer {
+ if va.IsNil() {
+ if !mayAlloc {
+ return addressableValue{}
+ }
+ va.Set(reflect.New(va.Type().Elem()))
+ }
+ va = addressableValue{va.Elem()} // dereferenced pointer is always addressable
+ }
+ return va
+}
+
+func makeSliceArshaler(t reflect.Type) *arshaler {
+ var fncs arshaler
+ var (
+ once sync.Once
+ valFncs *arshaler
+ )
+ init := func() {
+ valFncs = lookupArshaler(t.Elem())
+ }
+ fncs.marshal = func(mo MarshalOptions, enc *Encoder, va addressableValue) error {
+ // Check for cycles.
+ if enc.tokens.depth() > startDetectingCyclesAfter {
+ if err := enc.seenPointers.visit(va.Value); err != nil {
+ return err
+ }
+ defer enc.seenPointers.leave(va.Value)
+ }
+
+ if mo.format != "" && mo.formatDepth == enc.tokens.depth() {
+ if mo.format == "emitnull" {
+ if va.IsNil() {
+ return enc.WriteToken(Null)
+ }
+ mo.format = ""
+ } else {
+ return newInvalidFormatError("marshal", t, mo.format)
+ }
+ }
+
+ // Optimize for marshaling an empty slice without any preceding whitespace.
+ n := va.Len()
+ if optimizeCommon && n == 0 && !enc.options.multiline && !enc.tokens.last.needObjectName() {
+ enc.buf = enc.tokens.mayAppendDelim(enc.buf, '[')
+ enc.buf = append(enc.buf, "[]"...)
+ enc.tokens.last.increment()
+ if enc.needFlush() {
+ return enc.flush()
+ }
+ return nil
+ }
+
+ once.Do(init)
+ if err := enc.WriteToken(ArrayStart); err != nil {
+ return err
+ }
+ marshal := valFncs.marshal
+ if mo.Marshalers != nil {
+ marshal, _ = mo.Marshalers.lookup(marshal, t.Elem())
+ }
+ for i := 0; i < n; i++ {
+ v := addressableValue{va.Index(i)} // indexed slice element is always addressable
+ if err := marshal(mo, enc, v); err != nil {
+ return err
+ }
+ }
+ if err := enc.WriteToken(ArrayEnd); err != nil {
+ return err
+ }
+ return nil
+ }
+ emptySlice := reflect.MakeSlice(t, 0, 0)
+ fncs.unmarshal = func(uo UnmarshalOptions, dec *Decoder, va addressableValue) error {
+ if uo.format != "" && uo.formatDepth == dec.tokens.depth() {
+ if uo.format == "emitnull" {
+ uo.format = "" // only relevant for marshaling
+ } else {
+ return newInvalidFormatError("unmarshal", t, uo.format)
+ }
+ }
+
+ tok, err := dec.ReadToken()
+ if err != nil {
+ return err
+ }
+ k := tok.Kind()
+ switch k {
+ case 'n':
+ va.Set(reflect.Zero(t))
+ return nil
+ case '[':
+ once.Do(init)
+ unmarshal := valFncs.unmarshal
+ if uo.Unmarshalers != nil {
+ unmarshal, _ = uo.Unmarshalers.lookup(unmarshal, t.Elem())
+ }
+ mustZero := true // we do not know the cleanliness of unused capacity
+ cap := va.Cap()
+ if cap > 0 {
+ va.SetLen(cap)
+ }
+ var i int
+ for dec.PeekKind() != ']' {
+ if i == cap {
+ // TODO(https://go.dev/issue/48000): Use reflect.Value.Append.
+ va.Set(reflect.Append(va.Value, reflect.Zero(t.Elem())))
+ cap = va.Cap()
+ va.SetLen(cap)
+ mustZero = false // append guarantees that unused capacity is zero-initialized
+ }
+ v := addressableValue{va.Index(i)} // indexed slice element is always addressable
+ i++
+ if mustZero {
+ v.Set(reflect.Zero(t.Elem()))
+ }
+ if err := unmarshal(uo, dec, v); err != nil {
+ va.SetLen(i)
+ return err
+ }
+ }
+ if i == 0 {
+ va.Set(emptySlice)
+ } else {
+ va.SetLen(i)
+ }
+ if _, err := dec.ReadToken(); err != nil {
+ return err
+ }
+ return nil
+ }
+ return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t}
+ }
+ return &fncs
+}
+
+func makeArrayArshaler(t reflect.Type) *arshaler {
+ var fncs arshaler
+ var (
+ once sync.Once
+ valFncs *arshaler
+ )
+ init := func() {
+ valFncs = lookupArshaler(t.Elem())
+ }
+ n := t.Len()
+ fncs.marshal = func(mo MarshalOptions, enc *Encoder, va addressableValue) error {
+ if mo.format != "" && mo.formatDepth == enc.tokens.depth() {
+ return newInvalidFormatError("marshal", t, mo.format)
+ }
+ once.Do(init)
+ if err := enc.WriteToken(ArrayStart); err != nil {
+ return err
+ }
+ marshal := valFncs.marshal
+ if mo.Marshalers != nil {
+ marshal, _ = mo.Marshalers.lookup(marshal, t.Elem())
+ }
+ for i := 0; i < n; i++ {
+ v := addressableValue{va.Index(i)} // indexed array element is addressable if array is addressable
+ if err := marshal(mo, enc, v); err != nil {
+ return err
+ }
+ }
+ if err := enc.WriteToken(ArrayEnd); err != nil {
+ return err
+ }
+ return nil
+ }
+ fncs.unmarshal = func(uo UnmarshalOptions, dec *Decoder, va addressableValue) error {
+ if uo.format != "" && uo.formatDepth == dec.tokens.depth() {
+ return newInvalidFormatError("unmarshal", t, uo.format)
+ }
+ tok, err := dec.ReadToken()
+ if err != nil {
+ return err
+ }
+ k := tok.Kind()
+ switch k {
+ case 'n':
+ va.Set(reflect.Zero(t))
+ return nil
+ case '[':
+ once.Do(init)
+ unmarshal := valFncs.unmarshal
+ if uo.Unmarshalers != nil {
+ unmarshal, _ = uo.Unmarshalers.lookup(unmarshal, t.Elem())
+ }
+ var i int
+ for dec.PeekKind() != ']' {
+ if i >= n {
+ err := errors.New("too many array elements")
+ return &SemanticError{action: "unmarshal", GoType: t, Err: err}
+ }
+ v := addressableValue{va.Index(i)} // indexed array element is addressable if array is addressable
+ v.Set(reflect.Zero(v.Type()))
+ if err := unmarshal(uo, dec, v); err != nil {
+ return err
+ }
+ i++
+ }
+ if _, err := dec.ReadToken(); err != nil {
+ return err
+ }
+ if i < n {
+ err := errors.New("too few array elements")
+ return &SemanticError{action: "unmarshal", GoType: t, Err: err}
+ }
+ return nil
+ }
+ return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t}
+ }
+ return &fncs
+}
+
+func makePointerArshaler(t reflect.Type) *arshaler {
+ var fncs arshaler
+ var (
+ once sync.Once
+ valFncs *arshaler
+ )
+ init := func() {
+ valFncs = lookupArshaler(t.Elem())
+ }
+ fncs.marshal = func(mo MarshalOptions, enc *Encoder, va addressableValue) error {
+ // Check for cycles.
+ if enc.tokens.depth() > startDetectingCyclesAfter {
+ if err := enc.seenPointers.visit(va.Value); err != nil {
+ return err
+ }
+ defer enc.seenPointers.leave(va.Value)
+ }
+
+ // NOTE: MarshalOptions.format is forwarded to underlying marshal.
+ if va.IsNil() {
+ return enc.WriteToken(Null)
+ }
+ once.Do(init)
+ marshal := valFncs.marshal
+ if mo.Marshalers != nil {
+ marshal, _ = mo.Marshalers.lookup(marshal, t.Elem())
+ }
+ v := addressableValue{va.Elem()} // dereferenced pointer is always addressable
+ return marshal(mo, enc, v)
+ }
+ fncs.unmarshal = func(uo UnmarshalOptions, dec *Decoder, va addressableValue) error {
+ // NOTE: UnmarshalOptions.format is forwarded to underlying unmarshal.
+ if dec.PeekKind() == 'n' {
+ if _, err := dec.ReadToken(); err != nil {
+ return err
+ }
+ va.Set(reflect.Zero(t))
+ return nil
+ }
+ once.Do(init)
+ unmarshal := valFncs.unmarshal
+ if uo.Unmarshalers != nil {
+ unmarshal, _ = uo.Unmarshalers.lookup(unmarshal, t.Elem())
+ }
+ if va.IsNil() {
+ va.Set(reflect.New(t.Elem()))
+ }
+ v := addressableValue{va.Elem()} // dereferenced pointer is always addressable
+ return unmarshal(uo, dec, v)
+ }
+ return &fncs
+}
+
+func makeInterfaceArshaler(t reflect.Type) *arshaler {
+ // NOTE: Values retrieved from an interface are not addressable,
+ // so we shallow copy the values to make them addressable and
+ // store them back into the interface afterwards.
+
+ var fncs arshaler
+ fncs.marshal = func(mo MarshalOptions, enc *Encoder, va addressableValue) error {
+ if mo.format != "" && mo.formatDepth == enc.tokens.depth() {
+ return newInvalidFormatError("marshal", t, mo.format)
+ }
+ if va.IsNil() {
+ return enc.WriteToken(Null)
+ }
+ v := newAddressableValue(va.Elem().Type())
+ v.Set(va.Elem())
+ marshal := lookupArshaler(v.Type()).marshal
+ if mo.Marshalers != nil {
+ marshal, _ = mo.Marshalers.lookup(marshal, v.Type())
+ }
+ // Optimize for the any type if there are no special options.
+ if optimizeCommon && t == anyType && !mo.StringifyNumbers && mo.format == "" && (mo.Marshalers == nil || !mo.Marshalers.fromAny) {
+ return marshalValueAny(mo, enc, va.Elem().Interface())
+ }
+ return marshal(mo, enc, v)
+ }
+ fncs.unmarshal = func(uo UnmarshalOptions, dec *Decoder, va addressableValue) error {
+ if uo.format != "" && uo.formatDepth == dec.tokens.depth() {
+ return newInvalidFormatError("unmarshal", t, uo.format)
+ }
+ if dec.PeekKind() == 'n' {
+ if _, err := dec.ReadToken(); err != nil {
+ return err
+ }
+ va.Set(reflect.Zero(t))
+ return nil
+ }
+ var v addressableValue
+ if va.IsNil() {
+ // Optimize for the any type if there are no special options.
+ // We do not care about stringified numbers since JSON strings
+ // are always unmarshaled into an any value as Go strings.
+ // Duplicate name check must be enforced since unmarshalValueAny
+ // does not implement merge semantics.
+ if optimizeCommon && t == anyType && uo.format == "" && (uo.Unmarshalers == nil || !uo.Unmarshalers.fromAny) && !dec.options.AllowDuplicateNames {
+ v, err := unmarshalValueAny(uo, dec)
+ // We must check for nil interface values up front.
+ // See https://go.dev/issue/52310.
+ if v != nil {
+ va.Set(reflect.ValueOf(v))
+ }
+ return err
+ }
+
+ k := dec.PeekKind()
+ if !isAnyType(t) {
+ err := errors.New("cannot derive concrete type for non-empty interface")
+ return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t, Err: err}
+ }
+ switch k {
+ case 'f', 't':
+ v = newAddressableValue(boolType)
+ case '"':
+ v = newAddressableValue(stringType)
+ case '0':
+ v = newAddressableValue(float64Type)
+ case '{':
+ v = newAddressableValue(mapStringAnyType)
+ case '[':
+ v = newAddressableValue(sliceAnyType)
+ default:
+ // If k is invalid (e.g., due to an I/O or syntax error), then
+ // that will be cached by PeekKind and returned by ReadValue.
+ // If k is '}' or ']', then ReadValue must error since
+ // those are invalid kinds at the start of a JSON value.
+ _, err := dec.ReadValue()
+ return err
+ }
+ } else {
+ // Shallow copy the existing value to keep it addressable.
+ // Any mutations at the top-level of the value will be observable
+ // since we always store this value back into the interface value.
+ v = newAddressableValue(va.Elem().Type())
+ v.Set(va.Elem())
+ }
+ unmarshal := lookupArshaler(v.Type()).unmarshal
+ if uo.Unmarshalers != nil {
+ unmarshal, _ = uo.Unmarshalers.lookup(unmarshal, v.Type())
+ }
+ err := unmarshal(uo, dec, v)
+ va.Set(v.Value)
+ return err
+ }
+ return &fncs
+}
+
+// isAnyType reports wether t is equivalent to the any interface type.
+func isAnyType(t reflect.Type) bool {
+ // This is forward compatible if the Go language permits type sets within
+ // ordinary interfaces where an interface with zero methods does not
+ // necessarily mean it can hold every possible Go type.
+ // See https://go.dev/issue/45346.
+ return t == anyType || anyType.Implements(t)
+}
+
+func makeInvalidArshaler(t reflect.Type) *arshaler {
+ var fncs arshaler
+ fncs.marshal = func(mo MarshalOptions, enc *Encoder, va addressableValue) error {
+ return &SemanticError{action: "marshal", GoType: t}
+ }
+ fncs.unmarshal = func(uo UnmarshalOptions, dec *Decoder, va addressableValue) error {
+ return &SemanticError{action: "unmarshal", GoType: t}
+ }
+ return &fncs
+}
+
+func newInvalidFormatError(action string, t reflect.Type, format string) error {
+ err := fmt.Errorf("invalid format flag: %q", format)
+ return &SemanticError{action: action, GoType: t, Err: err}
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_funcs.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_funcs.go
new file mode 100644
index 000000000..8a4e70083
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_funcs.go
@@ -0,0 +1,387 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package json
+
+import (
+ "errors"
+ "fmt"
+ "reflect"
+ "sync"
+)
+
+// SkipFunc may be returned by MarshalFuncV2 and UnmarshalFuncV2 functions.
+//
+// Any function that returns SkipFunc must not cause observable side effects
+// on the provided Encoder or Decoder. For example, it is permissible to call
+// Decoder.PeekKind, but not permissible to call Decoder.ReadToken or
+// Encoder.WriteToken since such methods mutate the state.
+const SkipFunc = jsonError("skip function")
+
+// Marshalers is a list of functions that may override the marshal behavior
+// of specific types. Populate MarshalOptions.Marshalers to use it.
+// A nil *Marshalers is equivalent to an empty list.
+type Marshalers = typedMarshalers
+
+// NewMarshalers constructs a flattened list of marshal functions.
+// If multiple functions in the list are applicable for a value of a given type,
+// then those earlier in the list take precedence over those that come later.
+// If a function returns SkipFunc, then the next applicable function is called,
+// otherwise the default marshaling behavior is used.
+//
+// For example:
+//
+// m1 := NewMarshalers(f1, f2)
+// m2 := NewMarshalers(f0, m1, f3) // equivalent to m3
+// m3 := NewMarshalers(f0, f1, f2, f3) // equivalent to m2
+func NewMarshalers(ms ...*Marshalers) *Marshalers {
+ return newMarshalers(ms...)
+}
+
+// Unmarshalers is a list of functions that may override the unmarshal behavior
+// of specific types. Populate UnmarshalOptions.Unmarshalers to use it.
+// A nil *Unmarshalers is equivalent to an empty list.
+type Unmarshalers = typedUnmarshalers
+
+// NewUnmarshalers constructs a flattened list of unmarshal functions.
+// If multiple functions in the list are applicable for a value of a given type,
+// then those earlier in the list take precedence over those that come later.
+// If a function returns SkipFunc, then the next applicable function is called,
+// otherwise the default unmarshaling behavior is used.
+//
+// For example:
+//
+// u1 := NewUnmarshalers(f1, f2)
+// u2 := NewUnmarshalers(f0, u1, f3) // equivalent to u3
+// u3 := NewUnmarshalers(f0, f1, f2, f3) // equivalent to u2
+func NewUnmarshalers(us ...*Unmarshalers) *Unmarshalers {
+ return newUnmarshalers(us...)
+}
+
+type typedMarshalers = typedArshalers[MarshalOptions, Encoder]
+type typedUnmarshalers = typedArshalers[UnmarshalOptions, Decoder]
+type typedArshalers[Options, Coder any] struct {
+ nonComparable
+
+ fncVals []typedArshaler[Options, Coder]
+ fncCache sync.Map // map[reflect.Type]arshaler
+
+ // fromAny reports whether any of Go types used to represent arbitrary JSON
+ // (i.e., any, bool, string, float64, map[string]any, or []any) matches
+ // any of the provided type-specific arshalers.
+ //
+ // This bit of information is needed in arshal_default.go to determine
+ // whether to use the specialized logic in arshal_any.go to handle
+ // the any interface type. The logic in arshal_any.go does not support
+ // type-specific arshal functions, so we must avoid using that logic
+ // if this is true.
+ fromAny bool
+}
+type typedMarshaler = typedArshaler[MarshalOptions, Encoder]
+type typedUnmarshaler = typedArshaler[UnmarshalOptions, Decoder]
+type typedArshaler[Options, Coder any] struct {
+ typ reflect.Type
+ fnc func(Options, *Coder, addressableValue) error
+ maySkip bool
+}
+
+func newMarshalers(ms ...*Marshalers) *Marshalers { return newTypedArshalers(ms...) }
+func newUnmarshalers(us ...*Unmarshalers) *Unmarshalers { return newTypedArshalers(us...) }
+func newTypedArshalers[Options, Coder any](as ...*typedArshalers[Options, Coder]) *typedArshalers[Options, Coder] {
+ var a typedArshalers[Options, Coder]
+ for _, a2 := range as {
+ if a2 != nil {
+ a.fncVals = append(a.fncVals, a2.fncVals...)
+ a.fromAny = a.fromAny || a2.fromAny
+ }
+ }
+ if len(a.fncVals) == 0 {
+ return nil
+ }
+ return &a
+}
+
+func (a *typedArshalers[Options, Coder]) lookup(fnc func(Options, *Coder, addressableValue) error, t reflect.Type) (func(Options, *Coder, addressableValue) error, bool) {
+ if a == nil {
+ return fnc, false
+ }
+ if v, ok := a.fncCache.Load(t); ok {
+ if v == nil {
+ return fnc, false
+ }
+ return v.(func(Options, *Coder, addressableValue) error), true
+ }
+
+ // Collect a list of arshalers that can be called for this type.
+ // This list may be longer than 1 since some arshalers can be skipped.
+ var fncs []func(Options, *Coder, addressableValue) error
+ for _, fncVal := range a.fncVals {
+ if !castableTo(t, fncVal.typ) {
+ continue
+ }
+ fncs = append(fncs, fncVal.fnc)
+ if !fncVal.maySkip {
+ break // subsequent arshalers will never be called
+ }
+ }
+
+ if len(fncs) == 0 {
+ a.fncCache.Store(t, nil) // nil to indicate that no funcs found
+ return fnc, false
+ }
+
+ // Construct an arshaler that may call every applicable arshaler.
+ fncDefault := fnc
+ fnc = func(o Options, c *Coder, v addressableValue) error {
+ for _, fnc := range fncs {
+ if err := fnc(o, c, v); err != SkipFunc {
+ return err // may be nil or non-nil
+ }
+ }
+ return fncDefault(o, c, v)
+ }
+
+ // Use the first stored so duplicate work can be garbage collected.
+ v, _ := a.fncCache.LoadOrStore(t, fnc)
+ return v.(func(Options, *Coder, addressableValue) error), true
+}
+
+// MarshalFuncV1 constructs a type-specific marshaler that
+// specifies how to marshal values of type T.
+// T can be any type except a named pointer.
+// The function is always provided with a non-nil pointer value
+// if T is an interface or pointer type.
+//
+// The function must marshal exactly one JSON value.
+// The value of T must not be retained outside the function call.
+// It may not return SkipFunc.
+func MarshalFuncV1[T any](fn func(T) ([]byte, error)) *Marshalers {
+ t := reflect.TypeOf((*T)(nil)).Elem()
+ assertCastableTo(t, true)
+ typFnc := typedMarshaler{
+ typ: t,
+ fnc: func(mo MarshalOptions, enc *Encoder, va addressableValue) error {
+ val, err := fn(va.castTo(t).Interface().(T))
+ if err != nil {
+ err = wrapSkipFunc(err, "marshal function of type func(T) ([]byte, error)")
+ // TODO: Avoid wrapping semantic errors.
+ return &SemanticError{action: "marshal", GoType: t, Err: err}
+ }
+ if err := enc.WriteValue(val); err != nil {
+ // TODO: Avoid wrapping semantic or I/O errors.
+ return &SemanticError{action: "marshal", JSONKind: RawValue(val).Kind(), GoType: t, Err: err}
+ }
+ return nil
+ },
+ }
+ return &Marshalers{fncVals: []typedMarshaler{typFnc}, fromAny: castableToFromAny(t)}
+}
+
+// MarshalFuncV2 constructs a type-specific marshaler that
+// specifies how to marshal values of type T.
+// T can be any type except a named pointer.
+// The function is always provided with a non-nil pointer value
+// if T is an interface or pointer type.
+//
+// The function must marshal exactly one JSON value by calling write methods
+// on the provided encoder. It may return SkipFunc such that marshaling can
+// move on to the next marshal function. However, no mutable method calls may
+// be called on the encoder if SkipFunc is returned.
+// The pointer to Encoder and the value of T must not be retained
+// outside the function call.
+func MarshalFuncV2[T any](fn func(MarshalOptions, *Encoder, T) error) *Marshalers {
+ t := reflect.TypeOf((*T)(nil)).Elem()
+ assertCastableTo(t, true)
+ typFnc := typedMarshaler{
+ typ: t,
+ fnc: func(mo MarshalOptions, enc *Encoder, va addressableValue) error {
+ prevDepth, prevLength := enc.tokens.depthLength()
+ err := fn(mo, enc, va.castTo(t).Interface().(T))
+ currDepth, currLength := enc.tokens.depthLength()
+ if err == nil && (prevDepth != currDepth || prevLength+1 != currLength) {
+ err = errors.New("must write exactly one JSON value")
+ }
+ if err != nil {
+ if err == SkipFunc {
+ if prevDepth == currDepth && prevLength == currLength {
+ return SkipFunc
+ }
+ err = errors.New("must not write any JSON tokens when skipping")
+ }
+ // TODO: Avoid wrapping semantic or I/O errors.
+ return &SemanticError{action: "marshal", GoType: t, Err: err}
+ }
+ return nil
+ },
+ maySkip: true,
+ }
+ return &Marshalers{fncVals: []typedMarshaler{typFnc}, fromAny: castableToFromAny(t)}
+}
+
+// UnmarshalFuncV1 constructs a type-specific unmarshaler that
+// specifies how to unmarshal values of type T.
+// T must be an unnamed pointer or an interface type.
+// The function is always provided with a non-nil pointer value.
+//
+// The function must unmarshal exactly one JSON value.
+// The input []byte must not be mutated.
+// The input []byte and value T must not be retained outside the function call.
+// It may not return SkipFunc.
+func UnmarshalFuncV1[T any](fn func([]byte, T) error) *Unmarshalers {
+ t := reflect.TypeOf((*T)(nil)).Elem()
+ assertCastableTo(t, false)
+ typFnc := typedUnmarshaler{
+ typ: t,
+ fnc: func(uo UnmarshalOptions, dec *Decoder, va addressableValue) error {
+ val, err := dec.ReadValue()
+ if err != nil {
+ return err // must be a syntactic or I/O error
+ }
+ err = fn(val, va.castTo(t).Interface().(T))
+ if err != nil {
+ err = wrapSkipFunc(err, "unmarshal function of type func([]byte, T) error")
+ // TODO: Avoid wrapping semantic, syntactic, or I/O errors.
+ return &SemanticError{action: "unmarshal", JSONKind: val.Kind(), GoType: t, Err: err}
+ }
+ return nil
+ },
+ }
+ return &Unmarshalers{fncVals: []typedUnmarshaler{typFnc}, fromAny: castableToFromAny(t)}
+}
+
+// UnmarshalFuncV2 constructs a type-specific unmarshaler that
+// specifies how to unmarshal values of type T.
+// T must be an unnamed pointer or an interface type.
+// The function is always provided with a non-nil pointer value.
+//
+// The function must unmarshal exactly one JSON value by calling read methods
+// on the provided decoder. It may return SkipFunc such that unmarshaling can
+// move on to the next unmarshal function. However, no mutable method calls may
+// be called on the decoder if SkipFunc is returned.
+// The pointer to Decoder and the value of T must not be retained
+// outside the function call.
+func UnmarshalFuncV2[T any](fn func(UnmarshalOptions, *Decoder, T) error) *Unmarshalers {
+ t := reflect.TypeOf((*T)(nil)).Elem()
+ assertCastableTo(t, false)
+ typFnc := typedUnmarshaler{
+ typ: t,
+ fnc: func(uo UnmarshalOptions, dec *Decoder, va addressableValue) error {
+ prevDepth, prevLength := dec.tokens.depthLength()
+ err := fn(uo, dec, va.castTo(t).Interface().(T))
+ currDepth, currLength := dec.tokens.depthLength()
+ if err == nil && (prevDepth != currDepth || prevLength+1 != currLength) {
+ err = errors.New("must read exactly one JSON value")
+ }
+ if err != nil {
+ if err == SkipFunc {
+ if prevDepth == currDepth && prevLength == currLength {
+ return SkipFunc
+ }
+ err = errors.New("must not read any JSON tokens when skipping")
+ }
+ // TODO: Avoid wrapping semantic, syntactic, or I/O errors.
+ return &SemanticError{action: "unmarshal", GoType: t, Err: err}
+ }
+ return nil
+ },
+ maySkip: true,
+ }
+ return &Unmarshalers{fncVals: []typedUnmarshaler{typFnc}, fromAny: castableToFromAny(t)}
+}
+
+// assertCastableTo asserts that "to" is a valid type to be casted to.
+// These are the Go types that type-specific arshalers may operate upon.
+//
+// Let AllTypes be the universal set of all possible Go types.
+// This function generally asserts that:
+//
+// len([from for from in AllTypes if castableTo(from, to)]) > 0
+//
+// otherwise it panics.
+//
+// As a special-case if marshal is false, then we forbid any non-pointer or
+// non-interface type since it is almost always a bug trying to unmarshal
+// into something where the end-user caller did not pass in an addressable value
+// since they will not observe the mutations.
+func assertCastableTo(to reflect.Type, marshal bool) {
+ switch to.Kind() {
+ case reflect.Interface:
+ return
+ case reflect.Pointer:
+ // Only allow unnamed pointers to be consistent with the fact that
+ // taking the address of a value produces an unnamed pointer type.
+ if to.Name() == "" {
+ return
+ }
+ default:
+ // Technically, non-pointer types are permissible for unmarshal.
+ // However, they are often a bug since the receiver would be immutable.
+ // Thus, only allow them for marshaling.
+ if marshal {
+ return
+ }
+ }
+ if marshal {
+ panic(fmt.Sprintf("input type %v must be an interface type, an unnamed pointer type, or a non-pointer type", to))
+ } else {
+ panic(fmt.Sprintf("input type %v must be an interface type or an unnamed pointer type", to))
+ }
+}
+
+// castableTo checks whether values of type "from" can be casted to type "to".
+// Nil pointer or interface "from" values are never considered castable.
+//
+// This function must be kept in sync with addressableValue.castTo.
+func castableTo(from, to reflect.Type) bool {
+ switch to.Kind() {
+ case reflect.Interface:
+ // TODO: This breaks when ordinary interfaces can have type sets
+ // since interfaces now exist where only the value form of a type (T)
+ // implements the interface, but not the pointer variant (*T).
+ // See https://go.dev/issue/45346.
+ return reflect.PointerTo(from).Implements(to)
+ case reflect.Pointer:
+ // Common case for unmarshaling.
+ // From must be a concrete or interface type.
+ return reflect.PointerTo(from) == to
+ default:
+ // Common case for marshaling.
+ // From must be a concrete type.
+ return from == to
+ }
+}
+
+// castTo casts va to the specified type.
+// If the type is an interface, then the underlying type will always
+// be a non-nil pointer to a concrete type.
+//
+// Requirement: castableTo(va.Type(), to) must hold.
+func (va addressableValue) castTo(to reflect.Type) reflect.Value {
+ switch to.Kind() {
+ case reflect.Interface:
+ return va.Addr().Convert(to)
+ case reflect.Pointer:
+ return va.Addr()
+ default:
+ return va.Value
+ }
+}
+
+// castableToFromAny reports whether "to" can be casted to from any
+// of the dynamic types used to represent arbitrary JSON.
+func castableToFromAny(to reflect.Type) bool {
+ for _, from := range []reflect.Type{anyType, boolType, stringType, float64Type, mapStringAnyType, sliceAnyType} {
+ if castableTo(from, to) {
+ return true
+ }
+ }
+ return false
+}
+
+func wrapSkipFunc(err error, what string) error {
+ if err == SkipFunc {
+ return errors.New(what + " cannot be skipped")
+ }
+ return err
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_inlined.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_inlined.go
new file mode 100644
index 000000000..258a98247
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_inlined.go
@@ -0,0 +1,213 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package json
+
+import (
+ "bytes"
+ "errors"
+ "reflect"
+)
+
+// This package supports "inlining" a Go struct field, where the contents
+// of the serialized field (which must be a JSON object) are treated as if
+// they are part of the parent Go struct (which represents a JSON object).
+//
+// Generally, inlined fields are of a Go struct type, where the fields of the
+// nested struct are virtually hoisted up to the parent struct using rules
+// similar to how Go embedding works (but operating within the JSON namespace).
+//
+// However, inlined fields may also be of a Go map type with a string key
+// or a RawValue. Such inlined fields are called "fallback" fields since they
+// represent any arbitrary JSON object member. Explicitly named fields take
+// precedence over the inlined fallback. Only one inlined fallback is allowed.
+
+var rawValueType = reflect.TypeOf((*RawValue)(nil)).Elem()
+
+// marshalInlinedFallbackAll marshals all the members in an inlined fallback.
+func marshalInlinedFallbackAll(mo MarshalOptions, enc *Encoder, va addressableValue, f *structField, insertUnquotedName func([]byte) bool) error {
+ v := addressableValue{va.Field(f.index[0])} // addressable if struct value is addressable
+ if len(f.index) > 1 {
+ v = v.fieldByIndex(f.index[1:], false)
+ if !v.IsValid() {
+ return nil // implies a nil inlined field
+ }
+ }
+ v = v.indirect(false)
+ if !v.IsValid() {
+ return nil
+ }
+
+ if v.Type() == rawValueType {
+ b := v.Interface().(RawValue)
+ if len(b) == 0 { // TODO: Should this be nil? What if it were all whitespace?
+ return nil
+ }
+
+ dec := getBufferedDecoder(b, DecodeOptions{AllowDuplicateNames: true, AllowInvalidUTF8: true})
+ defer putBufferedDecoder(dec)
+
+ tok, err := dec.ReadToken()
+ if err != nil {
+ return &SemanticError{action: "marshal", GoType: rawValueType, Err: err}
+ }
+ if tok.Kind() != '{' {
+ err := errors.New("inlined raw value must be a JSON object")
+ return &SemanticError{action: "marshal", JSONKind: tok.Kind(), GoType: rawValueType, Err: err}
+ }
+ for dec.PeekKind() != '}' {
+ // Parse the JSON object name.
+ var flags valueFlags
+ val, err := dec.readValue(&flags)
+ if err != nil {
+ return &SemanticError{action: "marshal", GoType: rawValueType, Err: err}
+ }
+ if insertUnquotedName != nil {
+ name := unescapeStringMayCopy(val, flags.isVerbatim())
+ if !insertUnquotedName(name) {
+ return &SyntacticError{str: "duplicate name " + string(val) + " in object"}
+ }
+ }
+ if err := enc.WriteValue(val); err != nil {
+ return err
+ }
+
+ // Parse the JSON object value.
+ val, err = dec.readValue(&flags)
+ if err != nil {
+ return &SemanticError{action: "marshal", GoType: rawValueType, Err: err}
+ }
+ if err := enc.WriteValue(val); err != nil {
+ return err
+ }
+ }
+ if _, err := dec.ReadToken(); err != nil {
+ return &SemanticError{action: "marshal", GoType: rawValueType, Err: err}
+ }
+ if err := dec.checkEOF(); err != nil {
+ return &SemanticError{action: "marshal", GoType: rawValueType, Err: err}
+ }
+ return nil
+ } else {
+ m := v // must be a map[string]V
+ n := m.Len()
+ if n == 0 {
+ return nil
+ }
+ mk := newAddressableValue(stringType)
+ mv := newAddressableValue(m.Type().Elem())
+ marshalKey := func(mk addressableValue) error {
+ b, err := appendString(enc.UnusedBuffer(), mk.String(), !enc.options.AllowInvalidUTF8, nil)
+ if err != nil {
+ return err
+ }
+ if insertUnquotedName != nil {
+ isVerbatim := bytes.IndexByte(b, '\\') < 0
+ name := unescapeStringMayCopy(b, isVerbatim)
+ if !insertUnquotedName(name) {
+ return &SyntacticError{str: "duplicate name " + string(b) + " in object"}
+ }
+ }
+ return enc.WriteValue(b)
+ }
+ marshalVal := f.fncs.marshal
+ if mo.Marshalers != nil {
+ marshalVal, _ = mo.Marshalers.lookup(marshalVal, mv.Type())
+ }
+ if !mo.Deterministic || n <= 1 {
+ for iter := m.MapRange(); iter.Next(); {
+ mk.SetIterKey(iter)
+ if err := marshalKey(mk); err != nil {
+ return err
+ }
+ mv.Set(iter.Value())
+ if err := marshalVal(mo, enc, mv); err != nil {
+ return err
+ }
+ }
+ } else {
+ names := getStrings(n)
+ for i, iter := 0, m.Value.MapRange(); i < n && iter.Next(); i++ {
+ mk.SetIterKey(iter)
+ (*names)[i] = mk.String()
+ }
+ names.Sort()
+ for _, name := range *names {
+ mk.SetString(name)
+ if err := marshalKey(mk); err != nil {
+ return err
+ }
+ // TODO(https://go.dev/issue/57061): Use mv.SetMapIndexOf.
+ mv.Set(m.MapIndex(mk.Value))
+ if err := marshalVal(mo, enc, mv); err != nil {
+ return err
+ }
+ }
+ putStrings(names)
+ }
+ return nil
+ }
+}
+
+// unmarshalInlinedFallbackNext unmarshals only the next member in an inlined fallback.
+func unmarshalInlinedFallbackNext(uo UnmarshalOptions, dec *Decoder, va addressableValue, f *structField, quotedName, unquotedName []byte) error {
+ v := addressableValue{va.Field(f.index[0])} // addressable if struct value is addressable
+ if len(f.index) > 1 {
+ v = v.fieldByIndex(f.index[1:], true)
+ }
+ v = v.indirect(true)
+
+ if v.Type() == rawValueType {
+ b := v.Addr().Interface().(*RawValue)
+ if len(*b) == 0 { // TODO: Should this be nil? What if it were all whitespace?
+ *b = append(*b, '{')
+ } else {
+ *b = trimSuffixWhitespace(*b)
+ if hasSuffixByte(*b, '}') {
+ // TODO: When merging into an object for the first time,
+ // should we verify that it is valid?
+ *b = trimSuffixByte(*b, '}')
+ *b = trimSuffixWhitespace(*b)
+ if !hasSuffixByte(*b, ',') && !hasSuffixByte(*b, '{') {
+ *b = append(*b, ',')
+ }
+ } else {
+ err := errors.New("inlined raw value must be a JSON object")
+ return &SemanticError{action: "unmarshal", GoType: rawValueType, Err: err}
+ }
+ }
+ *b = append(*b, quotedName...)
+ *b = append(*b, ':')
+ rawValue, err := dec.ReadValue()
+ if err != nil {
+ return err
+ }
+ *b = append(*b, rawValue...)
+ *b = append(*b, '}')
+ return nil
+ } else {
+ name := string(unquotedName) // TODO: Intern this?
+
+ m := v // must be a map[string]V
+ if m.IsNil() {
+ m.Set(reflect.MakeMap(m.Type()))
+ }
+ mk := reflect.ValueOf(name)
+ mv := newAddressableValue(v.Type().Elem()) // TODO: Cache across calls?
+ if v2 := m.MapIndex(mk); v2.IsValid() {
+ mv.Set(v2)
+ }
+
+ unmarshal := f.fncs.unmarshal
+ if uo.Unmarshalers != nil {
+ unmarshal, _ = uo.Unmarshalers.lookup(unmarshal, mv.Type())
+ }
+ err := unmarshal(uo, dec, mv)
+ m.SetMapIndex(mk, mv.Value)
+ if err != nil {
+ return err
+ }
+ return nil
+ }
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_methods.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_methods.go
new file mode 100644
index 000000000..20899c868
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_methods.go
@@ -0,0 +1,229 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package json
+
+import (
+ "encoding"
+ "errors"
+ "reflect"
+)
+
+// Interfaces for custom serialization.
+var (
+ jsonMarshalerV1Type = reflect.TypeOf((*MarshalerV1)(nil)).Elem()
+ jsonMarshalerV2Type = reflect.TypeOf((*MarshalerV2)(nil)).Elem()
+ jsonUnmarshalerV1Type = reflect.TypeOf((*UnmarshalerV1)(nil)).Elem()
+ jsonUnmarshalerV2Type = reflect.TypeOf((*UnmarshalerV2)(nil)).Elem()
+ textMarshalerType = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem()
+ textUnmarshalerType = reflect.TypeOf((*encoding.TextUnmarshaler)(nil)).Elem()
+)
+
+// MarshalerV1 is implemented by types that can marshal themselves.
+// It is recommended that types implement MarshalerV2 unless the implementation
+// is trying to avoid a hard dependency on the "jsontext" package.
+//
+// It is recommended that implementations return a buffer that is safe
+// for the caller to retain and potentially mutate.
+type MarshalerV1 interface {
+ MarshalJSON() ([]byte, error)
+}
+
+// MarshalerV2 is implemented by types that can marshal themselves.
+// It is recommended that types implement MarshalerV2 instead of MarshalerV1
+// since this is both more performant and flexible.
+// If a type implements both MarshalerV1 and MarshalerV2,
+// then MarshalerV2 takes precedence. In such a case, both implementations
+// should aim to have equivalent behavior for the default marshal options.
+//
+// The implementation must write only one JSON value to the Encoder and
+// must not retain the pointer to Encoder.
+type MarshalerV2 interface {
+ MarshalNextJSON(MarshalOptions, *Encoder) error
+
+ // TODO: Should users call the MarshalOptions.MarshalNext method or
+ // should/can they call this method directly? Does it matter?
+}
+
+// UnmarshalerV1 is implemented by types that can unmarshal themselves.
+// It is recommended that types implement UnmarshalerV2 unless
+// the implementation is trying to avoid a hard dependency on this package.
+//
+// The input can be assumed to be a valid encoding of a JSON value
+// if called from unmarshal functionality in this package.
+// UnmarshalJSON must copy the JSON data if it is retained after returning.
+// It is recommended that UnmarshalJSON implement merge semantics when
+// unmarshaling into a pre-populated value.
+//
+// Implementations must not retain or mutate the input []byte.
+type UnmarshalerV1 interface {
+ UnmarshalJSON([]byte) error
+}
+
+// UnmarshalerV2 is implemented by types that can unmarshal themselves.
+// It is recommended that types implement UnmarshalerV2 instead of UnmarshalerV1
+// since this is both more performant and flexible.
+// If a type implements both UnmarshalerV1 and UnmarshalerV2,
+// then UnmarshalerV2 takes precedence. In such a case, both implementations
+// should aim to have equivalent behavior for the default unmarshal options.
+//
+// The implementation must read only one JSON value from the Decoder.
+// It is recommended that UnmarshalNextJSON implement merge semantics when
+// unmarshaling into a pre-populated value.
+//
+// Implementations must not retain the pointer to Decoder.
+type UnmarshalerV2 interface {
+ UnmarshalNextJSON(UnmarshalOptions, *Decoder) error
+
+ // TODO: Should users call the UnmarshalOptions.UnmarshalNext method or
+ // should/can they call this method directly? Does it matter?
+}
+
+func makeMethodArshaler(fncs *arshaler, t reflect.Type) *arshaler {
+ // Avoid injecting method arshaler on the pointer or interface version
+ // to avoid ever calling the method on a nil pointer or interface receiver.
+ // Let it be injected on the value receiver (which is always addressable).
+ if t.Kind() == reflect.Pointer || t.Kind() == reflect.Interface {
+ return fncs
+ }
+
+ // Handle custom marshaler.
+ switch which, needAddr := implementsWhich(t, jsonMarshalerV2Type, jsonMarshalerV1Type, textMarshalerType); which {
+ case jsonMarshalerV2Type:
+ fncs.nonDefault = true
+ fncs.marshal = func(mo MarshalOptions, enc *Encoder, va addressableValue) error {
+ prevDepth, prevLength := enc.tokens.depthLength()
+ err := va.addrWhen(needAddr).Interface().(MarshalerV2).MarshalNextJSON(mo, enc)
+ currDepth, currLength := enc.tokens.depthLength()
+ if (prevDepth != currDepth || prevLength+1 != currLength) && err == nil {
+ err = errors.New("must write exactly one JSON value")
+ }
+ if err != nil {
+ err = wrapSkipFunc(err, "marshal method")
+ // TODO: Avoid wrapping semantic or I/O errors.
+ return &SemanticError{action: "marshal", GoType: t, Err: err}
+ }
+ return nil
+ }
+ case jsonMarshalerV1Type:
+ fncs.nonDefault = true
+ fncs.marshal = func(mo MarshalOptions, enc *Encoder, va addressableValue) error {
+ marshaler := va.addrWhen(needAddr).Interface().(MarshalerV1)
+ val, err := marshaler.MarshalJSON()
+ if err != nil {
+ err = wrapSkipFunc(err, "marshal method")
+ // TODO: Avoid wrapping semantic errors.
+ return &SemanticError{action: "marshal", GoType: t, Err: err}
+ }
+ if err := enc.WriteValue(val); err != nil {
+ // TODO: Avoid wrapping semantic or I/O errors.
+ return &SemanticError{action: "marshal", JSONKind: RawValue(val).Kind(), GoType: t, Err: err}
+ }
+ return nil
+ }
+ case textMarshalerType:
+ fncs.nonDefault = true
+ fncs.marshal = func(mo MarshalOptions, enc *Encoder, va addressableValue) error {
+ marshaler := va.addrWhen(needAddr).Interface().(encoding.TextMarshaler)
+ s, err := marshaler.MarshalText()
+ if err != nil {
+ err = wrapSkipFunc(err, "marshal method")
+ // TODO: Avoid wrapping semantic errors.
+ return &SemanticError{action: "marshal", JSONKind: '"', GoType: t, Err: err}
+ }
+ val := enc.UnusedBuffer()
+ val, err = appendString(val, string(s), true, nil)
+ if err != nil {
+ return &SemanticError{action: "marshal", JSONKind: '"', GoType: t, Err: err}
+ }
+ if err := enc.WriteValue(val); err != nil {
+ // TODO: Avoid wrapping syntactic or I/O errors.
+ return &SemanticError{action: "marshal", JSONKind: '"', GoType: t, Err: err}
+ }
+ return nil
+ }
+ }
+
+ // Handle custom unmarshaler.
+ switch which, needAddr := implementsWhich(t, jsonUnmarshalerV2Type, jsonUnmarshalerV1Type, textUnmarshalerType); which {
+ case jsonUnmarshalerV2Type:
+ fncs.nonDefault = true
+ fncs.unmarshal = func(uo UnmarshalOptions, dec *Decoder, va addressableValue) error {
+ prevDepth, prevLength := dec.tokens.depthLength()
+ err := va.addrWhen(needAddr).Interface().(UnmarshalerV2).UnmarshalNextJSON(uo, dec)
+ currDepth, currLength := dec.tokens.depthLength()
+ if (prevDepth != currDepth || prevLength+1 != currLength) && err == nil {
+ err = errors.New("must read exactly one JSON value")
+ }
+ if err != nil {
+ err = wrapSkipFunc(err, "unmarshal method")
+ // TODO: Avoid wrapping semantic, syntactic, or I/O errors.
+ return &SemanticError{action: "unmarshal", GoType: t, Err: err}
+ }
+ return nil
+ }
+ case jsonUnmarshalerV1Type:
+ fncs.nonDefault = true
+ fncs.unmarshal = func(uo UnmarshalOptions, dec *Decoder, va addressableValue) error {
+ val, err := dec.ReadValue()
+ if err != nil {
+ return err // must be a syntactic or I/O error
+ }
+ unmarshaler := va.addrWhen(needAddr).Interface().(UnmarshalerV1)
+ if err := unmarshaler.UnmarshalJSON(val); err != nil {
+ err = wrapSkipFunc(err, "unmarshal method")
+ // TODO: Avoid wrapping semantic, syntactic, or I/O errors.
+ return &SemanticError{action: "unmarshal", JSONKind: val.Kind(), GoType: t, Err: err}
+ }
+ return nil
+ }
+ case textUnmarshalerType:
+ fncs.nonDefault = true
+ fncs.unmarshal = func(uo UnmarshalOptions, dec *Decoder, va addressableValue) error {
+ var flags valueFlags
+ val, err := dec.readValue(&flags)
+ if err != nil {
+ return err // must be a syntactic or I/O error
+ }
+ if val.Kind() != '"' {
+ err = errors.New("JSON value must be string type")
+ return &SemanticError{action: "unmarshal", JSONKind: val.Kind(), GoType: t, Err: err}
+ }
+ s := unescapeStringMayCopy(val, flags.isVerbatim())
+ unmarshaler := va.addrWhen(needAddr).Interface().(encoding.TextUnmarshaler)
+ if err := unmarshaler.UnmarshalText(s); err != nil {
+ err = wrapSkipFunc(err, "unmarshal method")
+ // TODO: Avoid wrapping semantic, syntactic, or I/O errors.
+ return &SemanticError{action: "unmarshal", JSONKind: val.Kind(), GoType: t, Err: err}
+ }
+ return nil
+ }
+ }
+
+ return fncs
+}
+
+// implementsWhich is like t.Implements(ifaceType) for a list of interfaces,
+// but checks whether either t or reflect.PointerTo(t) implements the interface.
+// It returns the first interface type that matches and whether a value of t
+// needs to be addressed first before it implements the interface.
+func implementsWhich(t reflect.Type, ifaceTypes ...reflect.Type) (which reflect.Type, needAddr bool) {
+ for _, ifaceType := range ifaceTypes {
+ switch {
+ case t.Implements(ifaceType):
+ return ifaceType, false
+ case reflect.PointerTo(t).Implements(ifaceType):
+ return ifaceType, true
+ }
+ }
+ return nil, false
+}
+
+// addrWhen returns va.Addr if addr is specified, otherwise it returns itself.
+func (va addressableValue) addrWhen(addr bool) reflect.Value {
+ if addr {
+ return va.Addr()
+ }
+ return va.Value
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_time.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_time.go
new file mode 100644
index 000000000..fc8d5b007
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_time.go
@@ -0,0 +1,241 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package json
+
+import (
+ "errors"
+ "fmt"
+ "reflect"
+ "strings"
+ "time"
+)
+
+var (
+ timeDurationType = reflect.TypeOf((*time.Duration)(nil)).Elem()
+ timeTimeType = reflect.TypeOf((*time.Time)(nil)).Elem()
+)
+
+func makeTimeArshaler(fncs *arshaler, t reflect.Type) *arshaler {
+ // Ideally, time types would implement MarshalerV2 and UnmarshalerV2,
+ // but that would incur a dependency on package json from package time.
+ // Given how widely used time is, it is more acceptable that we incur a
+ // dependency on time from json.
+ //
+ // Injecting the arshaling functionality like this will not be identical
+ // to actually declaring methods on the time types since embedding of the
+ // time types will not be able to forward this functionality.
+ switch t {
+ case timeDurationType:
+ fncs.nonDefault = true
+ marshalNanos := fncs.marshal
+ fncs.marshal = func(mo MarshalOptions, enc *Encoder, va addressableValue) error {
+ if mo.format != "" && mo.formatDepth == enc.tokens.depth() {
+ if mo.format == "nanos" {
+ mo.format = ""
+ return marshalNanos(mo, enc, va)
+ } else {
+ return newInvalidFormatError("marshal", t, mo.format)
+ }
+ }
+
+ td := va.Interface().(time.Duration)
+ b := enc.UnusedBuffer()
+ b = append(b, '"')
+ b = append(b, td.String()...) // never contains special characters
+ b = append(b, '"')
+ return enc.WriteValue(b)
+ }
+ unmarshalNanos := fncs.unmarshal
+ fncs.unmarshal = func(uo UnmarshalOptions, dec *Decoder, va addressableValue) error {
+ // TODO: Should there be a flag that specifies that we can unmarshal
+ // from either form since there would be no ambiguity?
+ if uo.format != "" && uo.formatDepth == dec.tokens.depth() {
+ if uo.format == "nanos" {
+ uo.format = ""
+ return unmarshalNanos(uo, dec, va)
+ } else {
+ return newInvalidFormatError("unmarshal", t, uo.format)
+ }
+ }
+
+ var flags valueFlags
+ td := va.Addr().Interface().(*time.Duration)
+ val, err := dec.readValue(&flags)
+ if err != nil {
+ return err
+ }
+ switch k := val.Kind(); k {
+ case 'n':
+ *td = time.Duration(0)
+ return nil
+ case '"':
+ val = unescapeStringMayCopy(val, flags.isVerbatim())
+ td2, err := time.ParseDuration(string(val))
+ if err != nil {
+ return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t, Err: err}
+ }
+ *td = td2
+ return nil
+ default:
+ return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t}
+ }
+ }
+ case timeTimeType:
+ fncs.nonDefault = true
+ fncs.marshal = func(mo MarshalOptions, enc *Encoder, va addressableValue) error {
+ format := time.RFC3339Nano
+ isRFC3339 := true
+ if mo.format != "" && mo.formatDepth == enc.tokens.depth() {
+ var err error
+ format, isRFC3339, err = checkTimeFormat(mo.format)
+ if err != nil {
+ return &SemanticError{action: "marshal", GoType: t, Err: err}
+ }
+ }
+
+ tt := va.Interface().(time.Time)
+ b := enc.UnusedBuffer()
+ b = append(b, '"')
+ b = tt.AppendFormat(b, format)
+ b = append(b, '"')
+ if isRFC3339 {
+ // Not all Go timestamps can be represented as valid RFC 3339.
+ // Explicitly check for these edge cases.
+ // See https://go.dev/issue/4556 and https://go.dev/issue/54580.
+ var err error
+ switch b := b[len(`"`) : len(b)-len(`"`)]; {
+ case b[len("9999")] != '-': // year must be exactly 4 digits wide
+ err = errors.New("year outside of range [0,9999]")
+ case b[len(b)-1] != 'Z':
+ c := b[len(b)-len("Z07:00")]
+ if ('0' <= c && c <= '9') || parseDec2(b[len(b)-len("07:00"):]) >= 24 {
+ err = errors.New("timezone hour outside of range [0,23]")
+ }
+ }
+ if err != nil {
+ return &SemanticError{action: "marshal", GoType: t, Err: err}
+ }
+ return enc.WriteValue(b) // RFC 3339 never needs JSON escaping
+ }
+ // The format may contain special characters that need escaping.
+ // Verify that the result is a valid JSON string (common case),
+ // otherwise escape the string correctly (slower case).
+ if consumeSimpleString(b) != len(b) {
+ b, _ = appendString(nil, string(b[len(`"`):len(b)-len(`"`)]), true, nil)
+ }
+ return enc.WriteValue(b)
+ }
+ fncs.unmarshal = func(uo UnmarshalOptions, dec *Decoder, va addressableValue) error {
+ format := time.RFC3339
+ isRFC3339 := true
+ if uo.format != "" && uo.formatDepth == dec.tokens.depth() {
+ var err error
+ format, isRFC3339, err = checkTimeFormat(uo.format)
+ if err != nil {
+ return &SemanticError{action: "unmarshal", GoType: t, Err: err}
+ }
+ }
+
+ var flags valueFlags
+ tt := va.Addr().Interface().(*time.Time)
+ val, err := dec.readValue(&flags)
+ if err != nil {
+ return err
+ }
+ k := val.Kind()
+ switch k {
+ case 'n':
+ *tt = time.Time{}
+ return nil
+ case '"':
+ val = unescapeStringMayCopy(val, flags.isVerbatim())
+ tt2, err := time.Parse(format, string(val))
+ if isRFC3339 && err == nil {
+ // TODO(https://go.dev/issue/54580): RFC 3339 specifies
+ // the exact grammar of a valid timestamp. However,
+ // the parsing functionality in "time" is too loose and
+ // incorrectly accepts invalid timestamps as valid.
+ // Remove these manual checks when "time" checks it for us.
+ newParseError := func(layout, value, layoutElem, valueElem, message string) error {
+ return &time.ParseError{Layout: layout, Value: value, LayoutElem: layoutElem, ValueElem: valueElem, Message: message}
+ }
+ switch {
+ case val[len("2006-01-02T")+1] == ':': // hour must be two digits
+ err = newParseError(format, string(val), "15", string(val[len("2006-01-02T"):][:1]), "")
+ case val[len("2006-01-02T15:04:05")] == ',': // sub-second separator must be a period
+ err = newParseError(format, string(val), ".", ",", "")
+ case val[len(val)-1] != 'Z':
+ switch {
+ case parseDec2(val[len(val)-len("07:00"):]) >= 24: // timezone hour must be in range
+ err = newParseError(format, string(val), "Z07:00", string(val[len(val)-len("Z07:00"):]), ": timezone hour out of range")
+ case parseDec2(val[len(val)-len("00"):]) >= 60: // timezone minute must be in range
+ err = newParseError(format, string(val), "Z07:00", string(val[len(val)-len("Z07:00"):]), ": timezone minute out of range")
+ }
+ }
+ }
+ if err != nil {
+ return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t, Err: err}
+ }
+ *tt = tt2
+ return nil
+ default:
+ return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t}
+ }
+ }
+ }
+ return fncs
+}
+
+func checkTimeFormat(format string) (string, bool, error) {
+ // We assume that an exported constant in the time package will
+ // always start with an uppercase ASCII letter.
+ if len(format) > 0 && 'A' <= format[0] && format[0] <= 'Z' {
+ switch format {
+ case "ANSIC":
+ return time.ANSIC, false, nil
+ case "UnixDate":
+ return time.UnixDate, false, nil
+ case "RubyDate":
+ return time.RubyDate, false, nil
+ case "RFC822":
+ return time.RFC822, false, nil
+ case "RFC822Z":
+ return time.RFC822Z, false, nil
+ case "RFC850":
+ return time.RFC850, false, nil
+ case "RFC1123":
+ return time.RFC1123, false, nil
+ case "RFC1123Z":
+ return time.RFC1123Z, false, nil
+ case "RFC3339":
+ return time.RFC3339, true, nil
+ case "RFC3339Nano":
+ return time.RFC3339Nano, true, nil
+ case "Kitchen":
+ return time.Kitchen, false, nil
+ case "Stamp":
+ return time.Stamp, false, nil
+ case "StampMilli":
+ return time.StampMilli, false, nil
+ case "StampMicro":
+ return time.StampMicro, false, nil
+ case "StampNano":
+ return time.StampNano, false, nil
+ default:
+ // Reject any format that is an exported Go identifier in case
+ // new format constants are added to the time package.
+ if strings.TrimFunc(format, isLetterOrDigit) == "" {
+ return "", false, fmt.Errorf("undefined format layout: %v", format)
+ }
+ }
+ }
+ return format, false, nil
+}
+
+// parseDec2 parses b as an unsigned, base-10, 2-digit number.
+// It panics if len(b) < 2. The result is undefined if digits are not base-10.
+func parseDec2(b []byte) byte {
+ return 10*(b[0]-'0') + (b[1] - '0')
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/decode.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/decode.go
new file mode 100644
index 000000000..0d68b3233
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/decode.go
@@ -0,0 +1,1655 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package json
+
+import (
+ "bytes"
+ "errors"
+ "io"
+ "math"
+ "strconv"
+ "unicode/utf16"
+ "unicode/utf8"
+)
+
+// NOTE: The logic for decoding is complicated by the fact that reading from
+// an io.Reader into a temporary buffer means that the buffer may contain a
+// truncated portion of some valid input, requiring the need to fetch more data.
+//
+// This file is structured in the following way:
+//
+// - consumeXXX functions parse an exact JSON token from a []byte.
+// If the buffer appears truncated, then it returns io.ErrUnexpectedEOF.
+// The consumeSimpleXXX functions are so named because they only handle
+// a subset of the grammar for the JSON token being parsed.
+// They do not handle the full grammar to keep these functions inlineable.
+//
+// - Decoder.consumeXXX methods parse the next JSON token from Decoder.buf,
+// automatically fetching more input if necessary. These methods take
+// a position relative to the start of Decoder.buf as an argument and
+// return the end of the consumed JSON token as a position,
+// also relative to the start of Decoder.buf.
+//
+// - In the event of an I/O errors or state machine violations,
+// the implementation avoids mutating the state of Decoder
+// (aside from the book-keeping needed to implement Decoder.fetch).
+// For this reason, only Decoder.ReadToken and Decoder.ReadValue are
+// responsible for updated Decoder.prevStart and Decoder.prevEnd.
+//
+// - For performance, much of the implementation uses the pattern of calling
+// the inlineable consumeXXX functions first, and if more work is necessary,
+// then it calls the slower Decoder.consumeXXX methods.
+// TODO: Revisit this pattern if the Go compiler provides finer control
+// over exactly which calls are inlined or not.
+
+// DecodeOptions configures how JSON decoding operates.
+// The zero value is equivalent to the default settings,
+// which is compliant with both RFC 7493 and RFC 8259.
+type DecodeOptions struct {
+ requireKeyedLiterals
+ nonComparable
+
+ // AllowDuplicateNames specifies that JSON objects may contain
+ // duplicate member names. Disabling the duplicate name check may provide
+ // computational and performance benefits, but breaks compliance with
+ // RFC 7493, section 2.3. The input will still be compliant with RFC 8259,
+ // which leaves the handling of duplicate names as unspecified behavior.
+ AllowDuplicateNames bool
+
+ // AllowInvalidUTF8 specifies that JSON strings may contain invalid UTF-8,
+ // which will be mangled as the Unicode replacement character, U+FFFD.
+ // This causes the decoder to break compliance with
+ // RFC 7493, section 2.1, and RFC 8259, section 8.1.
+ AllowInvalidUTF8 bool
+}
+
+// Decoder is a streaming decoder for raw JSON tokens and values.
+// It is used to read a stream of top-level JSON values,
+// each separated by optional whitespace characters.
+//
+// ReadToken and ReadValue calls may be interleaved.
+// For example, the following JSON value:
+//
+// {"name":"value","array":[null,false,true,3.14159],"object":{"k":"v"}}
+//
+// can be parsed with the following calls (ignoring errors for brevity):
+//
+// d.ReadToken() // {
+// d.ReadToken() // "name"
+// d.ReadToken() // "value"
+// d.ReadValue() // "array"
+// d.ReadToken() // [
+// d.ReadToken() // null
+// d.ReadToken() // false
+// d.ReadValue() // true
+// d.ReadToken() // 3.14159
+// d.ReadToken() // ]
+// d.ReadValue() // "object"
+// d.ReadValue() // {"k":"v"}
+// d.ReadToken() // }
+//
+// The above is one of many possible sequence of calls and
+// may not represent the most sensible method to call for any given token/value.
+// For example, it is probably more common to call ReadToken to obtain a
+// string token for object names.
+type Decoder struct {
+ state
+ decodeBuffer
+ options DecodeOptions
+
+ stringCache *stringCache // only used when unmarshaling
+}
+
+// decodeBuffer is a buffer split into 4 segments:
+//
+// - buf[0:prevEnd] // already read portion of the buffer
+// - buf[prevStart:prevEnd] // previously read value
+// - buf[prevEnd:len(buf)] // unread portion of the buffer
+// - buf[len(buf):cap(buf)] // unused portion of the buffer
+//
+// Invariants:
+//
+// 0 ≤ prevStart ≤ prevEnd ≤ len(buf) ≤ cap(buf)
+type decodeBuffer struct {
+ peekPos int // non-zero if valid offset into buf for start of next token
+ peekErr error // implies peekPos is -1
+
+ buf []byte // may alias rd if it is a bytes.Buffer
+ prevStart int
+ prevEnd int
+
+ // baseOffset is added to prevStart and prevEnd to obtain
+ // the absolute offset relative to the start of io.Reader stream.
+ baseOffset int64
+
+ rd io.Reader
+}
+
+// NewDecoder constructs a new streaming decoder reading from r.
+//
+// If r is a bytes.Buffer, then the decoder parses directly from the buffer
+// without first copying the contents to an intermediate buffer.
+// Additional writes to the buffer must not occur while the decoder is in use.
+func NewDecoder(r io.Reader) *Decoder {
+ return DecodeOptions{}.NewDecoder(r)
+}
+
+// NewDecoder constructs a new streaming decoder reading from r
+// configured with the provided options.
+func (o DecodeOptions) NewDecoder(r io.Reader) *Decoder {
+ d := new(Decoder)
+ o.ResetDecoder(d, r)
+ return d
+}
+
+// ResetDecoder resets a decoder such that it is reading afresh from r and
+// configured with the provided options.
+func (o DecodeOptions) ResetDecoder(d *Decoder, r io.Reader) {
+ if d == nil {
+ panic("json: invalid nil Decoder")
+ }
+ if r == nil {
+ panic("json: invalid nil io.Reader")
+ }
+ d.reset(nil, r, o)
+}
+
+func (d *Decoder) reset(b []byte, r io.Reader, o DecodeOptions) {
+ d.state.reset()
+ d.decodeBuffer = decodeBuffer{buf: b, rd: r}
+ d.options = o
+}
+
+// Reset resets a decoder such that it is reading afresh from r but
+// keep any pre-existing decoder options.
+func (d *Decoder) Reset(r io.Reader) {
+ d.options.ResetDecoder(d, r)
+}
+
+var errBufferWriteAfterNext = errors.New("invalid bytes.Buffer.Write call after calling bytes.Buffer.Next")
+
+// fetch reads at least 1 byte from the underlying io.Reader.
+// It returns io.ErrUnexpectedEOF if zero bytes were read and io.EOF was seen.
+func (d *Decoder) fetch() error {
+ if d.rd == nil {
+ return io.ErrUnexpectedEOF
+ }
+
+ // Inform objectNameStack that we are about to fetch new buffer content.
+ d.names.copyQuotedBuffer(d.buf)
+
+ // Specialize bytes.Buffer for better performance.
+ if bb, ok := d.rd.(*bytes.Buffer); ok {
+ switch {
+ case bb.Len() == 0:
+ return io.ErrUnexpectedEOF
+ case len(d.buf) == 0:
+ d.buf = bb.Next(bb.Len()) // "read" all data in the buffer
+ return nil
+ default:
+ // This only occurs if a partially filled bytes.Buffer was provided
+ // and more data is written to it while Decoder is reading from it.
+ // This practice will lead to data corruption since future writes
+ // may overwrite the contents of the current buffer.
+ //
+ // The user is trying to use a bytes.Buffer as a pipe,
+ // but a bytes.Buffer is poor implementation of a pipe,
+ // the purpose-built io.Pipe should be used instead.
+ return &ioError{action: "read", err: errBufferWriteAfterNext}
+ }
+ }
+
+ // Allocate initial buffer if empty.
+ if cap(d.buf) == 0 {
+ d.buf = make([]byte, 0, 64)
+ }
+
+ // Check whether to grow the buffer.
+ const maxBufferSize = 4 << 10
+ const growthSizeFactor = 2 // higher value is faster
+ const growthRateFactor = 2 // higher value is slower
+ // By default, grow if below the maximum buffer size.
+ grow := cap(d.buf) <= maxBufferSize/growthSizeFactor
+ // Growing can be expensive, so only grow
+ // if a sufficient number of bytes have been processed.
+ grow = grow && int64(cap(d.buf)) < d.previousOffsetEnd()/growthRateFactor
+ // If prevStart==0, then fetch was called in order to fetch more data
+ // to finish consuming a large JSON value contiguously.
+ // Grow if less than 25% of the remaining capacity is available.
+ // Note that this may cause the input buffer to exceed maxBufferSize.
+ grow = grow || (d.prevStart == 0 && len(d.buf) >= 3*cap(d.buf)/4)
+
+ if grow {
+ // Allocate a new buffer and copy the contents of the old buffer over.
+ // TODO: Provide a hard limit on the maximum internal buffer size?
+ buf := make([]byte, 0, cap(d.buf)*growthSizeFactor)
+ d.buf = append(buf, d.buf[d.prevStart:]...)
+ } else {
+ // Move unread portion of the data to the front.
+ n := copy(d.buf[:cap(d.buf)], d.buf[d.prevStart:])
+ d.buf = d.buf[:n]
+ }
+ d.baseOffset += int64(d.prevStart)
+ d.prevEnd -= d.prevStart
+ d.prevStart = 0
+
+ // Read more data into the internal buffer.
+ for {
+ n, err := d.rd.Read(d.buf[len(d.buf):cap(d.buf)])
+ switch {
+ case n > 0:
+ d.buf = d.buf[:len(d.buf)+n]
+ return nil // ignore errors if any bytes are read
+ case err == io.EOF:
+ return io.ErrUnexpectedEOF
+ case err != nil:
+ return &ioError{action: "read", err: err}
+ default:
+ continue // Read returned (0, nil)
+ }
+ }
+}
+
+const invalidateBufferByte = '#' // invalid starting character for JSON grammar
+
+// invalidatePreviousRead invalidates buffers returned by Peek and Read calls
+// so that the first byte is an invalid character.
+// This Hyrum-proofs the API against faulty application code that assumes
+// values returned by ReadValue remain valid past subsequent Read calls.
+func (d *decodeBuffer) invalidatePreviousRead() {
+ // Avoid mutating the buffer if d.rd is nil which implies that d.buf
+ // is provided by the user code and may not expect mutations.
+ isBytesBuffer := func(r io.Reader) bool {
+ _, ok := r.(*bytes.Buffer)
+ return ok
+ }
+ if d.rd != nil && !isBytesBuffer(d.rd) && d.prevStart < d.prevEnd && uint(d.prevStart) < uint(len(d.buf)) {
+ d.buf[d.prevStart] = invalidateBufferByte
+ d.prevStart = d.prevEnd
+ }
+}
+
+// needMore reports whether there are no more unread bytes.
+func (d *decodeBuffer) needMore(pos int) bool {
+ // NOTE: The arguments and logic are kept simple to keep this inlineable.
+ return pos == len(d.buf)
+}
+
+// injectSyntacticErrorWithPosition wraps a SyntacticError with the position,
+// otherwise it returns the error as is.
+// It takes a position relative to the start of the start of d.buf.
+func (d *decodeBuffer) injectSyntacticErrorWithPosition(err error, pos int) error {
+ if serr, ok := err.(*SyntacticError); ok {
+ return serr.withOffset(d.baseOffset + int64(pos))
+ }
+ return err
+}
+
+func (d *decodeBuffer) previousOffsetStart() int64 { return d.baseOffset + int64(d.prevStart) }
+func (d *decodeBuffer) previousOffsetEnd() int64 { return d.baseOffset + int64(d.prevEnd) }
+func (d *decodeBuffer) previousBuffer() []byte { return d.buf[d.prevStart:d.prevEnd] }
+func (d *decodeBuffer) unreadBuffer() []byte { return d.buf[d.prevEnd:len(d.buf)] }
+
+// PeekKind retrieves the next token kind, but does not advance the read offset.
+// It returns 0 if there are no more tokens.
+func (d *Decoder) PeekKind() Kind {
+ // Check whether we have a cached peek result.
+ if d.peekPos > 0 {
+ return Kind(d.buf[d.peekPos]).normalize()
+ }
+
+ var err error
+ d.invalidatePreviousRead()
+ pos := d.prevEnd
+
+ // Consume leading whitespace.
+ pos += consumeWhitespace(d.buf[pos:])
+ if d.needMore(pos) {
+ if pos, err = d.consumeWhitespace(pos); err != nil {
+ if err == io.ErrUnexpectedEOF && d.tokens.depth() == 1 {
+ err = io.EOF // EOF possibly if no Tokens present after top-level value
+ }
+ d.peekPos, d.peekErr = -1, err
+ return invalidKind
+ }
+ }
+
+ // Consume colon or comma.
+ var delim byte
+ if c := d.buf[pos]; c == ':' || c == ',' {
+ delim = c
+ pos += 1
+ pos += consumeWhitespace(d.buf[pos:])
+ if d.needMore(pos) {
+ if pos, err = d.consumeWhitespace(pos); err != nil {
+ d.peekPos, d.peekErr = -1, err
+ return invalidKind
+ }
+ }
+ }
+ next := Kind(d.buf[pos]).normalize()
+ if d.tokens.needDelim(next) != delim {
+ pos = d.prevEnd // restore position to right after leading whitespace
+ pos += consumeWhitespace(d.buf[pos:])
+ err = d.tokens.checkDelim(delim, next)
+ err = d.injectSyntacticErrorWithPosition(err, pos)
+ d.peekPos, d.peekErr = -1, err
+ return invalidKind
+ }
+
+ // This may set peekPos to zero, which is indistinguishable from
+ // the uninitialized state. While a small hit to performance, it is correct
+ // since ReadValue and ReadToken will disregard the cached result and
+ // recompute the next kind.
+ d.peekPos, d.peekErr = pos, nil
+ return next
+}
+
+// SkipValue is semantically equivalent to calling ReadValue and discarding
+// the result except that memory is not wasted trying to hold the entire result.
+func (d *Decoder) SkipValue() error {
+ switch d.PeekKind() {
+ case '{', '[':
+ // For JSON objects and arrays, keep skipping all tokens
+ // until the depth matches the starting depth.
+ depth := d.tokens.depth()
+ for {
+ if _, err := d.ReadToken(); err != nil {
+ return err
+ }
+ if depth >= d.tokens.depth() {
+ return nil
+ }
+ }
+ default:
+ // Trying to skip a value when the next token is a '}' or ']'
+ // will result in an error being returned here.
+ if _, err := d.ReadValue(); err != nil {
+ return err
+ }
+ return nil
+ }
+}
+
+// ReadToken reads the next Token, advancing the read offset.
+// The returned token is only valid until the next Peek, Read, or Skip call.
+// It returns io.EOF if there are no more tokens.
+func (d *Decoder) ReadToken() (Token, error) {
+ // Determine the next kind.
+ var err error
+ var next Kind
+ pos := d.peekPos
+ if pos != 0 {
+ // Use cached peek result.
+ if d.peekErr != nil {
+ err := d.peekErr
+ d.peekPos, d.peekErr = 0, nil // possibly a transient I/O error
+ return Token{}, err
+ }
+ next = Kind(d.buf[pos]).normalize()
+ d.peekPos = 0 // reset cache
+ } else {
+ d.invalidatePreviousRead()
+ pos = d.prevEnd
+
+ // Consume leading whitespace.
+ pos += consumeWhitespace(d.buf[pos:])
+ if d.needMore(pos) {
+ if pos, err = d.consumeWhitespace(pos); err != nil {
+ if err == io.ErrUnexpectedEOF && d.tokens.depth() == 1 {
+ err = io.EOF // EOF possibly if no Tokens present after top-level value
+ }
+ return Token{}, err
+ }
+ }
+
+ // Consume colon or comma.
+ var delim byte
+ if c := d.buf[pos]; c == ':' || c == ',' {
+ delim = c
+ pos += 1
+ pos += consumeWhitespace(d.buf[pos:])
+ if d.needMore(pos) {
+ if pos, err = d.consumeWhitespace(pos); err != nil {
+ return Token{}, err
+ }
+ }
+ }
+ next = Kind(d.buf[pos]).normalize()
+ if d.tokens.needDelim(next) != delim {
+ pos = d.prevEnd // restore position to right after leading whitespace
+ pos += consumeWhitespace(d.buf[pos:])
+ err = d.tokens.checkDelim(delim, next)
+ return Token{}, d.injectSyntacticErrorWithPosition(err, pos)
+ }
+ }
+
+ // Handle the next token.
+ var n int
+ switch next {
+ case 'n':
+ if consumeNull(d.buf[pos:]) == 0 {
+ pos, err = d.consumeLiteral(pos, "null")
+ if err != nil {
+ return Token{}, d.injectSyntacticErrorWithPosition(err, pos)
+ }
+ } else {
+ pos += len("null")
+ }
+ if err = d.tokens.appendLiteral(); err != nil {
+ return Token{}, d.injectSyntacticErrorWithPosition(err, pos-len("null")) // report position at start of literal
+ }
+ d.prevStart, d.prevEnd = pos, pos
+ return Null, nil
+
+ case 'f':
+ if consumeFalse(d.buf[pos:]) == 0 {
+ pos, err = d.consumeLiteral(pos, "false")
+ if err != nil {
+ return Token{}, d.injectSyntacticErrorWithPosition(err, pos)
+ }
+ } else {
+ pos += len("false")
+ }
+ if err = d.tokens.appendLiteral(); err != nil {
+ return Token{}, d.injectSyntacticErrorWithPosition(err, pos-len("false")) // report position at start of literal
+ }
+ d.prevStart, d.prevEnd = pos, pos
+ return False, nil
+
+ case 't':
+ if consumeTrue(d.buf[pos:]) == 0 {
+ pos, err = d.consumeLiteral(pos, "true")
+ if err != nil {
+ return Token{}, d.injectSyntacticErrorWithPosition(err, pos)
+ }
+ } else {
+ pos += len("true")
+ }
+ if err = d.tokens.appendLiteral(); err != nil {
+ return Token{}, d.injectSyntacticErrorWithPosition(err, pos-len("true")) // report position at start of literal
+ }
+ d.prevStart, d.prevEnd = pos, pos
+ return True, nil
+
+ case '"':
+ var flags valueFlags // TODO: Preserve this in Token?
+ if n = consumeSimpleString(d.buf[pos:]); n == 0 {
+ oldAbsPos := d.baseOffset + int64(pos)
+ pos, err = d.consumeString(&flags, pos)
+ newAbsPos := d.baseOffset + int64(pos)
+ n = int(newAbsPos - oldAbsPos)
+ if err != nil {
+ return Token{}, d.injectSyntacticErrorWithPosition(err, pos)
+ }
+ } else {
+ pos += n
+ }
+ if !d.options.AllowDuplicateNames && d.tokens.last.needObjectName() {
+ if !d.tokens.last.isValidNamespace() {
+ return Token{}, errInvalidNamespace
+ }
+ if d.tokens.last.isActiveNamespace() && !d.namespaces.last().insertQuoted(d.buf[pos-n:pos], flags.isVerbatim()) {
+ err = &SyntacticError{str: "duplicate name " + string(d.buf[pos-n:pos]) + " in object"}
+ return Token{}, d.injectSyntacticErrorWithPosition(err, pos-n) // report position at start of string
+ }
+ d.names.replaceLastQuotedOffset(pos - n) // only replace if insertQuoted succeeds
+ }
+ if err = d.tokens.appendString(); err != nil {
+ return Token{}, d.injectSyntacticErrorWithPosition(err, pos-n) // report position at start of string
+ }
+ d.prevStart, d.prevEnd = pos-n, pos
+ return Token{raw: &d.decodeBuffer, num: uint64(d.previousOffsetStart())}, nil
+
+ case '0':
+ // NOTE: Since JSON numbers are not self-terminating,
+ // we need to make sure that the next byte is not part of a number.
+ if n = consumeSimpleNumber(d.buf[pos:]); n == 0 || d.needMore(pos+n) {
+ oldAbsPos := d.baseOffset + int64(pos)
+ pos, err = d.consumeNumber(pos)
+ newAbsPos := d.baseOffset + int64(pos)
+ n = int(newAbsPos - oldAbsPos)
+ if err != nil {
+ return Token{}, d.injectSyntacticErrorWithPosition(err, pos)
+ }
+ } else {
+ pos += n
+ }
+ if err = d.tokens.appendNumber(); err != nil {
+ return Token{}, d.injectSyntacticErrorWithPosition(err, pos-n) // report position at start of number
+ }
+ d.prevStart, d.prevEnd = pos-n, pos
+ return Token{raw: &d.decodeBuffer, num: uint64(d.previousOffsetStart())}, nil
+
+ case '{':
+ if err = d.tokens.pushObject(); err != nil {
+ return Token{}, d.injectSyntacticErrorWithPosition(err, pos)
+ }
+ if !d.options.AllowDuplicateNames {
+ d.names.push()
+ d.namespaces.push()
+ }
+ pos += 1
+ d.prevStart, d.prevEnd = pos, pos
+ return ObjectStart, nil
+
+ case '}':
+ if err = d.tokens.popObject(); err != nil {
+ return Token{}, d.injectSyntacticErrorWithPosition(err, pos)
+ }
+ if !d.options.AllowDuplicateNames {
+ d.names.pop()
+ d.namespaces.pop()
+ }
+ pos += 1
+ d.prevStart, d.prevEnd = pos, pos
+ return ObjectEnd, nil
+
+ case '[':
+ if err = d.tokens.pushArray(); err != nil {
+ return Token{}, d.injectSyntacticErrorWithPosition(err, pos)
+ }
+ pos += 1
+ d.prevStart, d.prevEnd = pos, pos
+ return ArrayStart, nil
+
+ case ']':
+ if err = d.tokens.popArray(); err != nil {
+ return Token{}, d.injectSyntacticErrorWithPosition(err, pos)
+ }
+ pos += 1
+ d.prevStart, d.prevEnd = pos, pos
+ return ArrayEnd, nil
+
+ default:
+ err = newInvalidCharacterError(d.buf[pos:], "at start of token")
+ return Token{}, d.injectSyntacticErrorWithPosition(err, pos)
+ }
+}
+
+type valueFlags uint
+
+const (
+ _ valueFlags = (1 << iota) / 2 // powers of two starting with zero
+
+ stringNonVerbatim // string cannot be naively treated as valid UTF-8
+ stringNonCanonical // string not formatted according to RFC 8785, section 3.2.2.2.
+ // TODO: Track whether a number is a non-integer?
+)
+
+func (f *valueFlags) set(f2 valueFlags) { *f |= f2 }
+func (f valueFlags) isVerbatim() bool { return f&stringNonVerbatim == 0 }
+func (f valueFlags) isCanonical() bool { return f&stringNonCanonical == 0 }
+
+// ReadValue returns the next raw JSON value, advancing the read offset.
+// The value is stripped of any leading or trailing whitespace.
+// The returned value is only valid until the next Peek, Read, or Skip call and
+// may not be mutated while the Decoder remains in use.
+// If the decoder is currently at the end token for an object or array,
+// then it reports a SyntacticError and the internal state remains unchanged.
+// It returns io.EOF if there are no more values.
+func (d *Decoder) ReadValue() (RawValue, error) {
+ var flags valueFlags
+ return d.readValue(&flags)
+}
+func (d *Decoder) readValue(flags *valueFlags) (RawValue, error) {
+ // Determine the next kind.
+ var err error
+ var next Kind
+ pos := d.peekPos
+ if pos != 0 {
+ // Use cached peek result.
+ if d.peekErr != nil {
+ err := d.peekErr
+ d.peekPos, d.peekErr = 0, nil // possibly a transient I/O error
+ return nil, err
+ }
+ next = Kind(d.buf[pos]).normalize()
+ d.peekPos = 0 // reset cache
+ } else {
+ d.invalidatePreviousRead()
+ pos = d.prevEnd
+
+ // Consume leading whitespace.
+ pos += consumeWhitespace(d.buf[pos:])
+ if d.needMore(pos) {
+ if pos, err = d.consumeWhitespace(pos); err != nil {
+ if err == io.ErrUnexpectedEOF && d.tokens.depth() == 1 {
+ err = io.EOF // EOF possibly if no Tokens present after top-level value
+ }
+ return nil, err
+ }
+ }
+
+ // Consume colon or comma.
+ var delim byte
+ if c := d.buf[pos]; c == ':' || c == ',' {
+ delim = c
+ pos += 1
+ pos += consumeWhitespace(d.buf[pos:])
+ if d.needMore(pos) {
+ if pos, err = d.consumeWhitespace(pos); err != nil {
+ return nil, err
+ }
+ }
+ }
+ next = Kind(d.buf[pos]).normalize()
+ if d.tokens.needDelim(next) != delim {
+ pos = d.prevEnd // restore position to right after leading whitespace
+ pos += consumeWhitespace(d.buf[pos:])
+ err = d.tokens.checkDelim(delim, next)
+ return nil, d.injectSyntacticErrorWithPosition(err, pos)
+ }
+ }
+
+ // Handle the next value.
+ oldAbsPos := d.baseOffset + int64(pos)
+ pos, err = d.consumeValue(flags, pos)
+ newAbsPos := d.baseOffset + int64(pos)
+ n := int(newAbsPos - oldAbsPos)
+ if err != nil {
+ return nil, d.injectSyntacticErrorWithPosition(err, pos)
+ }
+ switch next {
+ case 'n', 't', 'f':
+ err = d.tokens.appendLiteral()
+ case '"':
+ if !d.options.AllowDuplicateNames && d.tokens.last.needObjectName() {
+ if !d.tokens.last.isValidNamespace() {
+ err = errInvalidNamespace
+ break
+ }
+ if d.tokens.last.isActiveNamespace() && !d.namespaces.last().insertQuoted(d.buf[pos-n:pos], flags.isVerbatim()) {
+ err = &SyntacticError{str: "duplicate name " + string(d.buf[pos-n:pos]) + " in object"}
+ break
+ }
+ d.names.replaceLastQuotedOffset(pos - n) // only replace if insertQuoted succeeds
+ }
+ err = d.tokens.appendString()
+ case '0':
+ err = d.tokens.appendNumber()
+ case '{':
+ if err = d.tokens.pushObject(); err != nil {
+ break
+ }
+ if err = d.tokens.popObject(); err != nil {
+ panic("BUG: popObject should never fail immediately after pushObject: " + err.Error())
+ }
+ case '[':
+ if err = d.tokens.pushArray(); err != nil {
+ break
+ }
+ if err = d.tokens.popArray(); err != nil {
+ panic("BUG: popArray should never fail immediately after pushArray: " + err.Error())
+ }
+ }
+ if err != nil {
+ return nil, d.injectSyntacticErrorWithPosition(err, pos-n) // report position at start of value
+ }
+ d.prevEnd = pos
+ d.prevStart = pos - n
+ return d.buf[pos-n : pos : pos], nil
+}
+
+// checkEOF verifies that the input has no more data.
+func (d *Decoder) checkEOF() error {
+ switch pos, err := d.consumeWhitespace(d.prevEnd); err {
+ case nil:
+ return newInvalidCharacterError(d.buf[pos:], "after top-level value")
+ case io.ErrUnexpectedEOF:
+ return nil
+ default:
+ return err
+ }
+}
+
+// consumeWhitespace consumes all whitespace starting at d.buf[pos:].
+// It returns the new position in d.buf immediately after the last whitespace.
+// If it returns nil, there is guaranteed to at least be one unread byte.
+//
+// The following pattern is common in this implementation:
+//
+// pos += consumeWhitespace(d.buf[pos:])
+// if d.needMore(pos) {
+// if pos, err = d.consumeWhitespace(pos); err != nil {
+// return ...
+// }
+// }
+//
+// It is difficult to simplify this without sacrificing performance since
+// consumeWhitespace must be inlined. The body of the if statement is
+// executed only in rare situations where we need to fetch more data.
+// Since fetching may return an error, we also need to check the error.
+func (d *Decoder) consumeWhitespace(pos int) (newPos int, err error) {
+ for {
+ pos += consumeWhitespace(d.buf[pos:])
+ if d.needMore(pos) {
+ absPos := d.baseOffset + int64(pos)
+ err = d.fetch() // will mutate d.buf and invalidate pos
+ pos = int(absPos - d.baseOffset)
+ if err != nil {
+ return pos, err
+ }
+ continue
+ }
+ return pos, nil
+ }
+}
+
+// consumeValue consumes a single JSON value starting at d.buf[pos:].
+// It returns the new position in d.buf immediately after the value.
+func (d *Decoder) consumeValue(flags *valueFlags, pos int) (newPos int, err error) {
+ for {
+ var n int
+ var err error
+ switch next := Kind(d.buf[pos]).normalize(); next {
+ case 'n':
+ if n = consumeNull(d.buf[pos:]); n == 0 {
+ n, err = consumeLiteral(d.buf[pos:], "null")
+ }
+ case 'f':
+ if n = consumeFalse(d.buf[pos:]); n == 0 {
+ n, err = consumeLiteral(d.buf[pos:], "false")
+ }
+ case 't':
+ if n = consumeTrue(d.buf[pos:]); n == 0 {
+ n, err = consumeLiteral(d.buf[pos:], "true")
+ }
+ case '"':
+ if n = consumeSimpleString(d.buf[pos:]); n == 0 {
+ return d.consumeString(flags, pos)
+ }
+ case '0':
+ // NOTE: Since JSON numbers are not self-terminating,
+ // we need to make sure that the next byte is not part of a number.
+ if n = consumeSimpleNumber(d.buf[pos:]); n == 0 || d.needMore(pos+n) {
+ return d.consumeNumber(pos)
+ }
+ case '{':
+ return d.consumeObject(flags, pos)
+ case '[':
+ return d.consumeArray(flags, pos)
+ default:
+ return pos, newInvalidCharacterError(d.buf[pos:], "at start of value")
+ }
+ if err == io.ErrUnexpectedEOF {
+ absPos := d.baseOffset + int64(pos)
+ err = d.fetch() // will mutate d.buf and invalidate pos
+ pos = int(absPos - d.baseOffset)
+ if err != nil {
+ return pos, err
+ }
+ continue
+ }
+ return pos + n, err
+ }
+}
+
+// consumeLiteral consumes a single JSON literal starting at d.buf[pos:].
+// It returns the new position in d.buf immediately after the literal.
+func (d *Decoder) consumeLiteral(pos int, lit string) (newPos int, err error) {
+ for {
+ n, err := consumeLiteral(d.buf[pos:], lit)
+ if err == io.ErrUnexpectedEOF {
+ absPos := d.baseOffset + int64(pos)
+ err = d.fetch() // will mutate d.buf and invalidate pos
+ pos = int(absPos - d.baseOffset)
+ if err != nil {
+ return pos, err
+ }
+ continue
+ }
+ return pos + n, err
+ }
+}
+
+// consumeString consumes a single JSON string starting at d.buf[pos:].
+// It returns the new position in d.buf immediately after the string.
+func (d *Decoder) consumeString(flags *valueFlags, pos int) (newPos int, err error) {
+ var n int
+ for {
+ n, err = consumeStringResumable(flags, d.buf[pos:], n, !d.options.AllowInvalidUTF8)
+ if err == io.ErrUnexpectedEOF {
+ absPos := d.baseOffset + int64(pos)
+ err = d.fetch() // will mutate d.buf and invalidate pos
+ pos = int(absPos - d.baseOffset)
+ if err != nil {
+ return pos, err
+ }
+ continue
+ }
+ return pos + n, err
+ }
+}
+
+// consumeNumber consumes a single JSON number starting at d.buf[pos:].
+// It returns the new position in d.buf immediately after the number.
+func (d *Decoder) consumeNumber(pos int) (newPos int, err error) {
+ var n int
+ var state consumeNumberState
+ for {
+ n, state, err = consumeNumberResumable(d.buf[pos:], n, state)
+ // NOTE: Since JSON numbers are not self-terminating,
+ // we need to make sure that the next byte is not part of a number.
+ if err == io.ErrUnexpectedEOF || d.needMore(pos+n) {
+ mayTerminate := err == nil
+ absPos := d.baseOffset + int64(pos)
+ err = d.fetch() // will mutate d.buf and invalidate pos
+ pos = int(absPos - d.baseOffset)
+ if err != nil {
+ if mayTerminate && err == io.ErrUnexpectedEOF {
+ return pos + n, nil
+ }
+ return pos, err
+ }
+ continue
+ }
+ return pos + n, err
+ }
+}
+
+// consumeObject consumes a single JSON object starting at d.buf[pos:].
+// It returns the new position in d.buf immediately after the object.
+func (d *Decoder) consumeObject(flags *valueFlags, pos int) (newPos int, err error) {
+ var n int
+ var names *objectNamespace
+ if !d.options.AllowDuplicateNames {
+ d.namespaces.push()
+ defer d.namespaces.pop()
+ names = d.namespaces.last()
+ }
+
+ // Handle before start.
+ if d.buf[pos] != '{' {
+ panic("BUG: consumeObject must be called with a buffer that starts with '{'")
+ }
+ pos++
+
+ // Handle after start.
+ pos += consumeWhitespace(d.buf[pos:])
+ if d.needMore(pos) {
+ if pos, err = d.consumeWhitespace(pos); err != nil {
+ return pos, err
+ }
+ }
+ if d.buf[pos] == '}' {
+ pos++
+ return pos, nil
+ }
+
+ for {
+ // Handle before name.
+ pos += consumeWhitespace(d.buf[pos:])
+ if d.needMore(pos) {
+ if pos, err = d.consumeWhitespace(pos); err != nil {
+ return pos, err
+ }
+ }
+ var flags2 valueFlags
+ if n = consumeSimpleString(d.buf[pos:]); n == 0 {
+ oldAbsPos := d.baseOffset + int64(pos)
+ pos, err = d.consumeString(&flags2, pos)
+ newAbsPos := d.baseOffset + int64(pos)
+ n = int(newAbsPos - oldAbsPos)
+ flags.set(flags2)
+ if err != nil {
+ return pos, err
+ }
+ } else {
+ pos += n
+ }
+ if !d.options.AllowDuplicateNames && !names.insertQuoted(d.buf[pos-n:pos], flags2.isVerbatim()) {
+ return pos - n, &SyntacticError{str: "duplicate name " + string(d.buf[pos-n:pos]) + " in object"}
+ }
+
+ // Handle after name.
+ pos += consumeWhitespace(d.buf[pos:])
+ if d.needMore(pos) {
+ if pos, err = d.consumeWhitespace(pos); err != nil {
+ return pos, err
+ }
+ }
+ if d.buf[pos] != ':' {
+ return pos, newInvalidCharacterError(d.buf[pos:], "after object name (expecting ':')")
+ }
+ pos++
+
+ // Handle before value.
+ pos += consumeWhitespace(d.buf[pos:])
+ if d.needMore(pos) {
+ if pos, err = d.consumeWhitespace(pos); err != nil {
+ return pos, err
+ }
+ }
+ pos, err = d.consumeValue(flags, pos)
+ if err != nil {
+ return pos, err
+ }
+
+ // Handle after value.
+ pos += consumeWhitespace(d.buf[pos:])
+ if d.needMore(pos) {
+ if pos, err = d.consumeWhitespace(pos); err != nil {
+ return pos, err
+ }
+ }
+ switch d.buf[pos] {
+ case ',':
+ pos++
+ continue
+ case '}':
+ pos++
+ return pos, nil
+ default:
+ return pos, newInvalidCharacterError(d.buf[pos:], "after object value (expecting ',' or '}')")
+ }
+ }
+}
+
+// consumeArray consumes a single JSON array starting at d.buf[pos:].
+// It returns the new position in d.buf immediately after the array.
+func (d *Decoder) consumeArray(flags *valueFlags, pos int) (newPos int, err error) {
+ // Handle before start.
+ if d.buf[pos] != '[' {
+ panic("BUG: consumeArray must be called with a buffer that starts with '['")
+ }
+ pos++
+
+ // Handle after start.
+ pos += consumeWhitespace(d.buf[pos:])
+ if d.needMore(pos) {
+ if pos, err = d.consumeWhitespace(pos); err != nil {
+ return pos, err
+ }
+ }
+ if d.buf[pos] == ']' {
+ pos++
+ return pos, nil
+ }
+
+ for {
+ // Handle before value.
+ pos += consumeWhitespace(d.buf[pos:])
+ if d.needMore(pos) {
+ if pos, err = d.consumeWhitespace(pos); err != nil {
+ return pos, err
+ }
+ }
+ pos, err = d.consumeValue(flags, pos)
+ if err != nil {
+ return pos, err
+ }
+
+ // Handle after value.
+ pos += consumeWhitespace(d.buf[pos:])
+ if d.needMore(pos) {
+ if pos, err = d.consumeWhitespace(pos); err != nil {
+ return pos, err
+ }
+ }
+ switch d.buf[pos] {
+ case ',':
+ pos++
+ continue
+ case ']':
+ pos++
+ return pos, nil
+ default:
+ return pos, newInvalidCharacterError(d.buf[pos:], "after array value (expecting ',' or ']')")
+ }
+ }
+}
+
+// InputOffset returns the current input byte offset. It gives the location
+// of the next byte immediately after the most recently returned token or value.
+// The number of bytes actually read from the underlying io.Reader may be more
+// than this offset due to internal buffering effects.
+func (d *Decoder) InputOffset() int64 {
+ return d.previousOffsetEnd()
+}
+
+// UnreadBuffer returns the data remaining in the unread buffer,
+// which may contain zero or more bytes.
+// The returned buffer must not be mutated while Decoder continues to be used.
+// The buffer contents are valid until the next Peek, Read, or Skip call.
+func (d *Decoder) UnreadBuffer() []byte {
+ return d.unreadBuffer()
+}
+
+// StackDepth returns the depth of the state machine for read JSON data.
+// Each level on the stack represents a nested JSON object or array.
+// It is incremented whenever an ObjectStart or ArrayStart token is encountered
+// and decremented whenever an ObjectEnd or ArrayEnd token is encountered.
+// The depth is zero-indexed, where zero represents the top-level JSON value.
+func (d *Decoder) StackDepth() int {
+ // NOTE: Keep in sync with Encoder.StackDepth.
+ return d.tokens.depth() - 1
+}
+
+// StackIndex returns information about the specified stack level.
+// It must be a number between 0 and StackDepth, inclusive.
+// For each level, it reports the kind:
+//
+// - 0 for a level of zero,
+// - '{' for a level representing a JSON object, and
+// - '[' for a level representing a JSON array.
+//
+// It also reports the length of that JSON object or array.
+// Each name and value in a JSON object is counted separately,
+// so the effective number of members would be half the length.
+// A complete JSON object must have an even length.
+func (d *Decoder) StackIndex(i int) (Kind, int) {
+ // NOTE: Keep in sync with Encoder.StackIndex.
+ switch s := d.tokens.index(i); {
+ case i > 0 && s.isObject():
+ return '{', s.length()
+ case i > 0 && s.isArray():
+ return '[', s.length()
+ default:
+ return 0, s.length()
+ }
+}
+
+// StackPointer returns a JSON Pointer (RFC 6901) to the most recently read value.
+// Object names are only present if AllowDuplicateNames is false, otherwise
+// object members are represented using their index within the object.
+func (d *Decoder) StackPointer() string {
+ d.names.copyQuotedBuffer(d.buf)
+ return string(d.appendStackPointer(nil))
+}
+
+// consumeWhitespace consumes leading JSON whitespace per RFC 7159, section 2.
+func consumeWhitespace(b []byte) (n int) {
+ // NOTE: The arguments and logic are kept simple to keep this inlineable.
+ for len(b) > n && (b[n] == ' ' || b[n] == '\t' || b[n] == '\r' || b[n] == '\n') {
+ n++
+ }
+ return n
+}
+
+// consumeNull consumes the next JSON null literal per RFC 7159, section 3.
+// It returns 0 if it is invalid, in which case consumeLiteral should be used.
+func consumeNull(b []byte) int {
+ // NOTE: The arguments and logic are kept simple to keep this inlineable.
+ const literal = "null"
+ if len(b) >= len(literal) && string(b[:len(literal)]) == literal {
+ return len(literal)
+ }
+ return 0
+}
+
+// consumeFalse consumes the next JSON false literal per RFC 7159, section 3.
+// It returns 0 if it is invalid, in which case consumeLiteral should be used.
+func consumeFalse(b []byte) int {
+ // NOTE: The arguments and logic are kept simple to keep this inlineable.
+ const literal = "false"
+ if len(b) >= len(literal) && string(b[:len(literal)]) == literal {
+ return len(literal)
+ }
+ return 0
+}
+
+// consumeTrue consumes the next JSON true literal per RFC 7159, section 3.
+// It returns 0 if it is invalid, in which case consumeLiteral should be used.
+func consumeTrue(b []byte) int {
+ // NOTE: The arguments and logic are kept simple to keep this inlineable.
+ const literal = "true"
+ if len(b) >= len(literal) && string(b[:len(literal)]) == literal {
+ return len(literal)
+ }
+ return 0
+}
+
+// consumeLiteral consumes the next JSON literal per RFC 7159, section 3.
+// If the input appears truncated, it returns io.ErrUnexpectedEOF.
+func consumeLiteral(b []byte, lit string) (n int, err error) {
+ for i := 0; i < len(b) && i < len(lit); i++ {
+ if b[i] != lit[i] {
+ return i, newInvalidCharacterError(b[i:], "within literal "+lit+" (expecting "+strconv.QuoteRune(rune(lit[i]))+")")
+ }
+ }
+ if len(b) < len(lit) {
+ return len(b), io.ErrUnexpectedEOF
+ }
+ return len(lit), nil
+}
+
+// consumeSimpleString consumes the next JSON string per RFC 7159, section 7
+// but is limited to the grammar for an ASCII string without escape sequences.
+// It returns 0 if it is invalid or more complicated than a simple string,
+// in which case consumeString should be called.
+func consumeSimpleString(b []byte) (n int) {
+ // NOTE: The arguments and logic are kept simple to keep this inlineable.
+ if len(b) > 0 && b[0] == '"' {
+ n++
+ for len(b) > n && (' ' <= b[n] && b[n] != '\\' && b[n] != '"' && b[n] < utf8.RuneSelf) {
+ n++
+ }
+ if len(b) > n && b[n] == '"' {
+ n++
+ return n
+ }
+ }
+ return 0
+}
+
+// consumeString consumes the next JSON string per RFC 7159, section 7.
+// If validateUTF8 is false, then this allows the presence of invalid UTF-8
+// characters within the string itself.
+// It reports the number of bytes consumed and whether an error was encountered.
+// If the input appears truncated, it returns io.ErrUnexpectedEOF.
+func consumeString(flags *valueFlags, b []byte, validateUTF8 bool) (n int, err error) {
+ return consumeStringResumable(flags, b, 0, validateUTF8)
+}
+
+// consumeStringResumable is identical to consumeString but supports resuming
+// from a previous call that returned io.ErrUnexpectedEOF.
+func consumeStringResumable(flags *valueFlags, b []byte, resumeOffset int, validateUTF8 bool) (n int, err error) {
+ // Consume the leading double quote.
+ switch {
+ case resumeOffset > 0:
+ n = resumeOffset // already handled the leading quote
+ case uint(len(b)) == 0:
+ return n, io.ErrUnexpectedEOF
+ case b[0] == '"':
+ n++
+ default:
+ return n, newInvalidCharacterError(b[n:], `at start of string (expecting '"')`)
+ }
+
+ // Consume every character in the string.
+ for uint(len(b)) > uint(n) {
+ // Optimize for long sequences of unescaped characters.
+ noEscape := func(c byte) bool {
+ return c < utf8.RuneSelf && ' ' <= c && c != '\\' && c != '"'
+ }
+ for uint(len(b)) > uint(n) && noEscape(b[n]) {
+ n++
+ }
+ if uint(len(b)) <= uint(n) {
+ return n, io.ErrUnexpectedEOF
+ }
+
+ // Check for terminating double quote.
+ if b[n] == '"' {
+ n++
+ return n, nil
+ }
+
+ switch r, rn := utf8.DecodeRune(b[n:]); {
+ // Handle UTF-8 encoded byte sequence.
+ // Due to specialized handling of ASCII above, we know that
+ // all normal sequences at this point must be 2 bytes or larger.
+ case rn > 1:
+ n += rn
+ // Handle escape sequence.
+ case r == '\\':
+ flags.set(stringNonVerbatim)
+ resumeOffset = n
+ if uint(len(b)) < uint(n+2) {
+ return resumeOffset, io.ErrUnexpectedEOF
+ }
+ switch r := b[n+1]; r {
+ case '/':
+ // Forward slash is the only character with 3 representations.
+ // Per RFC 8785, section 3.2.2.2., this must not be escaped.
+ flags.set(stringNonCanonical)
+ n += 2
+ case '"', '\\', 'b', 'f', 'n', 'r', 't':
+ n += 2
+ case 'u':
+ if uint(len(b)) < uint(n+6) {
+ if !hasEscapeSequencePrefix(b[n:]) {
+ flags.set(stringNonCanonical)
+ return n, &SyntacticError{str: "invalid escape sequence " + strconv.Quote(string(b[n:])) + " within string"}
+ }
+ return resumeOffset, io.ErrUnexpectedEOF
+ }
+ v1, ok := parseHexUint16(b[n+2 : n+6])
+ if !ok {
+ flags.set(stringNonCanonical)
+ return n, &SyntacticError{str: "invalid escape sequence " + strconv.Quote(string(b[n:n+6])) + " within string"}
+ }
+ // Only certain control characters can use the \uFFFF notation
+ // for canonical formatting (per RFC 8785, section 3.2.2.2.).
+ switch v1 {
+ // \uFFFF notation not permitted for these characters.
+ case '\b', '\f', '\n', '\r', '\t':
+ flags.set(stringNonCanonical)
+ default:
+ // \uFFFF notation only permitted for control characters.
+ if v1 >= ' ' {
+ flags.set(stringNonCanonical)
+ } else {
+ // \uFFFF notation must be lower case.
+ for _, c := range b[n+2 : n+6] {
+ if 'A' <= c && c <= 'F' {
+ flags.set(stringNonCanonical)
+ }
+ }
+ }
+ }
+ n += 6
+
+ if validateUTF8 && utf16.IsSurrogate(rune(v1)) {
+ if uint(len(b)) >= uint(n+2) && (b[n] != '\\' || b[n+1] != 'u') {
+ return n, &SyntacticError{str: "invalid unpaired surrogate half within string"}
+ }
+ if uint(len(b)) < uint(n+6) {
+ if !hasEscapeSequencePrefix(b[n:]) {
+ flags.set(stringNonCanonical)
+ return n, &SyntacticError{str: "invalid escape sequence " + strconv.Quote(string(b[n:])) + " within string"}
+ }
+ return resumeOffset, io.ErrUnexpectedEOF
+ }
+ v2, ok := parseHexUint16(b[n+2 : n+6])
+ if !ok {
+ return n, &SyntacticError{str: "invalid escape sequence " + strconv.Quote(string(b[n:n+6])) + " within string"}
+ }
+ if utf16.DecodeRune(rune(v1), rune(v2)) == utf8.RuneError {
+ return n, &SyntacticError{str: "invalid surrogate pair in string"}
+ }
+ n += 6
+ }
+ default:
+ flags.set(stringNonCanonical)
+ return n, &SyntacticError{str: "invalid escape sequence " + strconv.Quote(string(b[n:n+2])) + " within string"}
+ }
+ // Handle invalid UTF-8.
+ case r == utf8.RuneError:
+ if !utf8.FullRune(b[n:]) {
+ return n, io.ErrUnexpectedEOF
+ }
+ flags.set(stringNonVerbatim | stringNonCanonical)
+ if validateUTF8 {
+ return n, &SyntacticError{str: "invalid UTF-8 within string"}
+ }
+ n++
+ // Handle invalid control characters.
+ case r < ' ':
+ flags.set(stringNonVerbatim | stringNonCanonical)
+ return n, newInvalidCharacterError(b[n:], "within string (expecting non-control character)")
+ default:
+ panic("BUG: unhandled character " + quoteRune(b[n:]))
+ }
+ }
+ return n, io.ErrUnexpectedEOF
+}
+
+// hasEscapeSequencePrefix reports whether b is possibly
+// the truncated prefix of a \uFFFF escape sequence.
+func hasEscapeSequencePrefix(b []byte) bool {
+ for i, c := range b {
+ switch {
+ case i == 0 && c != '\\':
+ return false
+ case i == 1 && c != 'u':
+ return false
+ case i >= 2 && i < 6 && !('0' <= c && c <= '9') && !('a' <= c && c <= 'f') && !('A' <= c && c <= 'F'):
+ return false
+ }
+ }
+ return true
+}
+
+// unescapeString appends the unescaped form of a JSON string in src to dst.
+// Any invalid UTF-8 within the string will be replaced with utf8.RuneError.
+// The input must be an entire JSON string with no surrounding whitespace.
+func unescapeString(dst, src []byte) (v []byte, ok bool) {
+ // Consume leading double quote.
+ if uint(len(src)) == 0 || src[0] != '"' {
+ return dst, false
+ }
+ i, n := 1, 1
+
+ // Consume every character until completion.
+ for uint(len(src)) > uint(n) {
+ // Optimize for long sequences of unescaped characters.
+ noEscape := func(c byte) bool {
+ return c < utf8.RuneSelf && ' ' <= c && c != '\\' && c != '"'
+ }
+ for uint(len(src)) > uint(n) && noEscape(src[n]) {
+ n++
+ }
+ if uint(len(src)) <= uint(n) {
+ break
+ }
+
+ // Check for terminating double quote.
+ if src[n] == '"' {
+ dst = append(dst, src[i:n]...)
+ n++
+ return dst, len(src) == n
+ }
+
+ switch r, rn := utf8.DecodeRune(src[n:]); {
+ // Handle UTF-8 encoded byte sequence.
+ // Due to specialized handling of ASCII above, we know that
+ // all normal sequences at this point must be 2 bytes or larger.
+ case rn > 1:
+ n += rn
+ // Handle escape sequence.
+ case r == '\\':
+ dst = append(dst, src[i:n]...)
+ if r < ' ' {
+ return dst, false // invalid control character or unescaped quote
+ }
+
+ // Handle escape sequence.
+ if uint(len(src)) < uint(n+2) {
+ return dst, false // truncated escape sequence
+ }
+ switch r := src[n+1]; r {
+ case '"', '\\', '/':
+ dst = append(dst, r)
+ n += 2
+ case 'b':
+ dst = append(dst, '\b')
+ n += 2
+ case 'f':
+ dst = append(dst, '\f')
+ n += 2
+ case 'n':
+ dst = append(dst, '\n')
+ n += 2
+ case 'r':
+ dst = append(dst, '\r')
+ n += 2
+ case 't':
+ dst = append(dst, '\t')
+ n += 2
+ case 'u':
+ if uint(len(src)) < uint(n+6) {
+ return dst, false // truncated escape sequence
+ }
+ v1, ok := parseHexUint16(src[n+2 : n+6])
+ if !ok {
+ return dst, false // invalid escape sequence
+ }
+ n += 6
+
+ // Check whether this is a surrogate half.
+ r := rune(v1)
+ if utf16.IsSurrogate(r) {
+ r = utf8.RuneError // assume failure unless the following succeeds
+ if uint(len(src)) >= uint(n+6) && src[n+0] == '\\' && src[n+1] == 'u' {
+ if v2, ok := parseHexUint16(src[n+2 : n+6]); ok {
+ if r = utf16.DecodeRune(rune(v1), rune(v2)); r != utf8.RuneError {
+ n += 6
+ }
+ }
+ }
+ }
+
+ dst = utf8.AppendRune(dst, r)
+ default:
+ return dst, false // invalid escape sequence
+ }
+ i = n
+ // Handle invalid UTF-8.
+ case r == utf8.RuneError:
+ // NOTE: An unescaped string may be longer than the escaped string
+ // because invalid UTF-8 bytes are being replaced.
+ dst = append(dst, src[i:n]...)
+ dst = append(dst, "\uFFFD"...)
+ n += rn
+ i = n
+ // Handle invalid control characters.
+ case r < ' ':
+ dst = append(dst, src[i:n]...)
+ return dst, false // invalid control character or unescaped quote
+ default:
+ panic("BUG: unhandled character " + quoteRune(src[n:]))
+ }
+ }
+ dst = append(dst, src[i:n]...)
+ return dst, false // truncated input
+}
+
+// unescapeStringMayCopy returns the unescaped form of b.
+// If there are no escaped characters, the output is simply a subslice of
+// the input with the surrounding quotes removed.
+// Otherwise, a new buffer is allocated for the output.
+func unescapeStringMayCopy(b []byte, isVerbatim bool) []byte {
+ // NOTE: The arguments and logic are kept simple to keep this inlineable.
+ if isVerbatim {
+ return b[len(`"`) : len(b)-len(`"`)]
+ }
+ b, _ = unescapeString(make([]byte, 0, len(b)), b)
+ return b
+}
+
+// consumeSimpleNumber consumes the next JSON number per RFC 7159, section 6
+// but is limited to the grammar for a positive integer.
+// It returns 0 if it is invalid or more complicated than a simple integer,
+// in which case consumeNumber should be called.
+func consumeSimpleNumber(b []byte) (n int) {
+ // NOTE: The arguments and logic are kept simple to keep this inlineable.
+ if len(b) > 0 {
+ if b[0] == '0' {
+ n++
+ } else if '1' <= b[0] && b[0] <= '9' {
+ n++
+ for len(b) > n && ('0' <= b[n] && b[n] <= '9') {
+ n++
+ }
+ } else {
+ return 0
+ }
+ if len(b) == n || !(b[n] == '.' || b[n] == 'e' || b[n] == 'E') {
+ return n
+ }
+ }
+ return 0
+}
+
+type consumeNumberState uint
+
+const (
+ consumeNumberInit consumeNumberState = iota
+ beforeIntegerDigits
+ withinIntegerDigits
+ beforeFractionalDigits
+ withinFractionalDigits
+ beforeExponentDigits
+ withinExponentDigits
+)
+
+// consumeNumber consumes the next JSON number per RFC 7159, section 6.
+// It reports the number of bytes consumed and whether an error was encountered.
+// If the input appears truncated, it returns io.ErrUnexpectedEOF.
+//
+// Note that JSON numbers are not self-terminating.
+// If the entire input is consumed, then the caller needs to consider whether
+// there may be subsequent unread data that may still be part of this number.
+func consumeNumber(b []byte) (n int, err error) {
+ n, _, err = consumeNumberResumable(b, 0, consumeNumberInit)
+ return n, err
+}
+
+// consumeNumberResumable is identical to consumeNumber but supports resuming
+// from a previous call that returned io.ErrUnexpectedEOF.
+func consumeNumberResumable(b []byte, resumeOffset int, state consumeNumberState) (n int, _ consumeNumberState, err error) {
+ // Jump to the right state when resuming from a partial consumption.
+ n = resumeOffset
+ if state > consumeNumberInit {
+ switch state {
+ case withinIntegerDigits, withinFractionalDigits, withinExponentDigits:
+ // Consume leading digits.
+ for len(b) > n && ('0' <= b[n] && b[n] <= '9') {
+ n++
+ }
+ if len(b) == n {
+ return n, state, nil // still within the same state
+ }
+ state++ // switches "withinX" to "beforeY" where Y is the state after X
+ }
+ switch state {
+ case beforeIntegerDigits:
+ goto beforeInteger
+ case beforeFractionalDigits:
+ goto beforeFractional
+ case beforeExponentDigits:
+ goto beforeExponent
+ default:
+ return n, state, nil
+ }
+ }
+
+ // Consume required integer component (with optional minus sign).
+beforeInteger:
+ resumeOffset = n
+ if len(b) > 0 && b[0] == '-' {
+ n++
+ }
+ switch {
+ case len(b) == n:
+ return resumeOffset, beforeIntegerDigits, io.ErrUnexpectedEOF
+ case b[n] == '0':
+ n++
+ state = beforeFractionalDigits
+ case '1' <= b[n] && b[n] <= '9':
+ n++
+ for len(b) > n && ('0' <= b[n] && b[n] <= '9') {
+ n++
+ }
+ state = withinIntegerDigits
+ default:
+ return n, state, newInvalidCharacterError(b[n:], "within number (expecting digit)")
+ }
+
+ // Consume optional fractional component.
+beforeFractional:
+ if len(b) > n && b[n] == '.' {
+ resumeOffset = n
+ n++
+ switch {
+ case len(b) == n:
+ return resumeOffset, beforeFractionalDigits, io.ErrUnexpectedEOF
+ case '0' <= b[n] && b[n] <= '9':
+ n++
+ default:
+ return n, state, newInvalidCharacterError(b[n:], "within number (expecting digit)")
+ }
+ for len(b) > n && ('0' <= b[n] && b[n] <= '9') {
+ n++
+ }
+ state = withinFractionalDigits
+ }
+
+ // Consume optional exponent component.
+beforeExponent:
+ if len(b) > n && (b[n] == 'e' || b[n] == 'E') {
+ resumeOffset = n
+ n++
+ if len(b) > n && (b[n] == '-' || b[n] == '+') {
+ n++
+ }
+ switch {
+ case len(b) == n:
+ return resumeOffset, beforeExponentDigits, io.ErrUnexpectedEOF
+ case '0' <= b[n] && b[n] <= '9':
+ n++
+ default:
+ return n, state, newInvalidCharacterError(b[n:], "within number (expecting digit)")
+ }
+ for len(b) > n && ('0' <= b[n] && b[n] <= '9') {
+ n++
+ }
+ state = withinExponentDigits
+ }
+
+ return n, state, nil
+}
+
+// parseHexUint16 is similar to strconv.ParseUint,
+// but operates directly on []byte and is optimized for base-16.
+// See https://go.dev/issue/42429.
+func parseHexUint16(b []byte) (v uint16, ok bool) {
+ if len(b) != 4 {
+ return 0, false
+ }
+ for _, c := range b[:4] {
+ switch {
+ case '0' <= c && c <= '9':
+ c = c - '0'
+ case 'a' <= c && c <= 'f':
+ c = 10 + c - 'a'
+ case 'A' <= c && c <= 'F':
+ c = 10 + c - 'A'
+ default:
+ return 0, false
+ }
+ v = v*16 + uint16(c)
+ }
+ return v, true
+}
+
+// parseDecUint is similar to strconv.ParseUint,
+// but operates directly on []byte and is optimized for base-10.
+// If the number is syntactically valid but overflows uint64,
+// then it returns (math.MaxUint64, false).
+// See https://go.dev/issue/42429.
+func parseDecUint(b []byte) (v uint64, ok bool) {
+ // Overflow logic is based on strconv/atoi.go:138-149 from Go1.15, where:
+ // - cutoff is equal to math.MaxUint64/10+1, and
+ // - the n1 > maxVal check is unnecessary
+ // since maxVal is equivalent to math.MaxUint64.
+ var n int
+ var overflow bool
+ for len(b) > n && ('0' <= b[n] && b[n] <= '9') {
+ overflow = overflow || v >= math.MaxUint64/10+1
+ v *= 10
+
+ v1 := v + uint64(b[n]-'0')
+ overflow = overflow || v1 < v
+ v = v1
+
+ n++
+ }
+ if n == 0 || len(b) != n {
+ return 0, false
+ }
+ if overflow {
+ return math.MaxUint64, false
+ }
+ return v, true
+}
+
+// parseFloat parses a floating point number according to the Go float grammar.
+// Note that the JSON number grammar is a strict subset.
+//
+// If the number overflows the finite representation of a float,
+// then we return MaxFloat since any finite value will always be infinitely
+// more accurate at representing another finite value than an infinite value.
+func parseFloat(b []byte, bits int) (v float64, ok bool) {
+ // Fast path for exact integer numbers which fit in the
+ // 24-bit or 53-bit significand of a float32 or float64.
+ var negLen int // either 0 or 1
+ if len(b) > 0 && b[0] == '-' {
+ negLen = 1
+ }
+ u, ok := parseDecUint(b[negLen:])
+ if ok && ((bits == 32 && u <= 1<<24) || (bits == 64 && u <= 1<<53)) {
+ return math.Copysign(float64(u), float64(-1*negLen)), true
+ }
+
+ // Note that the []byte->string conversion unfortunately allocates.
+ // See https://go.dev/issue/42429 for more information.
+ fv, err := strconv.ParseFloat(string(b), bits)
+ if math.IsInf(fv, 0) {
+ switch {
+ case bits == 32 && math.IsInf(fv, +1):
+ return +math.MaxFloat32, true
+ case bits == 64 && math.IsInf(fv, +1):
+ return +math.MaxFloat64, true
+ case bits == 32 && math.IsInf(fv, -1):
+ return -math.MaxFloat32, true
+ case bits == 64 && math.IsInf(fv, -1):
+ return -math.MaxFloat64, true
+ }
+ }
+ return fv, err == nil
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/doc.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/doc.go
new file mode 100644
index 000000000..e4eefa3de
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/doc.go
@@ -0,0 +1,182 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Package json implements serialization of JSON
+// as specified in RFC 4627, RFC 7159, RFC 7493, RFC 8259, and RFC 8785.
+// JSON is a simple data interchange format that can represent
+// primitive data types such as booleans, strings, and numbers,
+// in addition to structured data types such as objects and arrays.
+//
+// # Terminology
+//
+// This package uses the terms "encode" and "decode" for syntactic functionality
+// that is concerned with processing JSON based on its grammar, and
+// uses the terms "marshal" and "unmarshal" for semantic functionality
+// that determines the meaning of JSON values as Go values and vice-versa.
+// It aims to provide a clear distinction between functionality that
+// is purely concerned with encoding versus that of marshaling.
+// For example, one can directly encode a stream of JSON tokens without
+// needing to marshal a concrete Go value representing them.
+// Similarly, one can decode a stream of JSON tokens without
+// needing to unmarshal them into a concrete Go value.
+//
+// This package uses JSON terminology when discussing JSON, which may differ
+// from related concepts in Go or elsewhere in computing literature.
+//
+// - A JSON "object" refers to an unordered collection of name/value members.
+// - A JSON "array" refers to an ordered sequence of elements.
+// - A JSON "value" refers to either a literal (i.e., null, false, or true),
+// string, number, object, or array.
+//
+// See RFC 8259 for more information.
+//
+// # Specifications
+//
+// Relevant specifications include RFC 4627, RFC 7159, RFC 7493, RFC 8259,
+// and RFC 8785. Each RFC is generally a stricter subset of another RFC.
+// In increasing order of strictness:
+//
+// - RFC 4627 and RFC 7159 do not require (but recommend) the use of UTF-8
+// and also do not require (but recommend) that object names be unique.
+// - RFC 8259 requires the use of UTF-8,
+// but does not require (but recommends) that object names be unique.
+// - RFC 7493 requires the use of UTF-8
+// and also requires that object names be unique.
+// - RFC 8785 defines a canonical representation. It requires the use of UTF-8
+// and also requires that object names be unique and in a specific ordering.
+// It specifies exactly how strings and numbers must be formatted.
+//
+// The primary difference between RFC 4627 and RFC 7159 is that the former
+// restricted top-level values to only JSON objects and arrays, while
+// RFC 7159 and subsequent RFCs permit top-level values to additionally be
+// JSON nulls, booleans, strings, or numbers.
+//
+// By default, this package operates on RFC 7493, but can be configured
+// to operate according to the other RFC specifications.
+// RFC 7493 is a stricter subset of RFC 8259 and fully compliant with it.
+// In particular, it makes specific choices about behavior that RFC 8259
+// leaves as undefined in order to ensure greater interoperability.
+//
+// # JSON Representation of Go structs
+//
+// A Go struct is naturally represented as a JSON object,
+// where each Go struct field corresponds with a JSON object member.
+// When marshaling, all Go struct fields are recursively encoded in depth-first
+// order as JSON object members except those that are ignored or omitted.
+// When unmarshaling, JSON object members are recursively decoded
+// into the corresponding Go struct fields.
+// Object members that do not match any struct fields,
+// also known as “unknown members”, are ignored by default or rejected
+// if UnmarshalOptions.RejectUnknownMembers is specified.
+//
+// The representation of each struct field can be customized in the
+// "json" struct field tag, where the tag is a comma separated list of options.
+// As a special case, if the entire tag is `json:"-"`,
+// then the field is ignored with regard to its JSON representation.
+//
+// The first option is the JSON object name override for the Go struct field.
+// If the name is not specified, then the Go struct field name
+// is used as the JSON object name. JSON names containing commas or quotes,
+// or names identical to "" or "-", can be specified using
+// a single-quoted string literal, where the syntax is identical to
+// the Go grammar for a double-quoted string literal,
+// but instead uses single quotes as the delimiters.
+// By default, unmarshaling uses case-sensitive matching to identify
+// the Go struct field associated with a JSON object name.
+//
+// After the name, the following tag options are supported:
+//
+// - omitzero: When marshaling, the "omitzero" option specifies that
+// the struct field should be omitted if the field value is zero
+// as determined by the "IsZero() bool" method if present,
+// otherwise based on whether the field is the zero Go value.
+// This option has no effect when unmarshaling.
+//
+// - omitempty: When marshaling, the "omitempty" option specifies that
+// the struct field should be omitted if the field value would have been
+// encoded as a JSON null, empty string, empty object, or empty array.
+// This option has no effect when unmarshaling.
+//
+// - string: The "string" option specifies that
+// MarshalOptions.StringifyNumbers and UnmarshalOptions.StringifyNumbers
+// be set when marshaling or unmarshaling a struct field value.
+// This causes numeric types to be encoded as a JSON number
+// within a JSON string, and to be decoded from either a JSON number or
+// a JSON string containing a JSON number.
+// This extra level of encoding is often necessary since
+// many JSON parsers cannot precisely represent 64-bit integers.
+//
+// - nocase: When unmarshaling, the "nocase" option specifies that
+// if the JSON object name does not exactly match the JSON name
+// for any of the struct fields, then it attempts to match the struct field
+// using a case-insensitive match that also ignores dashes and underscores.
+// If multiple fields match, the first declared field in breadth-first order
+// takes precedence. This option has no effect when marshaling.
+//
+// - inline: The "inline" option specifies that
+// the JSON representable content of this field type is to be promoted
+// as if they were specified in the parent struct.
+// It is the JSON equivalent of Go struct embedding.
+// A Go embedded field is implicitly inlined unless an explicit JSON name
+// is specified. The inlined field must be a Go struct
+// (that does not implement any JSON methods), RawValue, map[string]T,
+// or an unnamed pointer to such types. When marshaling,
+// inlined fields from a pointer type are omitted if it is nil.
+// Inlined fields of type RawValue and map[string]T are called
+// “inlined fallbacks” as they can represent all possible
+// JSON object members not directly handled by the parent struct.
+// Only one inlined fallback field may be specified in a struct,
+// while many non-fallback fields may be specified. This option
+// must not be specified with any other option (including the JSON name).
+//
+// - unknown: The "unknown" option is a specialized variant
+// of the inlined fallback to indicate that this Go struct field
+// contains any number of unknown JSON object members. The field type
+// must be a RawValue, map[string]T, or an unnamed pointer to such types.
+// If MarshalOptions.DiscardUnknownMembers is specified when marshaling,
+// the contents of this field are ignored.
+// If UnmarshalOptions.RejectUnknownMembers is specified when unmarshaling,
+// any unknown object members are rejected regardless of whether
+// an inlined fallback with the "unknown" option exists. This option
+// must not be specified with any other option (including the JSON name).
+//
+// - format: The "format" option specifies a format flag
+// used to specialize the formatting of the field value.
+// The option is a key-value pair specified as "format:value" where
+// the value must be either a literal consisting of letters and numbers
+// (e.g., "format:RFC3339") or a single-quoted string literal
+// (e.g., "format:'2006-01-02'"). The interpretation of the format flag
+// is determined by the struct field type.
+//
+// The "omitzero" and "omitempty" options are mostly semantically identical.
+// The former is defined in terms of the Go type system,
+// while the latter in terms of the JSON type system.
+// Consequently they behave differently in some circumstances.
+// For example, only a nil slice or map is omitted under "omitzero", while
+// an empty slice or map is omitted under "omitempty" regardless of nilness.
+// The "omitzero" option is useful for types with a well-defined zero value
+// (e.g., netip.Addr) or have an IsZero method (e.g., time.Time).
+//
+// Every Go struct corresponds to a list of JSON representable fields
+// which is constructed by performing a breadth-first search over
+// all struct fields (excluding unexported or ignored fields),
+// where the search recursively descends into inlined structs.
+// The set of non-inlined fields in a struct must have unique JSON names.
+// If multiple fields all have the same JSON name, then the one
+// at shallowest depth takes precedence and the other fields at deeper depths
+// are excluded from the list of JSON representable fields.
+// If multiple fields at the shallowest depth have the same JSON name,
+// then all of those fields are excluded from the list. This is analogous to
+// Go visibility rules for struct field selection with embedded struct types.
+//
+// Marshaling or unmarshaling a non-empty struct
+// without any JSON representable fields results in a SemanticError.
+// Unexported fields must not have any `json` tags except for `json:"-"`.
+package json
+
+// requireKeyedLiterals can be embedded in a struct to require keyed literals.
+type requireKeyedLiterals struct{}
+
+// nonComparable can be embedded in a struct to prevent comparability.
+type nonComparable [0]func()
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/encode.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/encode.go
new file mode 100644
index 000000000..5b81ca15a
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/encode.go
@@ -0,0 +1,1170 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package json
+
+import (
+ "bytes"
+ "io"
+ "math"
+ "math/bits"
+ "strconv"
+ "unicode/utf16"
+ "unicode/utf8"
+)
+
+// EncodeOptions configures how JSON encoding operates.
+// The zero value is equivalent to the default settings,
+// which is compliant with both RFC 7493 and RFC 8259.
+type EncodeOptions struct {
+ requireKeyedLiterals
+ nonComparable
+
+ // multiline specifies whether the encoder should emit multiline output.
+ multiline bool
+
+ // omitTopLevelNewline specifies whether to omit the newline
+ // that is appended after every top-level JSON value when streaming.
+ omitTopLevelNewline bool
+
+ // AllowDuplicateNames specifies that JSON objects may contain
+ // duplicate member names. Disabling the duplicate name check may provide
+ // performance benefits, but breaks compliance with RFC 7493, section 2.3.
+ // The output will still be compliant with RFC 8259,
+ // which leaves the handling of duplicate names as unspecified behavior.
+ AllowDuplicateNames bool
+
+ // AllowInvalidUTF8 specifies that JSON strings may contain invalid UTF-8,
+ // which will be mangled as the Unicode replacement character, U+FFFD.
+ // This causes the encoder to break compliance with
+ // RFC 7493, section 2.1, and RFC 8259, section 8.1.
+ AllowInvalidUTF8 bool
+
+ // preserveRawStrings specifies that WriteToken and WriteValue should not
+ // reformat any JSON string, but keep the formatting verbatim.
+ preserveRawStrings bool
+
+ // canonicalizeNumbers specifies that WriteToken and WriteValue should
+ // reformat any JSON numbers according to RFC 8785, section 3.2.2.3.
+ canonicalizeNumbers bool
+
+ // EscapeRune reports whether the provided character should be escaped
+ // as a hexadecimal Unicode codepoint (e.g., \ufffd).
+ // If nil, the shortest and simplest encoding will be used,
+ // which is also the formatting specified by RFC 8785, section 3.2.2.2.
+ EscapeRune func(rune) bool
+
+ // Indent (if non-empty) specifies that the encoder should emit multiline
+ // output where each element in a JSON object or array begins on a new,
+ // indented line beginning with the indent prefix followed by one or more
+ // copies of indent according to the indentation nesting.
+ // It may only be composed of space or tab characters.
+ Indent string
+
+ // IndentPrefix is prepended to each line within a JSON object or array.
+ // The purpose of the indent prefix is to encode data that can more easily
+ // be embedded inside other formatted JSON data.
+ // It may only be composed of space or tab characters.
+ // It is ignored if Indent is empty.
+ IndentPrefix string
+}
+
+// Encoder is a streaming encoder from raw JSON tokens and values.
+// It is used to write a stream of top-level JSON values,
+// each terminated with a newline character.
+//
+// WriteToken and WriteValue calls may be interleaved.
+// For example, the following JSON value:
+//
+// {"name":"value","array":[null,false,true,3.14159],"object":{"k":"v"}}
+//
+// can be composed with the following calls (ignoring errors for brevity):
+//
+// e.WriteToken(ObjectStart) // {
+// e.WriteToken(String("name")) // "name"
+// e.WriteToken(String("value")) // "value"
+// e.WriteValue(RawValue(`"array"`)) // "array"
+// e.WriteToken(ArrayStart) // [
+// e.WriteToken(Null) // null
+// e.WriteToken(False) // false
+// e.WriteValue(RawValue("true")) // true
+// e.WriteToken(Float(3.14159)) // 3.14159
+// e.WriteToken(ArrayEnd) // ]
+// e.WriteValue(RawValue(`"object"`)) // "object"
+// e.WriteValue(RawValue(`{"k":"v"}`)) // {"k":"v"}
+// e.WriteToken(ObjectEnd) // }
+//
+// The above is one of many possible sequence of calls and
+// may not represent the most sensible method to call for any given token/value.
+// For example, it is probably more common to call WriteToken with a string
+// for object names.
+type Encoder struct {
+ state
+ encodeBuffer
+ options EncodeOptions
+
+ seenPointers seenPointers // only used when marshaling
+}
+
+// encodeBuffer is a buffer split into 2 segments:
+//
+// - buf[0:len(buf)] // written (but unflushed) portion of the buffer
+// - buf[len(buf):cap(buf)] // unused portion of the buffer
+type encodeBuffer struct {
+ buf []byte // may alias wr if it is a bytes.Buffer
+
+ // baseOffset is added to len(buf) to obtain the absolute offset
+ // relative to the start of io.Writer stream.
+ baseOffset int64
+
+ wr io.Writer
+
+ // maxValue is the approximate maximum RawValue size passed to WriteValue.
+ maxValue int
+ // unusedCache is the buffer returned by the UnusedBuffer method.
+ unusedCache []byte
+ // bufStats is statistics about buffer utilization.
+ // It is only used with pooled encoders in pools.go.
+ bufStats bufferStatistics
+}
+
+// NewEncoder constructs a new streaming encoder writing to w.
+func NewEncoder(w io.Writer) *Encoder {
+ return EncodeOptions{}.NewEncoder(w)
+}
+
+// NewEncoder constructs a new streaming encoder writing to w
+// configured with the provided options.
+// It flushes the internal buffer when the buffer is sufficiently full or
+// when a top-level value has been written.
+//
+// If w is a bytes.Buffer, then the encoder appends directly into the buffer
+// without copying the contents from an intermediate buffer.
+func (o EncodeOptions) NewEncoder(w io.Writer) *Encoder {
+ e := new(Encoder)
+ o.ResetEncoder(e, w)
+ return e
+}
+
+// ResetEncoder resets an encoder such that it is writing afresh to w and
+// configured with the provided options.
+func (o EncodeOptions) ResetEncoder(e *Encoder, w io.Writer) {
+ if e == nil {
+ panic("json: invalid nil Encoder")
+ }
+ if w == nil {
+ panic("json: invalid nil io.Writer")
+ }
+ e.reset(nil, w, o)
+}
+
+func (e *Encoder) reset(b []byte, w io.Writer, o EncodeOptions) {
+ if len(o.Indent) > 0 {
+ o.multiline = true
+ if s := trimLeftSpaceTab(o.IndentPrefix); len(s) > 0 {
+ panic("json: invalid character " + quoteRune([]byte(s)) + " in indent prefix")
+ }
+ if s := trimLeftSpaceTab(o.Indent); len(s) > 0 {
+ panic("json: invalid character " + quoteRune([]byte(s)) + " in indent")
+ }
+ }
+ e.state.reset()
+ e.encodeBuffer = encodeBuffer{buf: b, wr: w, bufStats: e.bufStats}
+ e.options = o
+ if bb, ok := w.(*bytes.Buffer); ok && bb != nil {
+ e.buf = bb.Bytes()[bb.Len():] // alias the unused buffer of bb
+ }
+}
+
+// Reset resets an encoder such that it is writing afresh to w but
+// keeps any pre-existing encoder options.
+func (e *Encoder) Reset(w io.Writer) {
+ e.options.ResetEncoder(e, w)
+}
+
+// needFlush determines whether to flush at this point.
+func (e *Encoder) needFlush() bool {
+ // NOTE: This function is carefully written to be inlineable.
+
+ // Avoid flushing if e.wr is nil since there is no underlying writer.
+ // Flush if less than 25% of the capacity remains.
+ // Flushing at some constant fraction ensures that the buffer stops growing
+ // so long as the largest Token or Value fits within that unused capacity.
+ return e.wr != nil && (e.tokens.depth() == 1 || len(e.buf) > 3*cap(e.buf)/4)
+}
+
+// flush flushes the buffer to the underlying io.Writer.
+// It may append a trailing newline after the top-level value.
+func (e *Encoder) flush() error {
+ if e.wr == nil || e.avoidFlush() {
+ return nil
+ }
+
+ // In streaming mode, always emit a newline after the top-level value.
+ if e.tokens.depth() == 1 && !e.options.omitTopLevelNewline {
+ e.buf = append(e.buf, '\n')
+ }
+
+ // Inform objectNameStack that we are about to flush the buffer content.
+ e.names.copyQuotedBuffer(e.buf)
+
+ // Specialize bytes.Buffer for better performance.
+ if bb, ok := e.wr.(*bytes.Buffer); ok {
+ // If e.buf already aliases the internal buffer of bb,
+ // then the Write call simply increments the internal offset,
+ // otherwise Write operates as expected.
+ // See https://go.dev/issue/42986.
+ n, _ := bb.Write(e.buf) // never fails unless bb is nil
+ e.baseOffset += int64(n)
+
+ // If the internal buffer of bytes.Buffer is too small,
+ // append operations elsewhere in the Encoder may grow the buffer.
+ // This would be semantically correct, but hurts performance.
+ // As such, ensure 25% of the current length is always available
+ // to reduce the probability that other appends must allocate.
+ if avail := bb.Cap() - bb.Len(); avail < bb.Len()/4 {
+ bb.Grow(avail + 1)
+ }
+
+ e.buf = bb.Bytes()[bb.Len():] // alias the unused buffer of bb
+ return nil
+ }
+
+ // Flush the internal buffer to the underlying io.Writer.
+ n, err := e.wr.Write(e.buf)
+ e.baseOffset += int64(n)
+ if err != nil {
+ // In the event of an error, preserve the unflushed portion.
+ // Thus, write errors aren't fatal so long as the io.Writer
+ // maintains consistent state after errors.
+ if n > 0 {
+ e.buf = e.buf[:copy(e.buf, e.buf[n:])]
+ }
+ return &ioError{action: "write", err: err}
+ }
+ e.buf = e.buf[:0]
+
+ // Check whether to grow the buffer.
+ // Note that cap(e.buf) may already exceed maxBufferSize since
+ // an append elsewhere already grew it to store a large token.
+ const maxBufferSize = 4 << 10
+ const growthSizeFactor = 2 // higher value is faster
+ const growthRateFactor = 2 // higher value is slower
+ // By default, grow if below the maximum buffer size.
+ grow := cap(e.buf) <= maxBufferSize/growthSizeFactor
+ // Growing can be expensive, so only grow
+ // if a sufficient number of bytes have been processed.
+ grow = grow && int64(cap(e.buf)) < e.previousOffsetEnd()/growthRateFactor
+ if grow {
+ e.buf = make([]byte, 0, cap(e.buf)*growthSizeFactor)
+ }
+
+ return nil
+}
+
+func (e *encodeBuffer) previousOffsetEnd() int64 { return e.baseOffset + int64(len(e.buf)) }
+func (e *encodeBuffer) unflushedBuffer() []byte { return e.buf }
+
+// avoidFlush indicates whether to avoid flushing to ensure there is always
+// enough in the buffer to unwrite the last object member if it were empty.
+func (e *Encoder) avoidFlush() bool {
+ switch {
+ case e.tokens.last.length() == 0:
+ // Never flush after ObjectStart or ArrayStart since we don't know yet
+ // if the object or array will end up being empty.
+ return true
+ case e.tokens.last.needObjectValue():
+ // Never flush before the object value since we don't know yet
+ // if the object value will end up being empty.
+ return true
+ case e.tokens.last.needObjectName() && len(e.buf) >= 2:
+ // Never flush after the object value if it does turn out to be empty.
+ switch string(e.buf[len(e.buf)-2:]) {
+ case `ll`, `""`, `{}`, `[]`: // last two bytes of every empty value
+ return true
+ }
+ }
+ return false
+}
+
+// unwriteEmptyObjectMember unwrites the last object member if it is empty
+// and reports whether it performed an unwrite operation.
+func (e *Encoder) unwriteEmptyObjectMember(prevName *string) bool {
+ if last := e.tokens.last; !last.isObject() || !last.needObjectName() || last.length() == 0 {
+ panic("BUG: must be called on an object after writing a value")
+ }
+
+ // The flushing logic is modified to never flush a trailing empty value.
+ // The encoder never writes trailing whitespace eagerly.
+ b := e.unflushedBuffer()
+
+ // Detect whether the last value was empty.
+ var n int
+ if len(b) >= 3 {
+ switch string(b[len(b)-2:]) {
+ case "ll": // last two bytes of `null`
+ n = len(`null`)
+ case `""`:
+ // It is possible for a non-empty string to have `""` as a suffix
+ // if the second to the last quote was escaped.
+ if b[len(b)-3] == '\\' {
+ return false // e.g., `"\""` is not empty
+ }
+ n = len(`""`)
+ case `{}`:
+ n = len(`{}`)
+ case `[]`:
+ n = len(`[]`)
+ }
+ }
+ if n == 0 {
+ return false
+ }
+
+ // Unwrite the value, whitespace, colon, name, whitespace, and comma.
+ b = b[:len(b)-n]
+ b = trimSuffixWhitespace(b)
+ b = trimSuffixByte(b, ':')
+ b = trimSuffixString(b)
+ b = trimSuffixWhitespace(b)
+ b = trimSuffixByte(b, ',')
+ e.buf = b // store back truncated unflushed buffer
+
+ // Undo state changes.
+ e.tokens.last.decrement() // for object member value
+ e.tokens.last.decrement() // for object member name
+ if !e.options.AllowDuplicateNames {
+ if e.tokens.last.isActiveNamespace() {
+ e.namespaces.last().removeLast()
+ }
+ e.names.clearLast()
+ if prevName != nil {
+ e.names.copyQuotedBuffer(e.buf) // required by objectNameStack.replaceLastUnquotedName
+ e.names.replaceLastUnquotedName(*prevName)
+ }
+ }
+ return true
+}
+
+// unwriteOnlyObjectMemberName unwrites the only object member name
+// and returns the unquoted name.
+func (e *Encoder) unwriteOnlyObjectMemberName() string {
+ if last := e.tokens.last; !last.isObject() || last.length() != 1 {
+ panic("BUG: must be called on an object after writing first name")
+ }
+
+ // Unwrite the name and whitespace.
+ b := trimSuffixString(e.buf)
+ isVerbatim := bytes.IndexByte(e.buf[len(b):], '\\') < 0
+ name := string(unescapeStringMayCopy(e.buf[len(b):], isVerbatim))
+ e.buf = trimSuffixWhitespace(b)
+
+ // Undo state changes.
+ e.tokens.last.decrement()
+ if !e.options.AllowDuplicateNames {
+ if e.tokens.last.isActiveNamespace() {
+ e.namespaces.last().removeLast()
+ }
+ e.names.clearLast()
+ }
+ return name
+}
+
+func trimSuffixWhitespace(b []byte) []byte {
+ // NOTE: The arguments and logic are kept simple to keep this inlineable.
+ n := len(b) - 1
+ for n >= 0 && (b[n] == ' ' || b[n] == '\t' || b[n] == '\r' || b[n] == '\n') {
+ n--
+ }
+ return b[:n+1]
+}
+
+func trimSuffixString(b []byte) []byte {
+ // NOTE: The arguments and logic are kept simple to keep this inlineable.
+ if len(b) > 0 && b[len(b)-1] == '"' {
+ b = b[:len(b)-1]
+ }
+ for len(b) >= 2 && !(b[len(b)-1] == '"' && b[len(b)-2] != '\\') {
+ b = b[:len(b)-1] // trim all characters except an unescaped quote
+ }
+ if len(b) > 0 && b[len(b)-1] == '"' {
+ b = b[:len(b)-1]
+ }
+ return b
+}
+
+func hasSuffixByte(b []byte, c byte) bool {
+ // NOTE: The arguments and logic are kept simple to keep this inlineable.
+ return len(b) > 0 && b[len(b)-1] == c
+}
+
+func trimSuffixByte(b []byte, c byte) []byte {
+ // NOTE: The arguments and logic are kept simple to keep this inlineable.
+ if len(b) > 0 && b[len(b)-1] == c {
+ return b[:len(b)-1]
+ }
+ return b
+}
+
+// WriteToken writes the next token and advances the internal write offset.
+//
+// The provided token kind must be consistent with the JSON grammar.
+// For example, it is an error to provide a number when the encoder
+// is expecting an object name (which is always a string), or
+// to provide an end object delimiter when the encoder is finishing an array.
+// If the provided token is invalid, then it reports a SyntacticError and
+// the internal state remains unchanged.
+func (e *Encoder) WriteToken(t Token) error {
+ k := t.Kind()
+ b := e.buf // use local variable to avoid mutating e in case of error
+
+ // Append any delimiters or optional whitespace.
+ b = e.tokens.mayAppendDelim(b, k)
+ if e.options.multiline {
+ b = e.appendWhitespace(b, k)
+ }
+
+ // Append the token to the output and to the state machine.
+ var err error
+ switch k {
+ case 'n':
+ b = append(b, "null"...)
+ err = e.tokens.appendLiteral()
+ case 'f':
+ b = append(b, "false"...)
+ err = e.tokens.appendLiteral()
+ case 't':
+ b = append(b, "true"...)
+ err = e.tokens.appendLiteral()
+ case '"':
+ n0 := len(b) // offset before calling t.appendString
+ if b, err = t.appendString(b, !e.options.AllowInvalidUTF8, e.options.preserveRawStrings, e.options.EscapeRune); err != nil {
+ break
+ }
+ if !e.options.AllowDuplicateNames && e.tokens.last.needObjectName() {
+ if !e.tokens.last.isValidNamespace() {
+ err = errInvalidNamespace
+ break
+ }
+ if e.tokens.last.isActiveNamespace() && !e.namespaces.last().insertQuoted(b[n0:], false) {
+ err = &SyntacticError{str: "duplicate name " + string(b[n0:]) + " in object"}
+ break
+ }
+ e.names.replaceLastQuotedOffset(n0) // only replace if insertQuoted succeeds
+ }
+ err = e.tokens.appendString()
+ case '0':
+ if b, err = t.appendNumber(b, e.options.canonicalizeNumbers); err != nil {
+ break
+ }
+ err = e.tokens.appendNumber()
+ case '{':
+ b = append(b, '{')
+ if err = e.tokens.pushObject(); err != nil {
+ break
+ }
+ if !e.options.AllowDuplicateNames {
+ e.names.push()
+ e.namespaces.push()
+ }
+ case '}':
+ b = append(b, '}')
+ if err = e.tokens.popObject(); err != nil {
+ break
+ }
+ if !e.options.AllowDuplicateNames {
+ e.names.pop()
+ e.namespaces.pop()
+ }
+ case '[':
+ b = append(b, '[')
+ err = e.tokens.pushArray()
+ case ']':
+ b = append(b, ']')
+ err = e.tokens.popArray()
+ default:
+ return &SyntacticError{str: "invalid json.Token"}
+ }
+ if err != nil {
+ return err
+ }
+
+ // Finish off the buffer and store it back into e.
+ e.buf = b
+ if e.needFlush() {
+ return e.flush()
+ }
+ return nil
+}
+
+const (
+ rawIntNumber = -1
+ rawUintNumber = -2
+)
+
+// writeNumber is specialized version of WriteToken, but optimized for numbers.
+// As a special-case, if bits is -1 or -2, it will treat v as
+// the raw-encoded bits of an int64 or uint64, respectively.
+// It is only called from arshal_default.go.
+func (e *Encoder) writeNumber(v float64, bits int, quote bool) error {
+ b := e.buf // use local variable to avoid mutating e in case of error
+
+ // Append any delimiters or optional whitespace.
+ b = e.tokens.mayAppendDelim(b, '0')
+ if e.options.multiline {
+ b = e.appendWhitespace(b, '0')
+ }
+
+ if quote {
+ // Append the value to the output.
+ n0 := len(b) // offset before appending the number
+ b = append(b, '"')
+ switch bits {
+ case rawIntNumber:
+ b = strconv.AppendInt(b, int64(math.Float64bits(v)), 10)
+ case rawUintNumber:
+ b = strconv.AppendUint(b, uint64(math.Float64bits(v)), 10)
+ default:
+ b = appendNumber(b, v, bits)
+ }
+ b = append(b, '"')
+
+ // Escape the string if necessary.
+ if e.options.EscapeRune != nil {
+ b2 := append(e.unusedCache, b[n0+len(`"`):len(b)-len(`"`)]...)
+ b, _ = appendString(b[:n0], string(b2), false, e.options.EscapeRune)
+ e.unusedCache = b2[:0]
+ }
+
+ // Update the state machine.
+ if !e.options.AllowDuplicateNames && e.tokens.last.needObjectName() {
+ if !e.tokens.last.isValidNamespace() {
+ return errInvalidNamespace
+ }
+ if e.tokens.last.isActiveNamespace() && !e.namespaces.last().insertQuoted(b[n0:], false) {
+ return &SyntacticError{str: "duplicate name " + string(b[n0:]) + " in object"}
+ }
+ e.names.replaceLastQuotedOffset(n0) // only replace if insertQuoted succeeds
+ }
+ if err := e.tokens.appendString(); err != nil {
+ return err
+ }
+ } else {
+ switch bits {
+ case rawIntNumber:
+ b = strconv.AppendInt(b, int64(math.Float64bits(v)), 10)
+ case rawUintNumber:
+ b = strconv.AppendUint(b, uint64(math.Float64bits(v)), 10)
+ default:
+ b = appendNumber(b, v, bits)
+ }
+ if err := e.tokens.appendNumber(); err != nil {
+ return err
+ }
+ }
+
+ // Finish off the buffer and store it back into e.
+ e.buf = b
+ if e.needFlush() {
+ return e.flush()
+ }
+ return nil
+}
+
+// WriteValue writes the next raw value and advances the internal write offset.
+// The Encoder does not simply copy the provided value verbatim, but
+// parses it to ensure that it is syntactically valid and reformats it
+// according to how the Encoder is configured to format whitespace and strings.
+//
+// The provided value kind must be consistent with the JSON grammar
+// (see examples on Encoder.WriteToken). If the provided value is invalid,
+// then it reports a SyntacticError and the internal state remains unchanged.
+func (e *Encoder) WriteValue(v RawValue) error {
+ e.maxValue |= len(v) // bitwise OR is a fast approximation of max
+
+ k := v.Kind()
+ b := e.buf // use local variable to avoid mutating e in case of error
+
+ // Append any delimiters or optional whitespace.
+ b = e.tokens.mayAppendDelim(b, k)
+ if e.options.multiline {
+ b = e.appendWhitespace(b, k)
+ }
+
+ // Append the value the output.
+ var err error
+ v = v[consumeWhitespace(v):]
+ n0 := len(b) // offset before calling e.reformatValue
+ b, v, err = e.reformatValue(b, v, e.tokens.depth())
+ if err != nil {
+ return err
+ }
+ v = v[consumeWhitespace(v):]
+ if len(v) > 0 {
+ return newInvalidCharacterError(v[0:], "after top-level value")
+ }
+
+ // Append the kind to the state machine.
+ switch k {
+ case 'n', 'f', 't':
+ err = e.tokens.appendLiteral()
+ case '"':
+ if !e.options.AllowDuplicateNames && e.tokens.last.needObjectName() {
+ if !e.tokens.last.isValidNamespace() {
+ err = errInvalidNamespace
+ break
+ }
+ if e.tokens.last.isActiveNamespace() && !e.namespaces.last().insertQuoted(b[n0:], false) {
+ err = &SyntacticError{str: "duplicate name " + string(b[n0:]) + " in object"}
+ break
+ }
+ e.names.replaceLastQuotedOffset(n0) // only replace if insertQuoted succeeds
+ }
+ err = e.tokens.appendString()
+ case '0':
+ err = e.tokens.appendNumber()
+ case '{':
+ if err = e.tokens.pushObject(); err != nil {
+ break
+ }
+ if err = e.tokens.popObject(); err != nil {
+ panic("BUG: popObject should never fail immediately after pushObject: " + err.Error())
+ }
+ case '[':
+ if err = e.tokens.pushArray(); err != nil {
+ break
+ }
+ if err = e.tokens.popArray(); err != nil {
+ panic("BUG: popArray should never fail immediately after pushArray: " + err.Error())
+ }
+ }
+ if err != nil {
+ return err
+ }
+
+ // Finish off the buffer and store it back into e.
+ e.buf = b
+ if e.needFlush() {
+ return e.flush()
+ }
+ return nil
+}
+
+// appendWhitespace appends whitespace that immediately precedes the next token.
+func (e *Encoder) appendWhitespace(b []byte, next Kind) []byte {
+ if e.tokens.needDelim(next) == ':' {
+ return append(b, ' ')
+ } else {
+ return e.appendIndent(b, e.tokens.needIndent(next))
+ }
+}
+
+// appendIndent appends the appropriate number of indentation characters
+// for the current nested level, n.
+func (e *Encoder) appendIndent(b []byte, n int) []byte {
+ if n == 0 {
+ return b
+ }
+ b = append(b, '\n')
+ b = append(b, e.options.IndentPrefix...)
+ for ; n > 1; n-- {
+ b = append(b, e.options.Indent...)
+ }
+ return b
+}
+
+// reformatValue parses a JSON value from the start of src and
+// appends it to the end of dst, reformatting whitespace and strings as needed.
+// It returns the updated versions of dst and src.
+func (e *Encoder) reformatValue(dst []byte, src RawValue, depth int) ([]byte, RawValue, error) {
+ // TODO: Should this update valueFlags as input?
+ if len(src) == 0 {
+ return dst, src, io.ErrUnexpectedEOF
+ }
+ var n int
+ var err error
+ switch k := Kind(src[0]).normalize(); k {
+ case 'n':
+ if n = consumeNull(src); n == 0 {
+ n, err = consumeLiteral(src, "null")
+ }
+ case 'f':
+ if n = consumeFalse(src); n == 0 {
+ n, err = consumeLiteral(src, "false")
+ }
+ case 't':
+ if n = consumeTrue(src); n == 0 {
+ n, err = consumeLiteral(src, "true")
+ }
+ case '"':
+ if n := consumeSimpleString(src); n > 0 && e.options.EscapeRune == nil {
+ dst, src = append(dst, src[:n]...), src[n:] // copy simple strings verbatim
+ return dst, src, nil
+ }
+ return reformatString(dst, src, !e.options.AllowInvalidUTF8, e.options.preserveRawStrings, e.options.EscapeRune)
+ case '0':
+ if n := consumeSimpleNumber(src); n > 0 && !e.options.canonicalizeNumbers {
+ dst, src = append(dst, src[:n]...), src[n:] // copy simple numbers verbatim
+ return dst, src, nil
+ }
+ return reformatNumber(dst, src, e.options.canonicalizeNumbers)
+ case '{':
+ return e.reformatObject(dst, src, depth)
+ case '[':
+ return e.reformatArray(dst, src, depth)
+ default:
+ return dst, src, newInvalidCharacterError(src, "at start of value")
+ }
+ if err != nil {
+ return dst, src, err
+ }
+ dst, src = append(dst, src[:n]...), src[n:]
+ return dst, src, nil
+}
+
+// reformatObject parses a JSON object from the start of src and
+// appends it to the end of src, reformatting whitespace and strings as needed.
+// It returns the updated versions of dst and src.
+func (e *Encoder) reformatObject(dst []byte, src RawValue, depth int) ([]byte, RawValue, error) {
+ // Append object start.
+ if src[0] != '{' {
+ panic("BUG: reformatObject must be called with a buffer that starts with '{'")
+ }
+ dst, src = append(dst, '{'), src[1:]
+
+ // Append (possible) object end.
+ src = src[consumeWhitespace(src):]
+ if len(src) == 0 {
+ return dst, src, io.ErrUnexpectedEOF
+ }
+ if src[0] == '}' {
+ dst, src = append(dst, '}'), src[1:]
+ return dst, src, nil
+ }
+
+ var err error
+ var names *objectNamespace
+ if !e.options.AllowDuplicateNames {
+ e.namespaces.push()
+ defer e.namespaces.pop()
+ names = e.namespaces.last()
+ }
+ depth++
+ for {
+ // Append optional newline and indentation.
+ if e.options.multiline {
+ dst = e.appendIndent(dst, depth)
+ }
+
+ // Append object name.
+ src = src[consumeWhitespace(src):]
+ if len(src) == 0 {
+ return dst, src, io.ErrUnexpectedEOF
+ }
+ n0 := len(dst) // offset before calling reformatString
+ n := consumeSimpleString(src)
+ if n > 0 && e.options.EscapeRune == nil {
+ dst, src = append(dst, src[:n]...), src[n:] // copy simple strings verbatim
+ } else {
+ dst, src, err = reformatString(dst, src, !e.options.AllowInvalidUTF8, e.options.preserveRawStrings, e.options.EscapeRune)
+ }
+ if err != nil {
+ return dst, src, err
+ }
+ if !e.options.AllowDuplicateNames && !names.insertQuoted(dst[n0:], false) {
+ return dst, src, &SyntacticError{str: "duplicate name " + string(dst[n0:]) + " in object"}
+ }
+
+ // Append colon.
+ src = src[consumeWhitespace(src):]
+ if len(src) == 0 {
+ return dst, src, io.ErrUnexpectedEOF
+ }
+ if src[0] != ':' {
+ return dst, src, newInvalidCharacterError(src, "after object name (expecting ':')")
+ }
+ dst, src = append(dst, ':'), src[1:]
+ if e.options.multiline {
+ dst = append(dst, ' ')
+ }
+
+ // Append object value.
+ src = src[consumeWhitespace(src):]
+ if len(src) == 0 {
+ return dst, src, io.ErrUnexpectedEOF
+ }
+ dst, src, err = e.reformatValue(dst, src, depth)
+ if err != nil {
+ return dst, src, err
+ }
+
+ // Append comma or object end.
+ src = src[consumeWhitespace(src):]
+ if len(src) == 0 {
+ return dst, src, io.ErrUnexpectedEOF
+ }
+ switch src[0] {
+ case ',':
+ dst, src = append(dst, ','), src[1:]
+ continue
+ case '}':
+ if e.options.multiline {
+ dst = e.appendIndent(dst, depth-1)
+ }
+ dst, src = append(dst, '}'), src[1:]
+ return dst, src, nil
+ default:
+ return dst, src, newInvalidCharacterError(src, "after object value (expecting ',' or '}')")
+ }
+ }
+}
+
+// reformatArray parses a JSON array from the start of src and
+// appends it to the end of dst, reformatting whitespace and strings as needed.
+// It returns the updated versions of dst and src.
+func (e *Encoder) reformatArray(dst []byte, src RawValue, depth int) ([]byte, RawValue, error) {
+ // Append array start.
+ if src[0] != '[' {
+ panic("BUG: reformatArray must be called with a buffer that starts with '['")
+ }
+ dst, src = append(dst, '['), src[1:]
+
+ // Append (possible) array end.
+ src = src[consumeWhitespace(src):]
+ if len(src) == 0 {
+ return dst, src, io.ErrUnexpectedEOF
+ }
+ if src[0] == ']' {
+ dst, src = append(dst, ']'), src[1:]
+ return dst, src, nil
+ }
+
+ var err error
+ depth++
+ for {
+ // Append optional newline and indentation.
+ if e.options.multiline {
+ dst = e.appendIndent(dst, depth)
+ }
+
+ // Append array value.
+ src = src[consumeWhitespace(src):]
+ if len(src) == 0 {
+ return dst, src, io.ErrUnexpectedEOF
+ }
+ dst, src, err = e.reformatValue(dst, src, depth)
+ if err != nil {
+ return dst, src, err
+ }
+
+ // Append comma or array end.
+ src = src[consumeWhitespace(src):]
+ if len(src) == 0 {
+ return dst, src, io.ErrUnexpectedEOF
+ }
+ switch src[0] {
+ case ',':
+ dst, src = append(dst, ','), src[1:]
+ continue
+ case ']':
+ if e.options.multiline {
+ dst = e.appendIndent(dst, depth-1)
+ }
+ dst, src = append(dst, ']'), src[1:]
+ return dst, src, nil
+ default:
+ return dst, src, newInvalidCharacterError(src, "after array value (expecting ',' or ']')")
+ }
+ }
+}
+
+// OutputOffset returns the current output byte offset. It gives the location
+// of the next byte immediately after the most recently written token or value.
+// The number of bytes actually written to the underlying io.Writer may be less
+// than this offset due to internal buffering effects.
+func (e *Encoder) OutputOffset() int64 {
+ return e.previousOffsetEnd()
+}
+
+// UnusedBuffer returns a zero-length buffer with a possible non-zero capacity.
+// This buffer is intended to be used to populate a RawValue
+// being passed to an immediately succeeding WriteValue call.
+//
+// Example usage:
+//
+// b := d.UnusedBuffer()
+// b = append(b, '"')
+// b = appendString(b, v) // append the string formatting of v
+// b = append(b, '"')
+// ... := d.WriteValue(b)
+//
+// It is the user's responsibility to ensure that the value is valid JSON.
+func (e *Encoder) UnusedBuffer() []byte {
+ // NOTE: We don't return e.buf[len(e.buf):cap(e.buf)] since WriteValue would
+ // need to take special care to avoid mangling the data while reformatting.
+ // WriteValue can't easily identify whether the input RawValue aliases e.buf
+ // without using unsafe.Pointer. Thus, we just return a different buffer.
+ // Should this ever alias e.buf, we need to consider how it operates with
+ // the specialized performance optimization for bytes.Buffer.
+ n := 1 << bits.Len(uint(e.maxValue|63)) // fast approximation for max length
+ if cap(e.unusedCache) < n {
+ e.unusedCache = make([]byte, 0, n)
+ }
+ return e.unusedCache
+}
+
+// StackDepth returns the depth of the state machine for written JSON data.
+// Each level on the stack represents a nested JSON object or array.
+// It is incremented whenever an ObjectStart or ArrayStart token is encountered
+// and decremented whenever an ObjectEnd or ArrayEnd token is encountered.
+// The depth is zero-indexed, where zero represents the top-level JSON value.
+func (e *Encoder) StackDepth() int {
+ // NOTE: Keep in sync with Decoder.StackDepth.
+ return e.tokens.depth() - 1
+}
+
+// StackIndex returns information about the specified stack level.
+// It must be a number between 0 and StackDepth, inclusive.
+// For each level, it reports the kind:
+//
+// - 0 for a level of zero,
+// - '{' for a level representing a JSON object, and
+// - '[' for a level representing a JSON array.
+//
+// It also reports the length of that JSON object or array.
+// Each name and value in a JSON object is counted separately,
+// so the effective number of members would be half the length.
+// A complete JSON object must have an even length.
+func (e *Encoder) StackIndex(i int) (Kind, int) {
+ // NOTE: Keep in sync with Decoder.StackIndex.
+ switch s := e.tokens.index(i); {
+ case i > 0 && s.isObject():
+ return '{', s.length()
+ case i > 0 && s.isArray():
+ return '[', s.length()
+ default:
+ return 0, s.length()
+ }
+}
+
+// StackPointer returns a JSON Pointer (RFC 6901) to the most recently written value.
+// Object names are only present if AllowDuplicateNames is false, otherwise
+// object members are represented using their index within the object.
+func (e *Encoder) StackPointer() string {
+ e.names.copyQuotedBuffer(e.buf)
+ return string(e.appendStackPointer(nil))
+}
+
+// appendString appends src to dst as a JSON string per RFC 7159, section 7.
+//
+// If validateUTF8 is specified, this rejects input that contains invalid UTF-8
+// otherwise invalid bytes are replaced with the Unicode replacement character.
+// If escapeRune is provided, it specifies which runes to escape using
+// hexadecimal sequences. If nil, the shortest representable form is used,
+// which is also the canonical form for strings (RFC 8785, section 3.2.2.2).
+//
+// Note that this API allows full control over the formatting of strings
+// except for whether a forward solidus '/' may be formatted as '\/' and
+// the casing of hexadecimal Unicode escape sequences.
+func appendString(dst []byte, src string, validateUTF8 bool, escapeRune func(rune) bool) ([]byte, error) {
+ appendEscapedASCII := func(dst []byte, c byte) []byte {
+ switch c {
+ case '"', '\\':
+ dst = append(dst, '\\', c)
+ case '\b':
+ dst = append(dst, "\\b"...)
+ case '\f':
+ dst = append(dst, "\\f"...)
+ case '\n':
+ dst = append(dst, "\\n"...)
+ case '\r':
+ dst = append(dst, "\\r"...)
+ case '\t':
+ dst = append(dst, "\\t"...)
+ default:
+ dst = append(dst, "\\u"...)
+ dst = appendHexUint16(dst, uint16(c))
+ }
+ return dst
+ }
+ appendEscapedUnicode := func(dst []byte, r rune) []byte {
+ if r1, r2 := utf16.EncodeRune(r); r1 != '\ufffd' && r2 != '\ufffd' {
+ dst = append(dst, "\\u"...)
+ dst = appendHexUint16(dst, uint16(r1))
+ dst = append(dst, "\\u"...)
+ dst = appendHexUint16(dst, uint16(r2))
+ } else {
+ dst = append(dst, "\\u"...)
+ dst = appendHexUint16(dst, uint16(r))
+ }
+ return dst
+ }
+
+ // Optimize for when escapeRune is nil.
+ if escapeRune == nil {
+ var i, n int
+ dst = append(dst, '"')
+ for uint(len(src)) > uint(n) {
+ // Handle single-byte ASCII.
+ if c := src[n]; c < utf8.RuneSelf {
+ n++
+ if c < ' ' || c == '"' || c == '\\' {
+ dst = append(dst, src[i:n-1]...)
+ dst = appendEscapedASCII(dst, c)
+ i = n
+ }
+ continue
+ }
+
+ // Handle multi-byte Unicode.
+ _, rn := utf8.DecodeRuneInString(src[n:])
+ n += rn
+ if rn == 1 { // must be utf8.RuneError since we already checked for single-byte ASCII
+ dst = append(dst, src[i:n-rn]...)
+ if validateUTF8 {
+ return dst, &SyntacticError{str: "invalid UTF-8 within string"}
+ }
+ dst = append(dst, "\ufffd"...)
+ i = n
+ }
+ }
+ dst = append(dst, src[i:n]...)
+ dst = append(dst, '"')
+ return dst, nil
+ }
+
+ // Slower implementation for when escapeRune is non-nil.
+ var i, n int
+ dst = append(dst, '"')
+ for uint(len(src)) > uint(n) {
+ switch r, rn := utf8.DecodeRuneInString(src[n:]); {
+ case r == utf8.RuneError && rn == 1:
+ dst = append(dst, src[i:n]...)
+ if validateUTF8 {
+ return dst, &SyntacticError{str: "invalid UTF-8 within string"}
+ }
+ if escapeRune('\ufffd') {
+ dst = append(dst, `\ufffd`...)
+ } else {
+ dst = append(dst, "\ufffd"...)
+ }
+ n += rn
+ i = n
+ case escapeRune(r):
+ dst = append(dst, src[i:n]...)
+ dst = appendEscapedUnicode(dst, r)
+ n += rn
+ i = n
+ case r < ' ' || r == '"' || r == '\\':
+ dst = append(dst, src[i:n]...)
+ dst = appendEscapedASCII(dst, byte(r))
+ n += rn
+ i = n
+ default:
+ n += rn
+ }
+ }
+ dst = append(dst, src[i:n]...)
+ dst = append(dst, '"')
+ return dst, nil
+}
+
+// reformatString consumes a JSON string from src and appends it to dst,
+// reformatting it if necessary for the given escapeRune parameter.
+// It returns the appended output and the remainder of the input.
+func reformatString(dst, src []byte, validateUTF8, preserveRaw bool, escapeRune func(rune) bool) ([]byte, []byte, error) {
+ // TODO: Should this update valueFlags as input?
+ var flags valueFlags
+ n, err := consumeString(&flags, src, validateUTF8)
+ if err != nil {
+ return dst, src[n:], err
+ }
+ if preserveRaw || (escapeRune == nil && flags.isCanonical()) {
+ dst = append(dst, src[:n]...) // copy the string verbatim
+ return dst, src[n:], nil
+ }
+
+ // TODO: Implement a direct, raw-to-raw reformat for strings.
+ // If the escapeRune option would have resulted in no changes to the output,
+ // it would be faster to simply append src to dst without going through
+ // an intermediary representation in a separate buffer.
+ b, _ := unescapeString(make([]byte, 0, n), src[:n])
+ dst, _ = appendString(dst, string(b), validateUTF8, escapeRune)
+ return dst, src[n:], nil
+}
+
+// appendNumber appends src to dst as a JSON number per RFC 7159, section 6.
+// It formats numbers similar to the ES6 number-to-string conversion.
+// See https://go.dev/issue/14135.
+//
+// The output is identical to ECMA-262, 6th edition, section 7.1.12.1 and with
+// RFC 8785, section 3.2.2.3 for 64-bit floating-point numbers except for -0,
+// which is formatted as -0 instead of just 0.
+//
+// For 32-bit floating-point numbers,
+// the output is a 32-bit equivalent of the algorithm.
+// Note that ECMA-262 specifies no algorithm for 32-bit numbers.
+func appendNumber(dst []byte, src float64, bits int) []byte {
+ if bits == 32 {
+ src = float64(float32(src))
+ }
+
+ abs := math.Abs(src)
+ fmt := byte('f')
+ if abs != 0 {
+ if bits == 64 && (float64(abs) < 1e-6 || float64(abs) >= 1e21) ||
+ bits == 32 && (float32(abs) < 1e-6 || float32(abs) >= 1e21) {
+ fmt = 'e'
+ }
+ }
+ dst = strconv.AppendFloat(dst, src, fmt, -1, bits)
+ if fmt == 'e' {
+ // Clean up e-09 to e-9.
+ n := len(dst)
+ if n >= 4 && dst[n-4] == 'e' && dst[n-3] == '-' && dst[n-2] == '0' {
+ dst[n-2] = dst[n-1]
+ dst = dst[:n-1]
+ }
+ }
+ return dst
+}
+
+// reformatNumber consumes a JSON string from src and appends it to dst,
+// canonicalizing it if specified.
+// It returns the appended output and the remainder of the input.
+func reformatNumber(dst, src []byte, canonicalize bool) ([]byte, []byte, error) {
+ n, err := consumeNumber(src)
+ if err != nil {
+ return dst, src[n:], err
+ }
+ if !canonicalize {
+ dst = append(dst, src[:n]...) // copy the number verbatim
+ return dst, src[n:], nil
+ }
+
+ // Canonicalize the number per RFC 8785, section 3.2.2.3.
+ // As an optimization, we can copy integer numbers below 2⁵³ verbatim.
+ const maxExactIntegerDigits = 16 // len(strconv.AppendUint(nil, 1<<53, 10))
+ if n < maxExactIntegerDigits && consumeSimpleNumber(src[:n]) == n {
+ dst = append(dst, src[:n]...) // copy the number verbatim
+ return dst, src[n:], nil
+ }
+ fv, _ := strconv.ParseFloat(string(src[:n]), 64)
+ switch {
+ case fv == 0:
+ fv = 0 // normalize negative zero as just zero
+ case math.IsInf(fv, +1):
+ fv = +math.MaxFloat64
+ case math.IsInf(fv, -1):
+ fv = -math.MaxFloat64
+ }
+ return appendNumber(dst, fv, 64), src[n:], nil
+}
+
+// appendHexUint16 appends src to dst as a 4-byte hexadecimal number.
+func appendHexUint16(dst []byte, src uint16) []byte {
+ dst = append(dst, "0000"[1+(bits.Len16(src)-1)/4:]...)
+ dst = strconv.AppendUint(dst, uint64(src), 16)
+ return dst
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/errors.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/errors.go
new file mode 100644
index 000000000..35be8601e
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/errors.go
@@ -0,0 +1,183 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package json
+
+import (
+ "errors"
+ "reflect"
+ "strconv"
+ "strings"
+ "unicode/utf8"
+)
+
+const errorPrefix = "json: "
+
+// Error matches errors returned by this package according to errors.Is.
+const Error = jsonError("json error")
+
+type jsonError string
+
+func (e jsonError) Error() string {
+ return string(e)
+}
+func (e jsonError) Is(target error) bool {
+ return e == target || target == Error
+}
+
+type ioError struct {
+ action string // either "read" or "write"
+ err error
+}
+
+func (e *ioError) Error() string {
+ return errorPrefix + e.action + " error: " + e.err.Error()
+}
+func (e *ioError) Unwrap() error {
+ return e.err
+}
+func (e *ioError) Is(target error) bool {
+ return e == target || target == Error || errors.Is(e.err, target)
+}
+
+// SemanticError describes an error determining the meaning
+// of JSON data as Go data or vice-versa.
+//
+// The contents of this error as produced by this package may change over time.
+type SemanticError struct {
+ requireKeyedLiterals
+ nonComparable
+
+ action string // either "marshal" or "unmarshal"
+
+ // ByteOffset indicates that an error occurred after this byte offset.
+ ByteOffset int64
+ // JSONPointer indicates that an error occurred within this JSON value
+ // as indicated using the JSON Pointer notation (see RFC 6901).
+ JSONPointer string
+
+ // JSONKind is the JSON kind that could not be handled.
+ JSONKind Kind // may be zero if unknown
+ // GoType is the Go type that could not be handled.
+ GoType reflect.Type // may be nil if unknown
+
+ // Err is the underlying error.
+ Err error // may be nil
+}
+
+func (e *SemanticError) Error() string {
+ var sb strings.Builder
+ sb.WriteString(errorPrefix)
+
+ // Hyrum-proof the error message by deliberately switching between
+ // two equivalent renderings of the same error message.
+ // The randomization is tied to the Hyrum-proofing already applied
+ // on map iteration in Go.
+ for phrase := range map[string]struct{}{"cannot": {}, "unable to": {}} {
+ sb.WriteString(phrase)
+ break // use whichever phrase we get in the first iteration
+ }
+
+ // Format action.
+ var preposition string
+ switch e.action {
+ case "marshal":
+ sb.WriteString(" marshal")
+ preposition = " from"
+ case "unmarshal":
+ sb.WriteString(" unmarshal")
+ preposition = " into"
+ default:
+ sb.WriteString(" handle")
+ preposition = " with"
+ }
+
+ // Format JSON kind.
+ var omitPreposition bool
+ switch e.JSONKind {
+ case 'n':
+ sb.WriteString(" JSON null")
+ case 'f', 't':
+ sb.WriteString(" JSON boolean")
+ case '"':
+ sb.WriteString(" JSON string")
+ case '0':
+ sb.WriteString(" JSON number")
+ case '{', '}':
+ sb.WriteString(" JSON object")
+ case '[', ']':
+ sb.WriteString(" JSON array")
+ default:
+ omitPreposition = true
+ }
+
+ // Format Go type.
+ if e.GoType != nil {
+ if !omitPreposition {
+ sb.WriteString(preposition)
+ }
+ sb.WriteString(" Go value of type ")
+ sb.WriteString(e.GoType.String())
+ }
+
+ // Format where.
+ switch {
+ case e.JSONPointer != "":
+ sb.WriteString(" within JSON value at ")
+ sb.WriteString(strconv.Quote(e.JSONPointer))
+ case e.ByteOffset > 0:
+ sb.WriteString(" after byte offset ")
+ sb.WriteString(strconv.FormatInt(e.ByteOffset, 10))
+ }
+
+ // Format underlying error.
+ if e.Err != nil {
+ sb.WriteString(": ")
+ sb.WriteString(e.Err.Error())
+ }
+
+ return sb.String()
+}
+func (e *SemanticError) Is(target error) bool {
+ return e == target || target == Error || errors.Is(e.Err, target)
+}
+func (e *SemanticError) Unwrap() error {
+ return e.Err
+}
+
+// SyntacticError is a description of a syntactic error that occurred when
+// encoding or decoding JSON according to the grammar.
+//
+// The contents of this error as produced by this package may change over time.
+type SyntacticError struct {
+ requireKeyedLiterals
+ nonComparable
+
+ // ByteOffset indicates that an error occurred after this byte offset.
+ ByteOffset int64
+ str string
+}
+
+func (e *SyntacticError) Error() string {
+ return errorPrefix + e.str
+}
+func (e *SyntacticError) Is(target error) bool {
+ return e == target || target == Error
+}
+func (e *SyntacticError) withOffset(pos int64) error {
+ return &SyntacticError{ByteOffset: pos, str: e.str}
+}
+
+func newInvalidCharacterError(prefix []byte, where string) *SyntacticError {
+ what := quoteRune(prefix)
+ return &SyntacticError{str: "invalid character " + what + " " + where}
+}
+
+func quoteRune(b []byte) string {
+ r, n := utf8.DecodeRune(b)
+ if r == utf8.RuneError && n == 1 {
+ return `'\x` + strconv.FormatUint(uint64(b[0]), 16) + `'`
+ }
+ return strconv.QuoteRune(r)
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/fields.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/fields.go
new file mode 100644
index 000000000..c0ee36166
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/fields.go
@@ -0,0 +1,509 @@
+// Copyright 2021 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package json
+
+import (
+ "errors"
+ "fmt"
+ "io"
+ "reflect"
+ "sort"
+ "strconv"
+ "strings"
+ "unicode"
+ "unicode/utf8"
+)
+
+var errIgnoredField = errors.New("ignored field")
+
+type isZeroer interface {
+ IsZero() bool
+}
+
+var isZeroerType = reflect.TypeOf((*isZeroer)(nil)).Elem()
+
+type structFields struct {
+ flattened []structField // listed in depth-first ordering
+ byActualName map[string]*structField
+ byFoldedName map[string][]*structField
+ inlinedFallback *structField
+}
+
+type structField struct {
+ id int // unique numeric ID in breadth-first ordering
+ index []int // index into a struct according to reflect.Type.FieldByIndex
+ typ reflect.Type
+ fncs *arshaler
+ isZero func(addressableValue) bool
+ isEmpty func(addressableValue) bool
+ fieldOptions
+}
+
+func makeStructFields(root reflect.Type) (structFields, *SemanticError) {
+ var fs structFields
+ fs.byActualName = make(map[string]*structField, root.NumField())
+ fs.byFoldedName = make(map[string][]*structField, root.NumField())
+
+ // ambiguous is a sentinel value to indicate that at least two fields
+ // at the same depth have the same name, and thus cancel each other out.
+ // This follows the same rules as selecting a field on embedded structs
+ // where the shallowest field takes precedence. If more than one field
+ // exists at the shallowest depth, then the selection is illegal.
+ // See https://go.dev/ref/spec#Selectors.
+ ambiguous := new(structField)
+
+ // Setup a queue for a breath-first search.
+ var queueIndex int
+ type queueEntry struct {
+ typ reflect.Type
+ index []int
+ visitChildren bool // whether to recursively visit inlined field in this struct
+ }
+ queue := []queueEntry{{root, nil, true}}
+ seen := map[reflect.Type]bool{root: true}
+
+ // Perform a breadth-first search over all reachable fields.
+ // This ensures that len(f.index) will be monotonically increasing.
+ for queueIndex < len(queue) {
+ qe := queue[queueIndex]
+ queueIndex++
+
+ t := qe.typ
+ inlinedFallbackIndex := -1 // index of last inlined fallback field in current struct
+ namesIndex := make(map[string]int) // index of each field with a given JSON object name in current struct
+ var hasAnyJSONTag bool // whether any Go struct field has a `json` tag
+ var hasAnyJSONField bool // whether any JSON serializable fields exist in current struct
+ for i := 0; i < t.NumField(); i++ {
+ sf := t.Field(i)
+ _, hasTag := sf.Tag.Lookup("json")
+ hasAnyJSONTag = hasAnyJSONTag || hasTag
+ options, err := parseFieldOptions(sf)
+ if err != nil {
+ if err == errIgnoredField {
+ continue
+ }
+ return structFields{}, &SemanticError{GoType: t, Err: err}
+ }
+ hasAnyJSONField = true
+ f := structField{
+ // Allocate a new slice (len=N+1) to hold both
+ // the parent index (len=N) and the current index (len=1).
+ // Do this to avoid clobbering the memory of the parent index.
+ index: append(append(make([]int, 0, len(qe.index)+1), qe.index...), i),
+ typ: sf.Type,
+ fieldOptions: options,
+ }
+ if sf.Anonymous && !f.hasName {
+ f.inline = true // implied by use of Go embedding without an explicit name
+ }
+ if f.inline || f.unknown {
+ // Handle an inlined field that serializes to/from
+ // zero or more JSON object members.
+
+ if f.inline && f.unknown {
+ err := fmt.Errorf("Go struct field %s cannot have both `inline` and `unknown` specified", sf.Name)
+ return structFields{}, &SemanticError{GoType: t, Err: err}
+ }
+ switch f.fieldOptions {
+ case fieldOptions{name: f.name, quotedName: f.quotedName, inline: true}:
+ case fieldOptions{name: f.name, quotedName: f.quotedName, unknown: true}:
+ default:
+ err := fmt.Errorf("Go struct field %s cannot have any options other than `inline` or `unknown` specified", sf.Name)
+ return structFields{}, &SemanticError{GoType: t, Err: err}
+ }
+
+ // Unwrap one level of pointer indirection similar to how Go
+ // only allows embedding either T or *T, but not **T.
+ tf := f.typ
+ if tf.Kind() == reflect.Pointer && tf.Name() == "" {
+ tf = tf.Elem()
+ }
+ // Reject any types with custom serialization otherwise
+ // it becomes impossible to know what sub-fields to inline.
+ if which, _ := implementsWhich(tf,
+ jsonMarshalerV2Type, jsonMarshalerV1Type, textMarshalerType,
+ jsonUnmarshalerV2Type, jsonUnmarshalerV1Type, textUnmarshalerType,
+ ); which != nil && tf != rawValueType {
+ err := fmt.Errorf("inlined Go struct field %s of type %s must not implement JSON marshal or unmarshal methods", sf.Name, tf)
+ return structFields{}, &SemanticError{GoType: t, Err: err}
+ }
+
+ // Handle an inlined field that serializes to/from
+ // a finite number of JSON object members backed by a Go struct.
+ if tf.Kind() == reflect.Struct {
+ if f.unknown {
+ err := fmt.Errorf("inlined Go struct field %s of type %s with `unknown` tag must be a Go map of string key or a json.RawValue", sf.Name, tf)
+ return structFields{}, &SemanticError{GoType: t, Err: err}
+ }
+ if qe.visitChildren {
+ queue = append(queue, queueEntry{tf, f.index, !seen[tf]})
+ }
+ seen[tf] = true
+ continue
+ }
+
+ // Handle an inlined field that serializes to/from any number of
+ // JSON object members back by a Go map or RawValue.
+ switch {
+ case tf == rawValueType:
+ f.fncs = nil // specially handled in arshal_inlined.go
+ case tf.Kind() == reflect.Map && tf.Key() == stringType:
+ f.fncs = lookupArshaler(tf.Elem())
+ default:
+ err := fmt.Errorf("inlined Go struct field %s of type %s must be a Go struct, Go map of string key, or json.RawValue", sf.Name, tf)
+ return structFields{}, &SemanticError{GoType: t, Err: err}
+ }
+
+ // Reject multiple inlined fallback fields within the same struct.
+ if inlinedFallbackIndex >= 0 {
+ err := fmt.Errorf("inlined Go struct fields %s and %s cannot both be a Go map or json.RawValue", t.Field(inlinedFallbackIndex).Name, sf.Name)
+ return structFields{}, &SemanticError{GoType: t, Err: err}
+ }
+ inlinedFallbackIndex = i
+
+ // Multiple inlined fallback fields across different structs
+ // follow the same precedence rules as Go struct embedding.
+ if fs.inlinedFallback == nil {
+ fs.inlinedFallback = &f // store first occurrence at lowest depth
+ } else if len(fs.inlinedFallback.index) == len(f.index) {
+ fs.inlinedFallback = ambiguous // at least two occurrences at same depth
+ }
+ } else {
+ // Handle normal Go struct field that serializes to/from
+ // a single JSON object member.
+
+ // Provide a function that uses a type's IsZero method.
+ switch {
+ case sf.Type.Kind() == reflect.Interface && sf.Type.Implements(isZeroerType):
+ f.isZero = func(va addressableValue) bool {
+ // Avoid panics calling IsZero on a nil interface or
+ // non-nil interface with nil pointer.
+ return va.IsNil() || (va.Elem().Kind() == reflect.Pointer && va.Elem().IsNil()) || va.Interface().(isZeroer).IsZero()
+ }
+ case sf.Type.Kind() == reflect.Pointer && sf.Type.Implements(isZeroerType):
+ f.isZero = func(va addressableValue) bool {
+ // Avoid panics calling IsZero on nil pointer.
+ return va.IsNil() || va.Interface().(isZeroer).IsZero()
+ }
+ case sf.Type.Implements(isZeroerType):
+ f.isZero = func(va addressableValue) bool { return va.Interface().(isZeroer).IsZero() }
+ case reflect.PointerTo(sf.Type).Implements(isZeroerType):
+ f.isZero = func(va addressableValue) bool { return va.Addr().Interface().(isZeroer).IsZero() }
+ }
+
+ // Provide a function that can determine whether the value would
+ // serialize as an empty JSON value.
+ switch sf.Type.Kind() {
+ case reflect.String, reflect.Map, reflect.Array, reflect.Slice:
+ f.isEmpty = func(va addressableValue) bool { return va.Len() == 0 }
+ case reflect.Pointer, reflect.Interface:
+ f.isEmpty = func(va addressableValue) bool { return va.IsNil() }
+ }
+
+ f.id = len(fs.flattened)
+ f.fncs = lookupArshaler(sf.Type)
+ fs.flattened = append(fs.flattened, f)
+
+ // Reject user-specified names with invalid UTF-8.
+ if !utf8.ValidString(f.name) {
+ err := fmt.Errorf("Go struct field %s has JSON object name %q with invalid UTF-8", sf.Name, f.name)
+ return structFields{}, &SemanticError{GoType: t, Err: err}
+ }
+ // Reject multiple fields with same name within the same struct.
+ if j, ok := namesIndex[f.name]; ok {
+ err := fmt.Errorf("Go struct fields %s and %s conflict over JSON object name %q", t.Field(j).Name, sf.Name, f.name)
+ return structFields{}, &SemanticError{GoType: t, Err: err}
+ }
+ namesIndex[f.name] = i
+
+ // Multiple fields of the same name across different structs
+ // follow the same precedence rules as Go struct embedding.
+ if f2 := fs.byActualName[f.name]; f2 == nil {
+ fs.byActualName[f.name] = &fs.flattened[len(fs.flattened)-1] // store first occurrence at lowest depth
+ } else if len(f2.index) == len(f.index) {
+ fs.byActualName[f.name] = ambiguous // at least two occurrences at same depth
+ }
+ }
+ }
+
+ // NOTE: New users to the json package are occasionally surprised that
+ // unexported fields are ignored. This occurs by necessity due to our
+ // inability to directly introspect such fields with Go reflection
+ // without the use of unsafe.
+ //
+ // To reduce friction here, refuse to serialize any Go struct that
+ // has no JSON serializable fields, has at least one Go struct field,
+ // and does not have any `json` tags present. For example,
+ // errors returned by errors.New would fail to serialize.
+ isEmptyStruct := t.NumField() == 0
+ if !isEmptyStruct && !hasAnyJSONTag && !hasAnyJSONField {
+ err := errors.New("Go struct has no exported fields")
+ return structFields{}, &SemanticError{GoType: t, Err: err}
+ }
+ }
+
+ // Remove all fields that are duplicates.
+ // This may move elements forward to fill the holes from removed fields.
+ var n int
+ for _, f := range fs.flattened {
+ switch f2 := fs.byActualName[f.name]; {
+ case f2 == ambiguous:
+ delete(fs.byActualName, f.name)
+ case f2 == nil:
+ continue // may be nil due to previous delete
+ // TODO(https://go.dev/issue/45955): Use slices.Equal.
+ case reflect.DeepEqual(f.index, f2.index):
+ f.id = n
+ fs.flattened[n] = f
+ fs.byActualName[f.name] = &fs.flattened[n] // fix pointer to new location
+ n++
+ }
+ }
+ fs.flattened = fs.flattened[:n]
+ if fs.inlinedFallback == ambiguous {
+ fs.inlinedFallback = nil
+ }
+ if len(fs.flattened) != len(fs.byActualName) {
+ panic(fmt.Sprintf("BUG: flattened list of fields mismatches fields mapped by name: %d != %d", len(fs.flattened), len(fs.byActualName)))
+ }
+
+ // Sort the fields according to a depth-first ordering.
+ // This operation will cause pointers in byActualName to become incorrect,
+ // which we will correct in another loop shortly thereafter.
+ sort.Slice(fs.flattened, func(i, j int) bool {
+ si := fs.flattened[i].index
+ sj := fs.flattened[j].index
+ for len(si) > 0 && len(sj) > 0 {
+ switch {
+ case si[0] < sj[0]:
+ return true
+ case si[0] > sj[0]:
+ return false
+ default:
+ si = si[1:]
+ sj = sj[1:]
+ }
+ }
+ return len(si) < len(sj)
+ })
+
+ // Recompute the mapping of fields in the byActualName map.
+ // Pre-fold all names so that we can lookup folded names quickly.
+ for i, f := range fs.flattened {
+ foldedName := string(foldName([]byte(f.name)))
+ fs.byActualName[f.name] = &fs.flattened[i]
+ fs.byFoldedName[foldedName] = append(fs.byFoldedName[foldedName], &fs.flattened[i])
+ }
+ for foldedName, fields := range fs.byFoldedName {
+ if len(fields) > 1 {
+ // The precedence order for conflicting nocase names
+ // is by breadth-first order, rather than depth-first order.
+ sort.Slice(fields, func(i, j int) bool {
+ return fields[i].id < fields[j].id
+ })
+ fs.byFoldedName[foldedName] = fields
+ }
+ }
+
+ return fs, nil
+}
+
+type fieldOptions struct {
+ name string
+ quotedName string // quoted name per RFC 8785, section 3.2.2.2.
+ hasName bool
+ nocase bool
+ inline bool
+ unknown bool
+ omitzero bool
+ omitempty bool
+ string bool
+ format string
+}
+
+// parseFieldOptions parses the `json` tag in a Go struct field as
+// a structured set of options configuring parameters such as
+// the JSON member name and other features.
+// As a special case, it returns errIgnoredField if the field is ignored.
+func parseFieldOptions(sf reflect.StructField) (out fieldOptions, err error) {
+ tag, hasTag := sf.Tag.Lookup("json")
+
+ // Check whether this field is explicitly ignored.
+ if tag == "-" {
+ return fieldOptions{}, errIgnoredField
+ }
+
+ // Check whether this field is unexported.
+ if !sf.IsExported() {
+ // In contrast to v1, v2 no longer forwards exported fields from
+ // embedded fields of unexported types since Go reflection does not
+ // allow the same set of operations that are available in normal cases
+ // of purely exported fields.
+ // See https://go.dev/issue/21357 and https://go.dev/issue/24153.
+ if sf.Anonymous {
+ return fieldOptions{}, fmt.Errorf("embedded Go struct field %s of an unexported type must be explicitly ignored with a `json:\"-\"` tag", sf.Type.Name())
+ }
+ // Tag options specified on an unexported field suggests user error.
+ if hasTag {
+ return fieldOptions{}, fmt.Errorf("unexported Go struct field %s cannot have non-ignored `json:%q` tag", sf.Name, tag)
+ }
+ return fieldOptions{}, errIgnoredField
+ }
+
+ // Determine the JSON member name for this Go field. A user-specified name
+ // may be provided as either an identifier or a single-quoted string.
+ // The single-quoted string allows arbitrary characters in the name.
+ // See https://go.dev/issue/2718 and https://go.dev/issue/3546.
+ out.name = sf.Name // always starts with an uppercase character
+ if len(tag) > 0 && !strings.HasPrefix(tag, ",") {
+ // For better compatibility with v1, accept almost any unescaped name.
+ n := len(tag) - len(strings.TrimLeftFunc(tag, func(r rune) bool {
+ return !strings.ContainsRune(",\\'\"`", r) // reserve comma, backslash, and quotes
+ }))
+ opt := tag[:n]
+ if n == 0 {
+ // Allow a single quoted string for arbitrary names.
+ opt, n, err = consumeTagOption(tag)
+ if err != nil {
+ return fieldOptions{}, fmt.Errorf("Go struct field %s has malformed `json` tag: %v", sf.Name, err)
+ }
+ }
+ out.hasName = true
+ out.name = opt
+ tag = tag[n:]
+ }
+ b, _ := appendString(nil, out.name, false, nil)
+ out.quotedName = string(b)
+
+ // Handle any additional tag options (if any).
+ var wasFormat bool
+ seenOpts := make(map[string]bool)
+ for len(tag) > 0 {
+ // Consume comma delimiter.
+ if tag[0] != ',' {
+ return fieldOptions{}, fmt.Errorf("Go struct field %s has malformed `json` tag: invalid character %q before next option (expecting ',')", sf.Name, tag[0])
+ }
+ tag = tag[len(","):]
+ if len(tag) == 0 {
+ return fieldOptions{}, fmt.Errorf("Go struct field %s has malformed `json` tag: invalid trailing ',' character", sf.Name)
+ }
+
+ // Consume and process the tag option.
+ opt, n, err := consumeTagOption(tag)
+ if err != nil {
+ return fieldOptions{}, fmt.Errorf("Go struct field %s has malformed `json` tag: %v", sf.Name, err)
+ }
+ rawOpt := tag[:n]
+ tag = tag[n:]
+ switch {
+ case wasFormat:
+ return fieldOptions{}, fmt.Errorf("Go struct field %s has `format` tag option that was not specified last", sf.Name)
+ case strings.HasPrefix(rawOpt, "'") && strings.TrimFunc(opt, isLetterOrDigit) == "":
+ return fieldOptions{}, fmt.Errorf("Go struct field %s has unnecessarily quoted appearance of `%s` tag option; specify `%s` instead", sf.Name, rawOpt, opt)
+ }
+ switch opt {
+ case "nocase":
+ out.nocase = true
+ case "inline":
+ out.inline = true
+ case "unknown":
+ out.unknown = true
+ case "omitzero":
+ out.omitzero = true
+ case "omitempty":
+ out.omitempty = true
+ case "string":
+ out.string = true
+ case "format":
+ if !strings.HasPrefix(tag, ":") {
+ return fieldOptions{}, fmt.Errorf("Go struct field %s is missing value for `format` tag option", sf.Name)
+ }
+ tag = tag[len(":"):]
+ opt, n, err := consumeTagOption(tag)
+ if err != nil {
+ return fieldOptions{}, fmt.Errorf("Go struct field %s has malformed value for `format` tag option: %v", sf.Name, err)
+ }
+ tag = tag[n:]
+ out.format = opt
+ wasFormat = true
+ default:
+ // Reject keys that resemble one of the supported options.
+ // This catches invalid mutants such as "omitEmpty" or "omit_empty".
+ normOpt := strings.ReplaceAll(strings.ToLower(opt), "_", "")
+ switch normOpt {
+ case "nocase", "inline", "unknown", "omitzero", "omitempty", "string", "format":
+ return fieldOptions{}, fmt.Errorf("Go struct field %s has invalid appearance of `%s` tag option; specify `%s` instead", sf.Name, opt, normOpt)
+ }
+
+ // NOTE: Everything else is ignored. This does not mean it is
+ // forward compatible to insert arbitrary tag options since
+ // a future version of this package may understand that tag.
+ }
+
+ // Reject duplicates.
+ if seenOpts[opt] {
+ return fieldOptions{}, fmt.Errorf("Go struct field %s has duplicate appearance of `%s` tag option", sf.Name, rawOpt)
+ }
+ seenOpts[opt] = true
+ }
+ return out, nil
+}
+
+func consumeTagOption(in string) (string, int, error) {
+ switch r, _ := utf8.DecodeRuneInString(in); {
+ // Option as a Go identifier.
+ case r == '_' || unicode.IsLetter(r):
+ n := len(in) - len(strings.TrimLeftFunc(in, isLetterOrDigit))
+ return in[:n], n, nil
+ // Option as a single-quoted string.
+ case r == '\'':
+ // The grammar is nearly identical to a double-quoted Go string literal,
+ // but uses single quotes as the terminators. The reason for a custom
+ // grammar is because both backtick and double quotes cannot be used
+ // verbatim in a struct tag.
+ //
+ // Convert a single-quoted string to a double-quote string and rely on
+ // strconv.Unquote to handle the rest.
+ var inEscape bool
+ b := []byte{'"'}
+ n := len(`'`)
+ for len(in) > n {
+ r, rn := utf8.DecodeRuneInString(in[n:])
+ switch {
+ case inEscape:
+ if r == '\'' {
+ b = b[:len(b)-1] // remove escape character: `\'` => `'`
+ }
+ inEscape = false
+ case r == '\\':
+ inEscape = true
+ case r == '"':
+ b = append(b, '\\') // insert escape character: `"` => `\"`
+ case r == '\'':
+ b = append(b, '"')
+ n += len(`'`)
+ out, err := strconv.Unquote(string(b))
+ if err != nil {
+ return "", 0, fmt.Errorf("invalid single-quoted string: %s", in[:n])
+ }
+ return out, n, nil
+ }
+ b = append(b, in[n:][:rn]...)
+ n += rn
+ }
+ if n > 10 {
+ n = 10 // limit the amount of context printed in the error
+ }
+ return "", 0, fmt.Errorf("single-quoted string not terminated: %s...", in[:n])
+ case len(in) == 0:
+ return "", 0, io.ErrUnexpectedEOF
+ default:
+ return "", 0, fmt.Errorf("invalid character %q at start of option (expecting Unicode letter or single quote)", r)
+ }
+}
+
+func isLetterOrDigit(r rune) bool {
+ return r == '_' || unicode.IsLetter(r) || unicode.IsNumber(r)
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/fold.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/fold.go
new file mode 100644
index 000000000..9ab735814
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/fold.go
@@ -0,0 +1,56 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package json
+
+import (
+ "unicode"
+ "unicode/utf8"
+)
+
+// foldName returns a folded string such that foldName(x) == foldName(y)
+// is similar to strings.EqualFold(x, y), but ignores underscore and dashes.
+// This allows foldName to match common naming conventions.
+func foldName(in []byte) []byte {
+ // This is inlinable to take advantage of "function outlining".
+ // See https://blog.filippo.io/efficient-go-apis-with-the-inliner/
+ var arr [32]byte // large enough for most JSON names
+ return appendFoldedName(arr[:0], in)
+}
+func appendFoldedName(out, in []byte) []byte {
+ for i := 0; i < len(in); {
+ // Handle single-byte ASCII.
+ if c := in[i]; c < utf8.RuneSelf {
+ if c != '_' && c != '-' {
+ if 'a' <= c && c <= 'z' {
+ c -= 'a' - 'A'
+ }
+ out = append(out, c)
+ }
+ i++
+ continue
+ }
+ // Handle multi-byte Unicode.
+ r, n := utf8.DecodeRune(in[i:])
+ out = utf8.AppendRune(out, foldRune(r))
+ i += n
+ }
+ return out
+}
+
+// foldRune is a variation on unicode.SimpleFold that returns the same rune
+// for all runes in the same fold set.
+//
+// Invariant:
+//
+// foldRune(x) == foldRune(y) ⇔ strings.EqualFold(string(x), string(y))
+func foldRune(r rune) rune {
+ for {
+ r2 := unicode.SimpleFold(r)
+ if r2 <= r {
+ return r2 // smallest character in the fold set
+ }
+ r = r2
+ }
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/intern.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/intern.go
new file mode 100644
index 000000000..700a56db0
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/intern.go
@@ -0,0 +1,86 @@
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package json
+
+import (
+ "encoding/binary"
+ "math/bits"
+)
+
+// stringCache is a cache for strings converted from a []byte.
+type stringCache [256]string // 256*unsafe.Sizeof(string("")) => 4KiB
+
+// make returns the string form of b.
+// It returns a pre-allocated string from c if present, otherwise
+// it allocates a new string, inserts it into the cache, and returns it.
+func (c *stringCache) make(b []byte) string {
+ const (
+ minCachedLen = 2 // single byte strings are already interned by the runtime
+ maxCachedLen = 256 // large enough for UUIDs, IPv6 addresses, SHA-256 checksums, etc.
+ )
+ if c == nil || len(b) < minCachedLen || len(b) > maxCachedLen {
+ return string(b)
+ }
+
+ // Compute a hash from the fixed-width prefix and suffix of the string.
+ // This ensures hashing a string is a constant time operation.
+ var h uint32
+ switch {
+ case len(b) >= 8:
+ lo := binary.LittleEndian.Uint64(b[:8])
+ hi := binary.LittleEndian.Uint64(b[len(b)-8:])
+ h = hash64(uint32(lo), uint32(lo>>32)) ^ hash64(uint32(hi), uint32(hi>>32))
+ case len(b) >= 4:
+ lo := binary.LittleEndian.Uint32(b[:4])
+ hi := binary.LittleEndian.Uint32(b[len(b)-4:])
+ h = hash64(lo, hi)
+ case len(b) >= 2:
+ lo := binary.LittleEndian.Uint16(b[:2])
+ hi := binary.LittleEndian.Uint16(b[len(b)-2:])
+ h = hash64(uint32(lo), uint32(hi))
+ }
+
+ // Check the cache for the string.
+ i := h % uint32(len(*c))
+ if s := (*c)[i]; s == string(b) {
+ return s
+ }
+ s := string(b)
+ (*c)[i] = s
+ return s
+}
+
+// hash64 returns the hash of two uint32s as a single uint32.
+func hash64(lo, hi uint32) uint32 {
+ // If avalanche=true, this is identical to XXH32 hash on a 8B string:
+ // var b [8]byte
+ // binary.LittleEndian.PutUint32(b[:4], lo)
+ // binary.LittleEndian.PutUint32(b[4:], hi)
+ // return xxhash.Sum32(b[:])
+ const (
+ prime1 = 0x9e3779b1
+ prime2 = 0x85ebca77
+ prime3 = 0xc2b2ae3d
+ prime4 = 0x27d4eb2f
+ prime5 = 0x165667b1
+ )
+ h := prime5 + uint32(8)
+ h += lo * prime3
+ h = bits.RotateLeft32(h, 17) * prime4
+ h += hi * prime3
+ h = bits.RotateLeft32(h, 17) * prime4
+ // Skip final mix (avalanche) step of XXH32 for performance reasons.
+ // Empirical testing shows that the improvements in unbiased distribution
+ // does not outweigh the extra cost in computational complexity.
+ const avalanche = false
+ if avalanche {
+ h ^= h >> 15
+ h *= prime2
+ h ^= h >> 13
+ h *= prime3
+ h ^= h >> 16
+ }
+ return h
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/pools.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/pools.go
new file mode 100644
index 000000000..60e93270f
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/pools.go
@@ -0,0 +1,182 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package json
+
+import (
+ "bytes"
+ "io"
+ "math/bits"
+ "sort"
+ "sync"
+)
+
+// TODO(https://go.dev/issue/47657): Use sync.PoolOf.
+
+var (
+ // This owns the internal buffer since there is no io.Writer to output to.
+ // Since the buffer can get arbitrarily large in normal usage,
+ // there is statistical tracking logic to determine whether to recycle
+ // the internal buffer or not based on a history of utilization.
+ bufferedEncoderPool = &sync.Pool{New: func() any { return new(Encoder) }}
+
+ // This owns the internal buffer, but it is only used to temporarily store
+ // buffered JSON before flushing it to the underlying io.Writer.
+ // In a sufficiently efficient streaming mode, we do not expect the buffer
+ // to grow arbitrarily large. Thus, we avoid recycling large buffers.
+ streamingEncoderPool = &sync.Pool{New: func() any { return new(Encoder) }}
+
+ // This does not own the internal buffer since
+ // it is taken directly from the provided bytes.Buffer.
+ bytesBufferEncoderPool = &sync.Pool{New: func() any { return new(Encoder) }}
+)
+
+// bufferStatistics is statistics to track buffer utilization.
+// It is used to determine whether to recycle a buffer or not
+// to avoid https://go.dev/issue/23199.
+type bufferStatistics struct {
+ strikes int // number of times the buffer was under-utilized
+ prevLen int // length of previous buffer
+}
+
+func getBufferedEncoder(o EncodeOptions) *Encoder {
+ e := bufferedEncoderPool.Get().(*Encoder)
+ if e.buf == nil {
+ // Round up to nearest 2ⁿ to make best use of malloc size classes.
+ // See runtime/sizeclasses.go on Go1.15.
+ // Logical OR with 63 to ensure 64 as the minimum buffer size.
+ n := 1 << bits.Len(uint(e.bufStats.prevLen|63))
+ e.buf = make([]byte, 0, n)
+ }
+ e.reset(e.buf[:0], nil, o)
+ return e
+}
+func putBufferedEncoder(e *Encoder) {
+ // Recycle large buffers only if sufficiently utilized.
+ // If a buffer is under-utilized enough times sequentially,
+ // then it is discarded, ensuring that a single large buffer
+ // won't be kept alive by a continuous stream of small usages.
+ //
+ // The worst case utilization is computed as:
+ // MIN_UTILIZATION_THRESHOLD / (1 + MAX_NUM_STRIKES)
+ //
+ // For the constants chosen below, this is (25%)/(1+4) ⇒ 5%.
+ // This may seem low, but it ensures a lower bound on
+ // the absolute worst-case utilization. Without this check,
+ // this would be theoretically 0%, which is infinitely worse.
+ //
+ // See https://go.dev/issue/27735.
+ switch {
+ case cap(e.buf) <= 4<<10: // always recycle buffers smaller than 4KiB
+ e.bufStats.strikes = 0
+ case cap(e.buf)/4 <= len(e.buf): // at least 25% utilization
+ e.bufStats.strikes = 0
+ case e.bufStats.strikes < 4: // at most 4 strikes
+ e.bufStats.strikes++
+ default: // discard the buffer; too large and too often under-utilized
+ e.bufStats.strikes = 0
+ e.bufStats.prevLen = len(e.buf) // heuristic for size to allocate next time
+ e.buf = nil
+ }
+ bufferedEncoderPool.Put(e)
+}
+
+func getStreamingEncoder(w io.Writer, o EncodeOptions) *Encoder {
+ if _, ok := w.(*bytes.Buffer); ok {
+ e := bytesBufferEncoderPool.Get().(*Encoder)
+ e.reset(nil, w, o) // buffer taken from bytes.Buffer
+ return e
+ } else {
+ e := streamingEncoderPool.Get().(*Encoder)
+ e.reset(e.buf[:0], w, o) // preserve existing buffer
+ return e
+ }
+}
+func putStreamingEncoder(e *Encoder) {
+ if _, ok := e.wr.(*bytes.Buffer); ok {
+ bytesBufferEncoderPool.Put(e)
+ } else {
+ if cap(e.buf) > 64<<10 {
+ e.buf = nil // avoid pinning arbitrarily large amounts of memory
+ }
+ streamingEncoderPool.Put(e)
+ }
+}
+
+var (
+ // This does not own the internal buffer since it is externally provided.
+ bufferedDecoderPool = &sync.Pool{New: func() any { return new(Decoder) }}
+
+ // This owns the internal buffer, but it is only used to temporarily store
+ // buffered JSON fetched from the underlying io.Reader.
+ // In a sufficiently efficient streaming mode, we do not expect the buffer
+ // to grow arbitrarily large. Thus, we avoid recycling large buffers.
+ streamingDecoderPool = &sync.Pool{New: func() any { return new(Decoder) }}
+
+ // This does not own the internal buffer since
+ // it is taken directly from the provided bytes.Buffer.
+ bytesBufferDecoderPool = bufferedDecoderPool
+)
+
+func getBufferedDecoder(b []byte, o DecodeOptions) *Decoder {
+ d := bufferedDecoderPool.Get().(*Decoder)
+ d.reset(b, nil, o)
+ return d
+}
+func putBufferedDecoder(d *Decoder) {
+ bufferedDecoderPool.Put(d)
+}
+
+func getStreamingDecoder(r io.Reader, o DecodeOptions) *Decoder {
+ if _, ok := r.(*bytes.Buffer); ok {
+ d := bytesBufferDecoderPool.Get().(*Decoder)
+ d.reset(nil, r, o) // buffer taken from bytes.Buffer
+ return d
+ } else {
+ d := streamingDecoderPool.Get().(*Decoder)
+ d.reset(d.buf[:0], r, o) // preserve existing buffer
+ return d
+ }
+}
+func putStreamingDecoder(d *Decoder) {
+ if _, ok := d.rd.(*bytes.Buffer); ok {
+ bytesBufferDecoderPool.Put(d)
+ } else {
+ if cap(d.buf) > 64<<10 {
+ d.buf = nil // avoid pinning arbitrarily large amounts of memory
+ }
+ streamingDecoderPool.Put(d)
+ }
+}
+
+var stringsPools = &sync.Pool{New: func() any { return new(stringSlice) }}
+
+type stringSlice []string
+
+// getStrings returns a non-nil pointer to a slice with length n.
+func getStrings(n int) *stringSlice {
+ s := stringsPools.Get().(*stringSlice)
+ if cap(*s) < n {
+ *s = make([]string, n)
+ }
+ *s = (*s)[:n]
+ return s
+}
+
+func putStrings(s *stringSlice) {
+ if cap(*s) > 1<<10 {
+ *s = nil // avoid pinning arbitrarily large amounts of memory
+ }
+ stringsPools.Put(s)
+}
+
+// Sort sorts the string slice according to RFC 8785, section 3.2.3.
+func (ss *stringSlice) Sort() {
+ // TODO(https://go.dev/issue/47619): Use slices.SortFunc instead.
+ sort.Sort(ss)
+}
+
+func (ss *stringSlice) Len() int { return len(*ss) }
+func (ss *stringSlice) Less(i, j int) bool { return lessUTF16((*ss)[i], (*ss)[j]) }
+func (ss *stringSlice) Swap(i, j int) { (*ss)[i], (*ss)[j] = (*ss)[j], (*ss)[i] }
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/state.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/state.go
new file mode 100644
index 000000000..ee14c753f
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/state.go
@@ -0,0 +1,747 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package json
+
+import (
+ "math"
+ "strconv"
+)
+
+var (
+ errMissingName = &SyntacticError{str: "missing string for object name"}
+ errMissingColon = &SyntacticError{str: "missing character ':' after object name"}
+ errMissingValue = &SyntacticError{str: "missing value after object name"}
+ errMissingComma = &SyntacticError{str: "missing character ',' after object or array value"}
+ errMismatchDelim = &SyntacticError{str: "mismatching structural token for object or array"}
+)
+
+const errInvalidNamespace = jsonError("object namespace is in an invalid state")
+
+type state struct {
+ // tokens validates whether the next token kind is valid.
+ tokens stateMachine
+
+ // names is a stack of object names.
+ // Not used if AllowDuplicateNames is true.
+ names objectNameStack
+
+ // namespaces is a stack of object namespaces.
+ // For performance reasons, Encoder or Decoder may not update this
+ // if Marshal or Unmarshal is able to track names in a more efficient way.
+ // See makeMapArshaler and makeStructArshaler.
+ // Not used if AllowDuplicateNames is true.
+ namespaces objectNamespaceStack
+}
+
+func (s *state) reset() {
+ s.tokens.reset()
+ s.names.reset()
+ s.namespaces.reset()
+}
+
+// appendStackPointer appends a JSON Pointer (RFC 6901) to the current value.
+// The returned pointer is only accurate if s.names is populated,
+// otherwise it uses the numeric index as the object member name.
+//
+// Invariant: Must call s.names.copyQuotedBuffer beforehand.
+func (s state) appendStackPointer(b []byte) []byte {
+ var objectDepth int
+ for i := 1; i < s.tokens.depth(); i++ {
+ e := s.tokens.index(i)
+ if e.length() == 0 {
+ break // empty object or array
+ }
+ b = append(b, '/')
+ switch {
+ case e.isObject():
+ if objectDepth < s.names.length() {
+ for _, c := range s.names.getUnquoted(objectDepth) {
+ // Per RFC 6901, section 3, escape '~' and '/' characters.
+ switch c {
+ case '~':
+ b = append(b, "~0"...)
+ case '/':
+ b = append(b, "~1"...)
+ default:
+ b = append(b, c)
+ }
+ }
+ } else {
+ // Since the names stack is unpopulated, the name is unknown.
+ // As a best-effort replacement, use the numeric member index.
+ // While inaccurate, it produces a syntactically valid pointer.
+ b = strconv.AppendUint(b, uint64((e.length()-1)/2), 10)
+ }
+ objectDepth++
+ case e.isArray():
+ b = strconv.AppendUint(b, uint64(e.length()-1), 10)
+ }
+ }
+ return b
+}
+
+// stateMachine is a push-down automaton that validates whether
+// a sequence of tokens is valid or not according to the JSON grammar.
+// It is useful for both encoding and decoding.
+//
+// It is a stack where each entry represents a nested JSON object or array.
+// The stack has a minimum depth of 1 where the first level is a
+// virtual JSON array to handle a stream of top-level JSON values.
+// The top-level virtual JSON array is special in that it doesn't require commas
+// between each JSON value.
+//
+// For performance, most methods are carefully written to be inlineable.
+// The zero value is a valid state machine ready for use.
+type stateMachine struct {
+ stack []stateEntry
+ last stateEntry
+}
+
+// reset resets the state machine.
+// The machine always starts with a minimum depth of 1.
+func (m *stateMachine) reset() {
+ m.stack = m.stack[:0]
+ if cap(m.stack) > 1<<10 {
+ m.stack = nil
+ }
+ m.last = stateTypeArray
+}
+
+// depth is the current nested depth of JSON objects and arrays.
+// It is one-indexed (i.e., top-level values have a depth of 1).
+func (m stateMachine) depth() int {
+ return len(m.stack) + 1
+}
+
+// index returns a reference to the ith entry.
+// It is only valid until the next push method call.
+func (m *stateMachine) index(i int) *stateEntry {
+ if i == len(m.stack) {
+ return &m.last
+ }
+ return &m.stack[i]
+}
+
+// depthLength reports the current nested depth and
+// the length of the last JSON object or array.
+func (m stateMachine) depthLength() (int, int) {
+ return m.depth(), m.last.length()
+}
+
+// appendLiteral appends a JSON literal as the next token in the sequence.
+// If an error is returned, the state is not mutated.
+func (m *stateMachine) appendLiteral() error {
+ switch {
+ case m.last.needObjectName():
+ return errMissingName
+ case !m.last.isValidNamespace():
+ return errInvalidNamespace
+ default:
+ m.last.increment()
+ return nil
+ }
+}
+
+// appendString appends a JSON string as the next token in the sequence.
+// If an error is returned, the state is not mutated.
+func (m *stateMachine) appendString() error {
+ switch {
+ case !m.last.isValidNamespace():
+ return errInvalidNamespace
+ default:
+ m.last.increment()
+ return nil
+ }
+}
+
+// appendNumber appends a JSON number as the next token in the sequence.
+// If an error is returned, the state is not mutated.
+func (m *stateMachine) appendNumber() error {
+ return m.appendLiteral()
+}
+
+// pushObject appends a JSON start object token as next in the sequence.
+// If an error is returned, the state is not mutated.
+func (m *stateMachine) pushObject() error {
+ switch {
+ case m.last.needObjectName():
+ return errMissingName
+ case !m.last.isValidNamespace():
+ return errInvalidNamespace
+ default:
+ m.last.increment()
+ m.stack = append(m.stack, m.last)
+ m.last = stateTypeObject
+ return nil
+ }
+}
+
+// popObject appends a JSON end object token as next in the sequence.
+// If an error is returned, the state is not mutated.
+func (m *stateMachine) popObject() error {
+ switch {
+ case !m.last.isObject():
+ return errMismatchDelim
+ case m.last.needObjectValue():
+ return errMissingValue
+ case !m.last.isValidNamespace():
+ return errInvalidNamespace
+ default:
+ m.last = m.stack[len(m.stack)-1]
+ m.stack = m.stack[:len(m.stack)-1]
+ return nil
+ }
+}
+
+// pushArray appends a JSON start array token as next in the sequence.
+// If an error is returned, the state is not mutated.
+func (m *stateMachine) pushArray() error {
+ switch {
+ case m.last.needObjectName():
+ return errMissingName
+ case !m.last.isValidNamespace():
+ return errInvalidNamespace
+ default:
+ m.last.increment()
+ m.stack = append(m.stack, m.last)
+ m.last = stateTypeArray
+ return nil
+ }
+}
+
+// popArray appends a JSON end array token as next in the sequence.
+// If an error is returned, the state is not mutated.
+func (m *stateMachine) popArray() error {
+ switch {
+ case !m.last.isArray() || len(m.stack) == 0: // forbid popping top-level virtual JSON array
+ return errMismatchDelim
+ case !m.last.isValidNamespace():
+ return errInvalidNamespace
+ default:
+ m.last = m.stack[len(m.stack)-1]
+ m.stack = m.stack[:len(m.stack)-1]
+ return nil
+ }
+}
+
+// needIndent reports whether indent whitespace should be injected.
+// A zero value means that no whitespace should be injected.
+// A positive value means '\n', indentPrefix, and (n-1) copies of indentBody
+// should be appended to the output immediately before the next token.
+func (m stateMachine) needIndent(next Kind) (n int) {
+ willEnd := next == '}' || next == ']'
+ switch {
+ case m.depth() == 1:
+ return 0 // top-level values are never indented
+ case m.last.length() == 0 && willEnd:
+ return 0 // an empty object or array is never indented
+ case m.last.length() == 0 || m.last.needImplicitComma(next):
+ return m.depth()
+ case willEnd:
+ return m.depth() - 1
+ default:
+ return 0
+ }
+}
+
+// mayAppendDelim appends a colon or comma that may precede the next token.
+func (m stateMachine) mayAppendDelim(b []byte, next Kind) []byte {
+ switch {
+ case m.last.needImplicitColon():
+ return append(b, ':')
+ case m.last.needImplicitComma(next) && len(m.stack) != 0: // comma not needed for top-level values
+ return append(b, ',')
+ default:
+ return b
+ }
+}
+
+// needDelim reports whether a colon or comma token should be implicitly emitted
+// before the next token of the specified kind.
+// A zero value means no delimiter should be emitted.
+func (m stateMachine) needDelim(next Kind) (delim byte) {
+ switch {
+ case m.last.needImplicitColon():
+ return ':'
+ case m.last.needImplicitComma(next) && len(m.stack) != 0: // comma not needed for top-level values
+ return ','
+ default:
+ return 0
+ }
+}
+
+// checkDelim reports whether the specified delimiter should be there given
+// the kind of the next token that appears immediately afterwards.
+func (m stateMachine) checkDelim(delim byte, next Kind) error {
+ switch needDelim := m.needDelim(next); {
+ case needDelim == delim:
+ return nil
+ case needDelim == ':':
+ return errMissingColon
+ case needDelim == ',':
+ return errMissingComma
+ default:
+ return newInvalidCharacterError([]byte{delim}, "before next token")
+ }
+}
+
+// invalidateDisabledNamespaces marks all disabled namespaces as invalid.
+//
+// For efficiency, Marshal and Unmarshal may disable namespaces since there are
+// more efficient ways to track duplicate names. However, if an error occurs,
+// the namespaces in Encoder or Decoder will be left in an inconsistent state.
+// Mark the namespaces as invalid so that future method calls on
+// Encoder or Decoder will return an error.
+func (m *stateMachine) invalidateDisabledNamespaces() {
+ for i := 0; i < m.depth(); i++ {
+ e := m.index(i)
+ if !e.isActiveNamespace() {
+ e.invalidateNamespace()
+ }
+ }
+}
+
+// stateEntry encodes several artifacts within a single unsigned integer:
+// - whether this represents a JSON object or array,
+// - whether this object should check for duplicate names, and
+// - how many elements are in this JSON object or array.
+type stateEntry uint64
+
+const (
+ // The type mask (1 bit) records whether this is a JSON object or array.
+ stateTypeMask stateEntry = 0x8000_0000_0000_0000
+ stateTypeObject stateEntry = 0x8000_0000_0000_0000
+ stateTypeArray stateEntry = 0x0000_0000_0000_0000
+
+ // The name check mask (2 bit) records whether to update
+ // the namespaces for the current JSON object and
+ // whether the namespace is valid.
+ stateNamespaceMask stateEntry = 0x6000_0000_0000_0000
+ stateDisableNamespace stateEntry = 0x4000_0000_0000_0000
+ stateInvalidNamespace stateEntry = 0x2000_0000_0000_0000
+
+ // The count mask (61 bits) records the number of elements.
+ stateCountMask stateEntry = 0x1fff_ffff_ffff_ffff
+ stateCountLSBMask stateEntry = 0x0000_0000_0000_0001
+ stateCountOdd stateEntry = 0x0000_0000_0000_0001
+ stateCountEven stateEntry = 0x0000_0000_0000_0000
+)
+
+// length reports the number of elements in the JSON object or array.
+// Each name and value in an object entry is treated as a separate element.
+func (e stateEntry) length() int {
+ return int(e & stateCountMask)
+}
+
+// isObject reports whether this is a JSON object.
+func (e stateEntry) isObject() bool {
+ return e&stateTypeMask == stateTypeObject
+}
+
+// isArray reports whether this is a JSON array.
+func (e stateEntry) isArray() bool {
+ return e&stateTypeMask == stateTypeArray
+}
+
+// needObjectName reports whether the next token must be a JSON string,
+// which is necessary for JSON object names.
+func (e stateEntry) needObjectName() bool {
+ return e&(stateTypeMask|stateCountLSBMask) == stateTypeObject|stateCountEven
+}
+
+// needImplicitColon reports whether an colon should occur next,
+// which always occurs after JSON object names.
+func (e stateEntry) needImplicitColon() bool {
+ return e.needObjectValue()
+}
+
+// needObjectValue reports whether the next token must be a JSON value,
+// which is necessary after every JSON object name.
+func (e stateEntry) needObjectValue() bool {
+ return e&(stateTypeMask|stateCountLSBMask) == stateTypeObject|stateCountOdd
+}
+
+// needImplicitComma reports whether an comma should occur next,
+// which always occurs after a value in a JSON object or array
+// before the next value (or name).
+func (e stateEntry) needImplicitComma(next Kind) bool {
+ return !e.needObjectValue() && e.length() > 0 && next != '}' && next != ']'
+}
+
+// increment increments the number of elements for the current object or array.
+// This assumes that overflow won't practically be an issue since
+// 1< 0.
+func (e *stateEntry) decrement() {
+ (*e)--
+}
+
+// disableNamespace disables the JSON object namespace such that the
+// Encoder or Decoder no longer updates the namespace.
+func (e *stateEntry) disableNamespace() {
+ *e |= stateDisableNamespace
+}
+
+// isActiveNamespace reports whether the JSON object namespace is actively
+// being updated and used for duplicate name checks.
+func (e stateEntry) isActiveNamespace() bool {
+ return e&(stateDisableNamespace) == 0
+}
+
+// invalidateNamespace marks the JSON object namespace as being invalid.
+func (e *stateEntry) invalidateNamespace() {
+ *e |= stateInvalidNamespace
+}
+
+// isValidNamespace reports whether the JSON object namespace is valid.
+func (e stateEntry) isValidNamespace() bool {
+ return e&(stateInvalidNamespace) == 0
+}
+
+// objectNameStack is a stack of names when descending into a JSON object.
+// In contrast to objectNamespaceStack, this only has to remember a single name
+// per JSON object.
+//
+// This data structure may contain offsets to encodeBuffer or decodeBuffer.
+// It violates clean abstraction of layers, but is significantly more efficient.
+// This ensures that popping and pushing in the common case is a trivial
+// push/pop of an offset integer.
+//
+// The zero value is an empty names stack ready for use.
+type objectNameStack struct {
+ // offsets is a stack of offsets for each name.
+ // A non-negative offset is the ending offset into the local names buffer.
+ // A negative offset is the bit-wise inverse of a starting offset into
+ // a remote buffer (e.g., encodeBuffer or decodeBuffer).
+ // A math.MinInt offset at the end implies that the last object is empty.
+ // Invariant: Positive offsets always occur before negative offsets.
+ offsets []int
+ // unquotedNames is a back-to-back concatenation of names.
+ unquotedNames []byte
+}
+
+func (ns *objectNameStack) reset() {
+ ns.offsets = ns.offsets[:0]
+ ns.unquotedNames = ns.unquotedNames[:0]
+ if cap(ns.offsets) > 1<<6 {
+ ns.offsets = nil // avoid pinning arbitrarily large amounts of memory
+ }
+ if cap(ns.unquotedNames) > 1<<10 {
+ ns.unquotedNames = nil // avoid pinning arbitrarily large amounts of memory
+ }
+}
+
+func (ns *objectNameStack) length() int {
+ return len(ns.offsets)
+}
+
+// getUnquoted retrieves the ith unquoted name in the namespace.
+// It returns an empty string if the last object is empty.
+//
+// Invariant: Must call copyQuotedBuffer beforehand.
+func (ns *objectNameStack) getUnquoted(i int) []byte {
+ ns.ensureCopiedBuffer()
+ if i == 0 {
+ return ns.unquotedNames[:ns.offsets[0]]
+ } else {
+ return ns.unquotedNames[ns.offsets[i-1]:ns.offsets[i-0]]
+ }
+}
+
+// invalidOffset indicates that the last JSON object currently has no name.
+const invalidOffset = math.MinInt
+
+// push descends into a nested JSON object.
+func (ns *objectNameStack) push() {
+ ns.offsets = append(ns.offsets, invalidOffset)
+}
+
+// replaceLastQuotedOffset replaces the last name with the starting offset
+// to the quoted name in some remote buffer. All offsets provided must be
+// relative to the same buffer until copyQuotedBuffer is called.
+func (ns *objectNameStack) replaceLastQuotedOffset(i int) {
+ // Use bit-wise inversion instead of naive multiplication by -1 to avoid
+ // ambiguity regarding zero (which is a valid offset into the names field).
+ // Bit-wise inversion is mathematically equivalent to -i-1,
+ // such that 0 becomes -1, 1 becomes -2, and so forth.
+ // This ensures that remote offsets are always negative.
+ ns.offsets[len(ns.offsets)-1] = ^i
+}
+
+// replaceLastUnquotedName replaces the last name with the provided name.
+//
+// Invariant: Must call copyQuotedBuffer beforehand.
+func (ns *objectNameStack) replaceLastUnquotedName(s string) {
+ ns.ensureCopiedBuffer()
+ var startOffset int
+ if len(ns.offsets) > 1 {
+ startOffset = ns.offsets[len(ns.offsets)-2]
+ }
+ ns.unquotedNames = append(ns.unquotedNames[:startOffset], s...)
+ ns.offsets[len(ns.offsets)-1] = len(ns.unquotedNames)
+}
+
+// clearLast removes any name in the last JSON object.
+// It is semantically equivalent to ns.push followed by ns.pop.
+func (ns *objectNameStack) clearLast() {
+ ns.offsets[len(ns.offsets)-1] = invalidOffset
+}
+
+// pop ascends out of a nested JSON object.
+func (ns *objectNameStack) pop() {
+ ns.offsets = ns.offsets[:len(ns.offsets)-1]
+}
+
+// copyQuotedBuffer copies names from the remote buffer into the local names
+// buffer so that there are no more offset references into the remote buffer.
+// This allows the remote buffer to change contents without affecting
+// the names that this data structure is trying to remember.
+func (ns *objectNameStack) copyQuotedBuffer(b []byte) {
+ // Find the first negative offset.
+ var i int
+ for i = len(ns.offsets) - 1; i >= 0 && ns.offsets[i] < 0; i-- {
+ continue
+ }
+
+ // Copy each name from the remote buffer into the local buffer.
+ for i = i + 1; i < len(ns.offsets); i++ {
+ if i == len(ns.offsets)-1 && ns.offsets[i] == invalidOffset {
+ if i == 0 {
+ ns.offsets[i] = 0
+ } else {
+ ns.offsets[i] = ns.offsets[i-1]
+ }
+ break // last JSON object had a push without any names
+ }
+
+ // As a form of Hyrum proofing, we write an invalid character into the
+ // buffer to make misuse of Decoder.ReadToken more obvious.
+ // We need to undo that mutation here.
+ quotedName := b[^ns.offsets[i]:]
+ if quotedName[0] == invalidateBufferByte {
+ quotedName[0] = '"'
+ }
+
+ // Append the unquoted name to the local buffer.
+ var startOffset int
+ if i > 0 {
+ startOffset = ns.offsets[i-1]
+ }
+ if n := consumeSimpleString(quotedName); n > 0 {
+ ns.unquotedNames = append(ns.unquotedNames[:startOffset], quotedName[len(`"`):n-len(`"`)]...)
+ } else {
+ ns.unquotedNames, _ = unescapeString(ns.unquotedNames[:startOffset], quotedName)
+ }
+ ns.offsets[i] = len(ns.unquotedNames)
+ }
+}
+
+func (ns *objectNameStack) ensureCopiedBuffer() {
+ if len(ns.offsets) > 0 && ns.offsets[len(ns.offsets)-1] < 0 {
+ panic("BUG: copyQuotedBuffer not called beforehand")
+ }
+}
+
+// objectNamespaceStack is a stack of object namespaces.
+// This data structure assists in detecting duplicate names.
+type objectNamespaceStack []objectNamespace
+
+// reset resets the object namespace stack.
+func (nss *objectNamespaceStack) reset() {
+ if cap(*nss) > 1<<10 {
+ *nss = nil
+ }
+ *nss = (*nss)[:0]
+}
+
+// push starts a new namespace for a nested JSON object.
+func (nss *objectNamespaceStack) push() {
+ if cap(*nss) > len(*nss) {
+ *nss = (*nss)[:len(*nss)+1]
+ nss.last().reset()
+ } else {
+ *nss = append(*nss, objectNamespace{})
+ }
+}
+
+// last returns a pointer to the last JSON object namespace.
+func (nss objectNamespaceStack) last() *objectNamespace {
+ return &nss[len(nss)-1]
+}
+
+// pop terminates the namespace for a nested JSON object.
+func (nss *objectNamespaceStack) pop() {
+ *nss = (*nss)[:len(*nss)-1]
+}
+
+// objectNamespace is the namespace for a JSON object.
+// In contrast to objectNameStack, this needs to remember a all names
+// per JSON object.
+//
+// The zero value is an empty namespace ready for use.
+type objectNamespace struct {
+ // It relies on a linear search over all the names before switching
+ // to use a Go map for direct lookup.
+
+ // endOffsets is a list of offsets to the end of each name in buffers.
+ // The length of offsets is the number of names in the namespace.
+ endOffsets []uint
+ // allUnquotedNames is a back-to-back concatenation of every name in the namespace.
+ allUnquotedNames []byte
+ // mapNames is a Go map containing every name in the namespace.
+ // Only valid if non-nil.
+ mapNames map[string]struct{}
+}
+
+// reset resets the namespace to be empty.
+func (ns *objectNamespace) reset() {
+ ns.endOffsets = ns.endOffsets[:0]
+ ns.allUnquotedNames = ns.allUnquotedNames[:0]
+ ns.mapNames = nil
+ if cap(ns.endOffsets) > 1<<6 {
+ ns.endOffsets = nil // avoid pinning arbitrarily large amounts of memory
+ }
+ if cap(ns.allUnquotedNames) > 1<<10 {
+ ns.allUnquotedNames = nil // avoid pinning arbitrarily large amounts of memory
+ }
+}
+
+// length reports the number of names in the namespace.
+func (ns *objectNamespace) length() int {
+ return len(ns.endOffsets)
+}
+
+// getUnquoted retrieves the ith unquoted name in the namespace.
+func (ns *objectNamespace) getUnquoted(i int) []byte {
+ if i == 0 {
+ return ns.allUnquotedNames[:ns.endOffsets[0]]
+ } else {
+ return ns.allUnquotedNames[ns.endOffsets[i-1]:ns.endOffsets[i-0]]
+ }
+}
+
+// lastUnquoted retrieves the last name in the namespace.
+func (ns *objectNamespace) lastUnquoted() []byte {
+ return ns.getUnquoted(ns.length() - 1)
+}
+
+// insertQuoted inserts a name and reports whether it was inserted,
+// which only occurs if name is not already in the namespace.
+// The provided name must be a valid JSON string.
+func (ns *objectNamespace) insertQuoted(name []byte, isVerbatim bool) bool {
+ if isVerbatim {
+ name = name[len(`"`) : len(name)-len(`"`)]
+ }
+ return ns.insert(name, !isVerbatim)
+}
+func (ns *objectNamespace) insertUnquoted(name []byte) bool {
+ return ns.insert(name, false)
+}
+func (ns *objectNamespace) insert(name []byte, quoted bool) bool {
+ var allNames []byte
+ if quoted {
+ allNames, _ = unescapeString(ns.allUnquotedNames, name)
+ } else {
+ allNames = append(ns.allUnquotedNames, name...)
+ }
+ name = allNames[len(ns.allUnquotedNames):]
+
+ // Switch to a map if the buffer is too large for linear search.
+ // This does not add the current name to the map.
+ if ns.mapNames == nil && (ns.length() > 64 || len(ns.allUnquotedNames) > 1024) {
+ ns.mapNames = make(map[string]struct{})
+ var startOffset uint
+ for _, endOffset := range ns.endOffsets {
+ name := ns.allUnquotedNames[startOffset:endOffset]
+ ns.mapNames[string(name)] = struct{}{} // allocates a new string
+ startOffset = endOffset
+ }
+ }
+
+ if ns.mapNames == nil {
+ // Perform linear search over the buffer to find matching names.
+ // It provides O(n) lookup, but does not require any allocations.
+ var startOffset uint
+ for _, endOffset := range ns.endOffsets {
+ if string(ns.allUnquotedNames[startOffset:endOffset]) == string(name) {
+ return false
+ }
+ startOffset = endOffset
+ }
+ } else {
+ // Use the map if it is populated.
+ // It provides O(1) lookup, but requires a string allocation per name.
+ if _, ok := ns.mapNames[string(name)]; ok {
+ return false
+ }
+ ns.mapNames[string(name)] = struct{}{} // allocates a new string
+ }
+
+ ns.allUnquotedNames = allNames
+ ns.endOffsets = append(ns.endOffsets, uint(len(ns.allUnquotedNames)))
+ return true
+}
+
+// removeLast removes the last name in the namespace.
+func (ns *objectNamespace) removeLast() {
+ if ns.mapNames != nil {
+ delete(ns.mapNames, string(ns.lastUnquoted()))
+ }
+ if ns.length()-1 == 0 {
+ ns.endOffsets = ns.endOffsets[:0]
+ ns.allUnquotedNames = ns.allUnquotedNames[:0]
+ } else {
+ ns.endOffsets = ns.endOffsets[:ns.length()-1]
+ ns.allUnquotedNames = ns.allUnquotedNames[:ns.endOffsets[ns.length()-1]]
+ }
+}
+
+type uintSet64 uint64
+
+func (s uintSet64) has(i uint) bool { return s&(1< 0 }
+func (s *uintSet64) set(i uint) { *s |= 1 << i }
+
+// uintSet is a set of unsigned integers.
+// It is optimized for most integers being close to zero.
+type uintSet struct {
+ lo uintSet64
+ hi []uintSet64
+}
+
+// has reports whether i is in the set.
+func (s *uintSet) has(i uint) bool {
+ if i < 64 {
+ return s.lo.has(i)
+ } else {
+ i -= 64
+ iHi, iLo := int(i/64), i%64
+ return iHi < len(s.hi) && s.hi[iHi].has(iLo)
+ }
+}
+
+// insert inserts i into the set and reports whether it was the first insertion.
+func (s *uintSet) insert(i uint) bool {
+ // TODO: Make this inlineable at least for the lower 64-bit case.
+ if i < 64 {
+ has := s.lo.has(i)
+ s.lo.set(i)
+ return !has
+ } else {
+ i -= 64
+ iHi, iLo := int(i/64), i%64
+ if iHi >= len(s.hi) {
+ s.hi = append(s.hi, make([]uintSet64, iHi+1-len(s.hi))...)
+ s.hi = s.hi[:cap(s.hi)]
+ }
+ has := s.hi[iHi].has(iLo)
+ s.hi[iHi].set(iLo)
+ return !has
+ }
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/token.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/token.go
new file mode 100644
index 000000000..9acba7dad
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/token.go
@@ -0,0 +1,522 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package json
+
+import (
+ "math"
+ "strconv"
+)
+
+// NOTE: Token is analogous to v1 json.Token.
+
+const (
+ maxInt64 = math.MaxInt64
+ minInt64 = math.MinInt64
+ maxUint64 = math.MaxUint64
+ minUint64 = 0 // for consistency and readability purposes
+
+ invalidTokenPanic = "invalid json.Token; it has been voided by a subsequent json.Decoder call"
+)
+
+// Token represents a lexical JSON token, which may be one of the following:
+// - a JSON literal (i.e., null, true, or false)
+// - a JSON string (e.g., "hello, world!")
+// - a JSON number (e.g., 123.456)
+// - a start or end delimiter for a JSON object (i.e., { or } )
+// - a start or end delimiter for a JSON array (i.e., [ or ] )
+//
+// A Token cannot represent entire array or object values, while a RawValue can.
+// There is no Token to represent commas and colons since
+// these structural tokens can be inferred from the surrounding context.
+type Token struct {
+ nonComparable
+
+ // Tokens can exist in either a "raw" or an "exact" form.
+ // Tokens produced by the Decoder are in the "raw" form.
+ // Tokens returned by constructors are usually in the "exact" form.
+ // The Encoder accepts Tokens in either the "raw" or "exact" form.
+ //
+ // The following chart shows the possible values for each Token type:
+ // ╔═════════════════╦════════════╤════════════╤════════════╗
+ // ║ Token type ║ raw field │ str field │ num field ║
+ // ╠═════════════════╬════════════╪════════════╪════════════╣
+ // ║ null (raw) ║ "null" │ "" │ 0 ║
+ // ║ false (raw) ║ "false" │ "" │ 0 ║
+ // ║ true (raw) ║ "true" │ "" │ 0 ║
+ // ║ string (raw) ║ non-empty │ "" │ offset ║
+ // ║ string (string) ║ nil │ non-empty │ 0 ║
+ // ║ number (raw) ║ non-empty │ "" │ offset ║
+ // ║ number (float) ║ nil │ "f" │ non-zero ║
+ // ║ number (int64) ║ nil │ "i" │ non-zero ║
+ // ║ number (uint64) ║ nil │ "u" │ non-zero ║
+ // ║ object (delim) ║ "{" or "}" │ "" │ 0 ║
+ // ║ array (delim) ║ "[" or "]" │ "" │ 0 ║
+ // ╚═════════════════╩════════════╧════════════╧════════════╝
+ //
+ // Notes:
+ // - For tokens stored in "raw" form, the num field contains the
+ // absolute offset determined by raw.previousOffsetStart().
+ // The buffer itself is stored in raw.previousBuffer().
+ // - JSON literals and structural characters are always in the "raw" form.
+ // - JSON strings and numbers can be in either "raw" or "exact" forms.
+ // - The exact zero value of JSON strings and numbers in the "exact" forms
+ // have ambiguous representation. Thus, they are always represented
+ // in the "raw" form.
+
+ // raw contains a reference to the raw decode buffer.
+ // If non-nil, then its value takes precedence over str and num.
+ // It is only valid if num == raw.previousOffsetStart().
+ raw *decodeBuffer
+
+ // str is the unescaped JSON string if num is zero.
+ // Otherwise, it is "f", "i", or "u" if num should be interpreted
+ // as a float64, int64, or uint64, respectively.
+ str string
+
+ // num is a float64, int64, or uint64 stored as a uint64 value.
+ // It is non-zero for any JSON number in the "exact" form.
+ num uint64
+}
+
+// TODO: Does representing 1-byte delimiters as *decodeBuffer cause performance issues?
+
+var (
+ Null Token = rawToken("null")
+ False Token = rawToken("false")
+ True Token = rawToken("true")
+
+ ObjectStart Token = rawToken("{")
+ ObjectEnd Token = rawToken("}")
+ ArrayStart Token = rawToken("[")
+ ArrayEnd Token = rawToken("]")
+
+ zeroString Token = rawToken(`""`)
+ zeroNumber Token = rawToken(`0`)
+
+ nanString Token = String("NaN")
+ pinfString Token = String("Infinity")
+ ninfString Token = String("-Infinity")
+)
+
+func rawToken(s string) Token {
+ return Token{raw: &decodeBuffer{buf: []byte(s), prevStart: 0, prevEnd: len(s)}}
+}
+
+// Bool constructs a Token representing a JSON boolean.
+func Bool(b bool) Token {
+ if b {
+ return True
+ }
+ return False
+}
+
+// String constructs a Token representing a JSON string.
+// The provided string should contain valid UTF-8, otherwise invalid characters
+// may be mangled as the Unicode replacement character.
+func String(s string) Token {
+ if len(s) == 0 {
+ return zeroString
+ }
+ return Token{str: s}
+}
+
+// Float constructs a Token representing a JSON number.
+// The values NaN, +Inf, and -Inf will be represented
+// as a JSON string with the values "NaN", "Infinity", and "-Infinity".
+func Float(n float64) Token {
+ switch {
+ case math.Float64bits(n) == 0:
+ return zeroNumber
+ case math.IsNaN(n):
+ return nanString
+ case math.IsInf(n, +1):
+ return pinfString
+ case math.IsInf(n, -1):
+ return ninfString
+ }
+ return Token{str: "f", num: math.Float64bits(n)}
+}
+
+// Int constructs a Token representing a JSON number from an int64.
+func Int(n int64) Token {
+ if n == 0 {
+ return zeroNumber
+ }
+ return Token{str: "i", num: uint64(n)}
+}
+
+// Uint constructs a Token representing a JSON number from a uint64.
+func Uint(n uint64) Token {
+ if n == 0 {
+ return zeroNumber
+ }
+ return Token{str: "u", num: uint64(n)}
+}
+
+// Clone makes a copy of the Token such that its value remains valid
+// even after a subsequent Decoder.Read call.
+func (t Token) Clone() Token {
+ // TODO: Allow caller to avoid any allocations?
+ if raw := t.raw; raw != nil {
+ // Avoid copying globals.
+ if t.raw.prevStart == 0 {
+ switch t.raw {
+ case Null.raw:
+ return Null
+ case False.raw:
+ return False
+ case True.raw:
+ return True
+ case ObjectStart.raw:
+ return ObjectStart
+ case ObjectEnd.raw:
+ return ObjectEnd
+ case ArrayStart.raw:
+ return ArrayStart
+ case ArrayEnd.raw:
+ return ArrayEnd
+ }
+ }
+
+ if uint64(raw.previousOffsetStart()) != t.num {
+ panic(invalidTokenPanic)
+ }
+ // TODO(https://go.dev/issue/45038): Use bytes.Clone.
+ buf := append([]byte(nil), raw.previousBuffer()...)
+ return Token{raw: &decodeBuffer{buf: buf, prevStart: 0, prevEnd: len(buf)}}
+ }
+ return t
+}
+
+// Bool returns the value for a JSON boolean.
+// It panics if the token kind is not a JSON boolean.
+func (t Token) Bool() bool {
+ switch t.raw {
+ case True.raw:
+ return true
+ case False.raw:
+ return false
+ default:
+ panic("invalid JSON token kind: " + t.Kind().String())
+ }
+}
+
+// appendString appends a JSON string to dst and returns it.
+// It panics if t is not a JSON string.
+func (t Token) appendString(dst []byte, validateUTF8, preserveRaw bool, escapeRune func(rune) bool) ([]byte, error) {
+ if raw := t.raw; raw != nil {
+ // Handle raw string value.
+ buf := raw.previousBuffer()
+ if Kind(buf[0]) == '"' {
+ if escapeRune == nil && consumeSimpleString(buf) == len(buf) {
+ return append(dst, buf...), nil
+ }
+ dst, _, err := reformatString(dst, buf, validateUTF8, preserveRaw, escapeRune)
+ return dst, err
+ }
+ } else if len(t.str) != 0 && t.num == 0 {
+ // Handle exact string value.
+ return appendString(dst, t.str, validateUTF8, escapeRune)
+ }
+
+ panic("invalid JSON token kind: " + t.Kind().String())
+}
+
+// String returns the unescaped string value for a JSON string.
+// For other JSON kinds, this returns the raw JSON representation.
+func (t Token) String() string {
+ // This is inlinable to take advantage of "function outlining".
+ // This avoids an allocation for the string(b) conversion
+ // if the caller does not use the string in an escaping manner.
+ // See https://blog.filippo.io/efficient-go-apis-with-the-inliner/
+ s, b := t.string()
+ if len(b) > 0 {
+ return string(b)
+ }
+ return s
+}
+func (t Token) string() (string, []byte) {
+ if raw := t.raw; raw != nil {
+ if uint64(raw.previousOffsetStart()) != t.num {
+ panic(invalidTokenPanic)
+ }
+ buf := raw.previousBuffer()
+ if buf[0] == '"' {
+ // TODO: Preserve valueFlags in Token?
+ isVerbatim := consumeSimpleString(buf) == len(buf)
+ return "", unescapeStringMayCopy(buf, isVerbatim)
+ }
+ // Handle tokens that are not JSON strings for fmt.Stringer.
+ return "", buf
+ }
+ if len(t.str) != 0 && t.num == 0 {
+ return t.str, nil
+ }
+ // Handle tokens that are not JSON strings for fmt.Stringer.
+ if t.num > 0 {
+ switch t.str[0] {
+ case 'f':
+ return string(appendNumber(nil, math.Float64frombits(t.num), 64)), nil
+ case 'i':
+ return strconv.FormatInt(int64(t.num), 10), nil
+ case 'u':
+ return strconv.FormatUint(uint64(t.num), 10), nil
+ }
+ }
+ return "", nil
+}
+
+// appendNumber appends a JSON number to dst and returns it.
+// It panics if t is not a JSON number.
+func (t Token) appendNumber(dst []byte, canonicalize bool) ([]byte, error) {
+ if raw := t.raw; raw != nil {
+ // Handle raw number value.
+ buf := raw.previousBuffer()
+ if Kind(buf[0]).normalize() == '0' {
+ if !canonicalize {
+ return append(dst, buf...), nil
+ }
+ dst, _, err := reformatNumber(dst, buf, canonicalize)
+ return dst, err
+ }
+ } else if t.num != 0 {
+ // Handle exact number value.
+ switch t.str[0] {
+ case 'f':
+ return appendNumber(dst, math.Float64frombits(t.num), 64), nil
+ case 'i':
+ return strconv.AppendInt(dst, int64(t.num), 10), nil
+ case 'u':
+ return strconv.AppendUint(dst, uint64(t.num), 10), nil
+ }
+ }
+
+ panic("invalid JSON token kind: " + t.Kind().String())
+}
+
+// Float returns the floating-point value for a JSON number.
+// It returns a NaN, +Inf, or -Inf value for any JSON string
+// with the values "NaN", "Infinity", or "-Infinity".
+// It panics for all other cases.
+func (t Token) Float() float64 {
+ if raw := t.raw; raw != nil {
+ // Handle raw number value.
+ if uint64(raw.previousOffsetStart()) != t.num {
+ panic(invalidTokenPanic)
+ }
+ buf := raw.previousBuffer()
+ if Kind(buf[0]).normalize() == '0' {
+ fv, _ := parseFloat(buf, 64)
+ return fv
+ }
+ } else if t.num != 0 {
+ // Handle exact number value.
+ switch t.str[0] {
+ case 'f':
+ return math.Float64frombits(t.num)
+ case 'i':
+ return float64(int64(t.num))
+ case 'u':
+ return float64(uint64(t.num))
+ }
+ }
+
+ // Handle string values with "NaN", "Infinity", or "-Infinity".
+ if t.Kind() == '"' {
+ switch t.String() {
+ case "NaN":
+ return math.NaN()
+ case "Infinity":
+ return math.Inf(+1)
+ case "-Infinity":
+ return math.Inf(-1)
+ }
+ }
+
+ panic("invalid JSON token kind: " + t.Kind().String())
+}
+
+// Int returns the signed integer value for a JSON number.
+// The fractional component of any number is ignored (truncation toward zero).
+// Any number beyond the representation of an int64 will be saturated
+// to the closest representable value.
+// It panics if the token kind is not a JSON number.
+func (t Token) Int() int64 {
+ if raw := t.raw; raw != nil {
+ // Handle raw integer value.
+ if uint64(raw.previousOffsetStart()) != t.num {
+ panic(invalidTokenPanic)
+ }
+ neg := false
+ buf := raw.previousBuffer()
+ if len(buf) > 0 && buf[0] == '-' {
+ neg, buf = true, buf[1:]
+ }
+ if numAbs, ok := parseDecUint(buf); ok {
+ if neg {
+ if numAbs > -minInt64 {
+ return minInt64
+ }
+ return -1 * int64(numAbs)
+ } else {
+ if numAbs > +maxInt64 {
+ return maxInt64
+ }
+ return +1 * int64(numAbs)
+ }
+ }
+ } else if t.num != 0 {
+ // Handle exact integer value.
+ switch t.str[0] {
+ case 'i':
+ return int64(t.num)
+ case 'u':
+ if t.num > maxInt64 {
+ return maxInt64
+ }
+ return int64(t.num)
+ }
+ }
+
+ // Handle JSON number that is a floating-point value.
+ if t.Kind() == '0' {
+ switch fv := t.Float(); {
+ case fv >= maxInt64:
+ return maxInt64
+ case fv <= minInt64:
+ return minInt64
+ default:
+ return int64(fv) // truncation toward zero
+ }
+ }
+
+ panic("invalid JSON token kind: " + t.Kind().String())
+}
+
+// Uint returns the unsigned integer value for a JSON number.
+// The fractional component of any number is ignored (truncation toward zero).
+// Any number beyond the representation of an uint64 will be saturated
+// to the closest representable value.
+// It panics if the token kind is not a JSON number.
+func (t Token) Uint() uint64 {
+ // NOTE: This accessor returns 0 for any negative JSON number,
+ // which might be surprising, but is at least consistent with the behavior
+ // of saturating out-of-bounds numbers to the closest representable number.
+
+ if raw := t.raw; raw != nil {
+ // Handle raw integer value.
+ if uint64(raw.previousOffsetStart()) != t.num {
+ panic(invalidTokenPanic)
+ }
+ neg := false
+ buf := raw.previousBuffer()
+ if len(buf) > 0 && buf[0] == '-' {
+ neg, buf = true, buf[1:]
+ }
+ if num, ok := parseDecUint(buf); ok {
+ if neg {
+ return minUint64
+ }
+ return num
+ }
+ } else if t.num != 0 {
+ // Handle exact integer value.
+ switch t.str[0] {
+ case 'u':
+ return t.num
+ case 'i':
+ if int64(t.num) < minUint64 {
+ return minUint64
+ }
+ return uint64(int64(t.num))
+ }
+ }
+
+ // Handle JSON number that is a floating-point value.
+ if t.Kind() == '0' {
+ switch fv := t.Float(); {
+ case fv >= maxUint64:
+ return maxUint64
+ case fv <= minUint64:
+ return minUint64
+ default:
+ return uint64(fv) // truncation toward zero
+ }
+ }
+
+ panic("invalid JSON token kind: " + t.Kind().String())
+}
+
+// Kind returns the token kind.
+func (t Token) Kind() Kind {
+ switch {
+ case t.raw != nil:
+ raw := t.raw
+ if uint64(raw.previousOffsetStart()) != t.num {
+ panic(invalidTokenPanic)
+ }
+ return Kind(t.raw.buf[raw.prevStart]).normalize()
+ case t.num != 0:
+ return '0'
+ case len(t.str) != 0:
+ return '"'
+ default:
+ return invalidKind
+ }
+}
+
+// Kind represents each possible JSON token kind with a single byte,
+// which is conveniently the first byte of that kind's grammar
+// with the restriction that numbers always be represented with '0':
+//
+// - 'n': null
+// - 'f': false
+// - 't': true
+// - '"': string
+// - '0': number
+// - '{': object start
+// - '}': object end
+// - '[': array start
+// - ']': array end
+//
+// An invalid kind is usually represented using 0,
+// but may be non-zero due to invalid JSON data.
+type Kind byte
+
+const invalidKind Kind = 0
+
+// String prints the kind in a humanly readable fashion.
+func (k Kind) String() string {
+ switch k {
+ case 'n':
+ return "null"
+ case 'f':
+ return "false"
+ case 't':
+ return "true"
+ case '"':
+ return "string"
+ case '0':
+ return "number"
+ case '{':
+ return "{"
+ case '}':
+ return "}"
+ case '[':
+ return "["
+ case ']':
+ return "]"
+ default:
+ return ""
+ }
+}
+
+// normalize coalesces all possible starting characters of a number as just '0'.
+func (k Kind) normalize() Kind {
+ if k == '-' || ('0' <= k && k <= '9') {
+ return '0'
+ }
+ return k
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/value.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/value.go
new file mode 100644
index 000000000..e0bd1b31d
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/value.go
@@ -0,0 +1,381 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package json
+
+import (
+ "bytes"
+ "errors"
+ "io"
+ "sort"
+ "sync"
+ "unicode/utf16"
+ "unicode/utf8"
+)
+
+// NOTE: RawValue is analogous to v1 json.RawMessage.
+
+// RawValue represents a single raw JSON value, which may be one of the following:
+// - a JSON literal (i.e., null, true, or false)
+// - a JSON string (e.g., "hello, world!")
+// - a JSON number (e.g., 123.456)
+// - an entire JSON object (e.g., {"fizz":"buzz"} )
+// - an entire JSON array (e.g., [1,2,3] )
+//
+// RawValue can represent entire array or object values, while Token cannot.
+// RawValue may contain leading and/or trailing whitespace.
+type RawValue []byte
+
+// Clone returns a copy of v.
+func (v RawValue) Clone() RawValue {
+ if v == nil {
+ return nil
+ }
+ return append(RawValue{}, v...)
+}
+
+// String returns the string formatting of v.
+func (v RawValue) String() string {
+ if v == nil {
+ return "null"
+ }
+ return string(v)
+}
+
+// IsValid reports whether the raw JSON value is syntactically valid
+// according to RFC 7493.
+//
+// It verifies whether the input is properly encoded as UTF-8,
+// that escape sequences within strings decode to valid Unicode codepoints, and
+// that all names in each object are unique.
+// It does not verify whether numbers are representable within the limits
+// of any common numeric type (e.g., float64, int64, or uint64).
+func (v RawValue) IsValid() bool {
+ d := getBufferedDecoder(v, DecodeOptions{})
+ defer putBufferedDecoder(d)
+ _, errVal := d.ReadValue()
+ _, errEOF := d.ReadToken()
+ return errVal == nil && errEOF == io.EOF
+}
+
+// Compact removes all whitespace from the raw JSON value.
+//
+// It does not reformat JSON strings to use any other representation.
+// It is guaranteed to succeed if the input is valid.
+// If the value is already compacted, then the buffer is not mutated.
+func (v *RawValue) Compact() error {
+ return v.reformat(false, false, "", "")
+}
+
+// Indent reformats the whitespace in the raw JSON value so that each element
+// in a JSON object or array begins on a new, indented line beginning with
+// prefix followed by one or more copies of indent according to the nesting.
+// The value does not begin with the prefix nor any indention,
+// to make it easier to embed inside other formatted JSON data.
+//
+// It does not reformat JSON strings to use any other representation.
+// It is guaranteed to succeed if the input is valid.
+// If the value is already indented properly, then the buffer is not mutated.
+func (v *RawValue) Indent(prefix, indent string) error {
+ return v.reformat(false, true, prefix, indent)
+}
+
+// Canonicalize canonicalizes the raw JSON value according to the
+// JSON Canonicalization Scheme (JCS) as defined by RFC 8785
+// where it produces a stable representation of a JSON value.
+//
+// The output stability is dependent on the stability of the application data
+// (see RFC 8785, Appendix E). It cannot produce stable output from
+// fundamentally unstable input. For example, if the JSON value
+// contains ephemeral data (e.g., a frequently changing timestamp),
+// then the value is still unstable regardless of whether this is called.
+//
+// Note that JCS treats all JSON numbers as IEEE 754 double precision numbers.
+// Any numbers with precision beyond what is representable by that form
+// will lose their precision when canonicalized. For example, integer values
+// beyond ±2⁵³ will lose their precision. It is recommended that
+// int64 and uint64 data types be represented as a JSON string.
+//
+// It is guaranteed to succeed if the input is valid.
+// If the value is already canonicalized, then the buffer is not mutated.
+func (v *RawValue) Canonicalize() error {
+ return v.reformat(true, false, "", "")
+}
+
+// TODO: Instead of implementing the v1 Marshaler/Unmarshaler,
+// consider implementing the v2 versions instead.
+
+// MarshalJSON returns v as the JSON encoding of v.
+// It returns the stored value as the raw JSON output without any validation.
+// If v is nil, then this returns a JSON null.
+func (v RawValue) MarshalJSON() ([]byte, error) {
+ // NOTE: This matches the behavior of v1 json.RawMessage.MarshalJSON.
+ if v == nil {
+ return []byte("null"), nil
+ }
+ return v, nil
+}
+
+// UnmarshalJSON sets v as the JSON encoding of b.
+// It stores a copy of the provided raw JSON input without any validation.
+func (v *RawValue) UnmarshalJSON(b []byte) error {
+ // NOTE: This matches the behavior of v1 json.RawMessage.UnmarshalJSON.
+ if v == nil {
+ return errors.New("json.RawValue: UnmarshalJSON on nil pointer")
+ }
+ *v = append((*v)[:0], b...)
+ return nil
+}
+
+// Kind returns the starting token kind.
+// For a valid value, this will never include '}' or ']'.
+func (v RawValue) Kind() Kind {
+ if v := v[consumeWhitespace(v):]; len(v) > 0 {
+ return Kind(v[0]).normalize()
+ }
+ return invalidKind
+}
+
+func (v *RawValue) reformat(canonical, multiline bool, prefix, indent string) error {
+ var eo EncodeOptions
+ if canonical {
+ eo.AllowInvalidUTF8 = false // per RFC 8785, section 3.2.4
+ eo.AllowDuplicateNames = false // per RFC 8785, section 3.1
+ eo.canonicalizeNumbers = true // per RFC 8785, section 3.2.2.3
+ eo.EscapeRune = nil // per RFC 8785, section 3.2.2.2
+ eo.multiline = false // per RFC 8785, section 3.2.1
+ } else {
+ if s := trimLeftSpaceTab(prefix); len(s) > 0 {
+ panic("json: invalid character " + quoteRune([]byte(s)) + " in indent prefix")
+ }
+ if s := trimLeftSpaceTab(indent); len(s) > 0 {
+ panic("json: invalid character " + quoteRune([]byte(s)) + " in indent")
+ }
+ eo.AllowInvalidUTF8 = true
+ eo.AllowDuplicateNames = true
+ eo.preserveRawStrings = true
+ eo.multiline = multiline // in case indent is empty
+ eo.IndentPrefix = prefix
+ eo.Indent = indent
+ }
+ eo.omitTopLevelNewline = true
+
+ // Write the entire value to reformat all tokens and whitespace.
+ e := getBufferedEncoder(eo)
+ defer putBufferedEncoder(e)
+ if err := e.WriteValue(*v); err != nil {
+ return err
+ }
+
+ // For canonical output, we may need to reorder object members.
+ if canonical {
+ // Obtain a buffered encoder just to use its internal buffer as
+ // a scratch buffer in reorderObjects for reordering object members.
+ e2 := getBufferedEncoder(EncodeOptions{})
+ defer putBufferedEncoder(e2)
+
+ // Disable redundant checks performed earlier during encoding.
+ d := getBufferedDecoder(e.buf, DecodeOptions{AllowInvalidUTF8: true, AllowDuplicateNames: true})
+ defer putBufferedDecoder(d)
+ reorderObjects(d, &e2.buf) // per RFC 8785, section 3.2.3
+ }
+
+ // Store the result back into the value if different.
+ if !bytes.Equal(*v, e.buf) {
+ *v = append((*v)[:0], e.buf...)
+ }
+ return nil
+}
+
+func trimLeftSpaceTab(s string) string {
+ for i, r := range s {
+ switch r {
+ case ' ', '\t':
+ default:
+ return s[i:]
+ }
+ }
+ return ""
+}
+
+type memberName struct {
+ // name is the unescaped name.
+ name []byte
+ // before and after are byte offsets into Decoder.buf that represents
+ // the entire name/value pair. It may contain leading commas.
+ before, after int64
+}
+
+var memberNamePool = sync.Pool{New: func() any { return new(memberNames) }}
+
+func getMemberNames() *memberNames {
+ ns := memberNamePool.Get().(*memberNames)
+ *ns = (*ns)[:0]
+ return ns
+}
+func putMemberNames(ns *memberNames) {
+ if cap(*ns) < 1<<10 {
+ for i := range *ns {
+ (*ns)[i] = memberName{} // avoid pinning name
+ }
+ memberNamePool.Put(ns)
+ }
+}
+
+type memberNames []memberName
+
+func (m *memberNames) Len() int { return len(*m) }
+func (m *memberNames) Less(i, j int) bool { return lessUTF16((*m)[i].name, (*m)[j].name) }
+func (m *memberNames) Swap(i, j int) { (*m)[i], (*m)[j] = (*m)[j], (*m)[i] }
+
+// reorderObjects recursively reorders all object members in place
+// according to the ordering specified in RFC 8785, section 3.2.3.
+//
+// Pre-conditions:
+// - The value is valid (i.e., no decoder errors should ever occur).
+// - The value is compact (i.e., no whitespace is present).
+// - Initial call is provided a Decoder reading from the start of v.
+//
+// Post-conditions:
+// - Exactly one JSON value is read from the Decoder.
+// - All fully-parsed JSON objects are reordered by directly moving
+// the members in the value buffer.
+//
+// The runtime is approximately O(n·log(n)) + O(m·log(m)),
+// where n is len(v) and m is the total number of object members.
+func reorderObjects(d *Decoder, scratch *[]byte) {
+ switch tok, _ := d.ReadToken(); tok.Kind() {
+ case '{':
+ // Iterate and collect the name and offsets for every object member.
+ members := getMemberNames()
+ defer putMemberNames(members)
+ var prevName []byte
+ isSorted := true
+
+ beforeBody := d.InputOffset() // offset after '{'
+ for d.PeekKind() != '}' {
+ beforeName := d.InputOffset()
+ var flags valueFlags
+ name, _ := d.readValue(&flags)
+ name = unescapeStringMayCopy(name, flags.isVerbatim())
+ reorderObjects(d, scratch)
+ afterValue := d.InputOffset()
+
+ if isSorted && len(*members) > 0 {
+ isSorted = lessUTF16(prevName, []byte(name))
+ }
+ *members = append(*members, memberName{name, beforeName, afterValue})
+ prevName = name
+ }
+ afterBody := d.InputOffset() // offset before '}'
+ d.ReadToken()
+
+ // Sort the members; return early if it's already sorted.
+ if isSorted {
+ return
+ }
+ // TODO(https://go.dev/issue/47619): Use slices.Sort.
+ sort.Sort(members)
+
+ // Append the reordered members to a new buffer,
+ // then copy the reordered members back over the original members.
+ // Avoid swapping in place since each member may be a different size
+ // where moving a member over a smaller member may corrupt the data
+ // for subsequent members before they have been moved.
+ //
+ // The following invariant must hold:
+ // sum([m.after-m.before for m in members]) == afterBody-beforeBody
+ sorted := (*scratch)[:0]
+ for i, member := range *members {
+ if d.buf[member.before] == ',' {
+ member.before++ // trim leading comma
+ }
+ sorted = append(sorted, d.buf[member.before:member.after]...)
+ if i < len(*members)-1 {
+ sorted = append(sorted, ',') // append trailing comma
+ }
+ }
+ if int(afterBody-beforeBody) != len(sorted) {
+ panic("BUG: length invariant violated")
+ }
+ copy(d.buf[beforeBody:afterBody], sorted)
+
+ // Update scratch buffer to the largest amount ever used.
+ if len(sorted) > len(*scratch) {
+ *scratch = sorted
+ }
+ case '[':
+ for d.PeekKind() != ']' {
+ reorderObjects(d, scratch)
+ }
+ d.ReadToken()
+ }
+}
+
+// lessUTF16 reports whether x is lexicographically less than y according
+// to the UTF-16 codepoints of the UTF-8 encoded input strings.
+// This implements the ordering specified in RFC 8785, section 3.2.3.
+// The inputs must be valid UTF-8, otherwise this may panic.
+func lessUTF16[Bytes []byte | string](x, y Bytes) bool {
+ // NOTE: This is an optimized, allocation-free implementation
+ // of lessUTF16Simple in fuzz_test.go. FuzzLessUTF16 verifies that the
+ // two implementations agree on the result of comparing any two strings.
+
+ isUTF16Self := func(r rune) bool {
+ return ('\u0000' <= r && r <= '\uD7FF') || ('\uE000' <= r && r <= '\uFFFF')
+ }
+
+ var invalidUTF8 bool
+ x0, y0 := x, y
+ for {
+ if len(x) == 0 || len(y) == 0 {
+ if len(x) == len(y) && invalidUTF8 {
+ return string(x0) < string(y0)
+ }
+ return len(x) < len(y)
+ }
+
+ // ASCII fast-path.
+ if x[0] < utf8.RuneSelf || y[0] < utf8.RuneSelf {
+ if x[0] != y[0] {
+ return x[0] < y[0]
+ }
+ x, y = x[1:], y[1:]
+ continue
+ }
+
+ // Decode next pair of runes as UTF-8.
+ // TODO(https://go.dev/issue/56948): Use a generic implementation
+ // of utf8.DecodeRune, or rely on a compiler optimization to statically
+ // hide the cost of a type switch (https://go.dev/issue/57072).
+ var rx, ry rune
+ var nx, ny int
+ switch any(x).(type) {
+ case string:
+ rx, nx = utf8.DecodeRuneInString(string(x))
+ ry, ny = utf8.DecodeRuneInString(string(y))
+ case []byte:
+ rx, nx = utf8.DecodeRune([]byte(x))
+ ry, ny = utf8.DecodeRune([]byte(y))
+ }
+
+ selfx := isUTF16Self(rx)
+ selfy := isUTF16Self(ry)
+ switch {
+ // The x rune is a single UTF-16 codepoint, while
+ // the y rune is a surrogate pair of UTF-16 codepoints.
+ case selfx && !selfy:
+ ry, _ = utf16.EncodeRune(ry)
+ // The y rune is a single UTF-16 codepoint, while
+ // the x rune is a surrogate pair of UTF-16 codepoints.
+ case selfy && !selfx:
+ rx, _ = utf16.EncodeRune(rx)
+ }
+ if rx != ry {
+ return rx < ry
+ }
+ invalidUTF8 = invalidUTF8 || (rx == utf8.RuneError && nx == 1) || (ry == utf8.RuneError && ny == 1)
+ x, y = x[nx:], y[ny:]
+ }
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/schemaconv/openapi.go b/vendor/k8s.io/kube-openapi/pkg/schemaconv/openapi.go
new file mode 100644
index 000000000..61141a500
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/schemaconv/openapi.go
@@ -0,0 +1,260 @@
+/*
+Copyright 2022 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package schemaconv
+
+import (
+ "errors"
+ "path"
+ "strings"
+
+ "k8s.io/kube-openapi/pkg/validation/spec"
+ "sigs.k8s.io/structured-merge-diff/v4/schema"
+)
+
+// ToSchemaFromOpenAPI converts a directory of OpenAPI schemas to an smd Schema.
+// - models: a map from definition name to OpenAPI V3 structural schema for each definition.
+// Key in map is used to resolve references in the schema.
+// - preserveUnknownFields: flag indicating whether unknown fields in all schemas should be preserved.
+// - returns: nil and an error if there is a parse error, or if schema does not satisfy a
+// required structural schema invariant for conversion. If no error, returns
+// a new smd schema.
+//
+// Schema should be validated as structural before using with this function, or
+// there may be information lost.
+func ToSchemaFromOpenAPI(models map[string]*spec.Schema, preserveUnknownFields bool) (*schema.Schema, error) {
+ c := convert{
+ preserveUnknownFields: preserveUnknownFields,
+ output: &schema.Schema{},
+ }
+
+ for name, spec := range models {
+ // Skip/Ignore top-level references
+ if len(spec.Ref.String()) > 0 {
+ continue
+ }
+
+ var a schema.Atom
+
+ // Hard-coded schemas for now as proto_models implementation functions.
+ // https://github.com/kubernetes/kube-openapi/issues/364
+ if name == quantityResource {
+ a = schema.Atom{
+ Scalar: untypedDef.Atom.Scalar,
+ }
+ } else if name == rawExtensionResource {
+ a = untypedDef.Atom
+ } else {
+ c2 := c.push(name, &a)
+ c2.visitSpec(spec)
+ c.pop(c2)
+ }
+
+ c.insertTypeDef(name, a)
+ }
+
+ if len(c.errorMessages) > 0 {
+ return nil, errors.New(strings.Join(c.errorMessages, "\n"))
+ }
+
+ c.addCommonTypes()
+ return c.output, nil
+}
+
+func (c *convert) visitSpec(m *spec.Schema) {
+ // Check if this schema opts its descendants into preserve-unknown-fields
+ if p, ok := m.Extensions["x-kubernetes-preserve-unknown-fields"]; ok && p == true {
+ c.preserveUnknownFields = true
+ }
+ a := c.top()
+ *a = c.parseSchema(m)
+}
+
+func (c *convert) parseSchema(m *spec.Schema) schema.Atom {
+ // k8s-generated OpenAPI specs have historically used only one value for
+ // type and starting with OpenAPIV3 it is only allowed to be
+ // a single string.
+ typ := ""
+ if len(m.Type) > 0 {
+ typ = m.Type[0]
+ }
+
+ // Structural Schemas produced by kubernetes follow very specific rules which
+ // we can use to infer the SMD type:
+ switch typ {
+ case "":
+ // According to Swagger docs:
+ // https://swagger.io/docs/specification/data-models/data-types/#any
+ //
+ // If no type is specified, it is equivalent to accepting any type.
+ return schema.Atom{
+ Scalar: ptr(schema.Scalar("untyped")),
+ List: c.parseList(m),
+ Map: c.parseObject(m),
+ }
+
+ case "object":
+ return schema.Atom{
+ Map: c.parseObject(m),
+ }
+ case "array":
+ return schema.Atom{
+ List: c.parseList(m),
+ }
+ case "integer", "boolean", "number", "string":
+ return convertPrimitive(typ, m.Format)
+ default:
+ c.reportError("unrecognized type: '%v'", typ)
+ return schema.Atom{
+ Scalar: ptr(schema.Scalar("untyped")),
+ }
+ }
+}
+
+func (c *convert) makeOpenAPIRef(specSchema *spec.Schema) schema.TypeRef {
+ refString := specSchema.Ref.String()
+
+ // Special-case handling for $ref stored inside a single-element allOf
+ if len(refString) == 0 && len(specSchema.AllOf) == 1 && len(specSchema.AllOf[0].Ref.String()) > 0 {
+ refString = specSchema.AllOf[0].Ref.String()
+ }
+
+ if _, n := path.Split(refString); len(n) > 0 {
+ //!TODO: Refactor the field ElementRelationship override
+ // we can generate the types with overrides ahead of time rather than
+ // requiring the hacky runtime support
+ // (could just create a normalized key struct containing all customizations
+ // to deduplicate)
+ mapRelationship, err := getMapElementRelationship(specSchema.Extensions)
+ if err != nil {
+ c.reportError(err.Error())
+ }
+
+ if len(mapRelationship) > 0 {
+ return schema.TypeRef{
+ NamedType: &n,
+ ElementRelationship: &mapRelationship,
+ }
+ }
+
+ return schema.TypeRef{
+ NamedType: &n,
+ }
+
+ }
+ var inlined schema.Atom
+
+ // compute the type inline
+ c2 := c.push("inlined in "+c.currentName, &inlined)
+ c2.preserveUnknownFields = c.preserveUnknownFields
+ c2.visitSpec(specSchema)
+ c.pop(c2)
+
+ return schema.TypeRef{
+ Inlined: inlined,
+ }
+}
+
+func (c *convert) parseObject(s *spec.Schema) *schema.Map {
+ var fields []schema.StructField
+ for name, member := range s.Properties {
+ fields = append(fields, schema.StructField{
+ Name: name,
+ Type: c.makeOpenAPIRef(&member),
+ Default: member.Default,
+ })
+ }
+
+ // AdditionalProperties informs the schema of any "unknown" keys
+ // Unknown keys are enforced by the ElementType field.
+ elementType := func() schema.TypeRef {
+ if s.AdditionalProperties == nil {
+ // According to openAPI spec, an object without properties and without
+ // additionalProperties is assumed to be a free-form object.
+ if c.preserveUnknownFields || len(s.Properties) == 0 {
+ return schema.TypeRef{
+ NamedType: &deducedName,
+ }
+ }
+
+ // If properties are specified, do not implicitly allow unknown
+ // fields
+ return schema.TypeRef{}
+ } else if s.AdditionalProperties.Schema != nil {
+ // Unknown fields use the referred schema
+ return c.makeOpenAPIRef(s.AdditionalProperties.Schema)
+
+ } else if s.AdditionalProperties.Allows {
+ // A boolean instead of a schema was provided. Deduce the
+ // type from the value provided at runtime.
+ return schema.TypeRef{
+ NamedType: &deducedName,
+ }
+ } else {
+ // Additional Properties are explicitly disallowed by the user.
+ // Ensure element type is empty.
+ return schema.TypeRef{}
+ }
+ }()
+
+ relationship, err := getMapElementRelationship(s.Extensions)
+ if err != nil {
+ c.reportError(err.Error())
+ }
+
+ return &schema.Map{
+ Fields: fields,
+ ElementRelationship: relationship,
+ ElementType: elementType,
+ }
+}
+
+func (c *convert) parseList(s *spec.Schema) *schema.List {
+ relationship, mapKeys, err := getListElementRelationship(s.Extensions)
+ if err != nil {
+ c.reportError(err.Error())
+ }
+ elementType := func() schema.TypeRef {
+ if s.Items != nil {
+ if s.Items.Schema == nil || s.Items.Len() != 1 {
+ c.reportError("structural schema arrays must have exactly one member subtype")
+ return schema.TypeRef{
+ NamedType: &deducedName,
+ }
+ }
+
+ subSchema := s.Items.Schema
+ if subSchema == nil {
+ subSchema = &s.Items.Schemas[0]
+ }
+ return c.makeOpenAPIRef(subSchema)
+ } else if len(s.Type) > 0 && len(s.Type[0]) > 0 {
+ c.reportError("`items` must be specified on arrays")
+ }
+
+ // A list with no items specified is treated as "untyped".
+ return schema.TypeRef{
+ NamedType: &untypedName,
+ }
+
+ }()
+
+ return &schema.List{
+ ElementRelationship: relationship,
+ Keys: mapKeys,
+ ElementType: elementType,
+ }
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/schemaconv/proto_models.go b/vendor/k8s.io/kube-openapi/pkg/schemaconv/proto_models.go
new file mode 100644
index 000000000..2c6fd76a9
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/schemaconv/proto_models.go
@@ -0,0 +1,178 @@
+/*
+Copyright 2022 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package schemaconv
+
+import (
+ "errors"
+ "path"
+ "strings"
+
+ "k8s.io/kube-openapi/pkg/util/proto"
+ "sigs.k8s.io/structured-merge-diff/v4/schema"
+)
+
+// ToSchema converts openapi definitions into a schema suitable for structured
+// merge (i.e. kubectl apply v2).
+func ToSchema(models proto.Models) (*schema.Schema, error) {
+ return ToSchemaWithPreserveUnknownFields(models, false)
+}
+
+// ToSchemaWithPreserveUnknownFields converts openapi definitions into a schema suitable for structured
+// merge (i.e. kubectl apply v2), it will preserve unknown fields if specified.
+func ToSchemaWithPreserveUnknownFields(models proto.Models, preserveUnknownFields bool) (*schema.Schema, error) {
+ c := convert{
+ preserveUnknownFields: preserveUnknownFields,
+ output: &schema.Schema{},
+ }
+ for _, name := range models.ListModels() {
+ model := models.LookupModel(name)
+
+ var a schema.Atom
+ c2 := c.push(name, &a)
+ model.Accept(c2)
+ c.pop(c2)
+
+ c.insertTypeDef(name, a)
+ }
+
+ if len(c.errorMessages) > 0 {
+ return nil, errors.New(strings.Join(c.errorMessages, "\n"))
+ }
+
+ c.addCommonTypes()
+ return c.output, nil
+}
+
+func (c *convert) makeRef(model proto.Schema, preserveUnknownFields bool) schema.TypeRef {
+ var tr schema.TypeRef
+ if r, ok := model.(*proto.Ref); ok {
+ if r.Reference() == "io.k8s.apimachinery.pkg.runtime.RawExtension" {
+ return schema.TypeRef{
+ NamedType: &untypedName,
+ }
+ }
+ // reference a named type
+ _, n := path.Split(r.Reference())
+ tr.NamedType = &n
+
+ mapRelationship, err := getMapElementRelationship(model.GetExtensions())
+
+ if err != nil {
+ c.reportError(err.Error())
+ }
+
+ // empty string means unset.
+ if len(mapRelationship) > 0 {
+ tr.ElementRelationship = &mapRelationship
+ }
+ } else {
+ // compute the type inline
+ c2 := c.push("inlined in "+c.currentName, &tr.Inlined)
+ c2.preserveUnknownFields = preserveUnknownFields
+ model.Accept(c2)
+ c.pop(c2)
+
+ if tr == (schema.TypeRef{}) {
+ // emit warning?
+ tr.NamedType = &untypedName
+ }
+ }
+ return tr
+}
+
+func (c *convert) VisitKind(k *proto.Kind) {
+ preserveUnknownFields := c.preserveUnknownFields
+ if p, ok := k.GetExtensions()["x-kubernetes-preserve-unknown-fields"]; ok && p == true {
+ preserveUnknownFields = true
+ }
+
+ a := c.top()
+ a.Map = &schema.Map{}
+ for _, name := range k.FieldOrder {
+ member := k.Fields[name]
+ tr := c.makeRef(member, preserveUnknownFields)
+ a.Map.Fields = append(a.Map.Fields, schema.StructField{
+ Name: name,
+ Type: tr,
+ Default: member.GetDefault(),
+ })
+ }
+
+ unions, err := makeUnions(k.GetExtensions())
+ if err != nil {
+ c.reportError(err.Error())
+ return
+ }
+ // TODO: We should check that the fields and discriminator
+ // specified in the union are actual fields in the struct.
+ a.Map.Unions = unions
+
+ if preserveUnknownFields {
+ a.Map.ElementType = schema.TypeRef{
+ NamedType: &deducedName,
+ }
+ }
+
+ a.Map.ElementRelationship, err = getMapElementRelationship(k.GetExtensions())
+ if err != nil {
+ c.reportError(err.Error())
+ }
+}
+
+func (c *convert) VisitArray(a *proto.Array) {
+ relationship, mapKeys, err := getListElementRelationship(a.GetExtensions())
+ if err != nil {
+ c.reportError(err.Error())
+ }
+
+ atom := c.top()
+ atom.List = &schema.List{
+ ElementType: c.makeRef(a.SubType, c.preserveUnknownFields),
+ ElementRelationship: relationship,
+ Keys: mapKeys,
+ }
+}
+
+func (c *convert) VisitMap(m *proto.Map) {
+ relationship, err := getMapElementRelationship(m.GetExtensions())
+ if err != nil {
+ c.reportError(err.Error())
+ }
+
+ a := c.top()
+ a.Map = &schema.Map{
+ ElementType: c.makeRef(m.SubType, c.preserveUnknownFields),
+ ElementRelationship: relationship,
+ }
+}
+
+func (c *convert) VisitPrimitive(p *proto.Primitive) {
+ a := c.top()
+ if c.currentName == quantityResource {
+ a.Scalar = ptr(schema.Scalar("untyped"))
+ } else {
+ *a = convertPrimitive(p.Type, p.Format)
+ }
+}
+
+func (c *convert) VisitArbitrary(a *proto.Arbitrary) {
+ *c.top() = deducedDef.Atom
+}
+
+func (c *convert) VisitReference(proto.Reference) {
+ // Do nothing, we handle references specially
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/schemaconv/smd.go b/vendor/k8s.io/kube-openapi/pkg/schemaconv/smd.go
index 35241fde6..9887d185b 100644
--- a/vendor/k8s.io/kube-openapi/pkg/schemaconv/smd.go
+++ b/vendor/k8s.io/kube-openapi/pkg/schemaconv/smd.go
@@ -17,43 +17,18 @@ limitations under the License.
package schemaconv
import (
- "errors"
"fmt"
- "path"
"sort"
- "strings"
- "k8s.io/kube-openapi/pkg/util/proto"
"sigs.k8s.io/structured-merge-diff/v4/schema"
)
const (
- quantityResource = "io.k8s.apimachinery.pkg.api.resource.Quantity"
+ quantityResource = "io.k8s.apimachinery.pkg.api.resource.Quantity"
+ rawExtensionResource = "io.k8s.apimachinery.pkg.runtime.RawExtension"
)
-// ToSchema converts openapi definitions into a schema suitable for structured
-// merge (i.e. kubectl apply v2).
-func ToSchema(models proto.Models) (*schema.Schema, error) {
- return ToSchemaWithPreserveUnknownFields(models, false)
-}
-
-// ToSchemaWithPreserveUnknownFields converts openapi definitions into a schema suitable for structured
-// merge (i.e. kubectl apply v2), it will preserve unknown fields if specified.
-func ToSchemaWithPreserveUnknownFields(models proto.Models, preserveUnknownFields bool) (*schema.Schema, error) {
- c := convert{
- input: models,
- preserveUnknownFields: preserveUnknownFields,
- output: &schema.Schema{},
- }
- if err := c.convertAll(); err != nil {
- return nil, err
- }
- c.addCommonTypes()
- return c.output, nil
-}
-
type convert struct {
- input proto.Models
preserveUnknownFields bool
output *schema.Schema
@@ -64,7 +39,6 @@ type convert struct {
func (c *convert) push(name string, a *schema.Atom) *convert {
return &convert{
- input: c.input,
preserveUnknownFields: c.preserveUnknownFields,
output: c.output,
currentName: name,
@@ -78,30 +52,17 @@ func (c *convert) pop(c2 *convert) {
c.errorMessages = append(c.errorMessages, c2.errorMessages...)
}
-func (c *convert) convertAll() error {
- for _, name := range c.input.ListModels() {
- model := c.input.LookupModel(name)
- c.insertTypeDef(name, model)
- }
- if len(c.errorMessages) > 0 {
- return errors.New(strings.Join(c.errorMessages, "\n"))
- }
- return nil
-}
-
func (c *convert) reportError(format string, args ...interface{}) {
c.errorMessages = append(c.errorMessages,
c.currentName+": "+fmt.Sprintf(format, args...),
)
}
-func (c *convert) insertTypeDef(name string, model proto.Schema) {
+func (c *convert) insertTypeDef(name string, atom schema.Atom) {
def := schema.TypeDef{
Name: name,
+ Atom: atom,
}
- c2 := c.push(name, &def.Atom)
- model.Accept(c2)
- c.pop(c2)
if def.Atom == (schema.Atom{}) {
// This could happen if there were a top-level reference.
return
@@ -156,32 +117,6 @@ var deducedDef schema.TypeDef = schema.TypeDef{
},
}
-func (c *convert) makeRef(model proto.Schema, preserveUnknownFields bool) schema.TypeRef {
- var tr schema.TypeRef
- if r, ok := model.(*proto.Ref); ok {
- if r.Reference() == "io.k8s.apimachinery.pkg.runtime.RawExtension" {
- return schema.TypeRef{
- NamedType: &untypedName,
- }
- }
- // reference a named type
- _, n := path.Split(r.Reference())
- tr.NamedType = &n
- } else {
- // compute the type inline
- c2 := c.push("inlined in "+c.currentName, &tr.Inlined)
- c2.preserveUnknownFields = preserveUnknownFields
- model.Accept(c2)
- c.pop(c2)
-
- if tr == (schema.TypeRef{}) {
- // emit warning?
- tr.NamedType = &untypedName
- }
- }
- return tr
-}
-
func makeUnions(extensions map[string]interface{}) ([]schema.Union, error) {
schemaUnions := []schema.Union{}
if iunions, ok := extensions["x-kubernetes-unions"]; ok {
@@ -279,58 +214,9 @@ func makeUnion(extensions map[string]interface{}) (schema.Union, error) {
}
}
- if union.Discriminator != nil && len(union.Fields) == 0 {
- return schema.Union{}, fmt.Errorf("discriminator set to %v, but no fields in union", *union.Discriminator)
- }
return union, nil
}
-func (c *convert) VisitKind(k *proto.Kind) {
- preserveUnknownFields := c.preserveUnknownFields
- if p, ok := k.GetExtensions()["x-kubernetes-preserve-unknown-fields"]; ok && p == true {
- preserveUnknownFields = true
- }
-
- a := c.top()
- a.Map = &schema.Map{}
- for _, name := range k.FieldOrder {
- member := k.Fields[name]
- tr := c.makeRef(member, preserveUnknownFields)
- a.Map.Fields = append(a.Map.Fields, schema.StructField{
- Name: name,
- Type: tr,
- Default: member.GetDefault(),
- })
- }
-
- unions, err := makeUnions(k.GetExtensions())
- if err != nil {
- c.reportError(err.Error())
- return
- }
- // TODO: We should check that the fields and discriminator
- // specified in the union are actual fields in the struct.
- a.Map.Unions = unions
-
- if preserveUnknownFields {
- a.Map.ElementType = schema.TypeRef{
- NamedType: &deducedName,
- }
- }
-
- ext := k.GetExtensions()
- if val, ok := ext["x-kubernetes-map-type"]; ok {
- switch val {
- case "atomic":
- a.Map.ElementRelationship = schema.Atomic
- case "granular":
- a.Map.ElementRelationship = schema.Separable
- default:
- c.reportError("unknown map type %v", val)
- }
- }
-}
-
func toStringSlice(o interface{}) (out []string, ok bool) {
switch t := o.(type) {
case []interface{}:
@@ -341,117 +227,108 @@ func toStringSlice(o interface{}) (out []string, ok bool) {
}
}
return out, true
+ case []string:
+ return t, true
}
return nil, false
}
-func (c *convert) VisitArray(a *proto.Array) {
- atom := c.top()
- atom.List = &schema.List{
- ElementRelationship: schema.Atomic,
- }
- l := atom.List
- l.ElementType = c.makeRef(a.SubType, c.preserveUnknownFields)
-
- ext := a.GetExtensions()
+func ptr(s schema.Scalar) *schema.Scalar { return &s }
- if val, ok := ext["x-kubernetes-list-type"]; ok {
- if val == "atomic" {
- l.ElementRelationship = schema.Atomic
- } else if val == "set" {
- l.ElementRelationship = schema.Associative
- } else if val == "map" {
- l.ElementRelationship = schema.Associative
- if keys, ok := ext["x-kubernetes-list-map-keys"]; ok {
- if keyNames, ok := toStringSlice(keys); ok {
- l.Keys = keyNames
- } else {
- c.reportError("uninterpreted map keys: %#v", keys)
- }
- } else {
- c.reportError("missing map keys")
- }
- } else {
- c.reportError("unknown list type %v", val)
- l.ElementRelationship = schema.Atomic
- }
- } else if val, ok := ext["x-kubernetes-patch-strategy"]; ok {
- if val == "merge" || val == "merge,retainKeys" {
- l.ElementRelationship = schema.Associative
- if key, ok := ext["x-kubernetes-patch-merge-key"]; ok {
- if keyName, ok := key.(string); ok {
- l.Keys = []string{keyName}
- } else {
- c.reportError("uninterpreted merge key: %#v", key)
- }
- } else {
- // It's not an error for this to be absent, it
- // means it's a set.
- }
- } else if val == "retainKeys" {
- } else {
- c.reportError("unknown patch strategy %v", val)
- l.ElementRelationship = schema.Atomic
+// Basic conversion functions to convert OpenAPI schema definitions to
+// SMD Schema atoms
+func convertPrimitive(typ string, format string) (a schema.Atom) {
+ switch typ {
+ case "integer":
+ a.Scalar = ptr(schema.Numeric)
+ case "number":
+ a.Scalar = ptr(schema.Numeric)
+ case "string":
+ switch format {
+ case "":
+ a.Scalar = ptr(schema.String)
+ case "byte":
+ // byte really means []byte and is encoded as a string.
+ a.Scalar = ptr(schema.String)
+ case "int-or-string":
+ a.Scalar = ptr(schema.Scalar("untyped"))
+ case "date-time":
+ a.Scalar = ptr(schema.Scalar("untyped"))
+ default:
+ a.Scalar = ptr(schema.Scalar("untyped"))
}
+ case "boolean":
+ a.Scalar = ptr(schema.Boolean)
+ default:
+ a.Scalar = ptr(schema.Scalar("untyped"))
}
-}
-func (c *convert) VisitMap(m *proto.Map) {
- a := c.top()
- a.Map = &schema.Map{}
- a.Map.ElementType = c.makeRef(m.SubType, c.preserveUnknownFields)
+ return a
+}
- ext := m.GetExtensions()
- if val, ok := ext["x-kubernetes-map-type"]; ok {
+func getListElementRelationship(ext map[string]any) (schema.ElementRelationship, []string, error) {
+ if val, ok := ext["x-kubernetes-list-type"]; ok {
switch val {
case "atomic":
- a.Map.ElementRelationship = schema.Atomic
- case "granular":
- a.Map.ElementRelationship = schema.Separable
+ return schema.Atomic, nil, nil
+ case "set":
+ return schema.Associative, nil, nil
+ case "map":
+ keys, ok := ext["x-kubernetes-list-map-keys"]
+
+ if !ok {
+ return schema.Associative, nil, fmt.Errorf("missing map keys")
+ }
+
+ keyNames, ok := toStringSlice(keys)
+ if !ok {
+ return schema.Associative, nil, fmt.Errorf("uninterpreted map keys: %#v", keys)
+ }
+
+ return schema.Associative, keyNames, nil
default:
- c.reportError("unknown map type %v", val)
+ return schema.Atomic, nil, fmt.Errorf("unknown list type %v", val)
}
- }
-}
+ } else if val, ok := ext["x-kubernetes-patch-strategy"]; ok {
+ switch val {
+ case "merge", "merge,retainKeys":
+ if key, ok := ext["x-kubernetes-patch-merge-key"]; ok {
+ keyName, ok := key.(string)
-func ptr(s schema.Scalar) *schema.Scalar { return &s }
+ if !ok {
+ return schema.Associative, nil, fmt.Errorf("uninterpreted merge key: %#v", key)
+ }
-func (c *convert) VisitPrimitive(p *proto.Primitive) {
- a := c.top()
- if c.currentName == quantityResource {
- a.Scalar = ptr(schema.Scalar("untyped"))
- } else {
- switch p.Type {
- case proto.Integer:
- a.Scalar = ptr(schema.Numeric)
- case proto.Number:
- a.Scalar = ptr(schema.Numeric)
- case proto.String:
- switch p.Format {
- case "":
- a.Scalar = ptr(schema.String)
- case "byte":
- // byte really means []byte and is encoded as a string.
- a.Scalar = ptr(schema.String)
- case "int-or-string":
- a.Scalar = ptr(schema.Scalar("untyped"))
- case "date-time":
- a.Scalar = ptr(schema.Scalar("untyped"))
- default:
- a.Scalar = ptr(schema.Scalar("untyped"))
+ return schema.Associative, []string{keyName}, nil
}
- case proto.Boolean:
- a.Scalar = ptr(schema.Boolean)
+ // It's not an error for x-kubernetes-patch-merge-key to be absent,
+ // it means it's a set
+ return schema.Associative, nil, nil
+ case "retainKeys":
+ return schema.Atomic, nil, nil
default:
- a.Scalar = ptr(schema.Scalar("untyped"))
+ return schema.Atomic, nil, fmt.Errorf("unknown patch strategy %v", val)
}
}
-}
-func (c *convert) VisitArbitrary(a *proto.Arbitrary) {
- *c.top() = deducedDef.Atom
+ // Treat as atomic by default
+ return schema.Atomic, nil, nil
}
-func (c *convert) VisitReference(proto.Reference) {
- // Do nothing, we handle references specially
+// Returns map element relationship if specified, or empty string if unspecified
+func getMapElementRelationship(ext map[string]any) (schema.ElementRelationship, error) {
+ val, ok := ext["x-kubernetes-map-type"]
+ if !ok {
+ // unset Map element relationship
+ return "", nil
+ }
+
+ switch val {
+ case "atomic":
+ return schema.Atomic, nil
+ case "granular":
+ return schema.Separable, nil
+ default:
+ return "", fmt.Errorf("unknown map type %v", val)
+ }
}
diff --git a/vendor/k8s.io/kube-openapi/pkg/util/proto/document.go b/vendor/k8s.io/kube-openapi/pkg/util/proto/document.go
index 4abcf9b82..5789e67ab 100644
--- a/vendor/k8s.io/kube-openapi/pkg/util/proto/document.go
+++ b/vendor/k8s.io/kube-openapi/pkg/util/proto/document.go
@@ -21,7 +21,7 @@ import (
"sort"
"strings"
- openapi_v2 "github.com/googleapis/gnostic/openapiv2"
+ openapi_v2 "github.com/google/gnostic-models/openapiv2"
"gopkg.in/yaml.v2"
)
diff --git a/vendor/k8s.io/kube-openapi/pkg/util/proto/document_v3.go b/vendor/k8s.io/kube-openapi/pkg/util/proto/document_v3.go
new file mode 100644
index 000000000..d9f2896e3
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/util/proto/document_v3.go
@@ -0,0 +1,324 @@
+/*
+Copyright 2022 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package proto
+
+import (
+ "fmt"
+ "reflect"
+ "strings"
+
+ openapi_v3 "github.com/google/gnostic-models/openapiv3"
+ "gopkg.in/yaml.v3"
+)
+
+// Temporary parse implementation to be used until gnostic->kube-openapi conversion
+// is possible.
+func NewOpenAPIV3Data(doc *openapi_v3.Document) (Models, error) {
+ definitions := Definitions{
+ models: map[string]Schema{},
+ }
+
+ schemas := doc.GetComponents().GetSchemas()
+ if schemas == nil {
+ return &definitions, nil
+ }
+
+ // Save the list of all models first. This will allow us to
+ // validate that we don't have any dangling reference.
+ for _, namedSchema := range schemas.GetAdditionalProperties() {
+ definitions.models[namedSchema.GetName()] = nil
+ }
+
+ // Now, parse each model. We can validate that references exists.
+ for _, namedSchema := range schemas.GetAdditionalProperties() {
+ path := NewPath(namedSchema.GetName())
+ val := namedSchema.GetValue()
+
+ if val == nil {
+ continue
+ }
+
+ if schema, err := definitions.ParseV3SchemaOrReference(namedSchema.GetValue(), &path); err != nil {
+ return nil, err
+ } else if schema != nil {
+ // Schema may be nil if we hit incompleteness in the conversion,
+ // but not a fatal error
+ definitions.models[namedSchema.GetName()] = schema
+ }
+ }
+
+ return &definitions, nil
+}
+
+func (d *Definitions) ParseV3SchemaReference(s *openapi_v3.Reference, path *Path) (Schema, error) {
+ base := &BaseSchema{
+ Description: s.Description,
+ }
+
+ if !strings.HasPrefix(s.GetXRef(), "#/components/schemas") {
+ // Only resolve references to components/schemas. We may add support
+ // later for other in-spec paths, but otherwise treat unrecognized
+ // refs as arbitrary/unknown values.
+ return &Arbitrary{
+ BaseSchema: *base,
+ }, nil
+ }
+
+ reference := strings.TrimPrefix(s.GetXRef(), "#/components/schemas/")
+ if _, ok := d.models[reference]; !ok {
+ return nil, newSchemaError(path, "unknown model in reference: %q", reference)
+ }
+
+ return &Ref{
+ BaseSchema: BaseSchema{
+ Description: s.Description,
+ },
+ reference: reference,
+ definitions: d,
+ }, nil
+}
+
+func (d *Definitions) ParseV3SchemaOrReference(s *openapi_v3.SchemaOrReference, path *Path) (Schema, error) {
+ var schema Schema
+ var err error
+
+ switch v := s.GetOneof().(type) {
+ case *openapi_v3.SchemaOrReference_Reference:
+ // Any references stored in #!/components/... are bound to refer
+ // to external documents. This API does not support such a
+ // feature.
+ //
+ // In the weird case that this is a reference to a schema that is
+ // not external, we attempt to parse anyway
+ schema, err = d.ParseV3SchemaReference(v.Reference, path)
+ case *openapi_v3.SchemaOrReference_Schema:
+ schema, err = d.ParseSchemaV3(v.Schema, path)
+ default:
+ panic("unexpected type")
+ }
+
+ return schema, err
+}
+
+// ParseSchema creates a walkable Schema from an openapi v3 schema. While
+// this function is public, it doesn't leak through the interface.
+func (d *Definitions) ParseSchemaV3(s *openapi_v3.Schema, path *Path) (Schema, error) {
+ switch s.GetType() {
+ case object:
+ for _, extension := range s.GetSpecificationExtension() {
+ if extension.Name == "x-kubernetes-group-version-kind" {
+ // Objects with x-kubernetes-group-version-kind are always top
+ // level types.
+ return d.parseV3Kind(s, path)
+ }
+ }
+
+ if len(s.GetProperties().GetAdditionalProperties()) > 0 {
+ return d.parseV3Kind(s, path)
+ }
+ return d.parseV3Map(s, path)
+ case array:
+ return d.parseV3Array(s, path)
+ case String, Number, Integer, Boolean:
+ return d.parseV3Primitive(s, path)
+ default:
+ return d.parseV3Arbitrary(s, path)
+ }
+}
+
+func (d *Definitions) parseV3Kind(s *openapi_v3.Schema, path *Path) (Schema, error) {
+ if s.GetType() != object {
+ return nil, newSchemaError(path, "invalid object type")
+ } else if s.GetProperties() == nil {
+ return nil, newSchemaError(path, "object doesn't have properties")
+ }
+
+ fields := map[string]Schema{}
+ fieldOrder := []string{}
+
+ for _, namedSchema := range s.GetProperties().GetAdditionalProperties() {
+ var err error
+ name := namedSchema.GetName()
+ path := path.FieldPath(name)
+ fields[name], err = d.ParseV3SchemaOrReference(namedSchema.GetValue(), &path)
+ if err != nil {
+ return nil, err
+ }
+ fieldOrder = append(fieldOrder, name)
+ }
+
+ base, err := d.parseV3BaseSchema(s, path)
+ if err != nil {
+ return nil, err
+ }
+
+ return &Kind{
+ BaseSchema: *base,
+ RequiredFields: s.GetRequired(),
+ Fields: fields,
+ FieldOrder: fieldOrder,
+ }, nil
+}
+
+func (d *Definitions) parseV3Arbitrary(s *openapi_v3.Schema, path *Path) (Schema, error) {
+ base, err := d.parseV3BaseSchema(s, path)
+ if err != nil {
+ return nil, err
+ }
+ return &Arbitrary{
+ BaseSchema: *base,
+ }, nil
+}
+
+func (d *Definitions) parseV3Primitive(s *openapi_v3.Schema, path *Path) (Schema, error) {
+ switch s.GetType() {
+ case String: // do nothing
+ case Number: // do nothing
+ case Integer: // do nothing
+ case Boolean: // do nothing
+ default:
+ // Unsupported primitive type. Treat as arbitrary type
+ return d.parseV3Arbitrary(s, path)
+ }
+
+ base, err := d.parseV3BaseSchema(s, path)
+ if err != nil {
+ return nil, err
+ }
+
+ return &Primitive{
+ BaseSchema: *base,
+ Type: s.GetType(),
+ Format: s.GetFormat(),
+ }, nil
+}
+
+func (d *Definitions) parseV3Array(s *openapi_v3.Schema, path *Path) (Schema, error) {
+ if s.GetType() != array {
+ return nil, newSchemaError(path, `array should have type "array"`)
+ } else if len(s.GetItems().GetSchemaOrReference()) != 1 {
+ // This array can have multiple types in it (or no types at all)
+ // This is not supported by this conversion.
+ // Just return an arbitrary type
+ return d.parseV3Arbitrary(s, path)
+ }
+
+ sub, err := d.ParseV3SchemaOrReference(s.GetItems().GetSchemaOrReference()[0], path)
+ if err != nil {
+ return nil, err
+ }
+
+ base, err := d.parseV3BaseSchema(s, path)
+ if err != nil {
+ return nil, err
+ }
+ return &Array{
+ BaseSchema: *base,
+ SubType: sub,
+ }, nil
+}
+
+// We believe the schema is a map, verify and return a new schema
+func (d *Definitions) parseV3Map(s *openapi_v3.Schema, path *Path) (Schema, error) {
+ if s.GetType() != object {
+ return nil, newSchemaError(path, "invalid object type")
+ }
+ var sub Schema
+
+ switch p := s.GetAdditionalProperties().GetOneof().(type) {
+ case *openapi_v3.AdditionalPropertiesItem_Boolean:
+ // What does this boolean even mean?
+ base, err := d.parseV3BaseSchema(s, path)
+ if err != nil {
+ return nil, err
+ }
+ sub = &Arbitrary{
+ BaseSchema: *base,
+ }
+ case *openapi_v3.AdditionalPropertiesItem_SchemaOrReference:
+ if schema, err := d.ParseV3SchemaOrReference(p.SchemaOrReference, path); err != nil {
+ return nil, err
+ } else {
+ sub = schema
+ }
+ case nil:
+ // no subtype?
+ sub = &Arbitrary{}
+ default:
+ panic("unrecognized type " + reflect.TypeOf(p).Name())
+ }
+
+ base, err := d.parseV3BaseSchema(s, path)
+ if err != nil {
+ return nil, err
+ }
+ return &Map{
+ BaseSchema: *base,
+ SubType: sub,
+ }, nil
+}
+
+func parseV3Interface(def *yaml.Node) (interface{}, error) {
+ if def == nil {
+ return nil, nil
+ }
+ var i interface{}
+ if err := def.Decode(&i); err != nil {
+ return nil, err
+ }
+ return i, nil
+}
+
+func (d *Definitions) parseV3BaseSchema(s *openapi_v3.Schema, path *Path) (*BaseSchema, error) {
+ if s == nil {
+ return nil, fmt.Errorf("cannot initialize BaseSchema from nil")
+ }
+
+ def, err := parseV3Interface(s.GetDefault().ToRawInfo())
+ if err != nil {
+ return nil, err
+ }
+
+ return &BaseSchema{
+ Description: s.GetDescription(),
+ Default: def,
+ Extensions: SpecificationExtensionToMap(s.GetSpecificationExtension()),
+ Path: *path,
+ }, nil
+}
+
+func SpecificationExtensionToMap(e []*openapi_v3.NamedAny) map[string]interface{} {
+ values := map[string]interface{}{}
+
+ for _, na := range e {
+ if na.GetName() == "" || na.GetValue() == nil {
+ continue
+ }
+ if na.GetValue().GetYaml() == "" {
+ continue
+ }
+ var value interface{}
+ err := yaml.Unmarshal([]byte(na.GetValue().GetYaml()), &value)
+ if err != nil {
+ continue
+ }
+
+ values[na.GetName()] = value
+ }
+
+ return values
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/.gitignore b/vendor/k8s.io/kube-openapi/pkg/validation/spec/.gitignore
new file mode 100644
index 000000000..dd91ed6a0
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/.gitignore
@@ -0,0 +1,2 @@
+secrets.yml
+coverage.out
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/LICENSE b/vendor/k8s.io/kube-openapi/pkg/validation/spec/LICENSE
new file mode 100644
index 000000000..d64569567
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/contact_info.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/contact_info.go
new file mode 100644
index 000000000..f285970aa
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/contact_info.go
@@ -0,0 +1,24 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package spec
+
+// ContactInfo contact information for the exposed API.
+//
+// For more information: http://goo.gl/8us55a#contactObject
+type ContactInfo struct {
+ Name string `json:"name,omitempty"`
+ URL string `json:"url,omitempty"`
+ Email string `json:"email,omitempty"`
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/external_docs.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/external_docs.go
new file mode 100644
index 000000000..88add91b2
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/external_docs.go
@@ -0,0 +1,24 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package spec
+
+// ExternalDocumentation allows referencing an external resource for
+// extended documentation.
+//
+// For more information: http://goo.gl/8us55a#externalDocumentationObject
+type ExternalDocumentation struct {
+ Description string `json:"description,omitempty"`
+ URL string `json:"url,omitempty"`
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/gnostic.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/gnostic.go
new file mode 100644
index 000000000..6a77f2ac8
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/gnostic.go
@@ -0,0 +1,1517 @@
+/*
+Copyright 2022 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package spec
+
+import (
+ "errors"
+ "strconv"
+
+ "github.com/go-openapi/jsonreference"
+ openapi_v2 "github.com/google/gnostic-models/openapiv2"
+)
+
+// Interfaces
+type GnosticCommonValidations interface {
+ GetMaximum() float64
+ GetExclusiveMaximum() bool
+ GetMinimum() float64
+ GetExclusiveMinimum() bool
+ GetMaxLength() int64
+ GetMinLength() int64
+ GetPattern() string
+ GetMaxItems() int64
+ GetMinItems() int64
+ GetUniqueItems() bool
+ GetMultipleOf() float64
+ GetEnum() []*openapi_v2.Any
+}
+
+func (k *CommonValidations) FromGnostic(g GnosticCommonValidations) error {
+ if g == nil {
+ return nil
+ }
+
+ max := g.GetMaximum()
+ if max != 0 {
+ k.Maximum = &max
+ }
+
+ k.ExclusiveMaximum = g.GetExclusiveMaximum()
+
+ min := g.GetMinimum()
+ if min != 0 {
+ k.Minimum = &min
+ }
+
+ k.ExclusiveMinimum = g.GetExclusiveMinimum()
+
+ maxLen := g.GetMaxLength()
+ if maxLen != 0 {
+ k.MaxLength = &maxLen
+ }
+
+ minLen := g.GetMinLength()
+ if minLen != 0 {
+ k.MinLength = &minLen
+ }
+
+ k.Pattern = g.GetPattern()
+
+ maxItems := g.GetMaxItems()
+ if maxItems != 0 {
+ k.MaxItems = &maxItems
+ }
+
+ minItems := g.GetMinItems()
+ if minItems != 0 {
+ k.MinItems = &minItems
+ }
+
+ k.UniqueItems = g.GetUniqueItems()
+
+ multOf := g.GetMultipleOf()
+ if multOf != 0 {
+ k.MultipleOf = &multOf
+ }
+
+ enums := g.GetEnum()
+
+ if enums != nil {
+ k.Enum = make([]interface{}, len(enums))
+ for i, v := range enums {
+ if v == nil {
+ continue
+ }
+
+ var convert interface{}
+ if err := v.ToRawInfo().Decode(&convert); err != nil {
+ return err
+ } else {
+ k.Enum[i] = convert
+ }
+ }
+ }
+
+ return nil
+}
+
+type GnosticSimpleSchema interface {
+ GetType() string
+ GetFormat() string
+ GetItems() *openapi_v2.PrimitivesItems
+ GetCollectionFormat() string
+ GetDefault() *openapi_v2.Any
+}
+
+func (k *SimpleSchema) FromGnostic(g GnosticSimpleSchema) error {
+ if g == nil {
+ return nil
+ }
+
+ k.Type = g.GetType()
+ k.Format = g.GetFormat()
+ k.CollectionFormat = g.GetCollectionFormat()
+
+ items := g.GetItems()
+ if items != nil {
+ k.Items = &Items{}
+ if err := k.Items.FromGnostic(items); err != nil {
+ return err
+ }
+ }
+
+ def := g.GetDefault()
+ if def != nil {
+ var convert interface{}
+ if err := def.ToRawInfo().Decode(&convert); err != nil {
+ return err
+ } else {
+ k.Default = convert
+ }
+ }
+
+ return nil
+}
+
+func (k *Items) FromGnostic(g *openapi_v2.PrimitivesItems) error {
+ if g == nil {
+ return nil
+ }
+
+ if err := k.SimpleSchema.FromGnostic(g); err != nil {
+ return err
+ }
+
+ if err := k.CommonValidations.FromGnostic(g); err != nil {
+ return err
+ }
+
+ if err := k.VendorExtensible.FromGnostic(g.VendorExtension); err != nil {
+ return err
+ }
+
+ return nil
+}
+
+func (k *VendorExtensible) FromGnostic(g []*openapi_v2.NamedAny) error {
+ if len(g) == 0 {
+ return nil
+ }
+
+ k.Extensions = make(Extensions, len(g))
+ for _, v := range g {
+ if v == nil {
+ continue
+ }
+
+ if v.Value == nil {
+ k.Extensions[v.Name] = nil
+ continue
+ }
+
+ var iface interface{}
+ if err := v.Value.ToRawInfo().Decode(&iface); err != nil {
+ return err
+ } else {
+ k.Extensions[v.Name] = iface
+ }
+ }
+ return nil
+}
+
+func (k *Refable) FromGnostic(g string) error {
+ return k.Ref.FromGnostic(g)
+}
+
+func (k *Ref) FromGnostic(g string) error {
+ if g == "" {
+ return nil
+ }
+
+ ref, err := jsonreference.New(g)
+ if err != nil {
+ return err
+ }
+
+ *k = Ref{
+ Ref: ref,
+ }
+
+ return nil
+}
+
+// Converts a gnostic v2 Document to a kube-openapi Swagger Document
+//
+// Caveats:
+//
+// - gnostic v2 documents treats zero as unspecified for numerical fields of
+// CommonValidations fields such as Maximum, Minimum, MaximumItems, etc.
+// There will always be data loss if one of the values of these fields is set to zero.
+//
+// Returns:
+//
+// - `ok`: `false` if a value was present in the gnostic document which cannot be
+// roundtripped into kube-openapi types. In these instances, `ok` is set to
+// `false` and the value is skipped.
+//
+// - `err`: an unexpected error occurred in the conversion from the gnostic type
+// to kube-openapi type.
+func (k *Swagger) FromGnostic(g *openapi_v2.Document) (ok bool, err error) {
+ ok = true
+ if g == nil {
+ return true, nil
+ }
+
+ if err := k.VendorExtensible.FromGnostic(g.VendorExtension); err != nil {
+ return false, err
+ }
+
+ if nok, err := k.SwaggerProps.FromGnostic(g); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+
+ return ok, nil
+}
+
+func (k *SwaggerProps) FromGnostic(g *openapi_v2.Document) (ok bool, err error) {
+ if g == nil {
+ return true, nil
+ }
+
+ ok = true
+
+ // openapi_v2.Document does not support "ID" field, so it will not be
+ // included
+ k.Consumes = g.Consumes
+ k.Produces = g.Produces
+ k.Schemes = g.Schemes
+ k.Swagger = g.Swagger
+
+ if g.Info != nil {
+ k.Info = &Info{}
+ if nok, err := k.Info.FromGnostic(g.Info); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ }
+
+ k.Host = g.Host
+ k.BasePath = g.BasePath
+
+ if g.Paths != nil {
+ k.Paths = &Paths{}
+ if nok, err := k.Paths.FromGnostic(g.Paths); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ }
+
+ if g.Definitions != nil {
+ k.Definitions = make(Definitions, len(g.Definitions.AdditionalProperties))
+ for _, v := range g.Definitions.AdditionalProperties {
+ if v == nil {
+ continue
+ }
+ converted := Schema{}
+ if nok, err := converted.FromGnostic(v.Value); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ k.Definitions[v.Name] = converted
+
+ }
+ }
+
+ if g.Parameters != nil {
+ k.Parameters = make(
+ map[string]Parameter,
+ len(g.Parameters.AdditionalProperties))
+ for _, v := range g.Parameters.AdditionalProperties {
+ if v == nil {
+ continue
+ }
+ p := Parameter{}
+ if nok, err := p.FromGnostic(v.Value); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+
+ k.Parameters[v.Name] = p
+ }
+ }
+
+ if g.Responses != nil {
+ k.Responses = make(
+ map[string]Response,
+ len(g.Responses.AdditionalProperties))
+
+ for _, v := range g.Responses.AdditionalProperties {
+ if v == nil {
+ continue
+ }
+ p := Response{}
+ if nok, err := p.FromGnostic(v.Value); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+
+ k.Responses[v.Name] = p
+ }
+ }
+
+ if g.SecurityDefinitions != nil {
+ k.SecurityDefinitions = make(SecurityDefinitions)
+ if err := k.SecurityDefinitions.FromGnostic(g.SecurityDefinitions); err != nil {
+ return false, err
+ }
+ }
+
+ if g.Security != nil {
+ k.Security = make([]map[string][]string, len(g.Security))
+ for i, v := range g.Security {
+ if v == nil || v.AdditionalProperties == nil {
+ continue
+ }
+
+ k.Security[i] = make(map[string][]string, len(v.AdditionalProperties))
+ converted := k.Security[i]
+ for _, p := range v.AdditionalProperties {
+ if p == nil {
+ continue
+ }
+ if p.Value != nil {
+ converted[p.Name] = p.Value.Value
+ } else {
+ converted[p.Name] = nil
+ }
+ }
+ }
+ }
+
+ if g.Tags != nil {
+ k.Tags = make([]Tag, len(g.Tags))
+ for i, v := range g.Tags {
+ if v == nil {
+ continue
+ } else if nok, err := k.Tags[i].FromGnostic(v); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ }
+ }
+
+ if g.ExternalDocs != nil {
+ k.ExternalDocs = &ExternalDocumentation{}
+ if nok, err := k.ExternalDocs.FromGnostic(g.ExternalDocs); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ }
+
+ return ok, nil
+}
+
+// Info
+
+func (k *Info) FromGnostic(g *openapi_v2.Info) (ok bool, err error) {
+ ok = true
+ if g == nil {
+ return true, nil
+ }
+
+ if err := k.VendorExtensible.FromGnostic(g.VendorExtension); err != nil {
+ return false, err
+ }
+
+ if nok, err := k.InfoProps.FromGnostic(g); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+
+ return ok, nil
+}
+
+func (k *InfoProps) FromGnostic(g *openapi_v2.Info) (ok bool, err error) {
+ if g == nil {
+ return true, nil
+ }
+
+ ok = true
+
+ k.Description = g.Description
+ k.Title = g.Title
+ k.TermsOfService = g.TermsOfService
+
+ if g.Contact != nil {
+ k.Contact = &ContactInfo{}
+
+ if nok, err := k.Contact.FromGnostic(g.Contact); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ }
+
+ if g.License != nil {
+ k.License = &License{}
+ if nok, err := k.License.FromGnostic(g.License); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ }
+
+ k.Version = g.Version
+ return ok, nil
+}
+
+func (k *License) FromGnostic(g *openapi_v2.License) (ok bool, err error) {
+ if g == nil {
+ return true, nil
+ }
+
+ ok = true
+
+ k.Name = g.Name
+ k.URL = g.Url
+
+ // License does not embed to VendorExtensible!
+ // data loss from g.VendorExtension
+ if len(g.VendorExtension) != 0 {
+ ok = false
+ }
+
+ return ok, nil
+}
+
+func (k *ContactInfo) FromGnostic(g *openapi_v2.Contact) (ok bool, err error) {
+ if g == nil {
+ return true, nil
+ }
+
+ ok = true
+
+ k.Name = g.Name
+ k.URL = g.Url
+ k.Email = g.Email
+
+ // ContactInfo does not embed to VendorExtensible!
+ // data loss from g.VendorExtension
+ if len(g.VendorExtension) != 0 {
+ ok = false
+ }
+
+ return ok, nil
+}
+
+// Paths
+
+func (k *Paths) FromGnostic(g *openapi_v2.Paths) (ok bool, err error) {
+ if g == nil {
+ return true, nil
+ }
+
+ ok = true
+
+ if g.Path != nil {
+ k.Paths = make(map[string]PathItem, len(g.Path))
+ for _, v := range g.Path {
+ if v == nil {
+ continue
+ }
+
+ converted := PathItem{}
+ if nok, err := converted.FromGnostic(v.Value); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+
+ k.Paths[v.Name] = converted
+ }
+ }
+
+ if err := k.VendorExtensible.FromGnostic(g.VendorExtension); err != nil {
+ return false, err
+ }
+ return ok, nil
+}
+
+func (k *PathItem) FromGnostic(g *openapi_v2.PathItem) (ok bool, err error) {
+ if g == nil {
+ return true, nil
+ }
+ ok = true
+
+ if nok, err := k.PathItemProps.FromGnostic(g); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+
+ if err := k.Refable.FromGnostic(g.XRef); err != nil {
+ return false, err
+ }
+
+ if err := k.VendorExtensible.FromGnostic(g.VendorExtension); err != nil {
+ return false, err
+ }
+ return ok, nil
+}
+
+func (k *PathItemProps) FromGnostic(g *openapi_v2.PathItem) (ok bool, err error) {
+ if g == nil {
+ return true, nil
+ }
+ ok = true
+ if g.Get != nil {
+ k.Get = &Operation{}
+ if nok, err := k.Get.FromGnostic(g.Get); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ }
+
+ if g.Put != nil {
+ k.Put = &Operation{}
+ if nok, err := k.Put.FromGnostic(g.Put); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ }
+
+ if g.Post != nil {
+ k.Post = &Operation{}
+ if nok, err := k.Post.FromGnostic(g.Post); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ }
+
+ if g.Delete != nil {
+ k.Delete = &Operation{}
+ if nok, err := k.Delete.FromGnostic(g.Delete); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ }
+
+ if g.Options != nil {
+ k.Options = &Operation{}
+ if nok, err := k.Options.FromGnostic(g.Options); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ }
+
+ if g.Head != nil {
+ k.Head = &Operation{}
+ if nok, err := k.Head.FromGnostic(g.Head); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ }
+
+ if g.Patch != nil {
+ k.Patch = &Operation{}
+ if nok, err := k.Patch.FromGnostic(g.Patch); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ }
+
+ if g.Parameters != nil {
+ k.Parameters = make([]Parameter, len(g.Parameters))
+ for i, v := range g.Parameters {
+ if v == nil {
+ continue
+ } else if nok, err := k.Parameters[i].FromGnosticParametersItem(v); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ }
+ }
+
+ return ok, nil
+}
+
+func (k *Operation) FromGnostic(g *openapi_v2.Operation) (ok bool, err error) {
+ if g == nil {
+ return true, nil
+ }
+
+ ok = true
+
+ if err := k.VendorExtensible.FromGnostic(g.VendorExtension); err != nil {
+ return false, err
+ }
+
+ if nok, err := k.OperationProps.FromGnostic(g); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+
+ return ok, nil
+}
+
+func (k *OperationProps) FromGnostic(g *openapi_v2.Operation) (ok bool, err error) {
+ if g == nil {
+ return true, nil
+ }
+
+ ok = true
+
+ k.Description = g.Description
+ k.Consumes = g.Consumes
+ k.Produces = g.Produces
+ k.Schemes = g.Schemes
+ k.Tags = g.Tags
+ k.Summary = g.Summary
+
+ if g.ExternalDocs != nil {
+ k.ExternalDocs = &ExternalDocumentation{}
+ if nok, err := k.ExternalDocs.FromGnostic(g.ExternalDocs); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ }
+
+ k.ID = g.OperationId
+ k.Deprecated = g.Deprecated
+
+ if g.Security != nil {
+ k.Security = make([]map[string][]string, len(g.Security))
+ for i, v := range g.Security {
+ if v == nil || v.AdditionalProperties == nil {
+ continue
+ }
+
+ k.Security[i] = make(map[string][]string, len(v.AdditionalProperties))
+ converted := k.Security[i]
+ for _, p := range v.AdditionalProperties {
+ if p == nil {
+ continue
+ }
+
+ if p.Value != nil {
+ converted[p.Name] = p.Value.Value
+ } else {
+ converted[p.Name] = nil
+ }
+ }
+ }
+ }
+
+ if g.Parameters != nil {
+ k.Parameters = make([]Parameter, len(g.Parameters))
+ for i, v := range g.Parameters {
+ if v == nil {
+ continue
+ } else if nok, err := k.Parameters[i].FromGnosticParametersItem(v); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ }
+ }
+
+ if g.Responses != nil {
+ k.Responses = &Responses{}
+ if nok, err := k.Responses.FromGnostic(g.Responses); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ }
+
+ return ok, nil
+}
+
+// Responses
+
+func (k *Responses) FromGnostic(g *openapi_v2.Responses) (ok bool, err error) {
+ if g == nil {
+ return true, nil
+ }
+ ok = true
+ if err := k.VendorExtensible.FromGnostic(g.VendorExtension); err != nil {
+ return false, err
+ }
+
+ if nok, err := k.ResponsesProps.FromGnostic(g); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+
+ return ok, nil
+}
+
+func (k *ResponsesProps) FromGnostic(g *openapi_v2.Responses) (ok bool, err error) {
+ if g == nil {
+ return true, nil
+ } else if g.ResponseCode == nil {
+ return ok, nil
+ }
+
+ ok = true
+ for _, v := range g.ResponseCode {
+ if v == nil {
+ continue
+ }
+ if v.Name == "default" {
+ k.Default = &Response{}
+ if nok, err := k.Default.FromGnosticResponseValue(v.Value); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ } else if nk, err := strconv.Atoi(v.Name); err != nil {
+ // This should actually never fail, unless gnostic struct was
+ // manually/purposefully tampered with at runtime.
+ // Gnostic's ParseDocument validates that all StatusCodeResponses
+ // keys adhere to the following regex ^([0-9]{3})$|^(default)$
+ ok = false
+ } else {
+ if k.StatusCodeResponses == nil {
+ k.StatusCodeResponses = map[int]Response{}
+ }
+
+ res := Response{}
+ if nok, err := res.FromGnosticResponseValue(v.Value); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ k.StatusCodeResponses[nk] = res
+ }
+ }
+
+ return ok, nil
+}
+
+func (k *Response) FromGnostic(g *openapi_v2.Response) (ok bool, err error) {
+ if g == nil {
+ return true, nil
+ }
+ ok = true
+ // Refable case handled in FromGnosticResponseValue
+
+ if err := k.VendorExtensible.FromGnostic(g.VendorExtension); err != nil {
+ return false, err
+ }
+
+ if nok, err := k.ResponseProps.FromGnostic(g); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+
+ return ok, nil
+}
+
+func (k *Response) FromGnosticResponseValue(g *openapi_v2.ResponseValue) (ok bool, err error) {
+ ok = true
+ if ref := g.GetJsonReference(); ref != nil {
+ k.Description = ref.Description
+
+ if err := k.Refable.FromGnostic(ref.XRef); err != nil {
+ return false, err
+ }
+ } else if nok, err := k.FromGnostic(g.GetResponse()); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+
+ return ok, nil
+}
+
+func (k *ResponseProps) FromGnostic(g *openapi_v2.Response) (ok bool, err error) {
+ if g == nil {
+ return true, nil
+ }
+ ok = true
+ k.Description = g.Description
+
+ if g.Schema != nil {
+ k.Schema = &Schema{}
+ if nok, err := k.Schema.FromGnosticSchemaItem(g.Schema); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ }
+
+ if g.Headers != nil {
+ k.Headers = make(map[string]Header, len(g.Headers.AdditionalProperties))
+ for _, v := range g.Headers.AdditionalProperties {
+ if v == nil {
+ continue
+ }
+
+ converted := Header{}
+ if err := converted.FromGnostic(v.GetValue()); err != nil {
+ return false, err
+ }
+
+ k.Headers[v.Name] = converted
+ }
+ }
+
+ if g.Examples != nil {
+ k.Examples = make(map[string]interface{}, len(g.Examples.AdditionalProperties))
+ for _, v := range g.Examples.AdditionalProperties {
+ if v == nil {
+ continue
+ } else if v.Value == nil {
+ k.Examples[v.Name] = nil
+ continue
+ }
+
+ var iface interface{}
+ if err := v.Value.ToRawInfo().Decode(&iface); err != nil {
+ return false, err
+ } else {
+ k.Examples[v.Name] = iface
+ }
+ }
+ }
+
+ return ok, nil
+}
+
+// Header
+
+func (k *Header) FromGnostic(g *openapi_v2.Header) (err error) {
+ if g == nil {
+ return nil
+ }
+
+ if err := k.CommonValidations.FromGnostic(g); err != nil {
+ return err
+ }
+
+ if err := k.VendorExtensible.FromGnostic(g.VendorExtension); err != nil {
+ return err
+ }
+
+ if err := k.SimpleSchema.FromGnostic(g); err != nil {
+ return err
+ }
+
+ if err := k.HeaderProps.FromGnostic(g); err != nil {
+ return err
+ }
+
+ return nil
+}
+
+func (k *HeaderProps) FromGnostic(g *openapi_v2.Header) error {
+ if g == nil {
+ return nil
+ }
+
+ // All other fields of openapi_v2.Header are handled by
+ // the embeded fields, commonvalidations, etc.
+ k.Description = g.Description
+ return nil
+}
+
+// Parameters
+
+func (k *Parameter) FromGnostic(g *openapi_v2.Parameter) (ok bool, err error) {
+ if g == nil {
+ return true, nil
+ }
+ ok = true
+ switch p := g.Oneof.(type) {
+ case *openapi_v2.Parameter_BodyParameter:
+ if nok, err := k.ParamProps.FromGnostic(p.BodyParameter); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+
+ if err := k.VendorExtensible.FromGnostic(p.BodyParameter.GetVendorExtension()); err != nil {
+ return false, err
+ }
+
+ return ok, nil
+ case *openapi_v2.Parameter_NonBodyParameter:
+ switch nb := g.GetNonBodyParameter().Oneof.(type) {
+ case *openapi_v2.NonBodyParameter_HeaderParameterSubSchema:
+ if nok, err := k.ParamProps.FromGnostic(nb.HeaderParameterSubSchema); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+
+ if err := k.SimpleSchema.FromGnostic(nb.HeaderParameterSubSchema); err != nil {
+ return false, err
+ }
+
+ if err := k.CommonValidations.FromGnostic(nb.HeaderParameterSubSchema); err != nil {
+ return false, err
+ }
+
+ if err := k.VendorExtensible.FromGnostic(nb.HeaderParameterSubSchema.GetVendorExtension()); err != nil {
+ return false, err
+ }
+
+ return ok, nil
+ case *openapi_v2.NonBodyParameter_FormDataParameterSubSchema:
+ if nok, err := k.ParamProps.FromGnostic(nb.FormDataParameterSubSchema); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+
+ if err := k.SimpleSchema.FromGnostic(nb.FormDataParameterSubSchema); err != nil {
+ return false, err
+ }
+
+ if err := k.CommonValidations.FromGnostic(nb.FormDataParameterSubSchema); err != nil {
+ return false, err
+ }
+
+ if err := k.VendorExtensible.FromGnostic(nb.FormDataParameterSubSchema.GetVendorExtension()); err != nil {
+ return false, err
+ }
+
+ return ok, nil
+ case *openapi_v2.NonBodyParameter_QueryParameterSubSchema:
+ if nok, err := k.ParamProps.FromGnostic(nb.QueryParameterSubSchema); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+
+ if err := k.SimpleSchema.FromGnostic(nb.QueryParameterSubSchema); err != nil {
+ return false, err
+ }
+
+ if err := k.CommonValidations.FromGnostic(nb.QueryParameterSubSchema); err != nil {
+ return false, err
+ }
+
+ if err := k.VendorExtensible.FromGnostic(nb.QueryParameterSubSchema.GetVendorExtension()); err != nil {
+ return false, err
+ }
+
+ return ok, nil
+ case *openapi_v2.NonBodyParameter_PathParameterSubSchema:
+ if nok, err := k.ParamProps.FromGnostic(nb.PathParameterSubSchema); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+
+ if err := k.SimpleSchema.FromGnostic(nb.PathParameterSubSchema); err != nil {
+ return false, err
+ }
+
+ if err := k.CommonValidations.FromGnostic(nb.PathParameterSubSchema); err != nil {
+ return false, err
+ }
+
+ if err := k.VendorExtensible.FromGnostic(nb.PathParameterSubSchema.GetVendorExtension()); err != nil {
+ return false, err
+ }
+
+ return ok, nil
+ default:
+ return false, errors.New("unrecognized nonbody type for Parameter")
+ }
+ default:
+ return false, errors.New("unrecognized type for Parameter")
+ }
+}
+
+type GnosticCommonParamProps interface {
+ GetName() string
+ GetRequired() bool
+ GetIn() string
+ GetDescription() string
+}
+
+type GnosticCommonParamPropsBodyParameter interface {
+ GetSchema() *openapi_v2.Schema
+}
+
+type GnosticCommonParamPropsFormData interface {
+ GetAllowEmptyValue() bool
+}
+
+func (k *ParamProps) FromGnostic(g GnosticCommonParamProps) (ok bool, err error) {
+ ok = true
+ k.Description = g.GetDescription()
+ k.In = g.GetIn()
+ k.Name = g.GetName()
+ k.Required = g.GetRequired()
+
+ if formDataParameter, success := g.(GnosticCommonParamPropsFormData); success {
+ k.AllowEmptyValue = formDataParameter.GetAllowEmptyValue()
+ }
+
+ if bodyParameter, success := g.(GnosticCommonParamPropsBodyParameter); success {
+ if bodyParameter.GetSchema() != nil {
+ k.Schema = &Schema{}
+ if nok, err := k.Schema.FromGnostic(bodyParameter.GetSchema()); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ }
+ }
+
+ return ok, nil
+}
+
+// PB types use a different structure than we do for "refable". For PB, there is
+// a wrappign oneof type that could be a ref or the type
+func (k *Parameter) FromGnosticParametersItem(g *openapi_v2.ParametersItem) (ok bool, err error) {
+ if g == nil {
+ return true, nil
+ }
+
+ ok = true
+ if ref := g.GetJsonReference(); ref != nil {
+ k.Description = ref.Description
+
+ if err := k.Refable.FromGnostic(ref.XRef); err != nil {
+ return false, err
+ }
+ } else if nok, err := k.FromGnostic(g.GetParameter()); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+
+ return ok, nil
+}
+
+// Schema
+
+func (k *Schema) FromGnostic(g *openapi_v2.Schema) (ok bool, err error) {
+ if g == nil {
+ return true, nil
+ }
+ ok = true
+
+ if err := k.VendorExtensible.FromGnostic(g.VendorExtension); err != nil {
+ return false, err
+ }
+
+ // SwaggerSchemaProps
+ k.Discriminator = g.Discriminator
+ k.ReadOnly = g.ReadOnly
+ k.Description = g.Description
+ if g.ExternalDocs != nil {
+ k.ExternalDocs = &ExternalDocumentation{}
+ if nok, err := k.ExternalDocs.FromGnostic(g.ExternalDocs); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ }
+
+ if g.Example != nil {
+ if err := g.Example.ToRawInfo().Decode(&k.Example); err != nil {
+ return false, err
+ }
+ }
+
+ // SchemaProps
+ if err := k.Ref.FromGnostic(g.XRef); err != nil {
+ return false, err
+ }
+ k.Type = g.Type.GetValue()
+ k.Format = g.GetFormat()
+ k.Title = g.GetTitle()
+
+ // These below fields are not available in gnostic types, so will never
+ // be populated. This means roundtrips which make use of these
+ // (non-official, kube-only) fields will lose information.
+ //
+ // Schema.ID is not available in official spec
+ // Schema.$schema
+ // Schema.Nullable - in openapiv3, not v2
+ // Schema.AnyOf - in openapiv3, not v2
+ // Schema.OneOf - in openapiv3, not v2
+ // Schema.Not - in openapiv3, not v2
+ // Schema.PatternProperties - in openapiv3, not v2
+ // Schema.Dependencies - in openapiv3, not v2
+ // Schema.AdditionalItems
+ // Schema.Definitions - not part of spec
+ // Schema.ExtraProps - gnostic parser rejects any keys it does not recognize
+
+ if g.GetDefault() != nil {
+ if err := g.GetDefault().ToRawInfo().Decode(&k.Default); err != nil {
+ return false, err
+ }
+ }
+
+ // These conditionals (!= 0) follow gnostic's logic for ToRawInfo
+ // The keys in gnostic source are only included if nonzero.
+
+ if g.Maximum != 0.0 {
+ k.Maximum = &g.Maximum
+ }
+
+ if g.Minimum != 0.0 {
+ k.Minimum = &g.Minimum
+ }
+
+ k.ExclusiveMaximum = g.ExclusiveMaximum
+ k.ExclusiveMinimum = g.ExclusiveMinimum
+
+ if g.MaxLength != 0 {
+ k.MaxLength = &g.MaxLength
+ }
+
+ if g.MinLength != 0 {
+ k.MinLength = &g.MinLength
+ }
+
+ k.Pattern = g.GetPattern()
+
+ if g.MaxItems != 0 {
+ k.MaxItems = &g.MaxItems
+ }
+
+ if g.MinItems != 0 {
+ k.MinItems = &g.MinItems
+ }
+ k.UniqueItems = g.UniqueItems
+
+ if g.MultipleOf != 0 {
+ k.MultipleOf = &g.MultipleOf
+ }
+
+ for _, v := range g.GetEnum() {
+ if v == nil {
+ continue
+ }
+
+ var convert interface{}
+ if err := v.ToRawInfo().Decode(&convert); err != nil {
+ return false, err
+ }
+ k.Enum = append(k.Enum, convert)
+ }
+
+ if g.MaxProperties != 0 {
+ k.MaxProperties = &g.MaxProperties
+ }
+
+ if g.MinProperties != 0 {
+ k.MinProperties = &g.MinProperties
+ }
+
+ k.Required = g.Required
+
+ if g.GetItems() != nil {
+ k.Items = &SchemaOrArray{}
+ for _, v := range g.Items.GetSchema() {
+ if v == nil {
+ continue
+ }
+
+ schema := Schema{}
+ if nok, err := schema.FromGnostic(v); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ k.Items.Schemas = append(k.Items.Schemas, schema)
+ }
+
+ if len(k.Items.Schemas) == 1 {
+ k.Items.Schema = &k.Items.Schemas[0]
+ k.Items.Schemas = nil
+ }
+ }
+
+ for i, v := range g.GetAllOf() {
+ if v == nil {
+ continue
+ }
+
+ k.AllOf = append(k.AllOf, Schema{})
+ if nok, err := k.AllOf[i].FromGnostic(v); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ }
+
+ if g.Properties != nil {
+ k.Properties = make(map[string]Schema)
+ for _, namedSchema := range g.Properties.AdditionalProperties {
+ if namedSchema == nil {
+ continue
+ }
+ val := &Schema{}
+ if nok, err := val.FromGnostic(namedSchema.Value); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+
+ k.Properties[namedSchema.Name] = *val
+ }
+ }
+
+ if g.AdditionalProperties != nil {
+ k.AdditionalProperties = &SchemaOrBool{}
+ if g.AdditionalProperties.GetSchema() == nil {
+ k.AdditionalProperties.Allows = g.AdditionalProperties.GetBoolean()
+ } else {
+ k.AdditionalProperties.Schema = &Schema{}
+ k.AdditionalProperties.Allows = true
+
+ if nok, err := k.AdditionalProperties.Schema.FromGnostic(g.AdditionalProperties.GetSchema()); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ }
+ }
+
+ return ok, nil
+}
+
+func (k *Schema) FromGnosticSchemaItem(g *openapi_v2.SchemaItem) (ok bool, err error) {
+ if g == nil {
+ return true, nil
+ }
+ ok = true
+
+ switch p := g.Oneof.(type) {
+ case *openapi_v2.SchemaItem_FileSchema:
+ fileSchema := p.FileSchema
+
+ if err := k.VendorExtensible.FromGnostic(fileSchema.VendorExtension); err != nil {
+ return false, err
+ }
+
+ k.Format = fileSchema.Format
+ k.Title = fileSchema.Title
+ k.Description = fileSchema.Description
+ k.Required = fileSchema.Required
+ k.Type = []string{fileSchema.Type}
+ k.ReadOnly = fileSchema.ReadOnly
+
+ if fileSchema.ExternalDocs != nil {
+ k.ExternalDocs = &ExternalDocumentation{}
+ if nok, err := k.ExternalDocs.FromGnostic(fileSchema.ExternalDocs); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ }
+
+ if fileSchema.Example != nil {
+ if err := fileSchema.Example.ToRawInfo().Decode(&k.Example); err != nil {
+ return false, err
+ }
+ }
+
+ if fileSchema.Default != nil {
+ if err := fileSchema.Default.ToRawInfo().Decode(&k.Default); err != nil {
+ return false, err
+ }
+ }
+
+ case *openapi_v2.SchemaItem_Schema:
+ schema := p.Schema
+
+ if nok, err := k.FromGnostic(schema); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ default:
+ return false, errors.New("unrecognized type for SchemaItem")
+ }
+
+ return ok, nil
+}
+
+// SecurityDefinitions
+
+func (k SecurityDefinitions) FromGnostic(g *openapi_v2.SecurityDefinitions) error {
+ for _, v := range g.GetAdditionalProperties() {
+ if v == nil {
+ continue
+ }
+ secScheme := &SecurityScheme{}
+ if err := secScheme.FromGnostic(v.Value); err != nil {
+ return err
+ }
+ k[v.Name] = secScheme
+ }
+
+ return nil
+}
+
+type GnosticCommonSecurityDefinition interface {
+ GetType() string
+ GetDescription() string
+}
+
+func (k *SecuritySchemeProps) FromGnostic(g GnosticCommonSecurityDefinition) error {
+ k.Type = g.GetType()
+ k.Description = g.GetDescription()
+
+ if hasName, success := g.(interface{ GetName() string }); success {
+ k.Name = hasName.GetName()
+ }
+
+ if hasIn, success := g.(interface{ GetIn() string }); success {
+ k.In = hasIn.GetIn()
+ }
+
+ if hasFlow, success := g.(interface{ GetFlow() string }); success {
+ k.Flow = hasFlow.GetFlow()
+ }
+
+ if hasAuthURL, success := g.(interface{ GetAuthorizationUrl() string }); success {
+ k.AuthorizationURL = hasAuthURL.GetAuthorizationUrl()
+ }
+
+ if hasTokenURL, success := g.(interface{ GetTokenUrl() string }); success {
+ k.TokenURL = hasTokenURL.GetTokenUrl()
+ }
+
+ if hasScopes, success := g.(interface {
+ GetScopes() *openapi_v2.Oauth2Scopes
+ }); success {
+ scopes := hasScopes.GetScopes()
+ if scopes != nil {
+ k.Scopes = make(map[string]string, len(scopes.AdditionalProperties))
+ for _, v := range scopes.AdditionalProperties {
+ if v == nil {
+ continue
+ }
+
+ k.Scopes[v.Name] = v.Value
+ }
+ }
+ }
+
+ return nil
+}
+
+func (k *SecurityScheme) FromGnostic(g *openapi_v2.SecurityDefinitionsItem) error {
+ if g == nil {
+ return nil
+ }
+
+ switch s := g.Oneof.(type) {
+ case *openapi_v2.SecurityDefinitionsItem_ApiKeySecurity:
+ if err := k.SecuritySchemeProps.FromGnostic(s.ApiKeySecurity); err != nil {
+ return err
+ }
+ if err := k.VendorExtensible.FromGnostic(s.ApiKeySecurity.VendorExtension); err != nil {
+ return err
+ }
+ return nil
+ case *openapi_v2.SecurityDefinitionsItem_BasicAuthenticationSecurity:
+ if err := k.SecuritySchemeProps.FromGnostic(s.BasicAuthenticationSecurity); err != nil {
+ return err
+ }
+ if err := k.VendorExtensible.FromGnostic(s.BasicAuthenticationSecurity.VendorExtension); err != nil {
+ return err
+ }
+ return nil
+ case *openapi_v2.SecurityDefinitionsItem_Oauth2AccessCodeSecurity:
+ if err := k.SecuritySchemeProps.FromGnostic(s.Oauth2AccessCodeSecurity); err != nil {
+ return err
+ }
+ if err := k.VendorExtensible.FromGnostic(s.Oauth2AccessCodeSecurity.VendorExtension); err != nil {
+ return err
+ }
+ return nil
+ case *openapi_v2.SecurityDefinitionsItem_Oauth2ApplicationSecurity:
+ if err := k.SecuritySchemeProps.FromGnostic(s.Oauth2ApplicationSecurity); err != nil {
+ return err
+ }
+ if err := k.VendorExtensible.FromGnostic(s.Oauth2ApplicationSecurity.VendorExtension); err != nil {
+ return err
+ }
+ return nil
+ case *openapi_v2.SecurityDefinitionsItem_Oauth2ImplicitSecurity:
+ if err := k.SecuritySchemeProps.FromGnostic(s.Oauth2ImplicitSecurity); err != nil {
+ return err
+ }
+ if err := k.VendorExtensible.FromGnostic(s.Oauth2ImplicitSecurity.VendorExtension); err != nil {
+ return err
+ }
+ return nil
+ case *openapi_v2.SecurityDefinitionsItem_Oauth2PasswordSecurity:
+ if err := k.SecuritySchemeProps.FromGnostic(s.Oauth2PasswordSecurity); err != nil {
+ return err
+ }
+ if err := k.VendorExtensible.FromGnostic(s.Oauth2PasswordSecurity.VendorExtension); err != nil {
+ return err
+ }
+ return nil
+ default:
+ return errors.New("unrecognized SecurityDefinitionsItem")
+ }
+}
+
+// Tag
+
+func (k *Tag) FromGnostic(g *openapi_v2.Tag) (ok bool, err error) {
+ if g == nil {
+ return true, nil
+ }
+
+ ok = true
+
+ if nok, err := k.TagProps.FromGnostic(g); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+
+ if err := k.VendorExtensible.FromGnostic(g.VendorExtension); err != nil {
+ return false, err
+ }
+ return ok, nil
+}
+
+func (k *TagProps) FromGnostic(g *openapi_v2.Tag) (ok bool, err error) {
+ if g == nil {
+ return true, nil
+ }
+ ok = true
+ k.Description = g.Description
+ k.Name = g.Name
+
+ if g.ExternalDocs != nil {
+ k.ExternalDocs = &ExternalDocumentation{}
+ if nok, err := k.ExternalDocs.FromGnostic(g.ExternalDocs); err != nil {
+ return false, err
+ } else if !nok {
+ ok = false
+ }
+ }
+
+ return ok, nil
+}
+
+// ExternalDocumentation
+
+func (k *ExternalDocumentation) FromGnostic(g *openapi_v2.ExternalDocs) (ok bool, err error) {
+ if g == nil {
+ return true, nil
+ }
+ ok = true
+ k.Description = g.Description
+ k.URL = g.Url
+
+ // data loss! g.VendorExtension
+ if len(g.VendorExtension) != 0 {
+ ok = false
+ }
+
+ return ok, nil
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/header.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/header.go
new file mode 100644
index 000000000..05310c46b
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/header.go
@@ -0,0 +1,118 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package spec
+
+import (
+ "encoding/json"
+
+ "github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
+)
+
+const (
+ jsonArray = "array"
+)
+
+// HeaderProps describes a response header
+type HeaderProps struct {
+ Description string `json:"description,omitempty"`
+}
+
+// Header describes a header for a response of the API
+//
+// For more information: http://goo.gl/8us55a#headerObject
+type Header struct {
+ CommonValidations
+ SimpleSchema
+ VendorExtensible
+ HeaderProps
+}
+
+// MarshalJSON marshal this to JSON
+func (h Header) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(h)
+ }
+ b1, err := json.Marshal(h.CommonValidations)
+ if err != nil {
+ return nil, err
+ }
+ b2, err := json.Marshal(h.SimpleSchema)
+ if err != nil {
+ return nil, err
+ }
+ b3, err := json.Marshal(h.HeaderProps)
+ if err != nil {
+ return nil, err
+ }
+ b4, err := json.Marshal(h.VendorExtensible)
+ if err != nil {
+ return nil, err
+ }
+ return swag.ConcatJSON(b1, b2, b3, b4), nil
+}
+
+func (h Header) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ CommonValidations commonValidationsOmitZero `json:",inline"`
+ SimpleSchema simpleSchemaOmitZero `json:",inline"`
+ Extensions
+ HeaderProps
+ }
+ x.CommonValidations = commonValidationsOmitZero(h.CommonValidations)
+ x.SimpleSchema = simpleSchemaOmitZero(h.SimpleSchema)
+ x.Extensions = internal.SanitizeExtensions(h.Extensions)
+ x.HeaderProps = h.HeaderProps
+ return opts.MarshalNext(enc, x)
+}
+
+// UnmarshalJSON unmarshals this header from JSON
+func (h *Header) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshaling {
+ return jsonv2.Unmarshal(data, h)
+ }
+
+ if err := json.Unmarshal(data, &h.CommonValidations); err != nil {
+ return err
+ }
+ if err := json.Unmarshal(data, &h.SimpleSchema); err != nil {
+ return err
+ }
+ if err := json.Unmarshal(data, &h.VendorExtensible); err != nil {
+ return err
+ }
+ return json.Unmarshal(data, &h.HeaderProps)
+}
+
+func (h *Header) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ var x struct {
+ CommonValidations
+ SimpleSchema
+ Extensions
+ HeaderProps
+ }
+
+ if err := opts.UnmarshalNext(dec, &x); err != nil {
+ return err
+ }
+
+ h.CommonValidations = x.CommonValidations
+ h.SimpleSchema = x.SimpleSchema
+ h.Extensions = internal.SanitizeExtensions(x.Extensions)
+ h.HeaderProps = x.HeaderProps
+
+ return nil
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/info.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/info.go
new file mode 100644
index 000000000..d667b705b
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/info.go
@@ -0,0 +1,219 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package spec
+
+import (
+ "encoding/json"
+ "strings"
+
+ "github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
+)
+
+// Extensions vendor specific extensions
+type Extensions map[string]interface{}
+
+// Add adds a value to these extensions
+func (e Extensions) Add(key string, value interface{}) {
+ realKey := strings.ToLower(key)
+ e[realKey] = value
+}
+
+// GetString gets a string value from the extensions
+func (e Extensions) GetString(key string) (string, bool) {
+ if v, ok := e[strings.ToLower(key)]; ok {
+ str, ok := v.(string)
+ return str, ok
+ }
+ return "", false
+}
+
+// GetBool gets a string value from the extensions
+func (e Extensions) GetBool(key string) (bool, bool) {
+ if v, ok := e[strings.ToLower(key)]; ok {
+ str, ok := v.(bool)
+ return str, ok
+ }
+ return false, false
+}
+
+// GetStringSlice gets a string value from the extensions
+func (e Extensions) GetStringSlice(key string) ([]string, bool) {
+ if v, ok := e[strings.ToLower(key)]; ok {
+ arr, isSlice := v.([]interface{})
+ if !isSlice {
+ return nil, false
+ }
+ var strs []string
+ for _, iface := range arr {
+ str, isString := iface.(string)
+ if !isString {
+ return nil, false
+ }
+ strs = append(strs, str)
+ }
+ return strs, ok
+ }
+ return nil, false
+}
+
+// GetObject gets the object value from the extensions.
+// out must be a json serializable type; the json go struct
+// tags of out are used to populate it.
+func (e Extensions) GetObject(key string, out interface{}) error {
+ // This json serialization/deserialization could be replaced with
+ // an approach using reflection if the optimization becomes justified.
+ if v, ok := e[strings.ToLower(key)]; ok {
+ b, err := json.Marshal(v)
+ if err != nil {
+ return err
+ }
+ err = json.Unmarshal(b, out)
+ if err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+func (e Extensions) sanitizeWithExtra() (extra map[string]any) {
+ for k, v := range e {
+ if !internal.IsExtensionKey(k) {
+ if extra == nil {
+ extra = make(map[string]any)
+ }
+ extra[k] = v
+ delete(e, k)
+ }
+ }
+ return extra
+}
+
+// VendorExtensible composition block.
+type VendorExtensible struct {
+ Extensions Extensions
+}
+
+// AddExtension adds an extension to this extensible object
+func (v *VendorExtensible) AddExtension(key string, value interface{}) {
+ if value == nil {
+ return
+ }
+ if v.Extensions == nil {
+ v.Extensions = make(map[string]interface{})
+ }
+ v.Extensions.Add(key, value)
+}
+
+// MarshalJSON marshals the extensions to json
+func (v VendorExtensible) MarshalJSON() ([]byte, error) {
+ toser := make(map[string]interface{})
+ for k, v := range v.Extensions {
+ lk := strings.ToLower(k)
+ if strings.HasPrefix(lk, "x-") {
+ toser[k] = v
+ }
+ }
+ return json.Marshal(toser)
+}
+
+// UnmarshalJSON for this extensible object
+func (v *VendorExtensible) UnmarshalJSON(data []byte) error {
+ var d map[string]interface{}
+ if err := json.Unmarshal(data, &d); err != nil {
+ return err
+ }
+ for k, vv := range d {
+ lk := strings.ToLower(k)
+ if strings.HasPrefix(lk, "x-") {
+ if v.Extensions == nil {
+ v.Extensions = map[string]interface{}{}
+ }
+ v.Extensions[k] = vv
+ }
+ }
+ return nil
+}
+
+// InfoProps the properties for an info definition
+type InfoProps struct {
+ Description string `json:"description,omitempty"`
+ Title string `json:"title,omitempty"`
+ TermsOfService string `json:"termsOfService,omitempty"`
+ Contact *ContactInfo `json:"contact,omitempty"`
+ License *License `json:"license,omitempty"`
+ Version string `json:"version,omitempty"`
+}
+
+// Info object provides metadata about the API.
+// The metadata can be used by the clients if needed, and can be presented in the Swagger-UI for convenience.
+//
+// For more information: http://goo.gl/8us55a#infoObject
+type Info struct {
+ VendorExtensible
+ InfoProps
+}
+
+// MarshalJSON marshal this to JSON
+func (i Info) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(i)
+ }
+ b1, err := json.Marshal(i.InfoProps)
+ if err != nil {
+ return nil, err
+ }
+ b2, err := json.Marshal(i.VendorExtensible)
+ if err != nil {
+ return nil, err
+ }
+ return swag.ConcatJSON(b1, b2), nil
+}
+
+func (i Info) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ Extensions
+ InfoProps
+ }
+ x.Extensions = i.Extensions
+ x.InfoProps = i.InfoProps
+ return opts.MarshalNext(enc, x)
+}
+
+// UnmarshalJSON marshal this from JSON
+func (i *Info) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshaling {
+ return jsonv2.Unmarshal(data, i)
+ }
+
+ if err := json.Unmarshal(data, &i.InfoProps); err != nil {
+ return err
+ }
+ return json.Unmarshal(data, &i.VendorExtensible)
+}
+
+func (i *Info) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ var x struct {
+ Extensions
+ InfoProps
+ }
+ if err := opts.UnmarshalNext(dec, &x); err != nil {
+ return err
+ }
+ i.Extensions = internal.SanitizeExtensions(x.Extensions)
+ i.InfoProps = x.InfoProps
+ return nil
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/items.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/items.go
new file mode 100644
index 000000000..4132467d2
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/items.go
@@ -0,0 +1,180 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package spec
+
+import (
+ "encoding/json"
+
+ "github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
+)
+
+const (
+ jsonRef = "$ref"
+)
+
+// SimpleSchema describe swagger simple schemas for parameters and headers
+type SimpleSchema struct {
+ Type string `json:"type,omitempty"`
+ Nullable bool `json:"nullable,omitempty"`
+ Format string `json:"format,omitempty"`
+ Items *Items `json:"items,omitempty"`
+ CollectionFormat string `json:"collectionFormat,omitempty"`
+ Default interface{} `json:"default,omitempty"`
+ Example interface{} `json:"example,omitempty"`
+}
+
+// Marshaling structure only, always edit along with corresponding
+// struct (or compilation will fail).
+type simpleSchemaOmitZero struct {
+ Type string `json:"type,omitempty"`
+ Nullable bool `json:"nullable,omitzero"`
+ Format string `json:"format,omitempty"`
+ Items *Items `json:"items,omitzero"`
+ CollectionFormat string `json:"collectionFormat,omitempty"`
+ Default interface{} `json:"default,omitempty"`
+ Example interface{} `json:"example,omitempty"`
+}
+
+// CommonValidations describe common JSON-schema validations
+type CommonValidations struct {
+ Maximum *float64 `json:"maximum,omitempty"`
+ ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"`
+ Minimum *float64 `json:"minimum,omitempty"`
+ ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"`
+ MaxLength *int64 `json:"maxLength,omitempty"`
+ MinLength *int64 `json:"minLength,omitempty"`
+ Pattern string `json:"pattern,omitempty"`
+ MaxItems *int64 `json:"maxItems,omitempty"`
+ MinItems *int64 `json:"minItems,omitempty"`
+ UniqueItems bool `json:"uniqueItems,omitempty"`
+ MultipleOf *float64 `json:"multipleOf,omitempty"`
+ Enum []interface{} `json:"enum,omitempty"`
+}
+
+// Marshaling structure only, always edit along with corresponding
+// struct (or compilation will fail).
+type commonValidationsOmitZero struct {
+ Maximum *float64 `json:"maximum,omitempty"`
+ ExclusiveMaximum bool `json:"exclusiveMaximum,omitzero"`
+ Minimum *float64 `json:"minimum,omitempty"`
+ ExclusiveMinimum bool `json:"exclusiveMinimum,omitzero"`
+ MaxLength *int64 `json:"maxLength,omitempty"`
+ MinLength *int64 `json:"minLength,omitempty"`
+ Pattern string `json:"pattern,omitempty"`
+ MaxItems *int64 `json:"maxItems,omitempty"`
+ MinItems *int64 `json:"minItems,omitempty"`
+ UniqueItems bool `json:"uniqueItems,omitzero"`
+ MultipleOf *float64 `json:"multipleOf,omitempty"`
+ Enum []interface{} `json:"enum,omitempty"`
+}
+
+// Items a limited subset of JSON-Schema's items object.
+// It is used by parameter definitions that are not located in "body".
+//
+// For more information: http://goo.gl/8us55a#items-object
+type Items struct {
+ Refable
+ CommonValidations
+ SimpleSchema
+ VendorExtensible
+}
+
+// UnmarshalJSON hydrates this items instance with the data from JSON
+func (i *Items) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshaling {
+ return jsonv2.Unmarshal(data, i)
+ }
+
+ var validations CommonValidations
+ if err := json.Unmarshal(data, &validations); err != nil {
+ return err
+ }
+ var ref Refable
+ if err := json.Unmarshal(data, &ref); err != nil {
+ return err
+ }
+ var simpleSchema SimpleSchema
+ if err := json.Unmarshal(data, &simpleSchema); err != nil {
+ return err
+ }
+ var vendorExtensible VendorExtensible
+ if err := json.Unmarshal(data, &vendorExtensible); err != nil {
+ return err
+ }
+ i.Refable = ref
+ i.CommonValidations = validations
+ i.SimpleSchema = simpleSchema
+ i.VendorExtensible = vendorExtensible
+ return nil
+}
+
+func (i *Items) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ var x struct {
+ CommonValidations
+ SimpleSchema
+ Extensions
+ }
+ if err := opts.UnmarshalNext(dec, &x); err != nil {
+ return err
+ }
+ if err := i.Refable.Ref.fromMap(x.Extensions); err != nil {
+ return err
+ }
+
+ i.CommonValidations = x.CommonValidations
+ i.SimpleSchema = x.SimpleSchema
+ i.Extensions = internal.SanitizeExtensions(x.Extensions)
+ return nil
+}
+
+// MarshalJSON converts this items object to JSON
+func (i Items) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(i)
+ }
+ b1, err := json.Marshal(i.CommonValidations)
+ if err != nil {
+ return nil, err
+ }
+ b2, err := json.Marshal(i.SimpleSchema)
+ if err != nil {
+ return nil, err
+ }
+ b3, err := json.Marshal(i.Refable)
+ if err != nil {
+ return nil, err
+ }
+ b4, err := json.Marshal(i.VendorExtensible)
+ if err != nil {
+ return nil, err
+ }
+ return swag.ConcatJSON(b4, b3, b1, b2), nil
+}
+
+func (i Items) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ CommonValidations commonValidationsOmitZero `json:",inline"`
+ SimpleSchema simpleSchemaOmitZero `json:",inline"`
+ Ref string `json:"$ref,omitempty"`
+ Extensions
+ }
+ x.CommonValidations = commonValidationsOmitZero(i.CommonValidations)
+ x.SimpleSchema = simpleSchemaOmitZero(i.SimpleSchema)
+ x.Ref = i.Refable.Ref.String()
+ x.Extensions = internal.SanitizeExtensions(i.Extensions)
+ return opts.MarshalNext(enc, x)
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/license.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/license.go
new file mode 100644
index 000000000..f20961b4f
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/license.go
@@ -0,0 +1,23 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package spec
+
+// License information for the exposed API.
+//
+// For more information: http://goo.gl/8us55a#licenseObject
+type License struct {
+ Name string `json:"name,omitempty"`
+ URL string `json:"url,omitempty"`
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/operation.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/operation.go
new file mode 100644
index 000000000..63eed3460
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/operation.go
@@ -0,0 +1,146 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package spec
+
+import (
+ "encoding/json"
+
+ "github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
+)
+
+// OperationProps describes an operation
+//
+// NOTES:
+// - schemes, when present must be from [http, https, ws, wss]: see validate
+// - Security is handled as a special case: see MarshalJSON function
+type OperationProps struct {
+ Description string `json:"description,omitempty"`
+ Consumes []string `json:"consumes,omitempty"`
+ Produces []string `json:"produces,omitempty"`
+ Schemes []string `json:"schemes,omitempty"`
+ Tags []string `json:"tags,omitempty"`
+ Summary string `json:"summary,omitempty"`
+ ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"`
+ ID string `json:"operationId,omitempty"`
+ Deprecated bool `json:"deprecated,omitempty"`
+ Security []map[string][]string `json:"security,omitempty"`
+ Parameters []Parameter `json:"parameters,omitempty"`
+ Responses *Responses `json:"responses,omitempty"`
+}
+
+// Marshaling structure only, always edit along with corresponding
+// struct (or compilation will fail).
+type operationPropsOmitZero struct {
+ Description string `json:"description,omitempty"`
+ Consumes []string `json:"consumes,omitempty"`
+ Produces []string `json:"produces,omitempty"`
+ Schemes []string `json:"schemes,omitempty"`
+ Tags []string `json:"tags,omitempty"`
+ Summary string `json:"summary,omitempty"`
+ ExternalDocs *ExternalDocumentation `json:"externalDocs,omitzero"`
+ ID string `json:"operationId,omitempty"`
+ Deprecated bool `json:"deprecated,omitempty,omitzero"`
+ Security []map[string][]string `json:"security,omitempty"`
+ Parameters []Parameter `json:"parameters,omitempty"`
+ Responses *Responses `json:"responses,omitzero"`
+}
+
+// MarshalJSON takes care of serializing operation properties to JSON
+//
+// We use a custom marhaller here to handle a special cases related to
+// the Security field. We need to preserve zero length slice
+// while omitting the field when the value is nil/unset.
+func (op OperationProps) MarshalJSON() ([]byte, error) {
+ type Alias OperationProps
+ if op.Security == nil {
+ return json.Marshal(&struct {
+ Security []map[string][]string `json:"security,omitempty"`
+ *Alias
+ }{
+ Security: op.Security,
+ Alias: (*Alias)(&op),
+ })
+ }
+ return json.Marshal(&struct {
+ Security []map[string][]string `json:"security"`
+ *Alias
+ }{
+ Security: op.Security,
+ Alias: (*Alias)(&op),
+ })
+}
+
+// Operation describes a single API operation on a path.
+//
+// For more information: http://goo.gl/8us55a#operationObject
+type Operation struct {
+ VendorExtensible
+ OperationProps
+}
+
+// UnmarshalJSON hydrates this items instance with the data from JSON
+func (o *Operation) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshaling {
+ return jsonv2.Unmarshal(data, o)
+ }
+
+ if err := json.Unmarshal(data, &o.OperationProps); err != nil {
+ return err
+ }
+ return json.Unmarshal(data, &o.VendorExtensible)
+}
+
+func (o *Operation) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ type OperationPropsNoMethods OperationProps // strip MarshalJSON method
+ var x struct {
+ Extensions
+ OperationPropsNoMethods
+ }
+ if err := opts.UnmarshalNext(dec, &x); err != nil {
+ return err
+ }
+ o.Extensions = internal.SanitizeExtensions(x.Extensions)
+ o.OperationProps = OperationProps(x.OperationPropsNoMethods)
+ return nil
+}
+
+// MarshalJSON converts this items object to JSON
+func (o Operation) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(o)
+ }
+ b1, err := json.Marshal(o.OperationProps)
+ if err != nil {
+ return nil, err
+ }
+ b2, err := json.Marshal(o.VendorExtensible)
+ if err != nil {
+ return nil, err
+ }
+ concated := swag.ConcatJSON(b1, b2)
+ return concated, nil
+}
+
+func (o Operation) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ Extensions
+ OperationProps operationPropsOmitZero `json:",inline"`
+ }
+ x.Extensions = internal.SanitizeExtensions(o.Extensions)
+ x.OperationProps = operationPropsOmitZero(o.OperationProps)
+ return opts.MarshalNext(enc, x)
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/parameter.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/parameter.go
new file mode 100644
index 000000000..53d1e0aa9
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/parameter.go
@@ -0,0 +1,172 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package spec
+
+import (
+ "encoding/json"
+
+ "github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
+)
+
+// ParamProps describes the specific attributes of an operation parameter
+//
+// NOTE:
+// - Schema is defined when "in" == "body": see validate
+// - AllowEmptyValue is allowed where "in" == "query" || "formData"
+type ParamProps struct {
+ Description string `json:"description,omitempty"`
+ Name string `json:"name,omitempty"`
+ In string `json:"in,omitempty"`
+ Required bool `json:"required,omitempty"`
+ Schema *Schema `json:"schema,omitempty"`
+ AllowEmptyValue bool `json:"allowEmptyValue,omitempty"`
+}
+
+// Marshaling structure only, always edit along with corresponding
+// struct (or compilation will fail).
+type paramPropsOmitZero struct {
+ Description string `json:"description,omitempty"`
+ Name string `json:"name,omitempty"`
+ In string `json:"in,omitempty"`
+ Required bool `json:"required,omitzero"`
+ Schema *Schema `json:"schema,omitzero"`
+ AllowEmptyValue bool `json:"allowEmptyValue,omitzero"`
+}
+
+// Parameter a unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn).
+//
+// There are five possible parameter types.
+// * Path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part
+//
+// of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`,
+// the path parameter is `itemId`.
+//
+// * Query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`.
+// * Header - Custom headers that are expected as part of the request.
+// * Body - The payload that's appended to the HTTP request. Since there can only be one payload, there can only be
+//
+// _one_ body parameter. The name of the body parameter has no effect on the parameter itself and is used for
+// documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist
+// together for the same operation.
+//
+// * Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded` or
+//
+// `multipart/form-data` are used as the content type of the request (in Swagger's definition,
+// the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used
+// to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be
+// declared together with a body parameter for the same operation. Form parameters have a different format based on
+// the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4).
+// * `application/x-www-form-urlencoded` - Similar to the format of Query parameters but as a payload.
+// For example, `foo=1&bar=swagger` - both `foo` and `bar` are form parameters. This is normally used for simple
+// parameters that are being transferred.
+// * `multipart/form-data` - each parameter takes a section in the payload with an internal header.
+// For example, for the header `Content-Disposition: form-data; name="submit-name"` the name of the parameter is
+// `submit-name`. This type of form parameters is more commonly used for file transfers.
+//
+// For more information: http://goo.gl/8us55a#parameterObject
+type Parameter struct {
+ Refable
+ CommonValidations
+ SimpleSchema
+ VendorExtensible
+ ParamProps
+}
+
+// UnmarshalJSON hydrates this items instance with the data from JSON
+func (p *Parameter) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshaling {
+ return jsonv2.Unmarshal(data, p)
+ }
+
+ if err := json.Unmarshal(data, &p.CommonValidations); err != nil {
+ return err
+ }
+ if err := json.Unmarshal(data, &p.Refable); err != nil {
+ return err
+ }
+ if err := json.Unmarshal(data, &p.SimpleSchema); err != nil {
+ return err
+ }
+ if err := json.Unmarshal(data, &p.VendorExtensible); err != nil {
+ return err
+ }
+ return json.Unmarshal(data, &p.ParamProps)
+}
+
+func (p *Parameter) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ var x struct {
+ CommonValidations
+ SimpleSchema
+ Extensions
+ ParamProps
+ }
+ if err := opts.UnmarshalNext(dec, &x); err != nil {
+ return err
+ }
+ if err := p.Refable.Ref.fromMap(x.Extensions); err != nil {
+ return err
+ }
+ p.CommonValidations = x.CommonValidations
+ p.SimpleSchema = x.SimpleSchema
+ p.Extensions = internal.SanitizeExtensions(x.Extensions)
+ p.ParamProps = x.ParamProps
+ return nil
+}
+
+// MarshalJSON converts this items object to JSON
+func (p Parameter) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(p)
+ }
+ b1, err := json.Marshal(p.CommonValidations)
+ if err != nil {
+ return nil, err
+ }
+ b2, err := json.Marshal(p.SimpleSchema)
+ if err != nil {
+ return nil, err
+ }
+ b3, err := json.Marshal(p.Refable)
+ if err != nil {
+ return nil, err
+ }
+ b4, err := json.Marshal(p.VendorExtensible)
+ if err != nil {
+ return nil, err
+ }
+ b5, err := json.Marshal(p.ParamProps)
+ if err != nil {
+ return nil, err
+ }
+ return swag.ConcatJSON(b3, b1, b2, b4, b5), nil
+}
+
+func (p Parameter) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ CommonValidations commonValidationsOmitZero `json:",inline"`
+ SimpleSchema simpleSchemaOmitZero `json:",inline"`
+ ParamProps paramPropsOmitZero `json:",inline"`
+ Ref string `json:"$ref,omitempty"`
+ Extensions
+ }
+ x.CommonValidations = commonValidationsOmitZero(p.CommonValidations)
+ x.SimpleSchema = simpleSchemaOmitZero(p.SimpleSchema)
+ x.Extensions = internal.SanitizeExtensions(p.Extensions)
+ x.ParamProps = paramPropsOmitZero(p.ParamProps)
+ x.Ref = p.Refable.Ref.String()
+ return opts.MarshalNext(enc, x)
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/path_item.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/path_item.go
new file mode 100644
index 000000000..1d1588cb9
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/path_item.go
@@ -0,0 +1,113 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package spec
+
+import (
+ "encoding/json"
+
+ "github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
+)
+
+// PathItemProps the path item specific properties
+type PathItemProps struct {
+ Get *Operation `json:"get,omitempty"`
+ Put *Operation `json:"put,omitempty"`
+ Post *Operation `json:"post,omitempty"`
+ Delete *Operation `json:"delete,omitempty"`
+ Options *Operation `json:"options,omitempty"`
+ Head *Operation `json:"head,omitempty"`
+ Patch *Operation `json:"patch,omitempty"`
+ Parameters []Parameter `json:"parameters,omitempty"`
+}
+
+// PathItem describes the operations available on a single path.
+// A Path Item may be empty, due to [ACL constraints](http://goo.gl/8us55a#securityFiltering).
+// The path itself is still exposed to the documentation viewer but they will
+// not know which operations and parameters are available.
+//
+// For more information: http://goo.gl/8us55a#pathItemObject
+type PathItem struct {
+ Refable
+ VendorExtensible
+ PathItemProps
+}
+
+// UnmarshalJSON hydrates this items instance with the data from JSON
+func (p *PathItem) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshaling {
+ return jsonv2.Unmarshal(data, p)
+ }
+
+ if err := json.Unmarshal(data, &p.Refable); err != nil {
+ return err
+ }
+ if err := json.Unmarshal(data, &p.VendorExtensible); err != nil {
+ return err
+ }
+ return json.Unmarshal(data, &p.PathItemProps)
+}
+
+func (p *PathItem) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ var x struct {
+ Extensions
+ PathItemProps
+ }
+
+ if err := opts.UnmarshalNext(dec, &x); err != nil {
+ return err
+ }
+ if err := p.Refable.Ref.fromMap(x.Extensions); err != nil {
+ return err
+ }
+ p.Extensions = internal.SanitizeExtensions(x.Extensions)
+ p.PathItemProps = x.PathItemProps
+
+ return nil
+}
+
+// MarshalJSON converts this items object to JSON
+func (p PathItem) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(p)
+ }
+ b3, err := json.Marshal(p.Refable)
+ if err != nil {
+ return nil, err
+ }
+ b4, err := json.Marshal(p.VendorExtensible)
+ if err != nil {
+ return nil, err
+ }
+ b5, err := json.Marshal(p.PathItemProps)
+ if err != nil {
+ return nil, err
+ }
+ concated := swag.ConcatJSON(b3, b4, b5)
+ return concated, nil
+}
+
+func (p PathItem) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ Ref string `json:"$ref,omitempty"`
+ Extensions
+ PathItemProps
+ }
+ x.Ref = p.Refable.Ref.String()
+ x.Extensions = internal.SanitizeExtensions(p.Extensions)
+ x.PathItemProps = p.PathItemProps
+ return opts.MarshalNext(enc, x)
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/paths.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/paths.go
new file mode 100644
index 000000000..18f6a9f42
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/paths.go
@@ -0,0 +1,164 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package spec
+
+import (
+ "encoding/json"
+ "fmt"
+ "strings"
+
+ "github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
+)
+
+// Paths holds the relative paths to the individual endpoints.
+// The path is appended to the [`basePath`](http://goo.gl/8us55a#swaggerBasePath) in order
+// to construct the full URL.
+// The Paths may be empty, due to [ACL constraints](http://goo.gl/8us55a#securityFiltering).
+//
+// For more information: http://goo.gl/8us55a#pathsObject
+type Paths struct {
+ VendorExtensible
+ Paths map[string]PathItem `json:"-"` // custom serializer to flatten this, each entry must start with "/"
+}
+
+// UnmarshalJSON hydrates this items instance with the data from JSON
+func (p *Paths) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshaling {
+ return jsonv2.Unmarshal(data, p)
+ }
+
+ var res map[string]json.RawMessage
+ if err := json.Unmarshal(data, &res); err != nil {
+ return err
+ }
+ for k, v := range res {
+ if strings.HasPrefix(strings.ToLower(k), "x-") {
+ if p.Extensions == nil {
+ p.Extensions = make(map[string]interface{})
+ }
+ var d interface{}
+ if err := json.Unmarshal(v, &d); err != nil {
+ return err
+ }
+ p.Extensions[k] = d
+ }
+ if strings.HasPrefix(k, "/") {
+ if p.Paths == nil {
+ p.Paths = make(map[string]PathItem)
+ }
+ var pi PathItem
+ if err := json.Unmarshal(v, &pi); err != nil {
+ return err
+ }
+ p.Paths[k] = pi
+ }
+ }
+ return nil
+}
+
+func (p *Paths) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ tok, err := dec.ReadToken()
+ if err != nil {
+ return err
+ }
+ var ext any
+ var pi PathItem
+ switch k := tok.Kind(); k {
+ case 'n':
+ return nil // noop
+ case '{':
+ for {
+ tok, err := dec.ReadToken()
+ if err != nil {
+ return err
+ }
+
+ if tok.Kind() == '}' {
+ return nil
+ }
+
+ switch k := tok.String(); {
+ case internal.IsExtensionKey(k):
+ ext = nil
+ if err := opts.UnmarshalNext(dec, &ext); err != nil {
+ return err
+ }
+
+ if p.Extensions == nil {
+ p.Extensions = make(map[string]any)
+ }
+ p.Extensions[k] = ext
+ case len(k) > 0 && k[0] == '/':
+ pi = PathItem{}
+ if err := opts.UnmarshalNext(dec, &pi); err != nil {
+ return err
+ }
+
+ if p.Paths == nil {
+ p.Paths = make(map[string]PathItem)
+ }
+ p.Paths[k] = pi
+ default:
+ _, err := dec.ReadValue() // skip value
+ if err != nil {
+ return err
+ }
+ }
+ }
+ default:
+ return fmt.Errorf("unknown JSON kind: %v", k)
+ }
+}
+
+// MarshalJSON converts this items object to JSON
+func (p Paths) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(p)
+ }
+ b1, err := json.Marshal(p.VendorExtensible)
+ if err != nil {
+ return nil, err
+ }
+
+ pths := make(map[string]PathItem)
+ for k, v := range p.Paths {
+ if strings.HasPrefix(k, "/") {
+ pths[k] = v
+ }
+ }
+ b2, err := json.Marshal(pths)
+ if err != nil {
+ return nil, err
+ }
+ concated := swag.ConcatJSON(b1, b2)
+ return concated, nil
+}
+
+func (p Paths) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ m := make(map[string]any, len(p.Extensions)+len(p.Paths))
+ for k, v := range p.Extensions {
+ if internal.IsExtensionKey(k) {
+ m[k] = v
+ }
+ }
+ for k, v := range p.Paths {
+ if strings.HasPrefix(k, "/") {
+ m[k] = v
+ }
+ }
+ return opts.MarshalNext(enc, m)
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/ref.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/ref.go
new file mode 100644
index 000000000..775b3b0c3
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/ref.go
@@ -0,0 +1,155 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package spec
+
+import (
+ "encoding/json"
+ "net/http"
+ "os"
+ "path/filepath"
+
+ "github.com/go-openapi/jsonreference"
+
+ "k8s.io/kube-openapi/pkg/internal"
+)
+
+// Refable is a struct for things that accept a $ref property
+type Refable struct {
+ Ref Ref
+}
+
+// MarshalJSON marshals the ref to json
+func (r Refable) MarshalJSON() ([]byte, error) {
+ return r.Ref.MarshalJSON()
+}
+
+// UnmarshalJSON unmarshalss the ref from json
+func (r *Refable) UnmarshalJSON(d []byte) error {
+ return json.Unmarshal(d, &r.Ref)
+}
+
+// Ref represents a json reference that is potentially resolved
+type Ref struct {
+ jsonreference.Ref
+}
+
+// RemoteURI gets the remote uri part of the ref
+func (r *Ref) RemoteURI() string {
+ if r.String() == "" {
+ return r.String()
+ }
+
+ u := *r.GetURL()
+ u.Fragment = ""
+ return u.String()
+}
+
+// IsValidURI returns true when the url the ref points to can be found
+func (r *Ref) IsValidURI(basepaths ...string) bool {
+ if r.String() == "" {
+ return true
+ }
+
+ v := r.RemoteURI()
+ if v == "" {
+ return true
+ }
+
+ if r.HasFullURL {
+ rr, err := http.Get(v)
+ if err != nil {
+ return false
+ }
+
+ return rr.StatusCode/100 == 2
+ }
+
+ if !(r.HasFileScheme || r.HasFullFilePath || r.HasURLPathOnly) {
+ return false
+ }
+
+ // check for local file
+ pth := v
+ if r.HasURLPathOnly {
+ base := "."
+ if len(basepaths) > 0 {
+ base = filepath.Dir(filepath.Join(basepaths...))
+ }
+ p, e := filepath.Abs(filepath.ToSlash(filepath.Join(base, pth)))
+ if e != nil {
+ return false
+ }
+ pth = p
+ }
+
+ fi, err := os.Stat(filepath.ToSlash(pth))
+ if err != nil {
+ return false
+ }
+
+ return !fi.IsDir()
+}
+
+// Inherits creates a new reference from a parent and a child
+// If the child cannot inherit from the parent, an error is returned
+func (r *Ref) Inherits(child Ref) (*Ref, error) {
+ ref, err := r.Ref.Inherits(child.Ref)
+ if err != nil {
+ return nil, err
+ }
+ return &Ref{Ref: *ref}, nil
+}
+
+// NewRef creates a new instance of a ref object
+// returns an error when the reference uri is an invalid uri
+func NewRef(refURI string) (Ref, error) {
+ ref, err := jsonreference.New(refURI)
+ if err != nil {
+ return Ref{}, err
+ }
+ return Ref{Ref: ref}, nil
+}
+
+// MustCreateRef creates a ref object but panics when refURI is invalid.
+// Use the NewRef method for a version that returns an error.
+func MustCreateRef(refURI string) Ref {
+ return Ref{Ref: jsonreference.MustCreateRef(refURI)}
+}
+
+// MarshalJSON marshals this ref into a JSON object
+func (r Ref) MarshalJSON() ([]byte, error) {
+ str := r.String()
+ if str == "" {
+ if r.IsRoot() {
+ return []byte(`{"$ref":""}`), nil
+ }
+ return []byte("{}"), nil
+ }
+ v := map[string]interface{}{"$ref": str}
+ return json.Marshal(v)
+}
+
+// UnmarshalJSON unmarshals this ref from a JSON object
+func (r *Ref) UnmarshalJSON(d []byte) error {
+ var v map[string]interface{}
+ if err := json.Unmarshal(d, &v); err != nil {
+ return err
+ }
+ return r.fromMap(v)
+}
+
+func (r *Ref) fromMap(v map[string]interface{}) error {
+ return internal.JSONRefFromMap(&r.Ref, v)
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/response.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/response.go
new file mode 100644
index 000000000..3ff1fe132
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/response.go
@@ -0,0 +1,131 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package spec
+
+import (
+ "encoding/json"
+
+ "github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
+)
+
+// ResponseProps properties specific to a response
+type ResponseProps struct {
+ Description string `json:"description,omitempty"`
+ Schema *Schema `json:"schema,omitempty"`
+ Headers map[string]Header `json:"headers,omitempty"`
+ Examples map[string]interface{} `json:"examples,omitempty"`
+}
+
+// Marshaling structure only, always edit along with corresponding
+// struct (or compilation will fail).
+type responsePropsOmitZero struct {
+ Description string `json:"description,omitempty"`
+ Schema *Schema `json:"schema,omitzero"`
+ Headers map[string]Header `json:"headers,omitempty"`
+ Examples map[string]interface{} `json:"examples,omitempty"`
+}
+
+// Response describes a single response from an API Operation.
+//
+// For more information: http://goo.gl/8us55a#responseObject
+type Response struct {
+ Refable
+ ResponseProps
+ VendorExtensible
+}
+
+// UnmarshalJSON hydrates this items instance with the data from JSON
+func (r *Response) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshaling {
+ return jsonv2.Unmarshal(data, r)
+ }
+
+ if err := json.Unmarshal(data, &r.ResponseProps); err != nil {
+ return err
+ }
+ if err := json.Unmarshal(data, &r.Refable); err != nil {
+ return err
+ }
+ if err := json.Unmarshal(data, &r.VendorExtensible); err != nil {
+ return err
+ }
+
+ return nil
+}
+
+func (r *Response) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ var x struct {
+ ResponseProps
+ Extensions
+ }
+
+ if err := opts.UnmarshalNext(dec, &x); err != nil {
+ return err
+ }
+
+ if err := r.Refable.Ref.fromMap(x.Extensions); err != nil {
+ return err
+ }
+ r.Extensions = internal.SanitizeExtensions(x.Extensions)
+ r.ResponseProps = x.ResponseProps
+
+ return nil
+}
+
+// MarshalJSON converts this items object to JSON
+func (r Response) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(r)
+ }
+ b1, err := json.Marshal(r.ResponseProps)
+ if err != nil {
+ return nil, err
+ }
+ b2, err := json.Marshal(r.Refable)
+ if err != nil {
+ return nil, err
+ }
+ b3, err := json.Marshal(r.VendorExtensible)
+ if err != nil {
+ return nil, err
+ }
+ return swag.ConcatJSON(b1, b2, b3), nil
+}
+
+func (r Response) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ Ref string `json:"$ref,omitempty"`
+ Extensions
+ ResponseProps responsePropsOmitZero `json:",inline"`
+ }
+ x.Ref = r.Refable.Ref.String()
+ x.Extensions = internal.SanitizeExtensions(r.Extensions)
+ x.ResponseProps = responsePropsOmitZero(r.ResponseProps)
+ return opts.MarshalNext(enc, x)
+}
+
+// NewResponse creates a new response instance
+func NewResponse() *Response {
+ return new(Response)
+}
+
+// ResponseRef creates a response as a json reference
+func ResponseRef(url string) *Response {
+ resp := NewResponse()
+ resp.Ref = MustCreateRef(url)
+ return resp
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/responses.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/responses.go
new file mode 100644
index 000000000..d9ad760a4
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/responses.go
@@ -0,0 +1,208 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package spec
+
+import (
+ "encoding/json"
+ "fmt"
+ "reflect"
+ "strconv"
+
+ "github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
+)
+
+// Responses is a container for the expected responses of an operation.
+// The container maps a HTTP response code to the expected response.
+// It is not expected from the documentation to necessarily cover all possible HTTP response codes,
+// since they may not be known in advance. However, it is expected from the documentation to cover
+// a successful operation response and any known errors.
+//
+// The `default` can be used a default response object for all HTTP codes that are not covered
+// individually by the specification.
+//
+// The `Responses Object` MUST contain at least one response code, and it SHOULD be the response
+// for a successful operation call.
+//
+// For more information: http://goo.gl/8us55a#responsesObject
+type Responses struct {
+ VendorExtensible
+ ResponsesProps
+}
+
+// UnmarshalJSON hydrates this items instance with the data from JSON
+func (r *Responses) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshaling {
+ return jsonv2.Unmarshal(data, r)
+ }
+
+ if err := json.Unmarshal(data, &r.ResponsesProps); err != nil {
+ return err
+ }
+ if err := json.Unmarshal(data, &r.VendorExtensible); err != nil {
+ return err
+ }
+ if reflect.DeepEqual(ResponsesProps{}, r.ResponsesProps) {
+ r.ResponsesProps = ResponsesProps{}
+ }
+ return nil
+}
+
+// MarshalJSON converts this items object to JSON
+func (r Responses) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(r)
+ }
+ b1, err := json.Marshal(r.ResponsesProps)
+ if err != nil {
+ return nil, err
+ }
+ b2, err := json.Marshal(r.VendorExtensible)
+ if err != nil {
+ return nil, err
+ }
+ concated := swag.ConcatJSON(b1, b2)
+ return concated, nil
+}
+
+func (r Responses) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ type ArbitraryKeys map[string]interface{}
+ var x struct {
+ ArbitraryKeys
+ Default *Response `json:"default,omitempty"`
+ }
+ x.ArbitraryKeys = make(map[string]any, len(r.Extensions)+len(r.StatusCodeResponses))
+ for k, v := range r.Extensions {
+ if internal.IsExtensionKey(k) {
+ x.ArbitraryKeys[k] = v
+ }
+ }
+ for k, v := range r.StatusCodeResponses {
+ x.ArbitraryKeys[strconv.Itoa(k)] = v
+ }
+ x.Default = r.Default
+ return opts.MarshalNext(enc, x)
+}
+
+// ResponsesProps describes all responses for an operation.
+// It tells what is the default response and maps all responses with a
+// HTTP status code.
+type ResponsesProps struct {
+ Default *Response
+ StatusCodeResponses map[int]Response
+}
+
+// MarshalJSON marshals responses as JSON
+func (r ResponsesProps) MarshalJSON() ([]byte, error) {
+ toser := map[string]Response{}
+ if r.Default != nil {
+ toser["default"] = *r.Default
+ }
+ for k, v := range r.StatusCodeResponses {
+ toser[strconv.Itoa(k)] = v
+ }
+ return json.Marshal(toser)
+}
+
+// UnmarshalJSON unmarshals responses from JSON
+func (r *ResponsesProps) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshaling {
+ return jsonv2.Unmarshal(data, r)
+ }
+ var res map[string]json.RawMessage
+ if err := json.Unmarshal(data, &res); err != nil {
+ return err
+ }
+ if v, ok := res["default"]; ok {
+ value := Response{}
+ if err := json.Unmarshal(v, &value); err != nil {
+ return err
+ }
+ r.Default = &value
+ delete(res, "default")
+ }
+ for k, v := range res {
+ // Take all integral keys
+ if nk, err := strconv.Atoi(k); err == nil {
+ if r.StatusCodeResponses == nil {
+ r.StatusCodeResponses = map[int]Response{}
+ }
+ value := Response{}
+ if err := json.Unmarshal(v, &value); err != nil {
+ return err
+ }
+ r.StatusCodeResponses[nk] = value
+ }
+ }
+ return nil
+}
+
+func (r *Responses) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) (err error) {
+ tok, err := dec.ReadToken()
+ if err != nil {
+ return err
+ }
+ var ext any
+ var resp Response
+ switch k := tok.Kind(); k {
+ case 'n':
+ return nil // noop
+ case '{':
+ for {
+ tok, err := dec.ReadToken()
+ if err != nil {
+ return err
+ }
+ if tok.Kind() == '}' {
+ return nil
+ }
+ switch k := tok.String(); {
+ case internal.IsExtensionKey(k):
+ ext = nil
+ if err := opts.UnmarshalNext(dec, &ext); err != nil {
+ return err
+ }
+
+ if r.Extensions == nil {
+ r.Extensions = make(map[string]any)
+ }
+ r.Extensions[k] = ext
+ case k == "default":
+ resp = Response{}
+ if err := opts.UnmarshalNext(dec, &resp); err != nil {
+ return err
+ }
+
+ respCopy := resp
+ r.ResponsesProps.Default = &respCopy
+ default:
+ if nk, err := strconv.Atoi(k); err == nil {
+ resp = Response{}
+ if err := opts.UnmarshalNext(dec, &resp); err != nil {
+ return err
+ }
+
+ if r.StatusCodeResponses == nil {
+ r.StatusCodeResponses = map[int]Response{}
+ }
+ r.StatusCodeResponses[nk] = resp
+ }
+ }
+ }
+ default:
+ return fmt.Errorf("unknown JSON kind: %v", k)
+ }
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/schema.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/schema.go
new file mode 100644
index 000000000..dfbb2e05c
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/schema.go
@@ -0,0 +1,631 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package spec
+
+import (
+ "encoding/json"
+ "fmt"
+ "net/url"
+ "strings"
+
+ "github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
+)
+
+// BooleanProperty creates a boolean property
+func BooleanProperty() *Schema {
+ return &Schema{SchemaProps: SchemaProps{Type: []string{"boolean"}}}
+}
+
+// BoolProperty creates a boolean property
+func BoolProperty() *Schema { return BooleanProperty() }
+
+// StringProperty creates a string property
+func StringProperty() *Schema {
+ return &Schema{SchemaProps: SchemaProps{Type: []string{"string"}}}
+}
+
+// CharProperty creates a string property
+func CharProperty() *Schema {
+ return &Schema{SchemaProps: SchemaProps{Type: []string{"string"}}}
+}
+
+// Float64Property creates a float64/double property
+func Float64Property() *Schema {
+ return &Schema{SchemaProps: SchemaProps{Type: []string{"number"}, Format: "double"}}
+}
+
+// Float32Property creates a float32/float property
+func Float32Property() *Schema {
+ return &Schema{SchemaProps: SchemaProps{Type: []string{"number"}, Format: "float"}}
+}
+
+// Int8Property creates an int8 property
+func Int8Property() *Schema {
+ return &Schema{SchemaProps: SchemaProps{Type: []string{"integer"}, Format: "int8"}}
+}
+
+// Int16Property creates an int16 property
+func Int16Property() *Schema {
+ return &Schema{SchemaProps: SchemaProps{Type: []string{"integer"}, Format: "int16"}}
+}
+
+// Int32Property creates an int32 property
+func Int32Property() *Schema {
+ return &Schema{SchemaProps: SchemaProps{Type: []string{"integer"}, Format: "int32"}}
+}
+
+// Int64Property creates an int64 property
+func Int64Property() *Schema {
+ return &Schema{SchemaProps: SchemaProps{Type: []string{"integer"}, Format: "int64"}}
+}
+
+// StrFmtProperty creates a property for the named string format
+func StrFmtProperty(format string) *Schema {
+ return &Schema{SchemaProps: SchemaProps{Type: []string{"string"}, Format: format}}
+}
+
+// DateProperty creates a date property
+func DateProperty() *Schema {
+ return &Schema{SchemaProps: SchemaProps{Type: []string{"string"}, Format: "date"}}
+}
+
+// DateTimeProperty creates a date time property
+func DateTimeProperty() *Schema {
+ return &Schema{SchemaProps: SchemaProps{Type: []string{"string"}, Format: "date-time"}}
+}
+
+// MapProperty creates a map property
+func MapProperty(property *Schema) *Schema {
+ return &Schema{SchemaProps: SchemaProps{Type: []string{"object"},
+ AdditionalProperties: &SchemaOrBool{Allows: true, Schema: property}}}
+}
+
+// RefProperty creates a ref property
+func RefProperty(name string) *Schema {
+ return &Schema{SchemaProps: SchemaProps{Ref: MustCreateRef(name)}}
+}
+
+// RefSchema creates a ref property
+func RefSchema(name string) *Schema {
+ return &Schema{SchemaProps: SchemaProps{Ref: MustCreateRef(name)}}
+}
+
+// ArrayProperty creates an array property
+func ArrayProperty(items *Schema) *Schema {
+ if items == nil {
+ return &Schema{SchemaProps: SchemaProps{Type: []string{"array"}}}
+ }
+ return &Schema{SchemaProps: SchemaProps{Items: &SchemaOrArray{Schema: items}, Type: []string{"array"}}}
+}
+
+// ComposedSchema creates a schema with allOf
+func ComposedSchema(schemas ...Schema) *Schema {
+ s := new(Schema)
+ s.AllOf = schemas
+ return s
+}
+
+// SchemaURL represents a schema url
+type SchemaURL string
+
+// MarshalJSON marshal this to JSON
+func (r SchemaURL) MarshalJSON() ([]byte, error) {
+ if r == "" {
+ return []byte("{}"), nil
+ }
+ v := map[string]interface{}{"$schema": string(r)}
+ return json.Marshal(v)
+}
+
+// UnmarshalJSON unmarshal this from JSON
+func (r *SchemaURL) UnmarshalJSON(data []byte) error {
+ var v map[string]interface{}
+ if err := json.Unmarshal(data, &v); err != nil {
+ return err
+ }
+ return r.fromMap(v)
+}
+
+func (r *SchemaURL) fromMap(v map[string]interface{}) error {
+ if v == nil {
+ return nil
+ }
+ if vv, ok := v["$schema"]; ok {
+ if str, ok := vv.(string); ok {
+ u, err := url.Parse(str)
+ if err != nil {
+ return err
+ }
+
+ *r = SchemaURL(u.String())
+ }
+ }
+ return nil
+}
+
+// SchemaProps describes a JSON schema (draft 4)
+type SchemaProps struct {
+ ID string `json:"id,omitempty"`
+ Ref Ref `json:"-"`
+ Schema SchemaURL `json:"-"`
+ Description string `json:"description,omitempty"`
+ Type StringOrArray `json:"type,omitempty"`
+ Nullable bool `json:"nullable,omitempty"`
+ Format string `json:"format,omitempty"`
+ Title string `json:"title,omitempty"`
+ Default interface{} `json:"default,omitempty"`
+ Maximum *float64 `json:"maximum,omitempty"`
+ ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"`
+ Minimum *float64 `json:"minimum,omitempty"`
+ ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"`
+ MaxLength *int64 `json:"maxLength,omitempty"`
+ MinLength *int64 `json:"minLength,omitempty"`
+ Pattern string `json:"pattern,omitempty"`
+ MaxItems *int64 `json:"maxItems,omitempty"`
+ MinItems *int64 `json:"minItems,omitempty"`
+ UniqueItems bool `json:"uniqueItems,omitempty"`
+ MultipleOf *float64 `json:"multipleOf,omitempty"`
+ Enum []interface{} `json:"enum,omitempty"`
+ MaxProperties *int64 `json:"maxProperties,omitempty"`
+ MinProperties *int64 `json:"minProperties,omitempty"`
+ Required []string `json:"required,omitempty"`
+ Items *SchemaOrArray `json:"items,omitempty"`
+ AllOf []Schema `json:"allOf,omitempty"`
+ OneOf []Schema `json:"oneOf,omitempty"`
+ AnyOf []Schema `json:"anyOf,omitempty"`
+ Not *Schema `json:"not,omitempty"`
+ Properties map[string]Schema `json:"properties,omitempty"`
+ AdditionalProperties *SchemaOrBool `json:"additionalProperties,omitempty"`
+ PatternProperties map[string]Schema `json:"patternProperties,omitempty"`
+ Dependencies Dependencies `json:"dependencies,omitempty"`
+ AdditionalItems *SchemaOrBool `json:"additionalItems,omitempty"`
+ Definitions Definitions `json:"definitions,omitempty"`
+}
+
+// Marshaling structure only, always edit along with corresponding
+// struct (or compilation will fail).
+type schemaPropsOmitZero struct {
+ ID string `json:"id,omitempty"`
+ Ref Ref `json:"-"`
+ Schema SchemaURL `json:"-"`
+ Description string `json:"description,omitempty"`
+ Type StringOrArray `json:"type,omitzero"`
+ Nullable bool `json:"nullable,omitzero"`
+ Format string `json:"format,omitempty"`
+ Title string `json:"title,omitempty"`
+ Default interface{} `json:"default,omitzero"`
+ Maximum *float64 `json:"maximum,omitempty"`
+ ExclusiveMaximum bool `json:"exclusiveMaximum,omitzero"`
+ Minimum *float64 `json:"minimum,omitempty"`
+ ExclusiveMinimum bool `json:"exclusiveMinimum,omitzero"`
+ MaxLength *int64 `json:"maxLength,omitempty"`
+ MinLength *int64 `json:"minLength,omitempty"`
+ Pattern string `json:"pattern,omitempty"`
+ MaxItems *int64 `json:"maxItems,omitempty"`
+ MinItems *int64 `json:"minItems,omitempty"`
+ UniqueItems bool `json:"uniqueItems,omitzero"`
+ MultipleOf *float64 `json:"multipleOf,omitempty"`
+ Enum []interface{} `json:"enum,omitempty"`
+ MaxProperties *int64 `json:"maxProperties,omitempty"`
+ MinProperties *int64 `json:"minProperties,omitempty"`
+ Required []string `json:"required,omitempty"`
+ Items *SchemaOrArray `json:"items,omitzero"`
+ AllOf []Schema `json:"allOf,omitempty"`
+ OneOf []Schema `json:"oneOf,omitempty"`
+ AnyOf []Schema `json:"anyOf,omitempty"`
+ Not *Schema `json:"not,omitzero"`
+ Properties map[string]Schema `json:"properties,omitempty"`
+ AdditionalProperties *SchemaOrBool `json:"additionalProperties,omitzero"`
+ PatternProperties map[string]Schema `json:"patternProperties,omitempty"`
+ Dependencies Dependencies `json:"dependencies,omitempty"`
+ AdditionalItems *SchemaOrBool `json:"additionalItems,omitzero"`
+ Definitions Definitions `json:"definitions,omitempty"`
+}
+
+// SwaggerSchemaProps are additional properties supported by swagger schemas, but not JSON-schema (draft 4)
+type SwaggerSchemaProps struct {
+ Discriminator string `json:"discriminator,omitempty"`
+ ReadOnly bool `json:"readOnly,omitempty"`
+ ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"`
+ Example interface{} `json:"example,omitempty"`
+}
+
+// Marshaling structure only, always edit along with corresponding
+// struct (or compilation will fail).
+type swaggerSchemaPropsOmitZero struct {
+ Discriminator string `json:"discriminator,omitempty"`
+ ReadOnly bool `json:"readOnly,omitzero"`
+ ExternalDocs *ExternalDocumentation `json:"externalDocs,omitzero"`
+ Example interface{} `json:"example,omitempty"`
+}
+
+// Schema the schema object allows the definition of input and output data types.
+// These types can be objects, but also primitives and arrays.
+// This object is based on the [JSON Schema Specification Draft 4](http://json-schema.org/)
+// and uses a predefined subset of it.
+// On top of this subset, there are extensions provided by this specification to allow for more complete documentation.
+//
+// For more information: http://goo.gl/8us55a#schemaObject
+type Schema struct {
+ VendorExtensible
+ SchemaProps
+ SwaggerSchemaProps
+ ExtraProps map[string]interface{} `json:"-"`
+}
+
+// WithID sets the id for this schema, allows for chaining
+func (s *Schema) WithID(id string) *Schema {
+ s.ID = id
+ return s
+}
+
+// WithTitle sets the title for this schema, allows for chaining
+func (s *Schema) WithTitle(title string) *Schema {
+ s.Title = title
+ return s
+}
+
+// WithDescription sets the description for this schema, allows for chaining
+func (s *Schema) WithDescription(description string) *Schema {
+ s.Description = description
+ return s
+}
+
+// WithProperties sets the properties for this schema
+func (s *Schema) WithProperties(schemas map[string]Schema) *Schema {
+ s.Properties = schemas
+ return s
+}
+
+// SetProperty sets a property on this schema
+func (s *Schema) SetProperty(name string, schema Schema) *Schema {
+ if s.Properties == nil {
+ s.Properties = make(map[string]Schema)
+ }
+ s.Properties[name] = schema
+ return s
+}
+
+// WithAllOf sets the all of property
+func (s *Schema) WithAllOf(schemas ...Schema) *Schema {
+ s.AllOf = schemas
+ return s
+}
+
+// WithMaxProperties sets the max number of properties an object can have
+func (s *Schema) WithMaxProperties(max int64) *Schema {
+ s.MaxProperties = &max
+ return s
+}
+
+// WithMinProperties sets the min number of properties an object must have
+func (s *Schema) WithMinProperties(min int64) *Schema {
+ s.MinProperties = &min
+ return s
+}
+
+// Typed sets the type of this schema for a single value item
+func (s *Schema) Typed(tpe, format string) *Schema {
+ s.Type = []string{tpe}
+ s.Format = format
+ return s
+}
+
+// AddType adds a type with potential format to the types for this schema
+func (s *Schema) AddType(tpe, format string) *Schema {
+ s.Type = append(s.Type, tpe)
+ if format != "" {
+ s.Format = format
+ }
+ return s
+}
+
+// AsNullable flags this schema as nullable.
+func (s *Schema) AsNullable() *Schema {
+ s.Nullable = true
+ return s
+}
+
+// CollectionOf a fluent builder method for an array parameter
+func (s *Schema) CollectionOf(items Schema) *Schema {
+ s.Type = []string{jsonArray}
+ s.Items = &SchemaOrArray{Schema: &items}
+ return s
+}
+
+// WithDefault sets the default value on this parameter
+func (s *Schema) WithDefault(defaultValue interface{}) *Schema {
+ s.Default = defaultValue
+ return s
+}
+
+// WithRequired flags this parameter as required
+func (s *Schema) WithRequired(items ...string) *Schema {
+ s.Required = items
+ return s
+}
+
+// AddRequired adds field names to the required properties array
+func (s *Schema) AddRequired(items ...string) *Schema {
+ s.Required = append(s.Required, items...)
+ return s
+}
+
+// WithMaxLength sets a max length value
+func (s *Schema) WithMaxLength(max int64) *Schema {
+ s.MaxLength = &max
+ return s
+}
+
+// WithMinLength sets a min length value
+func (s *Schema) WithMinLength(min int64) *Schema {
+ s.MinLength = &min
+ return s
+}
+
+// WithPattern sets a pattern value
+func (s *Schema) WithPattern(pattern string) *Schema {
+ s.Pattern = pattern
+ return s
+}
+
+// WithMultipleOf sets a multiple of value
+func (s *Schema) WithMultipleOf(number float64) *Schema {
+ s.MultipleOf = &number
+ return s
+}
+
+// WithMaximum sets a maximum number value
+func (s *Schema) WithMaximum(max float64, exclusive bool) *Schema {
+ s.Maximum = &max
+ s.ExclusiveMaximum = exclusive
+ return s
+}
+
+// WithMinimum sets a minimum number value
+func (s *Schema) WithMinimum(min float64, exclusive bool) *Schema {
+ s.Minimum = &min
+ s.ExclusiveMinimum = exclusive
+ return s
+}
+
+// WithEnum sets a the enum values (replace)
+func (s *Schema) WithEnum(values ...interface{}) *Schema {
+ s.Enum = append([]interface{}{}, values...)
+ return s
+}
+
+// WithMaxItems sets the max items
+func (s *Schema) WithMaxItems(size int64) *Schema {
+ s.MaxItems = &size
+ return s
+}
+
+// WithMinItems sets the min items
+func (s *Schema) WithMinItems(size int64) *Schema {
+ s.MinItems = &size
+ return s
+}
+
+// UniqueValues dictates that this array can only have unique items
+func (s *Schema) UniqueValues() *Schema {
+ s.UniqueItems = true
+ return s
+}
+
+// AllowDuplicates this array can have duplicates
+func (s *Schema) AllowDuplicates() *Schema {
+ s.UniqueItems = false
+ return s
+}
+
+// AddToAllOf adds a schema to the allOf property
+func (s *Schema) AddToAllOf(schemas ...Schema) *Schema {
+ s.AllOf = append(s.AllOf, schemas...)
+ return s
+}
+
+// WithDiscriminator sets the name of the discriminator field
+func (s *Schema) WithDiscriminator(discriminator string) *Schema {
+ s.Discriminator = discriminator
+ return s
+}
+
+// AsReadOnly flags this schema as readonly
+func (s *Schema) AsReadOnly() *Schema {
+ s.ReadOnly = true
+ return s
+}
+
+// AsWritable flags this schema as writeable (not read-only)
+func (s *Schema) AsWritable() *Schema {
+ s.ReadOnly = false
+ return s
+}
+
+// WithExample sets the example for this schema
+func (s *Schema) WithExample(example interface{}) *Schema {
+ s.Example = example
+ return s
+}
+
+// WithExternalDocs sets/removes the external docs for/from this schema.
+// When you pass empty strings as params the external documents will be removed.
+// When you pass non-empty string as one value then those values will be used on the external docs object.
+// So when you pass a non-empty description, you should also pass the url and vice versa.
+func (s *Schema) WithExternalDocs(description, url string) *Schema {
+ if description == "" && url == "" {
+ s.ExternalDocs = nil
+ return s
+ }
+
+ if s.ExternalDocs == nil {
+ s.ExternalDocs = &ExternalDocumentation{}
+ }
+ s.ExternalDocs.Description = description
+ s.ExternalDocs.URL = url
+ return s
+}
+
+// MarshalJSON marshal this to JSON
+func (s Schema) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(s)
+ }
+ b1, err := json.Marshal(s.SchemaProps)
+ if err != nil {
+ return nil, fmt.Errorf("schema props %v", err)
+ }
+ b2, err := json.Marshal(s.VendorExtensible)
+ if err != nil {
+ return nil, fmt.Errorf("vendor props %v", err)
+ }
+ b3, err := s.Ref.MarshalJSON()
+ if err != nil {
+ return nil, fmt.Errorf("ref prop %v", err)
+ }
+ b4, err := s.Schema.MarshalJSON()
+ if err != nil {
+ return nil, fmt.Errorf("schema prop %v", err)
+ }
+ b5, err := json.Marshal(s.SwaggerSchemaProps)
+ if err != nil {
+ return nil, fmt.Errorf("common validations %v", err)
+ }
+ var b6 []byte
+ if s.ExtraProps != nil {
+ jj, err := json.Marshal(s.ExtraProps)
+ if err != nil {
+ return nil, fmt.Errorf("extra props %v", err)
+ }
+ b6 = jj
+ }
+ return swag.ConcatJSON(b1, b2, b3, b4, b5, b6), nil
+}
+
+func (s Schema) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ type ArbitraryKeys map[string]interface{}
+ var x struct {
+ ArbitraryKeys
+ SchemaProps schemaPropsOmitZero `json:",inline"`
+ SwaggerSchemaProps swaggerSchemaPropsOmitZero `json:",inline"`
+ Schema string `json:"$schema,omitempty"`
+ Ref string `json:"$ref,omitempty"`
+ }
+ x.ArbitraryKeys = make(map[string]any, len(s.Extensions)+len(s.ExtraProps))
+ for k, v := range s.Extensions {
+ if internal.IsExtensionKey(k) {
+ x.ArbitraryKeys[k] = v
+ }
+ }
+ for k, v := range s.ExtraProps {
+ x.ArbitraryKeys[k] = v
+ }
+ x.SchemaProps = schemaPropsOmitZero(s.SchemaProps)
+ x.SwaggerSchemaProps = swaggerSchemaPropsOmitZero(s.SwaggerSchemaProps)
+ x.Ref = s.Ref.String()
+ x.Schema = string(s.Schema)
+ return opts.MarshalNext(enc, x)
+}
+
+// UnmarshalJSON marshal this from JSON
+func (s *Schema) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshaling {
+ return jsonv2.Unmarshal(data, s)
+ }
+
+ props := struct {
+ SchemaProps
+ SwaggerSchemaProps
+ }{}
+ if err := json.Unmarshal(data, &props); err != nil {
+ return err
+ }
+
+ sch := Schema{
+ SchemaProps: props.SchemaProps,
+ SwaggerSchemaProps: props.SwaggerSchemaProps,
+ }
+
+ var d map[string]interface{}
+ if err := json.Unmarshal(data, &d); err != nil {
+ return err
+ }
+
+ _ = sch.Ref.fromMap(d)
+ _ = sch.Schema.fromMap(d)
+
+ delete(d, "$ref")
+ delete(d, "$schema")
+ for _, pn := range swag.DefaultJSONNameProvider.GetJSONNames(s) {
+ delete(d, pn)
+ }
+
+ for k, vv := range d {
+ lk := strings.ToLower(k)
+ if strings.HasPrefix(lk, "x-") {
+ if sch.Extensions == nil {
+ sch.Extensions = map[string]interface{}{}
+ }
+ sch.Extensions[k] = vv
+ continue
+ }
+ if sch.ExtraProps == nil {
+ sch.ExtraProps = map[string]interface{}{}
+ }
+ sch.ExtraProps[k] = vv
+ }
+
+ *s = sch
+
+ return nil
+}
+
+func (s *Schema) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ var x struct {
+ Extensions
+ SchemaProps
+ SwaggerSchemaProps
+ }
+ if err := opts.UnmarshalNext(dec, &x); err != nil {
+ return err
+ }
+
+ if err := x.Ref.fromMap(x.Extensions); err != nil {
+ return err
+ }
+
+ if err := x.Schema.fromMap(x.Extensions); err != nil {
+ return err
+ }
+
+ delete(x.Extensions, "$ref")
+ delete(x.Extensions, "$schema")
+
+ for _, pn := range swag.DefaultJSONNameProvider.GetJSONNames(s) {
+ delete(x.Extensions, pn)
+ }
+ if len(x.Extensions) == 0 {
+ x.Extensions = nil
+ }
+
+ s.ExtraProps = x.Extensions.sanitizeWithExtra()
+ s.Extensions = internal.SanitizeExtensions(x.Extensions)
+ s.SchemaProps = x.SchemaProps
+ s.SwaggerSchemaProps = x.SwaggerSchemaProps
+ return nil
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/security_scheme.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/security_scheme.go
new file mode 100644
index 000000000..e2b7da14c
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/security_scheme.go
@@ -0,0 +1,92 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package spec
+
+import (
+ "encoding/json"
+
+ "github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
+)
+
+// SecuritySchemeProps describes a swagger security scheme in the securityDefinitions section
+type SecuritySchemeProps struct {
+ Description string `json:"description,omitempty"`
+ Type string `json:"type"`
+ Name string `json:"name,omitempty"` // api key
+ In string `json:"in,omitempty"` // api key
+ Flow string `json:"flow,omitempty"` // oauth2
+ AuthorizationURL string `json:"authorizationUrl,omitempty"` // oauth2
+ TokenURL string `json:"tokenUrl,omitempty"` // oauth2
+ Scopes map[string]string `json:"scopes,omitempty"` // oauth2
+}
+
+// SecurityScheme allows the definition of a security scheme that can be used by the operations.
+// Supported schemes are basic authentication, an API key (either as a header or as a query parameter)
+// and OAuth2's common flows (implicit, password, application and access code).
+//
+// For more information: http://goo.gl/8us55a#securitySchemeObject
+type SecurityScheme struct {
+ VendorExtensible
+ SecuritySchemeProps
+}
+
+// MarshalJSON marshal this to JSON
+func (s SecurityScheme) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(s)
+ }
+ b1, err := json.Marshal(s.SecuritySchemeProps)
+ if err != nil {
+ return nil, err
+ }
+ b2, err := json.Marshal(s.VendorExtensible)
+ if err != nil {
+ return nil, err
+ }
+ return swag.ConcatJSON(b1, b2), nil
+}
+
+func (s SecurityScheme) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ Extensions
+ SecuritySchemeProps
+ }
+ x.Extensions = internal.SanitizeExtensions(s.Extensions)
+ x.SecuritySchemeProps = s.SecuritySchemeProps
+ return opts.MarshalNext(enc, x)
+}
+
+// UnmarshalJSON marshal this from JSON
+func (s *SecurityScheme) UnmarshalJSON(data []byte) error {
+ if err := json.Unmarshal(data, &s.SecuritySchemeProps); err != nil {
+ return err
+ }
+ return json.Unmarshal(data, &s.VendorExtensible)
+}
+
+func (s *SecurityScheme) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ var x struct {
+ Extensions
+ SecuritySchemeProps
+ }
+ if err := opts.UnmarshalNext(dec, &x); err != nil {
+ return err
+ }
+ s.Extensions = internal.SanitizeExtensions(x.Extensions)
+ s.SecuritySchemeProps = x.SecuritySchemeProps
+ return nil
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/swagger.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/swagger.go
new file mode 100644
index 000000000..c8f3beaa3
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/swagger.go
@@ -0,0 +1,439 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package spec
+
+import (
+ "encoding/json"
+ "fmt"
+
+ "github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
+)
+
+// Swagger this is the root document object for the API specification.
+// It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier)
+// together into one document.
+//
+// For more information: http://goo.gl/8us55a#swagger-object-
+type Swagger struct {
+ VendorExtensible
+ SwaggerProps
+}
+
+// MarshalJSON marshals this swagger structure to json
+func (s Swagger) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(s)
+ }
+ b1, err := json.Marshal(s.SwaggerProps)
+ if err != nil {
+ return nil, err
+ }
+ b2, err := json.Marshal(s.VendorExtensible)
+ if err != nil {
+ return nil, err
+ }
+ return swag.ConcatJSON(b1, b2), nil
+}
+
+// MarshalJSON marshals this swagger structure to json
+func (s Swagger) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ Extensions
+ SwaggerProps
+ }
+ x.Extensions = internal.SanitizeExtensions(s.Extensions)
+ x.SwaggerProps = s.SwaggerProps
+ return opts.MarshalNext(enc, x)
+}
+
+// UnmarshalJSON unmarshals a swagger spec from json
+func (s *Swagger) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshaling {
+ return jsonv2.Unmarshal(data, s)
+ }
+ var sw Swagger
+ if err := json.Unmarshal(data, &sw.SwaggerProps); err != nil {
+ return err
+ }
+ if err := json.Unmarshal(data, &sw.VendorExtensible); err != nil {
+ return err
+ }
+ *s = sw
+ return nil
+}
+
+func (s *Swagger) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ // Note: If you're willing to make breaking changes, it is possible to
+ // optimize this and other usages of this pattern:
+ // https://github.com/kubernetes/kube-openapi/pull/319#discussion_r983165948
+ var x struct {
+ Extensions
+ SwaggerProps
+ }
+
+ if err := opts.UnmarshalNext(dec, &x); err != nil {
+ return err
+ }
+ s.Extensions = internal.SanitizeExtensions(x.Extensions)
+ s.SwaggerProps = x.SwaggerProps
+ return nil
+}
+
+// SwaggerProps captures the top-level properties of an Api specification
+//
+// NOTE: validation rules
+// - the scheme, when present must be from [http, https, ws, wss]
+// - BasePath must start with a leading "/"
+// - Paths is required
+type SwaggerProps struct {
+ ID string `json:"id,omitempty"`
+ Consumes []string `json:"consumes,omitempty"`
+ Produces []string `json:"produces,omitempty"`
+ Schemes []string `json:"schemes,omitempty"`
+ Swagger string `json:"swagger,omitempty"`
+ Info *Info `json:"info,omitempty"`
+ Host string `json:"host,omitempty"`
+ BasePath string `json:"basePath,omitempty"`
+ Paths *Paths `json:"paths"`
+ Definitions Definitions `json:"definitions,omitempty"`
+ Parameters map[string]Parameter `json:"parameters,omitempty"`
+ Responses map[string]Response `json:"responses,omitempty"`
+ SecurityDefinitions SecurityDefinitions `json:"securityDefinitions,omitempty"`
+ Security []map[string][]string `json:"security,omitempty"`
+ Tags []Tag `json:"tags,omitempty"`
+ ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"`
+}
+
+// Dependencies represent a dependencies property
+type Dependencies map[string]SchemaOrStringArray
+
+// SchemaOrBool represents a schema or boolean value, is biased towards true for the boolean property
+type SchemaOrBool struct {
+ Allows bool
+ Schema *Schema
+}
+
+var jsTrue = []byte("true")
+var jsFalse = []byte("false")
+
+// MarshalJSON convert this object to JSON
+func (s SchemaOrBool) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(s)
+ }
+ if s.Schema != nil {
+ return json.Marshal(s.Schema)
+ }
+
+ if s.Schema == nil && !s.Allows {
+ return jsFalse, nil
+ }
+ return jsTrue, nil
+}
+
+// MarshalJSON convert this object to JSON
+func (s SchemaOrBool) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ if s.Schema != nil {
+ return opts.MarshalNext(enc, s.Schema)
+ }
+
+ if s.Schema == nil && !s.Allows {
+ return enc.WriteToken(jsonv2.False)
+ }
+ return enc.WriteToken(jsonv2.True)
+}
+
+// UnmarshalJSON converts this bool or schema object from a JSON structure
+func (s *SchemaOrBool) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshaling {
+ return jsonv2.Unmarshal(data, s)
+ }
+
+ var nw SchemaOrBool
+ if len(data) > 0 && data[0] == '{' {
+ var sch Schema
+ if err := json.Unmarshal(data, &sch); err != nil {
+ return err
+ }
+ nw.Schema = &sch
+ nw.Allows = true
+ } else {
+ json.Unmarshal(data, &nw.Allows)
+ }
+ *s = nw
+ return nil
+}
+
+func (s *SchemaOrBool) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ switch k := dec.PeekKind(); k {
+ case '{':
+ err := opts.UnmarshalNext(dec, &s.Schema)
+ if err != nil {
+ return err
+ }
+ s.Allows = true
+ return nil
+ case 't', 'f':
+ err := opts.UnmarshalNext(dec, &s.Allows)
+ if err != nil {
+ return err
+ }
+ return nil
+ default:
+ return fmt.Errorf("expected object or bool, not '%v'", k.String())
+ }
+}
+
+// SchemaOrStringArray represents a schema or a string array
+type SchemaOrStringArray struct {
+ Schema *Schema
+ Property []string
+}
+
+// MarshalJSON converts this schema object or array into JSON structure
+func (s SchemaOrStringArray) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(s)
+ }
+ if len(s.Property) > 0 {
+ return json.Marshal(s.Property)
+ }
+ if s.Schema != nil {
+ return json.Marshal(s.Schema)
+ }
+ return []byte("null"), nil
+}
+
+// MarshalJSON converts this schema object or array into JSON structure
+func (s SchemaOrStringArray) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ if len(s.Property) > 0 {
+ return opts.MarshalNext(enc, s.Property)
+ }
+ if s.Schema != nil {
+ return opts.MarshalNext(enc, s.Schema)
+ }
+ return enc.WriteToken(jsonv2.Null)
+}
+
+// UnmarshalJSON converts this schema object or array from a JSON structure
+func (s *SchemaOrStringArray) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshaling {
+ return jsonv2.Unmarshal(data, s)
+ }
+
+ var first byte
+ if len(data) > 1 {
+ first = data[0]
+ }
+ var nw SchemaOrStringArray
+ if first == '{' {
+ var sch Schema
+ if err := json.Unmarshal(data, &sch); err != nil {
+ return err
+ }
+ nw.Schema = &sch
+ }
+ if first == '[' {
+ if err := json.Unmarshal(data, &nw.Property); err != nil {
+ return err
+ }
+ }
+ *s = nw
+ return nil
+}
+
+func (s *SchemaOrStringArray) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ switch dec.PeekKind() {
+ case '{':
+ return opts.UnmarshalNext(dec, &s.Schema)
+ case '[':
+ return opts.UnmarshalNext(dec, &s.Property)
+ default:
+ _, err := dec.ReadValue()
+ return err
+ }
+}
+
+// Definitions contains the models explicitly defined in this spec
+// An object to hold data types that can be consumed and produced by operations.
+// These data types can be primitives, arrays or models.
+//
+// For more information: http://goo.gl/8us55a#definitionsObject
+type Definitions map[string]Schema
+
+// SecurityDefinitions a declaration of the security schemes available to be used in the specification.
+// This does not enforce the security schemes on the operations and only serves to provide
+// the relevant details for each scheme.
+//
+// For more information: http://goo.gl/8us55a#securityDefinitionsObject
+type SecurityDefinitions map[string]*SecurityScheme
+
+// StringOrArray represents a value that can either be a string
+// or an array of strings. Mainly here for serialization purposes
+type StringOrArray []string
+
+// Contains returns true when the value is contained in the slice
+func (s StringOrArray) Contains(value string) bool {
+ for _, str := range s {
+ if str == value {
+ return true
+ }
+ }
+ return false
+}
+
+// UnmarshalJSON unmarshals this string or array object from a JSON array or JSON string
+func (s *StringOrArray) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshaling {
+ return jsonv2.Unmarshal(data, s)
+ }
+
+ var first byte
+ if len(data) > 1 {
+ first = data[0]
+ }
+
+ if first == '[' {
+ var parsed []string
+ if err := json.Unmarshal(data, &parsed); err != nil {
+ return err
+ }
+ *s = StringOrArray(parsed)
+ return nil
+ }
+
+ var single interface{}
+ if err := json.Unmarshal(data, &single); err != nil {
+ return err
+ }
+ if single == nil {
+ return nil
+ }
+ switch v := single.(type) {
+ case string:
+ *s = StringOrArray([]string{v})
+ return nil
+ default:
+ return fmt.Errorf("only string or array is allowed, not %T", single)
+ }
+}
+
+func (s *StringOrArray) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ switch k := dec.PeekKind(); k {
+ case '[':
+ *s = StringOrArray{}
+ return opts.UnmarshalNext(dec, (*[]string)(s))
+ case '"':
+ *s = StringOrArray{""}
+ return opts.UnmarshalNext(dec, &(*s)[0])
+ case 'n':
+ // Throw out null token
+ _, _ = dec.ReadToken()
+ return nil
+ default:
+ return fmt.Errorf("expected string or array, not '%v'", k.String())
+ }
+}
+
+// MarshalJSON converts this string or array to a JSON array or JSON string
+func (s StringOrArray) MarshalJSON() ([]byte, error) {
+ if len(s) == 1 {
+ return json.Marshal([]string(s)[0])
+ }
+ return json.Marshal([]string(s))
+}
+
+// SchemaOrArray represents a value that can either be a Schema
+// or an array of Schema. Mainly here for serialization purposes
+type SchemaOrArray struct {
+ Schema *Schema
+ Schemas []Schema
+}
+
+// Len returns the number of schemas in this property
+func (s SchemaOrArray) Len() int {
+ if s.Schema != nil {
+ return 1
+ }
+ return len(s.Schemas)
+}
+
+// ContainsType returns true when one of the schemas is of the specified type
+func (s *SchemaOrArray) ContainsType(name string) bool {
+ if s.Schema != nil {
+ return s.Schema.Type != nil && s.Schema.Type.Contains(name)
+ }
+ return false
+}
+
+// MarshalJSON converts this schema object or array into JSON structure
+func (s SchemaOrArray) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(s)
+ }
+ if s.Schemas != nil {
+ return json.Marshal(s.Schemas)
+ }
+ return json.Marshal(s.Schema)
+}
+
+// MarshalJSON converts this schema object or array into JSON structure
+func (s SchemaOrArray) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ if s.Schemas != nil {
+ return opts.MarshalNext(enc, s.Schemas)
+ }
+ return opts.MarshalNext(enc, s.Schema)
+}
+
+// UnmarshalJSON converts this schema object or array from a JSON structure
+func (s *SchemaOrArray) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshaling {
+ return jsonv2.Unmarshal(data, s)
+ }
+
+ var nw SchemaOrArray
+ var first byte
+ if len(data) > 1 {
+ first = data[0]
+ }
+ if first == '{' {
+ var sch Schema
+ if err := json.Unmarshal(data, &sch); err != nil {
+ return err
+ }
+ nw.Schema = &sch
+ }
+ if first == '[' {
+ if err := json.Unmarshal(data, &nw.Schemas); err != nil {
+ return err
+ }
+ }
+ *s = nw
+ return nil
+}
+
+func (s *SchemaOrArray) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ switch dec.PeekKind() {
+ case '{':
+ return opts.UnmarshalNext(dec, &s.Schema)
+ case '[':
+ return opts.UnmarshalNext(dec, &s.Schemas)
+ default:
+ _, err := dec.ReadValue()
+ return err
+ }
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/tag.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/tag.go
new file mode 100644
index 000000000..d105d52ca
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/tag.go
@@ -0,0 +1,91 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package spec
+
+import (
+ "encoding/json"
+
+ "github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
+)
+
+// TagProps describe a tag entry in the top level tags section of a swagger spec
+type TagProps struct {
+ Description string `json:"description,omitempty"`
+ Name string `json:"name,omitempty"`
+ ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"`
+}
+
+// Tag allows adding meta data to a single tag that is used by the
+// [Operation Object](http://goo.gl/8us55a#operationObject).
+// It is not mandatory to have a Tag Object per tag used there.
+//
+// For more information: http://goo.gl/8us55a#tagObject
+type Tag struct {
+ VendorExtensible
+ TagProps
+}
+
+// MarshalJSON marshal this to JSON
+func (t Tag) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(t)
+ }
+ b1, err := json.Marshal(t.TagProps)
+ if err != nil {
+ return nil, err
+ }
+ b2, err := json.Marshal(t.VendorExtensible)
+ if err != nil {
+ return nil, err
+ }
+ return swag.ConcatJSON(b1, b2), nil
+}
+
+func (t Tag) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ Extensions
+ TagProps
+ }
+ x.Extensions = internal.SanitizeExtensions(t.Extensions)
+ x.TagProps = t.TagProps
+ return opts.MarshalNext(enc, x)
+}
+
+// UnmarshalJSON marshal this from JSON
+func (t *Tag) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshaling {
+ return jsonv2.Unmarshal(data, t)
+ }
+
+ if err := json.Unmarshal(data, &t.TagProps); err != nil {
+ return err
+ }
+ return json.Unmarshal(data, &t.VendorExtensible)
+}
+
+func (t *Tag) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ var x struct {
+ Extensions
+ TagProps
+ }
+ if err := opts.UnmarshalNext(dec, &x); err != nil {
+ return err
+ }
+ t.Extensions = internal.SanitizeExtensions(x.Extensions)
+ t.TagProps = x.TagProps
+ return nil
+}
diff --git a/vendor/k8s.io/utils/clock/clock.go b/vendor/k8s.io/utils/clock/clock.go
index dd181ce8d..b8b6af5c8 100644
--- a/vendor/k8s.io/utils/clock/clock.go
+++ b/vendor/k8s.io/utils/clock/clock.go
@@ -63,6 +63,16 @@ type WithDelayedExecution interface {
AfterFunc(d time.Duration, f func()) Timer
}
+// WithTickerAndDelayedExecution allows for injecting fake or real clocks
+// into code that needs Ticker and AfterFunc functionality
+type WithTickerAndDelayedExecution interface {
+ WithTicker
+ // AfterFunc executes f in its own goroutine after waiting
+ // for d duration and returns a Timer whose channel can be
+ // closed by calling Stop() on the Timer.
+ AfterFunc(d time.Duration, f func()) Timer
+}
+
// Ticker defines the Ticker interface.
type Ticker interface {
C() <-chan time.Time
diff --git a/vendor/k8s.io/utils/clock/testing/fake_clock.go b/vendor/k8s.io/utils/clock/testing/fake_clock.go
index fb493c4ba..79e11deb6 100644
--- a/vendor/k8s.io/utils/clock/testing/fake_clock.go
+++ b/vendor/k8s.io/utils/clock/testing/fake_clock.go
@@ -239,7 +239,8 @@ func (f *FakeClock) Sleep(d time.Duration) {
// IntervalClock implements clock.PassiveClock, but each invocation of Now steps the clock forward the specified duration.
// IntervalClock technically implements the other methods of clock.Clock, but each implementation is just a panic.
-// See SimpleIntervalClock for an alternative that only has the methods of PassiveClock.
+//
+// Deprecated: See SimpleIntervalClock for an alternative that only has the methods of PassiveClock.
type IntervalClock struct {
Time time.Time
Duration time.Duration
@@ -282,9 +283,9 @@ func (*IntervalClock) Tick(d time.Duration) <-chan time.Time {
// NewTicker has no implementation yet and is omitted.
// TODO: make interval clock use FakeClock so this can be implemented.
-//func (*IntervalClock) NewTicker(d time.Duration) clock.Ticker {
-// panic("IntervalClock doesn't implement NewTicker")
-//}
+func (*IntervalClock) NewTicker(d time.Duration) clock.Ticker {
+ panic("IntervalClock doesn't implement NewTicker")
+}
// Sleep is unimplemented, will panic.
func (*IntervalClock) Sleep(d time.Duration) {
diff --git a/vendor/k8s.io/utils/integer/integer.go b/vendor/k8s.io/utils/integer/integer.go
index e4e740cad..e0811e834 100644
--- a/vendor/k8s.io/utils/integer/integer.go
+++ b/vendor/k8s.io/utils/integer/integer.go
@@ -16,6 +16,8 @@ limitations under the License.
package integer
+import "math"
+
// IntMax returns the maximum of the params
func IntMax(a, b int) int {
if b > a {
@@ -65,9 +67,7 @@ func Int64Min(a, b int64) int64 {
}
// RoundToInt32 rounds floats into integer numbers.
+// Deprecated: use math.Round() and a cast directly.
func RoundToInt32(a float64) int32 {
- if a < 0 {
- return int32(a - 0.5)
- }
- return int32(a + 0.5)
+ return int32(math.Round(a))
}
diff --git a/vendor/k8s.io/utils/net/ipfamily.go b/vendor/k8s.io/utils/net/ipfamily.go
new file mode 100644
index 000000000..1a51fa391
--- /dev/null
+++ b/vendor/k8s.io/utils/net/ipfamily.go
@@ -0,0 +1,181 @@
+/*
+Copyright 2018 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package net
+
+import (
+ "fmt"
+ "net"
+)
+
+// IPFamily refers to a specific family if not empty, i.e. "4" or "6".
+type IPFamily string
+
+// Constants for valid IPFamilys:
+const (
+ IPFamilyUnknown IPFamily = ""
+
+ IPv4 IPFamily = "4"
+ IPv6 IPFamily = "6"
+)
+
+// IsDualStackIPs returns true if:
+// - all elements of ips are valid
+// - at least one IP from each family (v4 and v6) is present
+func IsDualStackIPs(ips []net.IP) (bool, error) {
+ v4Found := false
+ v6Found := false
+ for i, ip := range ips {
+ switch IPFamilyOf(ip) {
+ case IPv4:
+ v4Found = true
+ case IPv6:
+ v6Found = true
+ default:
+ return false, fmt.Errorf("invalid IP[%d]: %v", i, ip)
+ }
+ }
+
+ return (v4Found && v6Found), nil
+}
+
+// IsDualStackIPStrings returns true if:
+// - all elements of ips can be parsed as IPs
+// - at least one IP from each family (v4 and v6) is present
+func IsDualStackIPStrings(ips []string) (bool, error) {
+ parsedIPs := make([]net.IP, 0, len(ips))
+ for i, ip := range ips {
+ parsedIP := ParseIPSloppy(ip)
+ if parsedIP == nil {
+ return false, fmt.Errorf("invalid IP[%d]: %v", i, ip)
+ }
+ parsedIPs = append(parsedIPs, parsedIP)
+ }
+ return IsDualStackIPs(parsedIPs)
+}
+
+// IsDualStackCIDRs returns true if:
+// - all elements of cidrs are non-nil
+// - at least one CIDR from each family (v4 and v6) is present
+func IsDualStackCIDRs(cidrs []*net.IPNet) (bool, error) {
+ v4Found := false
+ v6Found := false
+ for i, cidr := range cidrs {
+ switch IPFamilyOfCIDR(cidr) {
+ case IPv4:
+ v4Found = true
+ case IPv6:
+ v6Found = true
+ default:
+ return false, fmt.Errorf("invalid CIDR[%d]: %v", i, cidr)
+ }
+ }
+
+ return (v4Found && v6Found), nil
+}
+
+// IsDualStackCIDRStrings returns if
+// - all elements of cidrs can be parsed as CIDRs
+// - at least one CIDR from each family (v4 and v6) is present
+func IsDualStackCIDRStrings(cidrs []string) (bool, error) {
+ parsedCIDRs, err := ParseCIDRs(cidrs)
+ if err != nil {
+ return false, err
+ }
+ return IsDualStackCIDRs(parsedCIDRs)
+}
+
+// IPFamilyOf returns the IP family of ip, or IPFamilyUnknown if it is invalid.
+func IPFamilyOf(ip net.IP) IPFamily {
+ switch {
+ case ip.To4() != nil:
+ return IPv4
+ case ip.To16() != nil:
+ return IPv6
+ default:
+ return IPFamilyUnknown
+ }
+}
+
+// IPFamilyOfString returns the IP family of ip, or IPFamilyUnknown if ip cannot
+// be parsed as an IP.
+func IPFamilyOfString(ip string) IPFamily {
+ return IPFamilyOf(ParseIPSloppy(ip))
+}
+
+// IPFamilyOfCIDR returns the IP family of cidr.
+func IPFamilyOfCIDR(cidr *net.IPNet) IPFamily {
+ if cidr == nil {
+ return IPFamilyUnknown
+ }
+ return IPFamilyOf(cidr.IP)
+}
+
+// IPFamilyOfCIDRString returns the IP family of cidr.
+func IPFamilyOfCIDRString(cidr string) IPFamily {
+ ip, _, _ := ParseCIDRSloppy(cidr)
+ return IPFamilyOf(ip)
+}
+
+// IsIPv6 returns true if netIP is IPv6 (and false if it is IPv4, nil, or invalid).
+func IsIPv6(netIP net.IP) bool {
+ return IPFamilyOf(netIP) == IPv6
+}
+
+// IsIPv6String returns true if ip contains a single IPv6 address and nothing else. It
+// returns false if ip is an empty string, an IPv4 address, or anything else that is not a
+// single IPv6 address.
+func IsIPv6String(ip string) bool {
+ return IPFamilyOfString(ip) == IPv6
+}
+
+// IsIPv6CIDR returns true if a cidr is a valid IPv6 CIDR. It returns false if cidr is
+// nil or an IPv4 CIDR. Its behavior is not defined if cidr is invalid.
+func IsIPv6CIDR(cidr *net.IPNet) bool {
+ return IPFamilyOfCIDR(cidr) == IPv6
+}
+
+// IsIPv6CIDRString returns true if cidr contains a single IPv6 CIDR and nothing else. It
+// returns false if cidr is an empty string, an IPv4 CIDR, or anything else that is not a
+// single valid IPv6 CIDR.
+func IsIPv6CIDRString(cidr string) bool {
+ return IPFamilyOfCIDRString(cidr) == IPv6
+}
+
+// IsIPv4 returns true if netIP is IPv4 (and false if it is IPv6, nil, or invalid).
+func IsIPv4(netIP net.IP) bool {
+ return IPFamilyOf(netIP) == IPv4
+}
+
+// IsIPv4String returns true if ip contains a single IPv4 address and nothing else. It
+// returns false if ip is an empty string, an IPv6 address, or anything else that is not a
+// single IPv4 address.
+func IsIPv4String(ip string) bool {
+ return IPFamilyOfString(ip) == IPv4
+}
+
+// IsIPv4CIDR returns true if cidr is a valid IPv4 CIDR. It returns false if cidr is nil
+// or an IPv6 CIDR. Its behavior is not defined if cidr is invalid.
+func IsIPv4CIDR(cidr *net.IPNet) bool {
+ return IPFamilyOfCIDR(cidr) == IPv4
+}
+
+// IsIPv4CIDRString returns true if cidr contains a single IPv4 CIDR and nothing else. It
+// returns false if cidr is an empty string, an IPv6 CIDR, or anything else that is not a
+// single valid IPv4 CIDR.
+func IsIPv4CIDRString(cidr string) bool {
+ return IPFamilyOfCIDRString(cidr) == IPv4
+}
diff --git a/vendor/k8s.io/utils/net/multi_listen.go b/vendor/k8s.io/utils/net/multi_listen.go
new file mode 100644
index 000000000..7cb7795be
--- /dev/null
+++ b/vendor/k8s.io/utils/net/multi_listen.go
@@ -0,0 +1,195 @@
+/*
+Copyright 2024 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package net
+
+import (
+ "context"
+ "fmt"
+ "net"
+ "sync"
+)
+
+// connErrPair pairs conn and error which is returned by accept on sub-listeners.
+type connErrPair struct {
+ conn net.Conn
+ err error
+}
+
+// multiListener implements net.Listener
+type multiListener struct {
+ listeners []net.Listener
+ wg sync.WaitGroup
+
+ // connCh passes accepted connections, from child listeners to parent.
+ connCh chan connErrPair
+ // stopCh communicates from parent to child listeners.
+ stopCh chan struct{}
+}
+
+// compile time check to ensure *multiListener implements net.Listener
+var _ net.Listener = &multiListener{}
+
+// MultiListen returns net.Listener which can listen on and accept connections for
+// the given network on multiple addresses. Internally it uses stdlib to create
+// sub-listener and multiplexes connection requests using go-routines.
+// The network must be "tcp", "tcp4" or "tcp6".
+// It follows the semantics of net.Listen that primarily means:
+// 1. If the host is an unspecified/zero IP address with "tcp" network, MultiListen
+// listens on all available unicast and anycast IP addresses of the local system.
+// 2. Use "tcp4" or "tcp6" to exclusively listen on IPv4 or IPv6 family, respectively.
+// 3. The host can accept names (e.g, localhost) and it will create a listener for at
+// most one of the host's IP.
+func MultiListen(ctx context.Context, network string, addrs ...string) (net.Listener, error) {
+ var lc net.ListenConfig
+ return multiListen(
+ ctx,
+ network,
+ addrs,
+ func(ctx context.Context, network, address string) (net.Listener, error) {
+ return lc.Listen(ctx, network, address)
+ })
+}
+
+// multiListen implements MultiListen by consuming stdlib functions as dependency allowing
+// mocking for unit-testing.
+func multiListen(
+ ctx context.Context,
+ network string,
+ addrs []string,
+ listenFunc func(ctx context.Context, network, address string) (net.Listener, error),
+) (net.Listener, error) {
+ if !(network == "tcp" || network == "tcp4" || network == "tcp6") {
+ return nil, fmt.Errorf("network %q not supported", network)
+ }
+ if len(addrs) == 0 {
+ return nil, fmt.Errorf("no address provided to listen on")
+ }
+
+ ml := &multiListener{
+ connCh: make(chan connErrPair),
+ stopCh: make(chan struct{}),
+ }
+ for _, addr := range addrs {
+ l, err := listenFunc(ctx, network, addr)
+ if err != nil {
+ // close all the sub-listeners and exit
+ _ = ml.Close()
+ return nil, err
+ }
+ ml.listeners = append(ml.listeners, l)
+ }
+
+ for _, l := range ml.listeners {
+ ml.wg.Add(1)
+ go func(l net.Listener) {
+ defer ml.wg.Done()
+ for {
+ // Accept() is blocking, unless ml.Close() is called, in which
+ // case it will return immediately with an error.
+ conn, err := l.Accept()
+ // This assumes that ANY error from Accept() will terminate the
+ // sub-listener. We could maybe be more precise, but it
+ // doesn't seem necessary.
+ terminate := err != nil
+
+ select {
+ case ml.connCh <- connErrPair{conn: conn, err: err}:
+ case <-ml.stopCh:
+ // In case we accepted a connection AND were stopped, and
+ // this select-case was chosen, just throw away the
+ // connection. This avoids potentially blocking on connCh
+ // or leaking a connection.
+ if conn != nil {
+ _ = conn.Close()
+ }
+ terminate = true
+ }
+ // Make sure we don't loop on Accept() returning an error and
+ // the select choosing the channel case.
+ if terminate {
+ return
+ }
+ }
+ }(l)
+ }
+ return ml, nil
+}
+
+// Accept implements net.Listener. It waits for and returns a connection from
+// any of the sub-listener.
+func (ml *multiListener) Accept() (net.Conn, error) {
+ // wait for any sub-listener to enqueue an accepted connection
+ connErr, ok := <-ml.connCh
+ if !ok {
+ // The channel will be closed only when Close() is called on the
+ // multiListener. Closing of this channel implies that all
+ // sub-listeners are also closed, which causes a "use of closed
+ // network connection" error on their Accept() calls. We return the
+ // same error for multiListener.Accept() if multiListener.Close()
+ // has already been called.
+ return nil, fmt.Errorf("use of closed network connection")
+ }
+ return connErr.conn, connErr.err
+}
+
+// Close implements net.Listener. It will close all sub-listeners and wait for
+// the go-routines to exit.
+func (ml *multiListener) Close() error {
+ // Make sure this can be called repeatedly without explosions.
+ select {
+ case <-ml.stopCh:
+ return fmt.Errorf("use of closed network connection")
+ default:
+ }
+
+ // Tell all sub-listeners to stop.
+ close(ml.stopCh)
+
+ // Closing the listeners causes Accept() to immediately return an error in
+ // the sub-listener go-routines.
+ for _, l := range ml.listeners {
+ _ = l.Close()
+ }
+
+ // Wait for all the sub-listener go-routines to exit.
+ ml.wg.Wait()
+ close(ml.connCh)
+
+ // Drain any already-queued connections.
+ for connErr := range ml.connCh {
+ if connErr.conn != nil {
+ _ = connErr.conn.Close()
+ }
+ }
+ return nil
+}
+
+// Addr is an implementation of the net.Listener interface. It always returns
+// the address of the first listener. Callers should use conn.LocalAddr() to
+// obtain the actual local address of the sub-listener.
+func (ml *multiListener) Addr() net.Addr {
+ return ml.listeners[0].Addr()
+}
+
+// Addrs is like Addr, but returns the address for all registered listeners.
+func (ml *multiListener) Addrs() []net.Addr {
+ var ret []net.Addr
+ for _, l := range ml.listeners {
+ ret = append(ret, l.Addr())
+ }
+ return ret
+}
diff --git a/vendor/k8s.io/utils/net/net.go b/vendor/k8s.io/utils/net/net.go
index b7c08e2e0..704c1f232 100644
--- a/vendor/k8s.io/utils/net/net.go
+++ b/vendor/k8s.io/utils/net/net.go
@@ -29,138 +29,16 @@ import (
// order is maintained
func ParseCIDRs(cidrsString []string) ([]*net.IPNet, error) {
cidrs := make([]*net.IPNet, 0, len(cidrsString))
- for _, cidrString := range cidrsString {
+ for i, cidrString := range cidrsString {
_, cidr, err := ParseCIDRSloppy(cidrString)
if err != nil {
- return nil, fmt.Errorf("failed to parse cidr value:%q with error:%v", cidrString, err)
+ return nil, fmt.Errorf("invalid CIDR[%d]: %v (%v)", i, cidr, err)
}
cidrs = append(cidrs, cidr)
}
return cidrs, nil
}
-// IsDualStackIPs returns if a slice of ips is:
-// - all are valid ips
-// - at least one ip from each family (v4 or v6)
-func IsDualStackIPs(ips []net.IP) (bool, error) {
- v4Found := false
- v6Found := false
- for _, ip := range ips {
- if ip == nil {
- return false, fmt.Errorf("ip %v is invalid", ip)
- }
-
- if v4Found && v6Found {
- continue
- }
-
- if IsIPv6(ip) {
- v6Found = true
- continue
- }
-
- v4Found = true
- }
-
- return (v4Found && v6Found), nil
-}
-
-// IsDualStackIPStrings returns if
-// - all are valid ips
-// - at least one ip from each family (v4 or v6)
-func IsDualStackIPStrings(ips []string) (bool, error) {
- parsedIPs := make([]net.IP, 0, len(ips))
- for _, ip := range ips {
- parsedIP := ParseIPSloppy(ip)
- parsedIPs = append(parsedIPs, parsedIP)
- }
- return IsDualStackIPs(parsedIPs)
-}
-
-// IsDualStackCIDRs returns if
-// - all are valid cidrs
-// - at least one cidr from each family (v4 or v6)
-func IsDualStackCIDRs(cidrs []*net.IPNet) (bool, error) {
- v4Found := false
- v6Found := false
- for _, cidr := range cidrs {
- if cidr == nil {
- return false, fmt.Errorf("cidr %v is invalid", cidr)
- }
-
- if v4Found && v6Found {
- continue
- }
-
- if IsIPv6(cidr.IP) {
- v6Found = true
- continue
- }
- v4Found = true
- }
-
- return v4Found && v6Found, nil
-}
-
-// IsDualStackCIDRStrings returns if
-// - all are valid cidrs
-// - at least one cidr from each family (v4 or v6)
-func IsDualStackCIDRStrings(cidrs []string) (bool, error) {
- parsedCIDRs, err := ParseCIDRs(cidrs)
- if err != nil {
- return false, err
- }
- return IsDualStackCIDRs(parsedCIDRs)
-}
-
-// IsIPv6 returns if netIP is IPv6.
-func IsIPv6(netIP net.IP) bool {
- return netIP != nil && netIP.To4() == nil
-}
-
-// IsIPv6String returns if ip is IPv6.
-func IsIPv6String(ip string) bool {
- netIP := ParseIPSloppy(ip)
- return IsIPv6(netIP)
-}
-
-// IsIPv6CIDRString returns if cidr is IPv6.
-// This assumes cidr is a valid CIDR.
-func IsIPv6CIDRString(cidr string) bool {
- ip, _, _ := ParseCIDRSloppy(cidr)
- return IsIPv6(ip)
-}
-
-// IsIPv6CIDR returns if a cidr is ipv6
-func IsIPv6CIDR(cidr *net.IPNet) bool {
- ip := cidr.IP
- return IsIPv6(ip)
-}
-
-// IsIPv4 returns if netIP is IPv4.
-func IsIPv4(netIP net.IP) bool {
- return netIP != nil && netIP.To4() != nil
-}
-
-// IsIPv4String returns if ip is IPv4.
-func IsIPv4String(ip string) bool {
- netIP := ParseIPSloppy(ip)
- return IsIPv4(netIP)
-}
-
-// IsIPv4CIDR returns if a cidr is ipv4
-func IsIPv4CIDR(cidr *net.IPNet) bool {
- ip := cidr.IP
- return IsIPv4(ip)
-}
-
-// IsIPv4CIDRString returns if cidr is IPv4.
-// This assumes cidr is a valid CIDR.
-func IsIPv4CIDRString(cidr string) bool {
- ip, _, _ := ParseCIDRSloppy(cidr)
- return IsIPv4(ip)
-}
-
// ParsePort parses a string representing an IP port. If the string is not a
// valid port number, this returns an error.
func ParsePort(port string, allowZero bool) (int, error) {
diff --git a/vendor/k8s.io/utils/net/port.go b/vendor/k8s.io/utils/net/port.go
index 7ac04f0dc..c6a53fa02 100644
--- a/vendor/k8s.io/utils/net/port.go
+++ b/vendor/k8s.io/utils/net/port.go
@@ -23,15 +23,6 @@ import (
"strings"
)
-// IPFamily refers to a specific family if not empty, i.e. "4" or "6".
-type IPFamily string
-
-// Constants for valid IPFamilys:
-const (
- IPv4 IPFamily = "4"
- IPv6 = "6"
-)
-
// Protocol is a network protocol support by LocalPort.
type Protocol string
@@ -67,7 +58,7 @@ func NewLocalPort(desc, ip string, ipFamily IPFamily, port int, protocol Protoco
if protocol != TCP && protocol != UDP {
return nil, fmt.Errorf("Unsupported protocol %s", protocol)
}
- if ipFamily != "" && ipFamily != "4" && ipFamily != "6" {
+ if ipFamily != IPFamilyUnknown && ipFamily != IPv4 && ipFamily != IPv6 {
return nil, fmt.Errorf("Invalid IP family %s", ipFamily)
}
if ip != "" {
@@ -75,9 +66,10 @@ func NewLocalPort(desc, ip string, ipFamily IPFamily, port int, protocol Protoco
if parsedIP == nil {
return nil, fmt.Errorf("invalid ip address %s", ip)
}
- asIPv4 := parsedIP.To4()
- if asIPv4 == nil && ipFamily == IPv4 || asIPv4 != nil && ipFamily == IPv6 {
- return nil, fmt.Errorf("ip address and family mismatch %s, %s", ip, ipFamily)
+ if ipFamily != IPFamilyUnknown {
+ if IPFamily(parsedIP) != ipFamily {
+ return nil, fmt.Errorf("ip address and family mismatch %s, %s", ip, ipFamily)
+ }
}
}
return &LocalPort{Description: desc, IP: ip, IPFamily: ipFamily, Port: port, Protocol: protocol}, nil
diff --git a/vendor/k8s.io/utils/ptr/OWNERS b/vendor/k8s.io/utils/ptr/OWNERS
new file mode 100644
index 000000000..0d6392752
--- /dev/null
+++ b/vendor/k8s.io/utils/ptr/OWNERS
@@ -0,0 +1,10 @@
+# See the OWNERS docs at https://go.k8s.io/owners
+
+approvers:
+- apelisse
+- stewart-yu
+- thockin
+reviewers:
+- apelisse
+- stewart-yu
+- thockin
diff --git a/vendor/k8s.io/utils/ptr/README.md b/vendor/k8s.io/utils/ptr/README.md
new file mode 100644
index 000000000..2ca8073dc
--- /dev/null
+++ b/vendor/k8s.io/utils/ptr/README.md
@@ -0,0 +1,3 @@
+# Pointer
+
+This package provides some functions for pointer-based operations.
diff --git a/vendor/k8s.io/utils/ptr/ptr.go b/vendor/k8s.io/utils/ptr/ptr.go
new file mode 100644
index 000000000..659ed3b9e
--- /dev/null
+++ b/vendor/k8s.io/utils/ptr/ptr.go
@@ -0,0 +1,73 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package ptr
+
+import (
+ "fmt"
+ "reflect"
+)
+
+// AllPtrFieldsNil tests whether all pointer fields in a struct are nil. This is useful when,
+// for example, an API struct is handled by plugins which need to distinguish
+// "no plugin accepted this spec" from "this spec is empty".
+//
+// This function is only valid for structs and pointers to structs. Any other
+// type will cause a panic. Passing a typed nil pointer will return true.
+func AllPtrFieldsNil(obj interface{}) bool {
+ v := reflect.ValueOf(obj)
+ if !v.IsValid() {
+ panic(fmt.Sprintf("reflect.ValueOf() produced a non-valid Value for %#v", obj))
+ }
+ if v.Kind() == reflect.Ptr {
+ if v.IsNil() {
+ return true
+ }
+ v = v.Elem()
+ }
+ for i := 0; i < v.NumField(); i++ {
+ if v.Field(i).Kind() == reflect.Ptr && !v.Field(i).IsNil() {
+ return false
+ }
+ }
+ return true
+}
+
+// To returns a pointer to the given value.
+func To[T any](v T) *T {
+ return &v
+}
+
+// Deref dereferences ptr and returns the value it points to if no nil, or else
+// returns def.
+func Deref[T any](ptr *T, def T) T {
+ if ptr != nil {
+ return *ptr
+ }
+ return def
+}
+
+// Equal returns true if both arguments are nil or both arguments
+// dereference to the same value.
+func Equal[T comparable](a, b *T) bool {
+ if (a == nil) != (b == nil) {
+ return false
+ }
+ if a == nil {
+ return true
+ }
+ return *a == *b
+}
diff --git a/vendor/k8s.io/utils/strings/slices/slices.go b/vendor/k8s.io/utils/strings/slices/slices.go
new file mode 100644
index 000000000..8e21838f2
--- /dev/null
+++ b/vendor/k8s.io/utils/strings/slices/slices.go
@@ -0,0 +1,82 @@
+/*
+Copyright 2021 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Package slices defines various functions useful with slices of string type.
+// The goal is to be as close as possible to
+// https://github.com/golang/go/issues/45955. Ideal would be if we can just
+// replace "stringslices" if the "slices" package becomes standard.
+package slices
+
+// Equal reports whether two slices are equal: the same length and all
+// elements equal. If the lengths are different, Equal returns false.
+// Otherwise, the elements are compared in index order, and the
+// comparison stops at the first unequal pair.
+func Equal(s1, s2 []string) bool {
+ if len(s1) != len(s2) {
+ return false
+ }
+ for i, n := range s1 {
+ if n != s2[i] {
+ return false
+ }
+ }
+ return true
+}
+
+// Filter appends to d each element e of s for which keep(e) returns true.
+// It returns the modified d. d may be s[:0], in which case the kept
+// elements will be stored in the same slice.
+// if the slices overlap in some other way, the results are unspecified.
+// To create a new slice with the filtered results, pass nil for d.
+func Filter(d, s []string, keep func(string) bool) []string {
+ for _, n := range s {
+ if keep(n) {
+ d = append(d, n)
+ }
+ }
+ return d
+}
+
+// Contains reports whether v is present in s.
+func Contains(s []string, v string) bool {
+ return Index(s, v) >= 0
+}
+
+// Index returns the index of the first occurrence of v in s, or -1 if
+// not present.
+func Index(s []string, v string) int {
+ // "Contains" may be replaced with "Index(s, v) >= 0":
+ // https://github.com/golang/go/issues/45955#issuecomment-873377947
+ for i, n := range s {
+ if n == v {
+ return i
+ }
+ }
+ return -1
+}
+
+// Functions below are not in https://github.com/golang/go/issues/45955
+
+// Clone returns a new clone of s.
+func Clone(s []string) []string {
+ // https://github.com/go101/go101/wiki/There-is-not-a-perfect-way-to-clone-slices-in-Go
+ if s == nil {
+ return nil
+ }
+ c := make([]string, len(s))
+ copy(c, s)
+ return c
+}
diff --git a/vendor/k8s.io/utils/trace/trace.go b/vendor/k8s.io/utils/trace/trace.go
index 3023d1066..559aebb59 100644
--- a/vendor/k8s.io/utils/trace/trace.go
+++ b/vendor/k8s.io/utils/trace/trace.go
@@ -21,6 +21,7 @@ import (
"context"
"fmt"
"math/rand"
+ "sync"
"time"
"k8s.io/klog/v2"
@@ -64,6 +65,11 @@ func durationToMilliseconds(timeDuration time.Duration) int64 {
}
type traceItem interface {
+ // rLock must be called before invoking time or writeItem.
+ rLock()
+ // rUnlock must be called after processing the item is complete.
+ rUnlock()
+
// time returns when the trace was recorded as completed.
time() time.Time
// writeItem outputs the traceItem to the buffer. If stepThreshold is non-nil, only output the
@@ -78,6 +84,10 @@ type traceStep struct {
fields []Field
}
+// rLock doesn't need to do anything because traceStep instances are immutable.
+func (s traceStep) rLock() {}
+func (s traceStep) rUnlock() {}
+
func (s traceStep) time() time.Time {
return s.stepTime
}
@@ -93,13 +103,24 @@ func (s traceStep) writeItem(b *bytes.Buffer, formatter string, startTime time.T
// Trace keeps track of a set of "steps" and allows us to log a specific
// step if it took longer than its share of the total allowed time
type Trace struct {
+ // constant fields
name string
fields []Field
- threshold *time.Duration
startTime time.Time
- endTime *time.Time
- traceItems []traceItem
parentTrace *Trace
+ // fields guarded by a lock
+ lock sync.RWMutex
+ threshold *time.Duration
+ endTime *time.Time
+ traceItems []traceItem
+}
+
+func (t *Trace) rLock() {
+ t.lock.RLock()
+}
+
+func (t *Trace) rUnlock() {
+ t.lock.RUnlock()
}
func (t *Trace) time() time.Time {
@@ -138,6 +159,8 @@ func New(name string, fields ...Field) *Trace {
// how long it took. The Fields add key value pairs to provide additional details about the trace
// step.
func (t *Trace) Step(msg string, fields ...Field) {
+ t.lock.Lock()
+ defer t.lock.Unlock()
if t.traceItems == nil {
// traces almost always have less than 6 steps, do this to avoid more than a single allocation
t.traceItems = make([]traceItem, 0, 6)
@@ -153,7 +176,9 @@ func (t *Trace) Nest(msg string, fields ...Field) *Trace {
newTrace := New(msg, fields...)
if t != nil {
newTrace.parentTrace = t
+ t.lock.Lock()
t.traceItems = append(t.traceItems, newTrace)
+ t.lock.Unlock()
}
return newTrace
}
@@ -163,9 +188,11 @@ func (t *Trace) Nest(msg string, fields ...Field) *Trace {
// is logged.
func (t *Trace) Log() {
endTime := time.Now()
+ t.lock.Lock()
t.endTime = &endTime
+ t.lock.Unlock()
// an explicit logging request should dump all the steps out at the higher level
- if t.parentTrace == nil { // We don't start logging until Log or LogIfLong is called on the root trace
+ if t.parentTrace == nil && klogV(2) { // We don't start logging until Log or LogIfLong is called on the root trace
t.logTrace()
}
}
@@ -178,13 +205,17 @@ func (t *Trace) Log() {
// If the Trace is nested it is not immediately logged. Instead, it is logged when the trace it
// is nested within is logged.
func (t *Trace) LogIfLong(threshold time.Duration) {
+ t.lock.Lock()
t.threshold = &threshold
+ t.lock.Unlock()
t.Log()
}
// logTopLevelTraces finds all traces in a hierarchy of nested traces that should be logged but do not have any
// parents that will be logged, due to threshold limits, and logs them as top level traces.
func (t *Trace) logTrace() {
+ t.lock.RLock()
+ defer t.lock.RUnlock()
if t.durationIsWithinThreshold() {
var buffer bytes.Buffer
traceNum := rand.Int31()
@@ -217,8 +248,10 @@ func (t *Trace) logTrace() {
func (t *Trace) writeTraceSteps(b *bytes.Buffer, formatter string, stepThreshold *time.Duration) {
lastStepTime := t.startTime
for _, stepOrTrace := range t.traceItems {
+ stepOrTrace.rLock()
stepOrTrace.writeItem(b, formatter, lastStepTime, stepThreshold)
lastStepTime = stepOrTrace.time()
+ stepOrTrace.rUnlock()
}
}
@@ -244,9 +277,13 @@ func (t *Trace) calculateStepThreshold() *time.Duration {
traceThreshold := *t.threshold
for _, s := range t.traceItems {
nestedTrace, ok := s.(*Trace)
- if ok && nestedTrace.threshold != nil {
- traceThreshold = traceThreshold - *nestedTrace.threshold
- lenTrace--
+ if ok {
+ nestedTrace.lock.RLock()
+ if nestedTrace.threshold != nil {
+ traceThreshold = traceThreshold - *nestedTrace.threshold
+ lenTrace--
+ }
+ nestedTrace.lock.RUnlock()
}
}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 49e3b8c84..7198caedf 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -1,33 +1,54 @@
-# github.com/davecgh/go-spew v1.1.1
+# github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
## explicit
github.com/davecgh/go-spew/spew
# github.com/evanphx/json-patch v5.6.0+incompatible
## explicit
github.com/evanphx/json-patch
-# github.com/go-logr/logr v1.2.0
-## explicit; go 1.16
+# github.com/fxamacker/cbor/v2 v2.7.0
+## explicit; go 1.17
+github.com/fxamacker/cbor/v2
+# github.com/go-logr/logr v1.4.2
+## explicit; go 1.18
github.com/go-logr/logr
+# github.com/go-openapi/jsonpointer v0.19.6
+## explicit; go 1.13
+github.com/go-openapi/jsonpointer
+# github.com/go-openapi/jsonreference v0.20.2
+## explicit; go 1.13
+github.com/go-openapi/jsonreference
+github.com/go-openapi/jsonreference/internal
+# github.com/go-openapi/swag v0.22.4
+## explicit; go 1.18
+github.com/go-openapi/swag
# github.com/gogo/protobuf v1.3.2
## explicit; go 1.15
github.com/gogo/protobuf/proto
github.com/gogo/protobuf/sortkeys
-# github.com/golang/protobuf v1.5.2
-## explicit; go 1.9
+# github.com/golang/protobuf v1.5.4
+## explicit; go 1.17
github.com/golang/protobuf/proto
github.com/golang/protobuf/ptypes
github.com/golang/protobuf/ptypes/any
github.com/golang/protobuf/ptypes/duration
github.com/golang/protobuf/ptypes/timestamp
-# github.com/google/go-cmp v0.5.6
-## explicit; go 1.8
+# github.com/google/gnostic-models v0.6.8
+## explicit; go 1.18
+github.com/google/gnostic-models/compiler
+github.com/google/gnostic-models/extensions
+github.com/google/gnostic-models/jsonschema
+github.com/google/gnostic-models/openapiv2
+github.com/google/gnostic-models/openapiv3
+# github.com/google/go-cmp v0.6.0
+## explicit; go 1.13
github.com/google/go-cmp/cmp
github.com/google/go-cmp/cmp/internal/diff
github.com/google/go-cmp/cmp/internal/flags
github.com/google/go-cmp/cmp/internal/function
github.com/google/go-cmp/cmp/internal/value
-# github.com/google/gofuzz v1.1.0
+# github.com/google/gofuzz v1.2.0
## explicit; go 1.12
github.com/google/gofuzz
+github.com/google/gofuzz/bytesource
# github.com/googleapis/gnostic v0.5.5
## explicit; go 1.12
github.com/googleapis/gnostic/compiler
@@ -40,9 +61,17 @@ github.com/imdario/mergo
# github.com/inconshreveable/mousetrap v1.0.0
## explicit
github.com/inconshreveable/mousetrap
+# github.com/josharian/intern v1.0.0
+## explicit; go 1.5
+github.com/josharian/intern
# github.com/json-iterator/go v1.1.12
## explicit; go 1.12
github.com/json-iterator/go
+# github.com/mailru/easyjson v0.7.7
+## explicit; go 1.12
+github.com/mailru/easyjson/buffer
+github.com/mailru/easyjson/jlexer
+github.com/mailru/easyjson/jwriter
# github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
## explicit
github.com/modern-go/concurrent
@@ -61,7 +90,10 @@ github.com/spf13/cobra
# github.com/spf13/pflag v1.0.5
## explicit; go 1.12
github.com/spf13/pflag
-# golang.org/x/net v0.23.0
+# github.com/x448/float16 v0.8.4
+## explicit; go 1.11
+github.com/x448/float16
+# golang.org/x/net v0.26.0
## explicit; go 1.18
golang.org/x/net/context
golang.org/x/net/context/ctxhttp
@@ -87,7 +119,7 @@ golang.org/x/text/secure/bidirule
golang.org/x/text/transform
golang.org/x/text/unicode/bidi
golang.org/x/text/unicode/norm
-# golang.org/x/time v0.0.0-20220210224613-90d013bbcef8
+# golang.org/x/time v0.3.0
## explicit
golang.org/x/time/rate
# google.golang.org/appengine v1.6.7
@@ -99,14 +131,15 @@ google.golang.org/appengine/internal/log
google.golang.org/appengine/internal/remote_api
google.golang.org/appengine/internal/urlfetch
google.golang.org/appengine/urlfetch
-# google.golang.org/protobuf v1.33.0
-## explicit; go 1.17
+# google.golang.org/protobuf v1.34.2
+## explicit; go 1.20
google.golang.org/protobuf/encoding/prototext
google.golang.org/protobuf/encoding/protowire
google.golang.org/protobuf/internal/descfmt
google.golang.org/protobuf/internal/descopts
google.golang.org/protobuf/internal/detrand
google.golang.org/protobuf/internal/editiondefaults
+google.golang.org/protobuf/internal/editionssupport
google.golang.org/protobuf/internal/encoding/defval
google.golang.org/protobuf/internal/encoding/messageset
google.golang.org/protobuf/internal/encoding/tag
@@ -136,8 +169,6 @@ google.golang.org/protobuf/types/known/timestamppb
# gopkg.in/inf.v0 v0.9.1
## explicit
gopkg.in/inf.v0
-# gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
-## explicit
# gopkg.in/yaml.v2 v2.4.0
## explicit; go 1.15
gopkg.in/yaml.v2
@@ -191,14 +222,17 @@ k8s.io/api/scheduling/v1beta1
k8s.io/api/storage/v1
k8s.io/api/storage/v1alpha1
k8s.io/api/storage/v1beta1
-# k8s.io/apimachinery v0.23.17
-## explicit; go 1.19
+# k8s.io/apimachinery v0.31.3
+## explicit; go 1.22.0
+k8s.io/apimachinery/pkg/api/equality
k8s.io/apimachinery/pkg/api/errors
k8s.io/apimachinery/pkg/api/meta
k8s.io/apimachinery/pkg/api/resource
+k8s.io/apimachinery/pkg/api/validation
k8s.io/apimachinery/pkg/apis/meta/internalversion
k8s.io/apimachinery/pkg/apis/meta/v1
k8s.io/apimachinery/pkg/apis/meta/v1/unstructured
+k8s.io/apimachinery/pkg/apis/meta/v1/validation
k8s.io/apimachinery/pkg/apis/meta/v1beta1
k8s.io/apimachinery/pkg/conversion
k8s.io/apimachinery/pkg/conversion/queryparams
@@ -207,6 +241,8 @@ k8s.io/apimachinery/pkg/labels
k8s.io/apimachinery/pkg/runtime
k8s.io/apimachinery/pkg/runtime/schema
k8s.io/apimachinery/pkg/runtime/serializer
+k8s.io/apimachinery/pkg/runtime/serializer/cbor/direct
+k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes
k8s.io/apimachinery/pkg/runtime/serializer/json
k8s.io/apimachinery/pkg/runtime/serializer/protobuf
k8s.io/apimachinery/pkg/runtime/serializer/recognizer
@@ -216,11 +252,13 @@ k8s.io/apimachinery/pkg/selection
k8s.io/apimachinery/pkg/types
k8s.io/apimachinery/pkg/util/cache
k8s.io/apimachinery/pkg/util/diff
+k8s.io/apimachinery/pkg/util/dump
k8s.io/apimachinery/pkg/util/errors
k8s.io/apimachinery/pkg/util/framer
k8s.io/apimachinery/pkg/util/intstr
k8s.io/apimachinery/pkg/util/json
k8s.io/apimachinery/pkg/util/managedfields
+k8s.io/apimachinery/pkg/util/managedfields/internal
k8s.io/apimachinery/pkg/util/mergepatch
k8s.io/apimachinery/pkg/util/naming
k8s.io/apimachinery/pkg/util/net
@@ -356,32 +394,45 @@ k8s.io/client-go/util/flowcontrol
k8s.io/client-go/util/homedir
k8s.io/client-go/util/keyutil
k8s.io/client-go/util/workqueue
-# k8s.io/klog/v2 v2.30.0
-## explicit; go 1.13
+# k8s.io/klog/v2 v2.130.1
+## explicit; go 1.18
k8s.io/klog/v2
-# k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65
-## explicit; go 1.16
+k8s.io/klog/v2/internal/buffer
+k8s.io/klog/v2/internal/clock
+k8s.io/klog/v2/internal/dbg
+k8s.io/klog/v2/internal/serialize
+k8s.io/klog/v2/internal/severity
+k8s.io/klog/v2/internal/sloghandler
+# k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340
+## explicit; go 1.20
+k8s.io/kube-openapi/pkg/internal
+k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json
k8s.io/kube-openapi/pkg/schemaconv
k8s.io/kube-openapi/pkg/util/proto
-# k8s.io/utils v0.0.0-20211116205334-6203023598ed
-## explicit; go 1.12
+k8s.io/kube-openapi/pkg/validation/spec
+# k8s.io/utils v0.0.0-20240711033017-18e509b52bc8
+## explicit; go 1.18
k8s.io/utils/buffer
k8s.io/utils/clock
k8s.io/utils/clock/testing
k8s.io/utils/integer
k8s.io/utils/internal/third_party/forked/golang/net
k8s.io/utils/net
+k8s.io/utils/ptr
+k8s.io/utils/strings/slices
k8s.io/utils/trace
-# sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6
-## explicit; go 1.16
+# sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd
+## explicit; go 1.18
sigs.k8s.io/json
sigs.k8s.io/json/internal/golang/encoding/json
-# sigs.k8s.io/structured-merge-diff/v4 v4.2.3
+# sigs.k8s.io/structured-merge-diff/v4 v4.4.1
## explicit; go 1.13
sigs.k8s.io/structured-merge-diff/v4/fieldpath
+sigs.k8s.io/structured-merge-diff/v4/merge
sigs.k8s.io/structured-merge-diff/v4/schema
sigs.k8s.io/structured-merge-diff/v4/typed
sigs.k8s.io/structured-merge-diff/v4/value
-# sigs.k8s.io/yaml v1.2.0
+# sigs.k8s.io/yaml v1.4.0
## explicit; go 1.12
sigs.k8s.io/yaml
+sigs.k8s.io/yaml/goyaml.v2
diff --git a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/decode.go b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/decode.go
index a047d981b..6a13cf2df 100644
--- a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/decode.go
+++ b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/decode.go
@@ -75,6 +75,8 @@ import (
// either be any string type, an integer, implement json.Unmarshaler, or
// implement encoding.TextUnmarshaler.
//
+// If the JSON-encoded data contain a syntax error, Unmarshal returns a SyntaxError.
+//
// If a JSON value is not appropriate for a given target type,
// or if a JSON number overflows the target type, Unmarshal
// skips that field and completes the unmarshaling as best it can.
@@ -85,15 +87,14 @@ import (
//
// The JSON null value unmarshals into an interface, map, pointer, or slice
// by setting that Go value to nil. Because null is often used in JSON to mean
-// ``not present,'' unmarshaling a JSON null into any other Go type has no effect
+// “not present,” unmarshaling a JSON null into any other Go type has no effect
// on the value and produces no error.
//
// When unmarshaling quoted strings, invalid UTF-8 or
// invalid UTF-16 surrogate pairs are not treated as an error.
// Instead, they are replaced by the Unicode replacement
// character U+FFFD.
-//
-func Unmarshal(data []byte, v interface{}, opts ...UnmarshalOpt) error {
+func Unmarshal(data []byte, v any, opts ...UnmarshalOpt) error {
// Check for well-formedness.
// Avoids filling out half a data structure
// before discovering a JSON syntax error.
@@ -167,16 +168,16 @@ func (e *InvalidUnmarshalError) Error() string {
return "json: Unmarshal(nil)"
}
- if e.Type.Kind() != reflect.Ptr {
+ if e.Type.Kind() != reflect.Pointer {
return "json: Unmarshal(non-pointer " + e.Type.String() + ")"
}
return "json: Unmarshal(nil " + e.Type.String() + ")"
}
*/
-func (d *decodeState) unmarshal(v interface{}) error {
+func (d *decodeState) unmarshal(v any) error {
rv := reflect.ValueOf(v)
- if rv.Kind() != reflect.Ptr || rv.IsNil() {
+ if rv.Kind() != reflect.Pointer || rv.IsNil() {
return &InvalidUnmarshalError{reflect.TypeOf(v)}
}
@@ -233,7 +234,8 @@ type decodeState struct {
disallowUnknownFields bool
savedStrictErrors []error
- seenStrictErrors map[string]struct{}
+ seenStrictErrors map[strictError]struct{}
+ strictFieldStack []string
caseSensitive bool
@@ -261,6 +263,8 @@ func (d *decodeState) init(data []byte) *decodeState {
// Reuse the allocated space for the FieldStack slice.
d.errorContext.FieldStack = d.errorContext.FieldStack[:0]
}
+ // Reuse the allocated space for the strict FieldStack slice.
+ d.strictFieldStack = d.strictFieldStack[:0]
return d
}
@@ -422,7 +426,7 @@ type unquotedValue struct{}
// quoted string literal or literal null into an interface value.
// If it finds anything other than a quoted string literal or null,
// valueQuoted returns unquotedValue{}.
-func (d *decodeState) valueQuoted() interface{} {
+func (d *decodeState) valueQuoted() any {
switch d.opcode {
default:
panic(phasePanicMsg)
@@ -464,7 +468,7 @@ func indirect(v reflect.Value, decodingNull bool) (Unmarshaler, encoding.TextUnm
// If v is a named type and is addressable,
// start with its address, so that if the type has pointer methods,
// we find them.
- if v.Kind() != reflect.Ptr && v.Type().Name() != "" && v.CanAddr() {
+ if v.Kind() != reflect.Pointer && v.Type().Name() != "" && v.CanAddr() {
haveAddr = true
v = v.Addr()
}
@@ -473,14 +477,14 @@ func indirect(v reflect.Value, decodingNull bool) (Unmarshaler, encoding.TextUnm
// usefully addressable.
if v.Kind() == reflect.Interface && !v.IsNil() {
e := v.Elem()
- if e.Kind() == reflect.Ptr && !e.IsNil() && (!decodingNull || e.Elem().Kind() == reflect.Ptr) {
+ if e.Kind() == reflect.Pointer && !e.IsNil() && (!decodingNull || e.Elem().Kind() == reflect.Pointer) {
haveAddr = false
v = e
continue
}
}
- if v.Kind() != reflect.Ptr {
+ if v.Kind() != reflect.Pointer {
break
}
@@ -555,6 +559,12 @@ func (d *decodeState) array(v reflect.Value) error {
break
}
+ origStrictFieldStackLen := len(d.strictFieldStack)
+ defer func() {
+ // Reset to original length and reuse the allocated space for the strict FieldStack slice.
+ d.strictFieldStack = d.strictFieldStack[:origStrictFieldStackLen]
+ }()
+
i := 0
for {
// Look ahead for ] - can only happen on first iteration.
@@ -580,6 +590,7 @@ func (d *decodeState) array(v reflect.Value) error {
}
}
+ d.appendStrictFieldStackIndex(i)
if i < v.Len() {
// Decode into element.
if err := d.value(v.Index(i)); err != nil {
@@ -591,6 +602,8 @@ func (d *decodeState) array(v reflect.Value) error {
return err
}
}
+ // Reset to original length and reuse the allocated space for the strict FieldStack slice.
+ d.strictFieldStack = d.strictFieldStack[:origStrictFieldStackLen]
i++
// Next token must be , or ].
@@ -666,7 +679,7 @@ func (d *decodeState) object(v reflect.Value) error {
reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
default:
- if !reflect.PtrTo(t.Key()).Implements(textUnmarshalerType) {
+ if !reflect.PointerTo(t.Key()).Implements(textUnmarshalerType) {
d.saveError(&UnmarshalTypeError{Value: "object", Type: t, Offset: int64(d.off)})
d.skip()
return nil
@@ -683,7 +696,7 @@ func (d *decodeState) object(v reflect.Value) error {
seenKeys = map[string]struct{}{}
}
if _, seen := seenKeys[fieldName]; seen {
- d.saveStrictError(fmt.Errorf("duplicate field %q", fieldName))
+ d.saveStrictError(d.newFieldError(duplicateStrictErrType, fieldName))
} else {
seenKeys[fieldName] = struct{}{}
}
@@ -699,7 +712,7 @@ func (d *decodeState) object(v reflect.Value) error {
var seenKeys uint64
checkDuplicateField = func(fieldNameIndex int, fieldName string) {
if seenKeys&(1< startDetectingCyclesAfter {
// We're a large number of nested ptrEncoder.encode calls deep;
// start checking if we've run into a pointer cycle.
- ptr := v.Pointer()
+ ptr := v.UnsafePointer()
if _, ok := e.ptrSeen[ptr]; ok {
e.error(&UnsupportedValueError{v, fmt.Sprintf("encountered a cycle via %s", v.Type())})
}
@@ -877,9 +876,9 @@ func (se sliceEncoder) encode(e *encodeState, v reflect.Value, opts encOpts) {
// Here we use a struct to memorize the pointer to the first element of the slice
// and its length.
ptr := struct {
- ptr uintptr
+ ptr interface{} // always an unsafe.Pointer, but avoids a dependency on package unsafe
len int
- }{v.Pointer(), v.Len()}
+ }{v.UnsafePointer(), v.Len()}
if _, ok := e.ptrSeen[ptr]; ok {
e.error(&UnsupportedValueError{v, fmt.Sprintf("encountered a cycle via %s", v.Type())})
}
@@ -893,7 +892,7 @@ func (se sliceEncoder) encode(e *encodeState, v reflect.Value, opts encOpts) {
func newSliceEncoder(t reflect.Type) encoderFunc {
// Byte slices get special treatment; arrays don't.
if t.Elem().Kind() == reflect.Uint8 {
- p := reflect.PtrTo(t.Elem())
+ p := reflect.PointerTo(t.Elem())
if !p.Implements(marshalerType) && !p.Implements(textMarshalerType) {
return encodeByteSlice
}
@@ -989,7 +988,7 @@ func isValidTag(s string) bool {
func typeByIndex(t reflect.Type, index []int) reflect.Type {
for _, i := range index {
- if t.Kind() == reflect.Ptr {
+ if t.Kind() == reflect.Pointer {
t = t.Elem()
}
t = t.Field(i).Type
@@ -1009,7 +1008,7 @@ func (w *reflectWithString) resolve() error {
return nil
}
if tm, ok := w.k.Interface().(encoding.TextMarshaler); ok {
- if w.k.Kind() == reflect.Ptr && w.k.IsNil() {
+ if w.k.Kind() == reflect.Pointer && w.k.IsNil() {
return nil
}
buf, err := tm.MarshalText()
@@ -1243,7 +1242,7 @@ func typeFields(t reflect.Type) structFields {
sf := f.typ.Field(i)
if sf.Anonymous {
t := sf.Type
- if t.Kind() == reflect.Ptr {
+ if t.Kind() == reflect.Pointer {
t = t.Elem()
}
if !sf.IsExported() && t.Kind() != reflect.Struct {
@@ -1269,7 +1268,7 @@ func typeFields(t reflect.Type) structFields {
index[len(f.index)] = i
ft := sf.Type
- if ft.Name() == "" && ft.Kind() == reflect.Ptr {
+ if ft.Name() == "" && ft.Kind() == reflect.Pointer {
// Follow pointer.
ft = ft.Elem()
}
diff --git a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/fold.go b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/fold.go
index 9e170127d..ab249b2bb 100644
--- a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/fold.go
+++ b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/fold.go
@@ -24,8 +24,9 @@ const (
// 4) simpleLetterEqualFold, no specials, no non-letters.
//
// The letters S and K are special because they map to 3 runes, not just 2:
-// * S maps to s and to U+017F 'ſ' Latin small letter long s
-// * k maps to K and to U+212A 'K' Kelvin sign
+// - S maps to s and to U+017F 'ſ' Latin small letter long s
+// - k maps to K and to U+212A 'K' Kelvin sign
+//
// See https://play.golang.org/p/tTxjOc0OGo
//
// The returned function is specialized for matching against s and
diff --git a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/fuzz.go b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/fuzz.go
index d3fa2d111..b8f4ff2c1 100644
--- a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/fuzz.go
+++ b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/fuzz.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build gofuzz
-// +build gofuzz
package json
@@ -12,10 +11,10 @@ import (
)
func Fuzz(data []byte) (score int) {
- for _, ctor := range []func() interface{}{
- func() interface{} { return new(interface{}) },
- func() interface{} { return new(map[string]interface{}) },
- func() interface{} { return new([]interface{}) },
+ for _, ctor := range []func() any{
+ func() any { return new(any) },
+ func() any { return new(map[string]any) },
+ func() any { return new([]any) },
} {
v := ctor()
err := Unmarshal(data, v)
diff --git a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/kubernetes_patch.go b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/kubernetes_patch.go
index 4b7acd6ef..e1c0a74d9 100644
--- a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/kubernetes_patch.go
+++ b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/kubernetes_patch.go
@@ -18,6 +18,7 @@ package json
import (
gojson "encoding/json"
+ "strconv"
"strings"
)
@@ -69,27 +70,85 @@ func (d *Decoder) DisallowDuplicateFields() {
d.d.disallowDuplicateFields = true
}
+func (d *decodeState) newFieldError(errType strictErrType, field string) *strictError {
+ if len(d.strictFieldStack) > 0 {
+ return &strictError{
+ ErrType: errType,
+ Path: strings.Join(d.strictFieldStack, "") + "." + field,
+ }
+ } else {
+ return &strictError{
+ ErrType: errType,
+ Path: field,
+ }
+ }
+}
+
// saveStrictError saves a strict decoding error,
// for reporting at the end of the unmarshal if no other errors occurred.
-func (d *decodeState) saveStrictError(err error) {
+func (d *decodeState) saveStrictError(err *strictError) {
// prevent excessive numbers of accumulated errors
if len(d.savedStrictErrors) >= 100 {
return
}
// dedupe accumulated strict errors
if d.seenStrictErrors == nil {
- d.seenStrictErrors = map[string]struct{}{}
+ d.seenStrictErrors = map[strictError]struct{}{}
}
- msg := err.Error()
- if _, seen := d.seenStrictErrors[msg]; seen {
+ if _, seen := d.seenStrictErrors[*err]; seen {
return
}
// accumulate the error
- d.seenStrictErrors[msg] = struct{}{}
+ d.seenStrictErrors[*err] = struct{}{}
d.savedStrictErrors = append(d.savedStrictErrors, err)
}
+func (d *decodeState) appendStrictFieldStackKey(key string) {
+ if !d.disallowDuplicateFields && !d.disallowUnknownFields {
+ return
+ }
+ if len(d.strictFieldStack) > 0 {
+ d.strictFieldStack = append(d.strictFieldStack, ".", key)
+ } else {
+ d.strictFieldStack = append(d.strictFieldStack, key)
+ }
+}
+
+func (d *decodeState) appendStrictFieldStackIndex(i int) {
+ if !d.disallowDuplicateFields && !d.disallowUnknownFields {
+ return
+ }
+ d.strictFieldStack = append(d.strictFieldStack, "[", strconv.Itoa(i), "]")
+}
+
+type strictErrType string
+
+const (
+ unknownStrictErrType strictErrType = "unknown field"
+ duplicateStrictErrType strictErrType = "duplicate field"
+)
+
+// strictError is a strict decoding error
+// It has an ErrType (either unknown or duplicate)
+// and a path to the erroneous field
+type strictError struct {
+ ErrType strictErrType
+ Path string
+}
+
+func (e *strictError) Error() string {
+ return string(e.ErrType) + " " + strconv.Quote(e.Path)
+}
+
+func (e *strictError) FieldPath() string {
+ return e.Path
+}
+
+func (e *strictError) SetFieldPath(path string) {
+ e.Path = path
+}
+
// UnmarshalStrictError holds errors resulting from use of strict disallow___ decoder directives.
// If this is returned from Unmarshal(), it means the decoding was successful in all other respects.
type UnmarshalStrictError struct {
diff --git a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/scanner.go b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/scanner.go
index 9dc1903e2..22fc6922d 100644
--- a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/scanner.go
+++ b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/scanner.go
@@ -27,6 +27,7 @@ func Valid(data []byte) bool {
// checkValid verifies that data is valid JSON-encoded data.
// scan is passed in for use by checkValid to avoid an allocation.
+// checkValid returns nil or a SyntaxError.
func checkValid(data []byte, scan *scanner) error {
scan.reset()
for _, c := range data {
@@ -42,6 +43,7 @@ func checkValid(data []byte, scan *scanner) error {
}
// A SyntaxError is a description of a JSON syntax error.
+// Unmarshal will return a SyntaxError if the JSON can't be parsed.
type SyntaxError struct {
msg string // description of error
Offset int64 // error occurred after reading Offset bytes
@@ -83,7 +85,7 @@ type scanner struct {
}
var scannerPool = sync.Pool{
- New: func() interface{} {
+ New: func() any {
return &scanner{}
},
}
diff --git a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/stream.go b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/stream.go
index 5f87df1c6..1967755ac 100644
--- a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/stream.go
+++ b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/stream.go
@@ -45,7 +45,7 @@ func (dec *Decoder) DisallowUnknownFields() { dec.d.disallowUnknownFields = true
//
// See the documentation for Unmarshal for details about
// the conversion of JSON into a Go value.
-func (dec *Decoder) Decode(v interface{}) error {
+func (dec *Decoder) Decode(v any) error {
if dec.err != nil {
return dec.err
}
@@ -197,7 +197,7 @@ func NewEncoder(w io.Writer) *Encoder {
//
// See the documentation for Marshal for details about the
// conversion of Go values to JSON.
-func (enc *Encoder) Encode(v interface{}) error {
+func (enc *Encoder) Encode(v any) error {
if enc.err != nil {
return enc.err
}
@@ -289,8 +289,7 @@ var _ Unmarshaler = (*RawMessage)(nil)
// Number, for JSON numbers
// string, for JSON string literals
// nil, for JSON null
-//
-type Token interface{}
+type Token any
*/
const (
@@ -457,7 +456,7 @@ func (dec *Decoder) Token() (Token, error) {
if !dec.tokenValueAllowed() {
return dec.tokenError(c)
}
- var x interface{}
+ var x any
if err := dec.Decode(&x); err != nil {
return nil, err
}
diff --git a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/tags.go b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/tags.go
index c38fd5102..b490328f4 100644
--- a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/tags.go
+++ b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/tags.go
@@ -15,10 +15,8 @@ type tagOptions string
// parseTag splits a struct field's json tag into its name and
// comma-separated options.
func parseTag(tag string) (string, tagOptions) {
- if idx := strings.Index(tag, ","); idx != -1 {
- return tag[:idx], tagOptions(tag[idx+1:])
- }
- return tag, tagOptions("")
+ tag, opt, _ := strings.Cut(tag, ",")
+ return tag, tagOptions(opt)
}
// Contains reports whether a comma-separated list of options
@@ -30,15 +28,11 @@ func (o tagOptions) Contains(optionName string) bool {
}
s := string(o)
for s != "" {
- var next string
- i := strings.Index(s, ",")
- if i >= 0 {
- s, next = s[:i], s[i+1:]
- }
- if s == optionName {
+ var name string
+ name, s, _ = strings.Cut(s, ",")
+ if name == optionName {
return true
}
- s = next
}
return false
}
diff --git a/vendor/sigs.k8s.io/json/json.go b/vendor/sigs.k8s.io/json/json.go
index 764e2a84c..e8f31b16c 100644
--- a/vendor/sigs.k8s.io/json/json.go
+++ b/vendor/sigs.k8s.io/json/json.go
@@ -34,13 +34,13 @@ type Decoder interface {
}
// NewDecoderCaseSensitivePreserveInts returns a decoder that matches the behavior of encoding/json#NewDecoder, with the following changes:
-// - When unmarshaling into a struct, JSON keys must case-sensitively match `json` tag names (for tagged struct fields)
-// or struct field names (for untagged struct fields), or they are treated as unknown fields and discarded.
-// - When unmarshaling a number into an interface value, it is unmarshaled as an int64 if
-// the JSON data does not contain a "." character and parses as an integer successfully and
-// does not overflow int64. Otherwise, the number is unmarshaled as a float64.
-// - If a syntax error is returned, it will not be of type encoding/json#SyntaxError,
-// but will be recognizeable by this package's IsSyntaxError() function.
+// - When unmarshaling into a struct, JSON keys must case-sensitively match `json` tag names (for tagged struct fields)
+// or struct field names (for untagged struct fields), or they are treated as unknown fields and discarded.
+// - When unmarshaling a number into an interface value, it is unmarshaled as an int64 if
+// the JSON data does not contain a "." character and parses as an integer successfully and
+// does not overflow int64. Otherwise, the number is unmarshaled as a float64.
+// - If a syntax error is returned, it will not be of type encoding/json#SyntaxError,
+// but will be recognizeable by this package's IsSyntaxError() function.
func NewDecoderCaseSensitivePreserveInts(r io.Reader) Decoder {
d := internaljson.NewDecoder(r)
d.CaseSensitive()
@@ -51,13 +51,13 @@ func NewDecoderCaseSensitivePreserveInts(r io.Reader) Decoder {
// UnmarshalCaseSensitivePreserveInts parses the JSON-encoded data and stores the result in the value pointed to by v.
//
// UnmarshalCaseSensitivePreserveInts matches the behavior of encoding/json#Unmarshal, with the following changes:
-// - When unmarshaling into a struct, JSON keys must case-sensitively match `json` tag names (for tagged struct fields)
-// or struct field names (for untagged struct fields), or they are treated as unknown fields and discarded.
-// - When unmarshaling a number into an interface value, it is unmarshaled as an int64 if
-// the JSON data does not contain a "." character and parses as an integer successfully and
-// does not overflow int64. Otherwise, the number is unmarshaled as a float64.
-// - If a syntax error is returned, it will not be of type encoding/json#SyntaxError,
-// but will be recognizeable by this package's IsSyntaxError() function.
+// - When unmarshaling into a struct, JSON keys must case-sensitively match `json` tag names (for tagged struct fields)
+// or struct field names (for untagged struct fields), or they are treated as unknown fields and discarded.
+// - When unmarshaling a number into an interface value, it is unmarshaled as an int64 if
+// the JSON data does not contain a "." character and parses as an integer successfully and
+// does not overflow int64. Otherwise, the number is unmarshaled as a float64.
+// - If a syntax error is returned, it will not be of type encoding/json#SyntaxError,
+// but will be recognizeable by this package's IsSyntaxError() function.
func UnmarshalCaseSensitivePreserveInts(data []byte, v interface{}) error {
return internaljson.Unmarshal(
data,
@@ -84,6 +84,8 @@ const (
// and a list of the strict failures (if any) are returned. If no `strictOptions` are selected,
// all supported strict checks are performed.
//
+// Strict errors returned will implement the FieldError interface for the specific erroneous fields.
+//
// Currently supported strict checks are:
// - DisallowDuplicateFields: ensure the data contains no duplicate fields
// - DisallowUnknownFields: ensure the data contains no unknown fields (when decoding into typed structs)
@@ -137,3 +139,12 @@ func SyntaxErrorOffset(err error) (isSyntaxError bool, offset int64) {
return false, 0
}
}
+
+// FieldError is an error that provides access to the path of the erroneous field
+type FieldError interface {
+ error
+ // FieldPath provides the full path of the erroneous field within the json object.
+ FieldPath() string
+ // SetFieldPath updates the path of the erroneous field output in the error message.
+ SetFieldPath(path string)
+}
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/pathelementmap.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/pathelementmap.go
index 9b14ca581..41fc2474a 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/pathelementmap.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/pathelementmap.go
@@ -28,20 +28,15 @@ import (
// for PathElementSet and SetNodeMap, so we could probably share the
// code.
type PathElementValueMap struct {
- members sortedPathElementValues
+ valueMap PathElementMap
}
func MakePathElementValueMap(size int) PathElementValueMap {
return PathElementValueMap{
- members: make(sortedPathElementValues, 0, size),
+ valueMap: MakePathElementMap(size),
}
}
-type pathElementValue struct {
- PathElement PathElement
- Value value.Value
-}
-
type sortedPathElementValues []pathElementValue
// Implement the sort interface; this would permit bulk creation, which would
@@ -53,7 +48,40 @@ func (spev sortedPathElementValues) Less(i, j int) bool {
func (spev sortedPathElementValues) Swap(i, j int) { spev[i], spev[j] = spev[j], spev[i] }
// Insert adds the pathelement and associated value in the map.
+// If insert is called twice with the same PathElement, the value is replaced.
func (s *PathElementValueMap) Insert(pe PathElement, v value.Value) {
+ s.valueMap.Insert(pe, v)
+}
+
+// Get retrieves the value associated with the given PathElement from the map.
+// (nil, false) is returned if there is no such PathElement.
+func (s *PathElementValueMap) Get(pe PathElement) (value.Value, bool) {
+ v, ok := s.valueMap.Get(pe)
+ if !ok {
+ return nil, false
+ }
+ return v.(value.Value), true
+}
+
+// PathElementValueMap is a map from PathElement to interface{}.
+type PathElementMap struct {
+ members sortedPathElementValues
+}
+
+type pathElementValue struct {
+ PathElement PathElement
+ Value interface{}
+}
+
+func MakePathElementMap(size int) PathElementMap {
+ return PathElementMap{
+ members: make(sortedPathElementValues, 0, size),
+ }
+}
+
+// Insert adds the pathelement and associated value in the map.
+// If insert is called twice with the same PathElement, the value is replaced.
+func (s *PathElementMap) Insert(pe PathElement, v interface{}) {
loc := sort.Search(len(s.members), func(i int) bool {
return !s.members[i].PathElement.Less(pe)
})
@@ -62,6 +90,7 @@ func (s *PathElementValueMap) Insert(pe PathElement, v value.Value) {
return
}
if s.members[loc].PathElement.Equals(pe) {
+ s.members[loc].Value = v
return
}
s.members = append(s.members, pathElementValue{})
@@ -71,7 +100,7 @@ func (s *PathElementValueMap) Insert(pe PathElement, v value.Value) {
// Get retrieves the value associated with the given PathElement from the map.
// (nil, false) is returned if there is no such PathElement.
-func (s *PathElementValueMap) Get(pe PathElement) (value.Value, bool) {
+func (s *PathElementMap) Get(pe PathElement) (interface{}, bool) {
loc := sort.Search(len(s.members), func(i int) bool {
return !s.members[i].PathElement.Less(pe)
})
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/merge/conflict.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/merge/conflict.go
new file mode 100644
index 000000000..f1aa25860
--- /dev/null
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/merge/conflict.go
@@ -0,0 +1,121 @@
+/*
+Copyright 2018 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package merge
+
+import (
+ "fmt"
+ "sort"
+ "strings"
+
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+)
+
+// Conflict is a conflict on a specific field with the current manager of
+// that field. It does implement the error interface so that it can be
+// used as an error.
+type Conflict struct {
+ Manager string
+ Path fieldpath.Path
+}
+
+// Conflict is an error.
+var _ error = Conflict{}
+
+// Error formats the conflict as an error.
+func (c Conflict) Error() string {
+ return fmt.Sprintf("conflict with %q: %v", c.Manager, c.Path)
+}
+
+// Equals returns true if c == c2
+func (c Conflict) Equals(c2 Conflict) bool {
+ if c.Manager != c2.Manager {
+ return false
+ }
+ return c.Path.Equals(c2.Path)
+}
+
+// Conflicts accumulates multiple conflicts and aggregates them by managers.
+type Conflicts []Conflict
+
+var _ error = Conflicts{}
+
+// Error prints the list of conflicts, grouped by sorted managers.
+func (conflicts Conflicts) Error() string {
+ if len(conflicts) == 1 {
+ return conflicts[0].Error()
+ }
+
+ m := map[string][]fieldpath.Path{}
+ for _, conflict := range conflicts {
+ m[conflict.Manager] = append(m[conflict.Manager], conflict.Path)
+ }
+
+ managers := []string{}
+ for manager := range m {
+ managers = append(managers, manager)
+ }
+
+ // Print conflicts by sorted managers.
+ sort.Strings(managers)
+
+ messages := []string{}
+ for _, manager := range managers {
+ messages = append(messages, fmt.Sprintf("conflicts with %q:", manager))
+ for _, path := range m[manager] {
+ messages = append(messages, fmt.Sprintf("- %v", path))
+ }
+ }
+ return strings.Join(messages, "\n")
+}
+
+// Equals returns true if the lists of conflicts are the same.
+func (c Conflicts) Equals(c2 Conflicts) bool {
+ if len(c) != len(c2) {
+ return false
+ }
+ for i := range c {
+ if !c[i].Equals(c2[i]) {
+ return false
+ }
+ }
+ return true
+}
+
+// ToSet aggregates conflicts for all managers into a single Set.
+func (c Conflicts) ToSet() *fieldpath.Set {
+ set := fieldpath.NewSet()
+ for _, conflict := range []Conflict(c) {
+ set.Insert(conflict.Path)
+ }
+ return set
+}
+
+// ConflictsFromManagers creates a list of conflicts given Managers sets.
+func ConflictsFromManagers(sets fieldpath.ManagedFields) Conflicts {
+ conflicts := []Conflict{}
+
+ for manager, set := range sets {
+ set.Set().Iterate(func(p fieldpath.Path) {
+ conflicts = append(conflicts, Conflict{
+ Manager: manager,
+ Path: p.Copy(),
+ })
+ })
+ }
+
+ return conflicts
+}
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/merge/update.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/merge/update.go
new file mode 100644
index 000000000..d5a977d60
--- /dev/null
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/merge/update.go
@@ -0,0 +1,358 @@
+/*
+Copyright 2018 The Kubernetes Authors.
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package merge
+
+import (
+ "fmt"
+
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+ "sigs.k8s.io/structured-merge-diff/v4/typed"
+ "sigs.k8s.io/structured-merge-diff/v4/value"
+)
+
+// Converter is an interface to the conversion logic. The converter
+// needs to be able to convert objects from one version to another.
+type Converter interface {
+ Convert(object *typed.TypedValue, version fieldpath.APIVersion) (*typed.TypedValue, error)
+ IsMissingVersionError(error) bool
+}
+
+// UpdateBuilder allows you to create a new Updater by exposing all of
+// the options and setting them once.
+type UpdaterBuilder struct {
+ Converter Converter
+ IgnoredFields map[fieldpath.APIVersion]*fieldpath.Set
+
+ // Stop comparing the new object with old object after applying.
+ // This was initially used to avoid spurious etcd update, but
+ // since that's vastly inefficient, we've come-up with a better
+ // way of doing that. Create this flag to stop it.
+ // Comparing has become more expensive too now that we're not using
+ // `Compare` but `value.Equals` so this gives an option to avoid it.
+ ReturnInputOnNoop bool
+}
+
+func (u *UpdaterBuilder) BuildUpdater() *Updater {
+ return &Updater{
+ Converter: u.Converter,
+ IgnoredFields: u.IgnoredFields,
+ returnInputOnNoop: u.ReturnInputOnNoop,
+ }
+}
+
+// Updater is the object used to compute updated FieldSets and also
+// merge the object on Apply.
+type Updater struct {
+ // Deprecated: This will eventually become private.
+ Converter Converter
+
+ // Deprecated: This will eventually become private.
+ IgnoredFields map[fieldpath.APIVersion]*fieldpath.Set
+
+ returnInputOnNoop bool
+}
+
+func (s *Updater) update(oldObject, newObject *typed.TypedValue, version fieldpath.APIVersion, managers fieldpath.ManagedFields, workflow string, force bool) (fieldpath.ManagedFields, *typed.Comparison, error) {
+ conflicts := fieldpath.ManagedFields{}
+ removed := fieldpath.ManagedFields{}
+ compare, err := oldObject.Compare(newObject)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to compare objects: %v", err)
+ }
+
+ versions := map[fieldpath.APIVersion]*typed.Comparison{
+ version: compare.ExcludeFields(s.IgnoredFields[version]),
+ }
+
+ for manager, managerSet := range managers {
+ if manager == workflow {
+ continue
+ }
+ compare, ok := versions[managerSet.APIVersion()]
+ if !ok {
+ var err error
+ versionedOldObject, err := s.Converter.Convert(oldObject, managerSet.APIVersion())
+ if err != nil {
+ if s.Converter.IsMissingVersionError(err) {
+ delete(managers, manager)
+ continue
+ }
+ return nil, nil, fmt.Errorf("failed to convert old object: %v", err)
+ }
+ versionedNewObject, err := s.Converter.Convert(newObject, managerSet.APIVersion())
+ if err != nil {
+ if s.Converter.IsMissingVersionError(err) {
+ delete(managers, manager)
+ continue
+ }
+ return nil, nil, fmt.Errorf("failed to convert new object: %v", err)
+ }
+ compare, err = versionedOldObject.Compare(versionedNewObject)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to compare objects: %v", err)
+ }
+ versions[managerSet.APIVersion()] = compare.ExcludeFields(s.IgnoredFields[managerSet.APIVersion()])
+ }
+
+ conflictSet := managerSet.Set().Intersection(compare.Modified.Union(compare.Added))
+ if !conflictSet.Empty() {
+ conflicts[manager] = fieldpath.NewVersionedSet(conflictSet, managerSet.APIVersion(), false)
+ }
+
+ if !compare.Removed.Empty() {
+ removed[manager] = fieldpath.NewVersionedSet(compare.Removed, managerSet.APIVersion(), false)
+ }
+ }
+
+ if !force && len(conflicts) != 0 {
+ return nil, nil, ConflictsFromManagers(conflicts)
+ }
+
+ for manager, conflictSet := range conflicts {
+ managers[manager] = fieldpath.NewVersionedSet(managers[manager].Set().Difference(conflictSet.Set()), managers[manager].APIVersion(), managers[manager].Applied())
+ }
+
+ for manager, removedSet := range removed {
+ managers[manager] = fieldpath.NewVersionedSet(managers[manager].Set().Difference(removedSet.Set()), managers[manager].APIVersion(), managers[manager].Applied())
+ }
+
+ for manager := range managers {
+ if managers[manager].Set().Empty() {
+ delete(managers, manager)
+ }
+ }
+
+ return managers, compare, nil
+}
+
+// Update is the method you should call once you've merged your final
+// object on CREATE/UPDATE/PATCH verbs. newObject must be the object
+// that you intend to persist (after applying the patch if this is for a
+// PATCH call), and liveObject must be the original object (empty if
+// this is a CREATE call).
+func (s *Updater) Update(liveObject, newObject *typed.TypedValue, version fieldpath.APIVersion, managers fieldpath.ManagedFields, manager string) (*typed.TypedValue, fieldpath.ManagedFields, error) {
+ var err error
+ managers, err = s.reconcileManagedFieldsWithSchemaChanges(liveObject, managers)
+ if err != nil {
+ return nil, fieldpath.ManagedFields{}, err
+ }
+ managers, compare, err := s.update(liveObject, newObject, version, managers, manager, true)
+ if err != nil {
+ return nil, fieldpath.ManagedFields{}, err
+ }
+ if _, ok := managers[manager]; !ok {
+ managers[manager] = fieldpath.NewVersionedSet(fieldpath.NewSet(), version, false)
+ }
+
+ ignored := s.IgnoredFields[version]
+ if ignored == nil {
+ ignored = fieldpath.NewSet()
+ }
+ managers[manager] = fieldpath.NewVersionedSet(
+ managers[manager].Set().Difference(compare.Removed).Union(compare.Modified).Union(compare.Added).RecursiveDifference(ignored),
+ version,
+ false,
+ )
+ if managers[manager].Set().Empty() {
+ delete(managers, manager)
+ }
+ return newObject, managers, nil
+}
+
+// Apply should be called when Apply is run, given the current object as
+// well as the configuration that is applied. This will merge the object
+// and return it.
+func (s *Updater) Apply(liveObject, configObject *typed.TypedValue, version fieldpath.APIVersion, managers fieldpath.ManagedFields, manager string, force bool) (*typed.TypedValue, fieldpath.ManagedFields, error) {
+ var err error
+ managers, err = s.reconcileManagedFieldsWithSchemaChanges(liveObject, managers)
+ if err != nil {
+ return nil, fieldpath.ManagedFields{}, err
+ }
+ newObject, err := liveObject.Merge(configObject)
+ if err != nil {
+ return nil, fieldpath.ManagedFields{}, fmt.Errorf("failed to merge config: %v", err)
+ }
+ lastSet := managers[manager]
+ set, err := configObject.ToFieldSet()
+ if err != nil {
+ return nil, fieldpath.ManagedFields{}, fmt.Errorf("failed to get field set: %v", err)
+ }
+
+ ignored := s.IgnoredFields[version]
+ if ignored != nil {
+ set = set.RecursiveDifference(ignored)
+ // TODO: is this correct. If we don't remove from lastSet pruning might remove the fields?
+ if lastSet != nil {
+ lastSet.Set().RecursiveDifference(ignored)
+ }
+ }
+ managers[manager] = fieldpath.NewVersionedSet(set, version, true)
+ newObject, err = s.prune(newObject, managers, manager, lastSet)
+ if err != nil {
+ return nil, fieldpath.ManagedFields{}, fmt.Errorf("failed to prune fields: %v", err)
+ }
+ managers, _, err = s.update(liveObject, newObject, version, managers, manager, force)
+ if err != nil {
+ return nil, fieldpath.ManagedFields{}, err
+ }
+ if !s.returnInputOnNoop && value.EqualsUsing(value.NewFreelistAllocator(), liveObject.AsValue(), newObject.AsValue()) {
+ newObject = nil
+ }
+ return newObject, managers, nil
+}
+
+// prune will remove a field, list or map item, iff:
+// * applyingManager applied it last time
+// * applyingManager didn't apply it this time
+// * no other applier claims to manage it
+func (s *Updater) prune(merged *typed.TypedValue, managers fieldpath.ManagedFields, applyingManager string, lastSet fieldpath.VersionedSet) (*typed.TypedValue, error) {
+ if lastSet == nil || lastSet.Set().Empty() {
+ return merged, nil
+ }
+ version := lastSet.APIVersion()
+ convertedMerged, err := s.Converter.Convert(merged, version)
+ if err != nil {
+ if s.Converter.IsMissingVersionError(err) {
+ return merged, nil
+ }
+ return nil, fmt.Errorf("failed to convert merged object to last applied version: %v", err)
+ }
+
+ sc, tr := convertedMerged.Schema(), convertedMerged.TypeRef()
+ pruned := convertedMerged.RemoveItems(lastSet.Set().EnsureNamedFieldsAreMembers(sc, tr))
+ pruned, err = s.addBackOwnedItems(convertedMerged, pruned, version, managers, applyingManager)
+ if err != nil {
+ return nil, fmt.Errorf("failed add back owned items: %v", err)
+ }
+ pruned, err = s.addBackDanglingItems(convertedMerged, pruned, lastSet)
+ if err != nil {
+ return nil, fmt.Errorf("failed add back dangling items: %v", err)
+ }
+ return s.Converter.Convert(pruned, managers[applyingManager].APIVersion())
+}
+
+// addBackOwnedItems adds back any fields, list and map items that were removed by prune,
+// but other appliers or updaters (or the current applier's new config) claim to own.
+func (s *Updater) addBackOwnedItems(merged, pruned *typed.TypedValue, prunedVersion fieldpath.APIVersion, managedFields fieldpath.ManagedFields, applyingManager string) (*typed.TypedValue, error) {
+ var err error
+ managedAtVersion := map[fieldpath.APIVersion]*fieldpath.Set{}
+ for _, managerSet := range managedFields {
+ if _, ok := managedAtVersion[managerSet.APIVersion()]; !ok {
+ managedAtVersion[managerSet.APIVersion()] = fieldpath.NewSet()
+ }
+ managedAtVersion[managerSet.APIVersion()] = managedAtVersion[managerSet.APIVersion()].Union(managerSet.Set())
+ }
+ // Add back owned items at pruned version first to avoid conversion failure
+ // caused by pruned fields which are required for conversion.
+ if managed, ok := managedAtVersion[prunedVersion]; ok {
+ merged, pruned, err = s.addBackOwnedItemsForVersion(merged, pruned, prunedVersion, managed)
+ if err != nil {
+ return nil, err
+ }
+ delete(managedAtVersion, prunedVersion)
+ }
+ for version, managed := range managedAtVersion {
+ merged, pruned, err = s.addBackOwnedItemsForVersion(merged, pruned, version, managed)
+ if err != nil {
+ return nil, err
+ }
+ }
+ return pruned, nil
+}
+
+// addBackOwnedItemsForVersion adds back any fields, list and map items that were removed by prune with specific managed field path at a version.
+// It is an extracted sub-function from addBackOwnedItems for code reuse.
+func (s *Updater) addBackOwnedItemsForVersion(merged, pruned *typed.TypedValue, version fieldpath.APIVersion, managed *fieldpath.Set) (*typed.TypedValue, *typed.TypedValue, error) {
+ var err error
+ merged, err = s.Converter.Convert(merged, version)
+ if err != nil {
+ if s.Converter.IsMissingVersionError(err) {
+ return merged, pruned, nil
+ }
+ return nil, nil, fmt.Errorf("failed to convert merged object at version %v: %v", version, err)
+ }
+ pruned, err = s.Converter.Convert(pruned, version)
+ if err != nil {
+ if s.Converter.IsMissingVersionError(err) {
+ return merged, pruned, nil
+ }
+ return nil, nil, fmt.Errorf("failed to convert pruned object at version %v: %v", version, err)
+ }
+ mergedSet, err := merged.ToFieldSet()
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to create field set from merged object at version %v: %v", version, err)
+ }
+ prunedSet, err := pruned.ToFieldSet()
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to create field set from pruned object at version %v: %v", version, err)
+ }
+ sc, tr := merged.Schema(), merged.TypeRef()
+ pruned = merged.RemoveItems(mergedSet.EnsureNamedFieldsAreMembers(sc, tr).Difference(prunedSet.EnsureNamedFieldsAreMembers(sc, tr).Union(managed.EnsureNamedFieldsAreMembers(sc, tr))))
+ return merged, pruned, nil
+}
+
+// addBackDanglingItems makes sure that the fields list and map items removed by prune were
+// previously owned by the currently applying manager. This will add back fields list and map items
+// that are unowned or that are owned by Updaters and shouldn't be removed.
+func (s *Updater) addBackDanglingItems(merged, pruned *typed.TypedValue, lastSet fieldpath.VersionedSet) (*typed.TypedValue, error) {
+ convertedPruned, err := s.Converter.Convert(pruned, lastSet.APIVersion())
+ if err != nil {
+ if s.Converter.IsMissingVersionError(err) {
+ return merged, nil
+ }
+ return nil, fmt.Errorf("failed to convert pruned object to last applied version: %v", err)
+ }
+ prunedSet, err := convertedPruned.ToFieldSet()
+ if err != nil {
+ return nil, fmt.Errorf("failed to create field set from pruned object in last applied version: %v", err)
+ }
+ mergedSet, err := merged.ToFieldSet()
+ if err != nil {
+ return nil, fmt.Errorf("failed to create field set from merged object in last applied version: %v", err)
+ }
+ sc, tr := merged.Schema(), merged.TypeRef()
+ prunedSet = prunedSet.EnsureNamedFieldsAreMembers(sc, tr)
+ mergedSet = mergedSet.EnsureNamedFieldsAreMembers(sc, tr)
+ last := lastSet.Set().EnsureNamedFieldsAreMembers(sc, tr)
+ return merged.RemoveItems(mergedSet.Difference(prunedSet).Intersection(last)), nil
+}
+
+// reconcileManagedFieldsWithSchemaChanges reconciles the managed fields with any changes to the
+// object's schema since the managed fields were written.
+//
+// Supports:
+// - changing types from atomic to granular
+// - changing types from granular to atomic
+func (s *Updater) reconcileManagedFieldsWithSchemaChanges(liveObject *typed.TypedValue, managers fieldpath.ManagedFields) (fieldpath.ManagedFields, error) {
+ result := fieldpath.ManagedFields{}
+ for manager, versionedSet := range managers {
+ tv, err := s.Converter.Convert(liveObject, versionedSet.APIVersion())
+ if s.Converter.IsMissingVersionError(err) { // okay to skip, obsolete versions will be deleted automatically anyway
+ continue
+ }
+ if err != nil {
+ return nil, err
+ }
+ reconciled, err := typed.ReconcileFieldSetWithSchema(versionedSet.Set(), tv)
+ if err != nil {
+ return nil, err
+ }
+ if reconciled != nil {
+ result[manager] = fieldpath.NewVersionedSet(reconciled, versionedSet.APIVersion(), versionedSet.Applied())
+ } else {
+ result[manager] = versionedSet
+ }
+ }
+ return result, nil
+}
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/schema/elements.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/schema/elements.go
index 7e5dc7582..5d3707a5b 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/schema/elements.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/schema/elements.go
@@ -73,7 +73,7 @@ type Atom struct {
}
// Scalar (AKA "primitive") represents a type which has a single value which is
-// either numeric, string, or boolean.
+// either numeric, string, or boolean, or untyped for any of them.
//
// TODO: split numeric into float/int? Something even more fine-grained?
type Scalar string
@@ -82,6 +82,7 @@ const (
Numeric = Scalar("numeric")
String = Scalar("string")
Boolean = Scalar("boolean")
+ Untyped = Scalar("untyped")
)
// ElementRelationship is an enum of the different possible relationships
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/schema/schemaschema.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/schema/schemaschema.go
index 7d64d1308..6eb6c36df 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/schema/schemaschema.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/schema/schemaschema.go
@@ -110,7 +110,7 @@ var SchemaSchemaYAML = `types:
scalar: string
- name: deduceInvalidDiscriminator
type:
- scalar: bool
+ scalar: boolean
- name: fields
type:
list:
@@ -145,6 +145,7 @@ var SchemaSchemaYAML = `types:
list:
elementType:
scalar: string
+ elementRelationship: atomic
- name: untyped
map:
fields:
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/compare.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/compare.go
new file mode 100644
index 000000000..ed483cbbc
--- /dev/null
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/compare.go
@@ -0,0 +1,460 @@
+/*
+Copyright 2018 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package typed
+
+import (
+ "fmt"
+ "strings"
+
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+ "sigs.k8s.io/structured-merge-diff/v4/schema"
+ "sigs.k8s.io/structured-merge-diff/v4/value"
+)
+
+// Comparison is the return value of a TypedValue.Compare() operation.
+//
+// No field will appear in more than one of the three fieldsets. If all of the
+// fieldsets are empty, then the objects must have been equal.
+type Comparison struct {
+ // Removed contains any fields removed by rhs (the right-hand-side
+ // object in the comparison).
+ Removed *fieldpath.Set
+ // Modified contains fields present in both objects but different.
+ Modified *fieldpath.Set
+ // Added contains any fields added by rhs.
+ Added *fieldpath.Set
+}
+
+// IsSame returns true if the comparison returned no changes (the two
+// compared objects are similar).
+func (c *Comparison) IsSame() bool {
+ return c.Removed.Empty() && c.Modified.Empty() && c.Added.Empty()
+}
+
+// String returns a human readable version of the comparison.
+func (c *Comparison) String() string {
+ bld := strings.Builder{}
+ if !c.Modified.Empty() {
+ bld.WriteString(fmt.Sprintf("- Modified Fields:\n%v\n", c.Modified))
+ }
+ if !c.Added.Empty() {
+ bld.WriteString(fmt.Sprintf("- Added Fields:\n%v\n", c.Added))
+ }
+ if !c.Removed.Empty() {
+ bld.WriteString(fmt.Sprintf("- Removed Fields:\n%v\n", c.Removed))
+ }
+ return bld.String()
+}
+
+// ExcludeFields fields from the compare recursively removes the fields
+// from the entire comparison
+func (c *Comparison) ExcludeFields(fields *fieldpath.Set) *Comparison {
+ if fields == nil || fields.Empty() {
+ return c
+ }
+ c.Removed = c.Removed.RecursiveDifference(fields)
+ c.Modified = c.Modified.RecursiveDifference(fields)
+ c.Added = c.Added.RecursiveDifference(fields)
+ return c
+}
+
+type compareWalker struct {
+ lhs value.Value
+ rhs value.Value
+ schema *schema.Schema
+ typeRef schema.TypeRef
+
+ // Current path that we are comparing
+ path fieldpath.Path
+
+ // Resulting comparison.
+ comparison *Comparison
+
+ // internal housekeeping--don't set when constructing.
+ inLeaf bool // Set to true if we're in a "big leaf"--atomic map/list
+
+ // Allocate only as many walkers as needed for the depth by storing them here.
+ spareWalkers *[]*compareWalker
+
+ allocator value.Allocator
+}
+
+// compare compares stuff.
+func (w *compareWalker) compare(prefixFn func() string) (errs ValidationErrors) {
+ if w.lhs == nil && w.rhs == nil {
+ // check this condidition here instead of everywhere below.
+ return errorf("at least one of lhs and rhs must be provided")
+ }
+ a, ok := w.schema.Resolve(w.typeRef)
+ if !ok {
+ return errorf("schema error: no type found matching: %v", *w.typeRef.NamedType)
+ }
+
+ alhs := deduceAtom(a, w.lhs)
+ arhs := deduceAtom(a, w.rhs)
+
+ // deduceAtom does not fix the type for nil values
+ // nil is a wildcard and will accept whatever form the other operand takes
+ if w.rhs == nil {
+ errs = append(errs, handleAtom(alhs, w.typeRef, w)...)
+ } else if w.lhs == nil || alhs.Equals(&arhs) {
+ errs = append(errs, handleAtom(arhs, w.typeRef, w)...)
+ } else {
+ w2 := *w
+ errs = append(errs, handleAtom(alhs, w.typeRef, &w2)...)
+ errs = append(errs, handleAtom(arhs, w.typeRef, w)...)
+ }
+
+ if !w.inLeaf {
+ if w.lhs == nil {
+ w.comparison.Added.Insert(w.path)
+ } else if w.rhs == nil {
+ w.comparison.Removed.Insert(w.path)
+ }
+ }
+ return errs.WithLazyPrefix(prefixFn)
+}
+
+// doLeaf should be called on leaves before descending into children, if there
+// will be a descent. It modifies w.inLeaf.
+func (w *compareWalker) doLeaf() {
+ if w.inLeaf {
+ // We're in a "big leaf", an atomic map or list. Ignore
+ // subsequent leaves.
+ return
+ }
+ w.inLeaf = true
+
+ // We don't recurse into leaf fields for merging.
+ if w.lhs == nil {
+ w.comparison.Added.Insert(w.path)
+ } else if w.rhs == nil {
+ w.comparison.Removed.Insert(w.path)
+ } else if !value.EqualsUsing(w.allocator, w.rhs, w.lhs) {
+ // TODO: Equality is not sufficient for this.
+ // Need to implement equality check on the value type.
+ w.comparison.Modified.Insert(w.path)
+ }
+}
+
+func (w *compareWalker) doScalar(t *schema.Scalar) ValidationErrors {
+ // Make sure at least one side is a valid scalar.
+ lerrs := validateScalar(t, w.lhs, "lhs: ")
+ rerrs := validateScalar(t, w.rhs, "rhs: ")
+ if len(lerrs) > 0 && len(rerrs) > 0 {
+ return append(lerrs, rerrs...)
+ }
+
+ // All scalars are leaf fields.
+ w.doLeaf()
+
+ return nil
+}
+
+func (w *compareWalker) prepareDescent(pe fieldpath.PathElement, tr schema.TypeRef, cmp *Comparison) *compareWalker {
+ if w.spareWalkers == nil {
+ // first descent.
+ w.spareWalkers = &[]*compareWalker{}
+ }
+ var w2 *compareWalker
+ if n := len(*w.spareWalkers); n > 0 {
+ w2, *w.spareWalkers = (*w.spareWalkers)[n-1], (*w.spareWalkers)[:n-1]
+ } else {
+ w2 = &compareWalker{}
+ }
+ *w2 = *w
+ w2.typeRef = tr
+ w2.path = append(w2.path, pe)
+ w2.lhs = nil
+ w2.rhs = nil
+ w2.comparison = cmp
+ return w2
+}
+
+func (w *compareWalker) finishDescent(w2 *compareWalker) {
+ // if the descent caused a realloc, ensure that we reuse the buffer
+ // for the next sibling.
+ w.path = w2.path[:len(w2.path)-1]
+ *w.spareWalkers = append(*w.spareWalkers, w2)
+}
+
+func (w *compareWalker) derefMap(prefix string, v value.Value) (value.Map, ValidationErrors) {
+ if v == nil {
+ return nil, nil
+ }
+ m, err := mapValue(w.allocator, v)
+ if err != nil {
+ return nil, errorf("%v: %v", prefix, err)
+ }
+ return m, nil
+}
+
+func (w *compareWalker) visitListItems(t *schema.List, lhs, rhs value.List) (errs ValidationErrors) {
+ rLen := 0
+ if rhs != nil {
+ rLen = rhs.Length()
+ }
+ lLen := 0
+ if lhs != nil {
+ lLen = lhs.Length()
+ }
+
+ maxLength := rLen
+ if lLen > maxLength {
+ maxLength = lLen
+ }
+ // Contains all the unique PEs between lhs and rhs, exactly once.
+ // Order doesn't matter since we're just tracking ownership in a set.
+ allPEs := make([]fieldpath.PathElement, 0, maxLength)
+
+ // Gather all the elements from lhs, indexed by PE, in a list for duplicates.
+ lValues := fieldpath.MakePathElementMap(lLen)
+ for i := 0; i < lLen; i++ {
+ child := lhs.At(i)
+ pe, err := listItemToPathElement(w.allocator, w.schema, t, child)
+ if err != nil {
+ errs = append(errs, errorf("element %v: %v", i, err.Error())...)
+ // If we can't construct the path element, we can't
+ // even report errors deeper in the schema, so bail on
+ // this element.
+ continue
+ }
+
+ if v, found := lValues.Get(pe); found {
+ list := v.([]value.Value)
+ lValues.Insert(pe, append(list, child))
+ } else {
+ lValues.Insert(pe, []value.Value{child})
+ allPEs = append(allPEs, pe)
+ }
+ }
+
+ // Gather all the elements from rhs, indexed by PE, in a list for duplicates.
+ rValues := fieldpath.MakePathElementMap(rLen)
+ for i := 0; i < rLen; i++ {
+ rValue := rhs.At(i)
+ pe, err := listItemToPathElement(w.allocator, w.schema, t, rValue)
+ if err != nil {
+ errs = append(errs, errorf("element %v: %v", i, err.Error())...)
+ // If we can't construct the path element, we can't
+ // even report errors deeper in the schema, so bail on
+ // this element.
+ continue
+ }
+ if v, found := rValues.Get(pe); found {
+ list := v.([]value.Value)
+ rValues.Insert(pe, append(list, rValue))
+ } else {
+ rValues.Insert(pe, []value.Value{rValue})
+ if _, found := lValues.Get(pe); !found {
+ allPEs = append(allPEs, pe)
+ }
+ }
+ }
+
+ for _, pe := range allPEs {
+ lList := []value.Value(nil)
+ if l, ok := lValues.Get(pe); ok {
+ lList = l.([]value.Value)
+ }
+ rList := []value.Value(nil)
+ if l, ok := rValues.Get(pe); ok {
+ rList = l.([]value.Value)
+ }
+
+ switch {
+ case len(lList) == 0 && len(rList) == 0:
+ // We shouldn't be here anyway.
+ return
+ // Normal use-case:
+ // We have no duplicates for this PE, compare items one-to-one.
+ case len(lList) <= 1 && len(rList) <= 1:
+ lValue := value.Value(nil)
+ if len(lList) != 0 {
+ lValue = lList[0]
+ }
+ rValue := value.Value(nil)
+ if len(rList) != 0 {
+ rValue = rList[0]
+ }
+ errs = append(errs, w.compareListItem(t, pe, lValue, rValue)...)
+ // Duplicates before & after use-case:
+ // Compare the duplicates lists as if they were atomic, mark modified if they changed.
+ case len(lList) >= 2 && len(rList) >= 2:
+ listEqual := func(lList, rList []value.Value) bool {
+ if len(lList) != len(rList) {
+ return false
+ }
+ for i := range lList {
+ if !value.Equals(lList[i], rList[i]) {
+ return false
+ }
+ }
+ return true
+ }
+ if !listEqual(lList, rList) {
+ w.comparison.Modified.Insert(append(w.path, pe))
+ }
+ // Duplicates before & not anymore use-case:
+ // Rcursively add new non-duplicate items, Remove duplicate marker,
+ case len(lList) >= 2:
+ if len(rList) != 0 {
+ errs = append(errs, w.compareListItem(t, pe, nil, rList[0])...)
+ }
+ w.comparison.Removed.Insert(append(w.path, pe))
+ // New duplicates use-case:
+ // Recursively remove old non-duplicate items, add duplicate marker.
+ case len(rList) >= 2:
+ if len(lList) != 0 {
+ errs = append(errs, w.compareListItem(t, pe, lList[0], nil)...)
+ }
+ w.comparison.Added.Insert(append(w.path, pe))
+ }
+ }
+
+ return
+}
+
+func (w *compareWalker) indexListPathElements(t *schema.List, list value.List) ([]fieldpath.PathElement, fieldpath.PathElementValueMap, ValidationErrors) {
+ var errs ValidationErrors
+ length := 0
+ if list != nil {
+ length = list.Length()
+ }
+ observed := fieldpath.MakePathElementValueMap(length)
+ pes := make([]fieldpath.PathElement, 0, length)
+ for i := 0; i < length; i++ {
+ child := list.At(i)
+ pe, err := listItemToPathElement(w.allocator, w.schema, t, child)
+ if err != nil {
+ errs = append(errs, errorf("element %v: %v", i, err.Error())...)
+ // If we can't construct the path element, we can't
+ // even report errors deeper in the schema, so bail on
+ // this element.
+ continue
+ }
+ // Ignore repeated occurences of `pe`.
+ if _, found := observed.Get(pe); found {
+ continue
+ }
+ observed.Insert(pe, child)
+ pes = append(pes, pe)
+ }
+ return pes, observed, errs
+}
+
+func (w *compareWalker) compareListItem(t *schema.List, pe fieldpath.PathElement, lChild, rChild value.Value) ValidationErrors {
+ w2 := w.prepareDescent(pe, t.ElementType, w.comparison)
+ w2.lhs = lChild
+ w2.rhs = rChild
+ errs := w2.compare(pe.String)
+ w.finishDescent(w2)
+ return errs
+}
+
+func (w *compareWalker) derefList(prefix string, v value.Value) (value.List, ValidationErrors) {
+ if v == nil {
+ return nil, nil
+ }
+ l, err := listValue(w.allocator, v)
+ if err != nil {
+ return nil, errorf("%v: %v", prefix, err)
+ }
+ return l, nil
+}
+
+func (w *compareWalker) doList(t *schema.List) (errs ValidationErrors) {
+ lhs, _ := w.derefList("lhs: ", w.lhs)
+ if lhs != nil {
+ defer w.allocator.Free(lhs)
+ }
+ rhs, _ := w.derefList("rhs: ", w.rhs)
+ if rhs != nil {
+ defer w.allocator.Free(rhs)
+ }
+
+ // If both lhs and rhs are empty/null, treat it as a
+ // leaf: this helps preserve the empty/null
+ // distinction.
+ emptyPromoteToLeaf := (lhs == nil || lhs.Length() == 0) && (rhs == nil || rhs.Length() == 0)
+
+ if t.ElementRelationship == schema.Atomic || emptyPromoteToLeaf {
+ w.doLeaf()
+ return nil
+ }
+
+ if lhs == nil && rhs == nil {
+ return nil
+ }
+
+ errs = w.visitListItems(t, lhs, rhs)
+
+ return errs
+}
+
+func (w *compareWalker) visitMapItem(t *schema.Map, out map[string]interface{}, key string, lhs, rhs value.Value) (errs ValidationErrors) {
+ fieldType := t.ElementType
+ if sf, ok := t.FindField(key); ok {
+ fieldType = sf.Type
+ }
+ pe := fieldpath.PathElement{FieldName: &key}
+ w2 := w.prepareDescent(pe, fieldType, w.comparison)
+ w2.lhs = lhs
+ w2.rhs = rhs
+ errs = append(errs, w2.compare(pe.String)...)
+ w.finishDescent(w2)
+ return errs
+}
+
+func (w *compareWalker) visitMapItems(t *schema.Map, lhs, rhs value.Map) (errs ValidationErrors) {
+ out := map[string]interface{}{}
+
+ value.MapZipUsing(w.allocator, lhs, rhs, value.Unordered, func(key string, lhsValue, rhsValue value.Value) bool {
+ errs = append(errs, w.visitMapItem(t, out, key, lhsValue, rhsValue)...)
+ return true
+ })
+
+ return errs
+}
+
+func (w *compareWalker) doMap(t *schema.Map) (errs ValidationErrors) {
+ lhs, _ := w.derefMap("lhs: ", w.lhs)
+ if lhs != nil {
+ defer w.allocator.Free(lhs)
+ }
+ rhs, _ := w.derefMap("rhs: ", w.rhs)
+ if rhs != nil {
+ defer w.allocator.Free(rhs)
+ }
+ // If both lhs and rhs are empty/null, treat it as a
+ // leaf: this helps preserve the empty/null
+ // distinction.
+ emptyPromoteToLeaf := (lhs == nil || lhs.Empty()) && (rhs == nil || rhs.Empty())
+
+ if t.ElementRelationship == schema.Atomic || emptyPromoteToLeaf {
+ w.doLeaf()
+ return nil
+ }
+
+ if lhs == nil && rhs == nil {
+ return nil
+ }
+
+ errs = append(errs, w.visitMapItems(t, lhs, rhs)...)
+
+ return errs
+}
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/helpers.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/helpers.go
index 19c77334f..78fdb0e75 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/helpers.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/helpers.go
@@ -197,7 +197,7 @@ func getAssociativeKeyDefault(s *schema.Schema, list *schema.List, fieldName str
return field.Default, nil
}
-func keyedAssociativeListItemToPathElement(a value.Allocator, s *schema.Schema, list *schema.List, index int, child value.Value) (fieldpath.PathElement, error) {
+func keyedAssociativeListItemToPathElement(a value.Allocator, s *schema.Schema, list *schema.List, child value.Value) (fieldpath.PathElement, error) {
pe := fieldpath.PathElement{}
if child.IsNull() {
// null entries are illegal.
@@ -225,7 +225,7 @@ func keyedAssociativeListItemToPathElement(a value.Allocator, s *schema.Schema,
return pe, nil
}
-func setItemToPathElement(list *schema.List, index int, child value.Value) (fieldpath.PathElement, error) {
+func setItemToPathElement(child value.Value) (fieldpath.PathElement, error) {
pe := fieldpath.PathElement{}
switch {
case child.IsMap():
@@ -245,16 +245,15 @@ func setItemToPathElement(list *schema.List, index int, child value.Value) (fiel
}
}
-func listItemToPathElement(a value.Allocator, s *schema.Schema, list *schema.List, index int, child value.Value) (fieldpath.PathElement, error) {
- if list.ElementRelationship == schema.Associative {
- if len(list.Keys) > 0 {
- return keyedAssociativeListItemToPathElement(a, s, list, index, child)
- }
+func listItemToPathElement(a value.Allocator, s *schema.Schema, list *schema.List, child value.Value) (fieldpath.PathElement, error) {
+ if list.ElementRelationship != schema.Associative {
+ return fieldpath.PathElement{}, errors.New("invalid indexing of non-associative list")
+ }
- // If there's no keys, then we must be a set of primitives.
- return setItemToPathElement(list, index, child)
+ if len(list.Keys) > 0 {
+ return keyedAssociativeListItemToPathElement(a, s, list, child)
}
- // Use the index as a key for atomic lists.
- return fieldpath.PathElement{Index: &index}, nil
+ // If there's no keys, then we must be a set of primitives.
+ return setItemToPathElement(child)
}
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/merge.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/merge.go
index 913644083..fa227ac40 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/merge.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/merge.go
@@ -113,11 +113,12 @@ func (w *mergingWalker) doLeaf() {
w.rule(w)
}
-func (w *mergingWalker) doScalar(t *schema.Scalar) (errs ValidationErrors) {
- errs = append(errs, validateScalar(t, w.lhs, "lhs: ")...)
- errs = append(errs, validateScalar(t, w.rhs, "rhs: ")...)
- if len(errs) > 0 {
- return errs
+func (w *mergingWalker) doScalar(t *schema.Scalar) ValidationErrors {
+ // Make sure at least one side is a valid scalar.
+ lerrs := validateScalar(t, w.lhs, "lhs: ")
+ rerrs := validateScalar(t, w.rhs, "rhs: ")
+ if len(lerrs) > 0 && len(rerrs) > 0 {
+ return append(lerrs, rerrs...)
}
// All scalars are leaf fields.
@@ -179,14 +180,18 @@ func (w *mergingWalker) visitListItems(t *schema.List, lhs, rhs value.List) (err
}
out := make([]interface{}, 0, outLen)
- rhsOrder, observedRHS, rhsErrs := w.indexListPathElements(t, rhs)
+ rhsPEs, observedRHS, rhsErrs := w.indexListPathElements(t, rhs, false)
errs = append(errs, rhsErrs...)
- lhsOrder, observedLHS, lhsErrs := w.indexListPathElements(t, lhs)
+ lhsPEs, observedLHS, lhsErrs := w.indexListPathElements(t, lhs, true)
errs = append(errs, lhsErrs...)
+ if len(errs) != 0 {
+ return errs
+ }
+
sharedOrder := make([]*fieldpath.PathElement, 0, rLen)
- for i := range rhsOrder {
- pe := &rhsOrder[i]
+ for i := range rhsPEs {
+ pe := &rhsPEs[i]
if _, ok := observedLHS.Get(*pe); ok {
sharedOrder = append(sharedOrder, pe)
}
@@ -198,13 +203,15 @@ func (w *mergingWalker) visitListItems(t *schema.List, lhs, rhs value.List) (err
sharedOrder = sharedOrder[1:]
}
- lLen, rLen = len(lhsOrder), len(rhsOrder)
+ mergedRHS := fieldpath.MakePathElementMap(len(rhsPEs))
+ lLen, rLen = len(lhsPEs), len(rhsPEs)
for lI, rI := 0, 0; lI < lLen || rI < rLen; {
if lI < lLen && rI < rLen {
- pe := lhsOrder[lI]
- if pe.Equals(rhsOrder[rI]) {
+ pe := lhsPEs[lI]
+ if pe.Equals(rhsPEs[rI]) {
// merge LHS & RHS items
- lChild, _ := observedLHS.Get(pe)
+ mergedRHS.Insert(pe, struct{}{})
+ lChild, _ := observedLHS.Get(pe) // may be nil if the PE is duplicaated.
rChild, _ := observedRHS.Get(pe)
mergeOut, errs := w.mergeListItem(t, pe, lChild, rChild)
errs = append(errs, errs...)
@@ -221,17 +228,17 @@ func (w *mergingWalker) visitListItems(t *schema.List, lhs, rhs value.List) (err
}
continue
}
- if _, ok := observedRHS.Get(pe); ok && nextShared != nil && !nextShared.Equals(lhsOrder[lI]) {
+ if _, ok := observedRHS.Get(pe); ok && nextShared != nil && !nextShared.Equals(lhsPEs[lI]) {
// shared item, but not the one we want in this round
lI++
continue
}
}
if lI < lLen {
- pe := lhsOrder[lI]
+ pe := lhsPEs[lI]
if _, ok := observedRHS.Get(pe); !ok {
- // take LHS item
- lChild, _ := observedLHS.Get(pe)
+ // take LHS item using At to make sure we get the right item (observed may not contain the right item).
+ lChild := lhs.AtUsing(w.allocator, lI)
mergeOut, errs := w.mergeListItem(t, pe, lChild, nil)
errs = append(errs, errs...)
if mergeOut != nil {
@@ -239,12 +246,16 @@ func (w *mergingWalker) visitListItems(t *schema.List, lhs, rhs value.List) (err
}
lI++
continue
+ } else if _, ok := mergedRHS.Get(pe); ok {
+ // we've already merged it with RHS, we don't want to duplicate it, skip it.
+ lI++
}
}
if rI < rLen {
// Take the RHS item, merge with matching LHS item if possible
- pe := rhsOrder[rI]
- lChild, _ := observedLHS.Get(pe) // may be nil
+ pe := rhsPEs[rI]
+ mergedRHS.Insert(pe, struct{}{})
+ lChild, _ := observedLHS.Get(pe) // may be nil if absent or duplicaated.
rChild, _ := observedRHS.Get(pe)
mergeOut, errs := w.mergeListItem(t, pe, lChild, rChild)
errs = append(errs, errs...)
@@ -271,7 +282,7 @@ func (w *mergingWalker) visitListItems(t *schema.List, lhs, rhs value.List) (err
return errs
}
-func (w *mergingWalker) indexListPathElements(t *schema.List, list value.List) ([]fieldpath.PathElement, fieldpath.PathElementValueMap, ValidationErrors) {
+func (w *mergingWalker) indexListPathElements(t *schema.List, list value.List, allowDuplicates bool) ([]fieldpath.PathElement, fieldpath.PathElementValueMap, ValidationErrors) {
var errs ValidationErrors
length := 0
if list != nil {
@@ -281,7 +292,7 @@ func (w *mergingWalker) indexListPathElements(t *schema.List, list value.List) (
pes := make([]fieldpath.PathElement, 0, length)
for i := 0; i < length; i++ {
child := list.At(i)
- pe, err := listItemToPathElement(w.allocator, w.schema, t, i, child)
+ pe, err := listItemToPathElement(w.allocator, w.schema, t, child)
if err != nil {
errs = append(errs, errorf("element %v: %v", i, err.Error())...)
// If we can't construct the path element, we can't
@@ -289,11 +300,15 @@ func (w *mergingWalker) indexListPathElements(t *schema.List, list value.List) (
// this element.
continue
}
- if _, found := observed.Get(pe); found {
+ if _, found := observed.Get(pe); found && !allowDuplicates {
errs = append(errs, errorf("duplicate entries for key %v", pe.String())...)
continue
+ } else if !found {
+ observed.Insert(pe, child)
+ } else {
+ // Duplicated items are not merged with the new value, make them nil.
+ observed.Insert(pe, value.NewValueInterface(nil))
}
- observed.Insert(pe, child)
pes = append(pes, pe)
}
return pes, observed, errs
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/parser.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/parser.go
index 3949a78fc..4258ee5ba 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/parser.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/parser.go
@@ -93,13 +93,13 @@ func (p ParseableType) IsValid() bool {
// FromYAML parses a yaml string into an object with the current schema
// and the type "typename" or an error if validation fails.
-func (p ParseableType) FromYAML(object YAMLObject) (*TypedValue, error) {
+func (p ParseableType) FromYAML(object YAMLObject, opts ...ValidationOptions) (*TypedValue, error) {
var v interface{}
err := yaml.Unmarshal([]byte(object), &v)
if err != nil {
return nil, err
}
- return AsTyped(value.NewValueInterface(v), p.Schema, p.TypeRef)
+ return AsTyped(value.NewValueInterface(v), p.Schema, p.TypeRef, opts...)
}
// FromUnstructured converts a go "interface{}" type, typically an
@@ -108,8 +108,8 @@ func (p ParseableType) FromYAML(object YAMLObject) (*TypedValue, error) {
// The provided interface{} must be one of: map[string]interface{},
// map[interface{}]interface{}, []interface{}, int types, float types,
// string or boolean. Nested interface{} must also be one of these types.
-func (p ParseableType) FromUnstructured(in interface{}) (*TypedValue, error) {
- return AsTyped(value.NewValueInterface(in), p.Schema, p.TypeRef)
+func (p ParseableType) FromUnstructured(in interface{}, opts ...ValidationOptions) (*TypedValue, error) {
+ return AsTyped(value.NewValueInterface(in), p.Schema, p.TypeRef, opts...)
}
// FromStructured converts a go "interface{}" type, typically an structured object in
@@ -117,12 +117,12 @@ func (p ParseableType) FromUnstructured(in interface{}) (*TypedValue, error) {
// schema validation. The provided "interface{}" value must be a pointer so that the
// value can be modified via reflection. The provided "interface{}" may contain structs
// and types that are converted to Values by the jsonMarshaler interface.
-func (p ParseableType) FromStructured(in interface{}) (*TypedValue, error) {
+func (p ParseableType) FromStructured(in interface{}, opts ...ValidationOptions) (*TypedValue, error) {
v, err := value.NewValueReflect(in)
if err != nil {
return nil, fmt.Errorf("error creating struct value reflector: %v", err)
}
- return AsTyped(v, p.Schema, p.TypeRef)
+ return AsTyped(v, p.Schema, p.TypeRef, opts...)
}
// DeducedParseableType is a ParseableType that deduces the type from
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/remove.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/remove.go
index a338d761d..ad071ee8f 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/remove.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/remove.go
@@ -74,9 +74,9 @@ func (w *removingWalker) doList(t *schema.List) (errs ValidationErrors) {
iter := l.RangeUsing(w.allocator)
defer w.allocator.Free(iter)
for iter.Next() {
- i, item := iter.Item()
+ _, item := iter.Item()
// Ignore error because we have already validated this list
- pe, _ := listItemToPathElement(w.allocator, w.schema, t, i, item)
+ pe, _ := listItemToPathElement(w.allocator, w.schema, t, item)
path, _ := fieldpath.MakePath(pe)
// save items on the path when we shouldExtract
// but ignore them when we are removing (i.e. !w.shouldExtract)
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/tofieldset.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/tofieldset.go
index 047efff05..d563a87ee 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/tofieldset.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/tofieldset.go
@@ -94,9 +94,31 @@ func (v *toFieldSetWalker) doScalar(t *schema.Scalar) ValidationErrors {
}
func (v *toFieldSetWalker) visitListItems(t *schema.List, list value.List) (errs ValidationErrors) {
+ // Keeps track of the PEs we've seen
+ seen := fieldpath.MakePathElementSet(list.Length())
+ // Keeps tracks of the PEs we've counted as duplicates
+ duplicates := fieldpath.MakePathElementSet(list.Length())
for i := 0; i < list.Length(); i++ {
child := list.At(i)
- pe, _ := listItemToPathElement(v.allocator, v.schema, t, i, child)
+ pe, _ := listItemToPathElement(v.allocator, v.schema, t, child)
+ if seen.Has(pe) {
+ if duplicates.Has(pe) {
+ // do nothing
+ } else {
+ v.set.Insert(append(v.path, pe))
+ duplicates.Insert(pe)
+ }
+ } else {
+ seen.Insert(pe)
+ }
+ }
+
+ for i := 0; i < list.Length(); i++ {
+ child := list.At(i)
+ pe, _ := listItemToPathElement(v.allocator, v.schema, t, child)
+ if duplicates.Has(pe) {
+ continue
+ }
v2 := v.prepareDescent(pe, t.ElementType)
v2.value = child
errs = append(errs, v2.toFieldSet()...)
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/typed.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/typed.go
index d63a97fe2..9be902828 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/typed.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/typed.go
@@ -17,8 +17,6 @@ limitations under the License.
package typed
import (
- "fmt"
- "strings"
"sync"
"sigs.k8s.io/structured-merge-diff/v4/fieldpath"
@@ -26,16 +24,24 @@ import (
"sigs.k8s.io/structured-merge-diff/v4/value"
)
+// ValidationOptions is the list of all the options available when running the validation.
+type ValidationOptions int
+
+const (
+ // AllowDuplicates means that sets and associative lists can have duplicate similar items.
+ AllowDuplicates ValidationOptions = iota
+)
+
// AsTyped accepts a value and a type and returns a TypedValue. 'v' must have
// type 'typeName' in the schema. An error is returned if the v doesn't conform
// to the schema.
-func AsTyped(v value.Value, s *schema.Schema, typeRef schema.TypeRef) (*TypedValue, error) {
+func AsTyped(v value.Value, s *schema.Schema, typeRef schema.TypeRef, opts ...ValidationOptions) (*TypedValue, error) {
tv := &TypedValue{
value: v,
typeRef: typeRef,
schema: s,
}
- if err := tv.Validate(); err != nil {
+ if err := tv.Validate(opts...); err != nil {
return nil, err
}
return tv, nil
@@ -45,6 +51,10 @@ func AsTyped(v value.Value, s *schema.Schema, typeRef schema.TypeRef) (*TypedVal
// conforms to the schema, for cases where that has already been checked or
// where you're going to call a method that validates as a side-effect (like
// ToFieldSet).
+//
+// Deprecated: This function was initially created because validation
+// was expensive. Now that this has been solved, objects should always
+// be created as validated, using `AsTyped`.
func AsTypedUnvalidated(v value.Value, s *schema.Schema, typeRef schema.TypeRef) *TypedValue {
tv := &TypedValue{
value: v,
@@ -77,8 +87,14 @@ func (tv TypedValue) Schema() *schema.Schema {
}
// Validate returns an error with a list of every spec violation.
-func (tv TypedValue) Validate() error {
+func (tv TypedValue) Validate(opts ...ValidationOptions) error {
w := tv.walker()
+ for _, opt := range opts {
+ switch opt {
+ case AllowDuplicates:
+ w.allowDuplicates = true
+ }
+ }
defer w.finished()
if errs := w.validate(nil); len(errs) != 0 {
return errs
@@ -113,6 +129,10 @@ func (tv TypedValue) Merge(pso *TypedValue) (*TypedValue, error) {
return merge(&tv, pso, ruleKeepRHS, nil)
}
+var cmpwPool = sync.Pool{
+ New: func() interface{} { return &compareWalker{} },
+}
+
// Compare compares the two objects. See the comments on the `Comparison`
// struct for details on the return value.
//
@@ -120,33 +140,44 @@ func (tv TypedValue) Merge(pso *TypedValue) (*TypedValue, error) {
// match), or an error will be returned. Validation errors will be returned if
// the objects don't conform to the schema.
func (tv TypedValue) Compare(rhs *TypedValue) (c *Comparison, err error) {
- c = &Comparison{
+ lhs := tv
+ if lhs.schema != rhs.schema {
+ return nil, errorf("expected objects with types from the same schema")
+ }
+ if !lhs.typeRef.Equals(&rhs.typeRef) {
+ return nil, errorf("expected objects of the same type, but got %v and %v", lhs.typeRef, rhs.typeRef)
+ }
+
+ cmpw := cmpwPool.Get().(*compareWalker)
+ defer func() {
+ cmpw.lhs = nil
+ cmpw.rhs = nil
+ cmpw.schema = nil
+ cmpw.typeRef = schema.TypeRef{}
+ cmpw.comparison = nil
+ cmpw.inLeaf = false
+
+ cmpwPool.Put(cmpw)
+ }()
+
+ cmpw.lhs = lhs.value
+ cmpw.rhs = rhs.value
+ cmpw.schema = lhs.schema
+ cmpw.typeRef = lhs.typeRef
+ cmpw.comparison = &Comparison{
Removed: fieldpath.NewSet(),
Modified: fieldpath.NewSet(),
Added: fieldpath.NewSet(),
}
- _, err = merge(&tv, rhs, func(w *mergingWalker) {
- if w.lhs == nil {
- c.Added.Insert(w.path)
- } else if w.rhs == nil {
- c.Removed.Insert(w.path)
- } else if !value.Equals(w.rhs, w.lhs) {
- // TODO: Equality is not sufficient for this.
- // Need to implement equality check on the value type.
- c.Modified.Insert(w.path)
- }
- }, func(w *mergingWalker) {
- if w.lhs == nil {
- c.Added.Insert(w.path)
- } else if w.rhs == nil {
- c.Removed.Insert(w.path)
- }
- })
- if err != nil {
- return nil, err
+ if cmpw.allocator == nil {
+ cmpw.allocator = value.NewFreelistAllocator()
}
- return c, nil
+ errs := cmpw.compare(nil)
+ if len(errs) > 0 {
+ return nil, errs
+ }
+ return cmpw.comparison, nil
}
// RemoveItems removes each provided list or map item from the value.
@@ -161,63 +192,6 @@ func (tv TypedValue) ExtractItems(items *fieldpath.Set) *TypedValue {
return &tv
}
-// NormalizeUnions takes the new object and normalizes the union:
-// - If discriminator changed to non-nil, and a new field has been added
-// that doesn't match, an error is returned,
-// - If discriminator hasn't changed and two fields or more are set, an
-// error is returned,
-// - If discriminator changed to non-nil, all other fields but the
-// discriminated one will be cleared,
-// - Otherwise, If only one field is left, update discriminator to that value.
-//
-// Please note: union behavior isn't finalized yet and this is still experimental.
-func (tv TypedValue) NormalizeUnions(new *TypedValue) (*TypedValue, error) {
- var errs ValidationErrors
- var normalizeFn = func(w *mergingWalker) {
- if w.rhs != nil {
- v := w.rhs.Unstructured()
- w.out = &v
- }
- if err := normalizeUnions(w); err != nil {
- errs = append(errs, errorf(err.Error())...)
- }
- }
- out, mergeErrs := merge(&tv, new, func(w *mergingWalker) {}, normalizeFn)
- if mergeErrs != nil {
- errs = append(errs, mergeErrs.(ValidationErrors)...)
- }
- if len(errs) > 0 {
- return nil, errs
- }
- return out, nil
-}
-
-// NormalizeUnionsApply specifically normalize unions on apply. It
-// validates that the applied union is correct (there should be no
-// ambiguity there), and clear the fields according to the sent intent.
-//
-// Please note: union behavior isn't finalized yet and this is still experimental.
-func (tv TypedValue) NormalizeUnionsApply(new *TypedValue) (*TypedValue, error) {
- var errs ValidationErrors
- var normalizeFn = func(w *mergingWalker) {
- if w.rhs != nil {
- v := w.rhs.Unstructured()
- w.out = &v
- }
- if err := normalizeUnionsApply(w); err != nil {
- errs = append(errs, errorf(err.Error())...)
- }
- }
- out, mergeErrs := merge(&tv, new, func(w *mergingWalker) {}, normalizeFn)
- if mergeErrs != nil {
- errs = append(errs, mergeErrs.(ValidationErrors)...)
- }
- if len(errs) > 0 {
- return nil, errs
- }
- return out, nil
-}
-
func (tv TypedValue) Empty() *TypedValue {
tv.value = value.NewValueInterface(nil)
return &tv
@@ -273,50 +247,3 @@ func merge(lhs, rhs *TypedValue, rule, postRule mergeRule) (*TypedValue, error)
}
return out, nil
}
-
-// Comparison is the return value of a TypedValue.Compare() operation.
-//
-// No field will appear in more than one of the three fieldsets. If all of the
-// fieldsets are empty, then the objects must have been equal.
-type Comparison struct {
- // Removed contains any fields removed by rhs (the right-hand-side
- // object in the comparison).
- Removed *fieldpath.Set
- // Modified contains fields present in both objects but different.
- Modified *fieldpath.Set
- // Added contains any fields added by rhs.
- Added *fieldpath.Set
-}
-
-// IsSame returns true if the comparison returned no changes (the two
-// compared objects are similar).
-func (c *Comparison) IsSame() bool {
- return c.Removed.Empty() && c.Modified.Empty() && c.Added.Empty()
-}
-
-// String returns a human readable version of the comparison.
-func (c *Comparison) String() string {
- bld := strings.Builder{}
- if !c.Modified.Empty() {
- bld.WriteString(fmt.Sprintf("- Modified Fields:\n%v\n", c.Modified))
- }
- if !c.Added.Empty() {
- bld.WriteString(fmt.Sprintf("- Added Fields:\n%v\n", c.Added))
- }
- if !c.Removed.Empty() {
- bld.WriteString(fmt.Sprintf("- Removed Fields:\n%v\n", c.Removed))
- }
- return bld.String()
-}
-
-// ExcludeFields fields from the compare recursively removes the fields
-// from the entire comparison
-func (c *Comparison) ExcludeFields(fields *fieldpath.Set) *Comparison {
- if fields == nil || fields.Empty() {
- return c
- }
- c.Removed = c.Removed.RecursiveDifference(fields)
- c.Modified = c.Modified.RecursiveDifference(fields)
- c.Added = c.Added.RecursiveDifference(fields)
- return c
-}
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/union.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/union.go
deleted file mode 100644
index 1fa5d88ae..000000000
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/union.go
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
-Copyright 2019 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package typed
-
-import (
- "fmt"
- "strings"
-
- "sigs.k8s.io/structured-merge-diff/v4/schema"
- "sigs.k8s.io/structured-merge-diff/v4/value"
-)
-
-func normalizeUnions(w *mergingWalker) error {
- atom, found := w.schema.Resolve(w.typeRef)
- if !found {
- panic(fmt.Sprintf("Unable to resolve schema in normalize union: %v/%v", w.schema, w.typeRef))
- }
- // Unions can only be in structures, and the struct must not have been removed
- if atom.Map == nil || w.out == nil {
- return nil
- }
-
- var old value.Map
- if w.lhs != nil && !w.lhs.IsNull() {
- old = w.lhs.AsMap()
- }
- for _, union := range atom.Map.Unions {
- if err := newUnion(&union).Normalize(old, w.rhs.AsMap(), value.NewValueInterface(*w.out).AsMap()); err != nil {
- return err
- }
- }
- return nil
-}
-
-func normalizeUnionsApply(w *mergingWalker) error {
- atom, found := w.schema.Resolve(w.typeRef)
- if !found {
- panic(fmt.Sprintf("Unable to resolve schema in normalize union: %v/%v", w.schema, w.typeRef))
- }
- // Unions can only be in structures, and the struct must not have been removed
- if atom.Map == nil || w.out == nil {
- return nil
- }
-
- var old value.Map
- if w.lhs != nil && !w.lhs.IsNull() {
- old = w.lhs.AsMap()
- }
-
- for _, union := range atom.Map.Unions {
- out := value.NewValueInterface(*w.out)
- if err := newUnion(&union).NormalizeApply(old, w.rhs.AsMap(), out.AsMap()); err != nil {
- return err
- }
- *w.out = out.Unstructured()
- }
- return nil
-}
-
-type discriminated string
-type field string
-
-type discriminatedNames struct {
- f2d map[field]discriminated
- d2f map[discriminated]field
-}
-
-func newDiscriminatedName(f2d map[field]discriminated) discriminatedNames {
- d2f := map[discriminated]field{}
- for key, value := range f2d {
- d2f[value] = key
- }
- return discriminatedNames{
- f2d: f2d,
- d2f: d2f,
- }
-}
-
-func (dn discriminatedNames) toField(d discriminated) field {
- if f, ok := dn.d2f[d]; ok {
- return f
- }
- return field(d)
-}
-
-func (dn discriminatedNames) toDiscriminated(f field) discriminated {
- if d, ok := dn.f2d[f]; ok {
- return d
- }
- return discriminated(f)
-}
-
-type discriminator struct {
- name string
-}
-
-func (d *discriminator) Set(m value.Map, v discriminated) {
- if d == nil {
- return
- }
- m.Set(d.name, value.NewValueInterface(string(v)))
-}
-
-func (d *discriminator) Get(m value.Map) discriminated {
- if d == nil || m == nil {
- return ""
- }
- val, ok := m.Get(d.name)
- if !ok {
- return ""
- }
- if !val.IsString() {
- return ""
- }
- return discriminated(val.AsString())
-}
-
-type fieldsSet map[field]struct{}
-
-// newFieldsSet returns a map of the fields that are part of the union and are set
-// in the given map.
-func newFieldsSet(m value.Map, fields []field) fieldsSet {
- if m == nil {
- return nil
- }
- set := fieldsSet{}
- for _, f := range fields {
- if subField, ok := m.Get(string(f)); ok && !subField.IsNull() {
- set.Add(f)
- }
- }
- return set
-}
-
-func (fs fieldsSet) Add(f field) {
- if fs == nil {
- fs = map[field]struct{}{}
- }
- fs[f] = struct{}{}
-}
-
-func (fs fieldsSet) One() *field {
- for f := range fs {
- return &f
- }
- return nil
-}
-
-func (fs fieldsSet) Has(f field) bool {
- _, ok := fs[f]
- return ok
-}
-
-func (fs fieldsSet) List() []field {
- fields := []field{}
- for f := range fs {
- fields = append(fields, f)
- }
- return fields
-}
-
-func (fs fieldsSet) Difference(o fieldsSet) fieldsSet {
- n := fieldsSet{}
- for f := range fs {
- if !o.Has(f) {
- n.Add(f)
- }
- }
- return n
-}
-
-func (fs fieldsSet) String() string {
- s := []string{}
- for k := range fs {
- s = append(s, string(k))
- }
- return strings.Join(s, ", ")
-}
-
-type union struct {
- deduceInvalidDiscriminator bool
- d *discriminator
- dn discriminatedNames
- f []field
-}
-
-func newUnion(su *schema.Union) *union {
- u := &union{}
- if su.Discriminator != nil {
- u.d = &discriminator{name: *su.Discriminator}
- }
- f2d := map[field]discriminated{}
- for _, f := range su.Fields {
- u.f = append(u.f, field(f.FieldName))
- f2d[field(f.FieldName)] = discriminated(f.DiscriminatorValue)
- }
- u.dn = newDiscriminatedName(f2d)
- u.deduceInvalidDiscriminator = su.DeduceInvalidDiscriminator
- return u
-}
-
-// clear removes all the fields in map that are part of the union, but
-// the one we decided to keep.
-func (u *union) clear(m value.Map, f field) {
- for _, fieldName := range u.f {
- if field(fieldName) != f {
- m.Delete(string(fieldName))
- }
- }
-}
-
-func (u *union) Normalize(old, new, out value.Map) error {
- os := newFieldsSet(old, u.f)
- ns := newFieldsSet(new, u.f)
- diff := ns.Difference(os)
-
- if u.d.Get(old) != u.d.Get(new) && u.d.Get(new) != "" {
- if len(diff) == 1 && u.d.Get(new) != u.dn.toDiscriminated(*diff.One()) {
- return fmt.Errorf("discriminator (%v) and field changed (%v) don't match", u.d.Get(new), diff.One())
- }
- if len(diff) > 1 {
- return fmt.Errorf("multiple new fields added: %v", diff)
- }
- u.clear(out, u.dn.toField(u.d.Get(new)))
- return nil
- }
-
- if len(ns) > 1 {
- return fmt.Errorf("multiple fields set without discriminator change: %v", ns)
- }
-
- // Set discriminiator if it needs to be deduced.
- if u.deduceInvalidDiscriminator && len(ns) == 1 {
- u.d.Set(out, u.dn.toDiscriminated(*ns.One()))
- }
-
- return nil
-}
-
-func (u *union) NormalizeApply(applied, merged, out value.Map) error {
- as := newFieldsSet(applied, u.f)
- if len(as) > 1 {
- return fmt.Errorf("more than one field of union applied: %v", as)
- }
- if len(as) == 0 {
- // None is set, just leave.
- return nil
- }
- // We have exactly one, discriminiator must match if set
- if u.d.Get(applied) != "" && u.d.Get(applied) != u.dn.toDiscriminated(*as.One()) {
- return fmt.Errorf("applied discriminator (%v) doesn't match applied field (%v)", u.d.Get(applied), *as.One())
- }
-
- // Update discriminiator if needed
- if u.deduceInvalidDiscriminator {
- u.d.Set(out, u.dn.toDiscriminated(*as.One()))
- }
- // Clear others fields.
- u.clear(out, *as.One())
-
- return nil
-}
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/validate.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/validate.go
index 378d30219..652e24c81 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/validate.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/validate.go
@@ -33,6 +33,7 @@ func (tv TypedValue) walker() *validatingObjectWalker {
v.value = tv.value
v.schema = tv.schema
v.typeRef = tv.typeRef
+ v.allowDuplicates = false
if v.allocator == nil {
v.allocator = value.NewFreelistAllocator()
}
@@ -49,6 +50,9 @@ type validatingObjectWalker struct {
value value.Value
schema *schema.Schema
typeRef schema.TypeRef
+ // If set to true, duplicates will be allowed in
+ // associativeLists/sets.
+ allowDuplicates bool
// Allocate only as many walkers as needed for the depth by storing them here.
spareWalkers *[]*validatingObjectWalker
@@ -102,6 +106,12 @@ func validateScalar(t *schema.Scalar, v value.Value, prefix string) (errs Valida
if !v.IsBool() {
return errorf("%vexpected boolean, got %v", prefix, v)
}
+ case schema.Untyped:
+ if !v.IsFloat() && !v.IsInt() && !v.IsString() && !v.IsBool() {
+ return errorf("%vexpected any scalar, got %v", prefix, v)
+ }
+ default:
+ return errorf("%vunexpected scalar type in schema: %v", prefix, *t)
}
return nil
}
@@ -123,7 +133,7 @@ func (v *validatingObjectWalker) visitListItems(t *schema.List, list value.List)
pe.Index = &i
} else {
var err error
- pe, err = listItemToPathElement(v.allocator, v.schema, t, i, child)
+ pe, err = listItemToPathElement(v.allocator, v.schema, t, child)
if err != nil {
errs = append(errs, errorf("element %v: %v", i, err.Error())...)
// If we can't construct the path element, we can't
@@ -131,7 +141,7 @@ func (v *validatingObjectWalker) visitListItems(t *schema.List, list value.List)
// this element.
return
}
- if observedKeys.Has(pe) {
+ if observedKeys.Has(pe) && !v.allowDuplicates {
errs = append(errs, errorf("duplicate entries for key %v", pe.String())...)
}
observedKeys.Insert(pe)
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/value/mapreflect.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/value/mapreflect.go
index dc8b8c720..c38402b99 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/value/mapreflect.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/value/mapreflect.go
@@ -136,7 +136,7 @@ func (r mapReflect) EqualsUsing(a Allocator, m Map) bool {
if !ok {
return false
}
- return Equals(vr.mustReuse(lhsVal, entry, nil, nil), value)
+ return EqualsUsing(a, vr.mustReuse(lhsVal, entry, nil, nil), value)
})
}
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/value/mapunstructured.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/value/mapunstructured.go
index d8e208628..c3ae00b18 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/value/mapunstructured.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/value/mapunstructured.go
@@ -88,12 +88,12 @@ func (m mapUnstructuredInterface) EqualsUsing(a Allocator, other Map) bool {
}
vv := a.allocValueUnstructured()
defer a.Free(vv)
- return other.Iterate(func(key string, value Value) bool {
+ return other.IterateUsing(a, func(key string, value Value) bool {
lhsVal, ok := m[key]
if !ok {
return false
}
- return Equals(vv.reuse(lhsVal), value)
+ return EqualsUsing(a, vv.reuse(lhsVal), value)
})
}
@@ -168,12 +168,12 @@ func (m mapUnstructuredString) EqualsUsing(a Allocator, other Map) bool {
}
vv := a.allocValueUnstructured()
defer a.Free(vv)
- return other.Iterate(func(key string, value Value) bool {
+ return other.IterateUsing(a, func(key string, value Value) bool {
lhsVal, ok := m[key]
if !ok {
return false
}
- return Equals(vv.reuse(lhsVal), value)
+ return EqualsUsing(a, vv.reuse(lhsVal), value)
})
}
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/value/reflectcache.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/value/reflectcache.go
index a5a467c0f..f0d58d42c 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/value/reflectcache.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/value/reflectcache.go
@@ -154,7 +154,9 @@ func buildStructCacheEntry(t reflect.Type, infos map[string]*FieldCacheEntry, fi
if field.Type.Kind() == reflect.Ptr {
e = field.Type.Elem()
}
- buildStructCacheEntry(e, infos, append(fieldPath, field.Index))
+ if e.Kind() == reflect.Struct {
+ buildStructCacheEntry(e, infos, append(fieldPath, field.Index))
+ }
continue
}
info := &FieldCacheEntry{JsonName: jsonName, isOmitEmpty: isOmitempty, fieldPath: append(fieldPath, field.Index), fieldType: field.Type}
diff --git a/vendor/sigs.k8s.io/yaml/.gitignore b/vendor/sigs.k8s.io/yaml/.gitignore
index e256a31e0..2dc92904e 100644
--- a/vendor/sigs.k8s.io/yaml/.gitignore
+++ b/vendor/sigs.k8s.io/yaml/.gitignore
@@ -6,6 +6,10 @@
.project
.settings/**
+# Idea files
+.idea/**
+.idea/
+
# Emacs save files
*~
diff --git a/vendor/sigs.k8s.io/yaml/.travis.yml b/vendor/sigs.k8s.io/yaml/.travis.yml
index d20e23eff..54ed8f9cb 100644
--- a/vendor/sigs.k8s.io/yaml/.travis.yml
+++ b/vendor/sigs.k8s.io/yaml/.travis.yml
@@ -1,8 +1,7 @@
language: go
-dist: xenial
-go:
- - 1.12.x
- - 1.13.x
+arch: arm64
+dist: focal
+go: 1.15.x
script:
- diff -u <(echo -n) <(gofmt -d *.go)
- diff -u <(echo -n) <(golint $(go list -e ./...) | grep -v YAMLToJSON)
diff --git a/vendor/sigs.k8s.io/yaml/LICENSE b/vendor/sigs.k8s.io/yaml/LICENSE
index 7805d36de..093d6d3ed 100644
--- a/vendor/sigs.k8s.io/yaml/LICENSE
+++ b/vendor/sigs.k8s.io/yaml/LICENSE
@@ -48,3 +48,259 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# The forked go-yaml.v3 library under this project is covered by two
+different licenses (MIT and Apache):
+
+#### MIT License ####
+
+The following files were ported to Go from C files of libyaml, and thus
+are still covered by their original MIT license, with the additional
+copyright staring in 2011 when the project was ported over:
+
+ apic.go emitterc.go parserc.go readerc.go scannerc.go
+ writerc.go yamlh.go yamlprivateh.go
+
+Copyright (c) 2006-2010 Kirill Simonov
+Copyright (c) 2006-2011 Kirill Simonov
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+### Apache License ###
+
+All the remaining project files are covered by the Apache license:
+
+Copyright (c) 2011-2019 Canonical Ltd
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+# The forked go-yaml.v2 library under the project is covered by an
+Apache license:
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/vendor/sigs.k8s.io/yaml/OWNERS b/vendor/sigs.k8s.io/yaml/OWNERS
index 325b40b07..003a149e1 100644
--- a/vendor/sigs.k8s.io/yaml/OWNERS
+++ b/vendor/sigs.k8s.io/yaml/OWNERS
@@ -2,26 +2,22 @@
approvers:
- dims
-- lavalamp
+- jpbetz
- smarterclayton
- deads2k
- sttts
- liggitt
-- caesarxuchao
reviewers:
- dims
- thockin
-- lavalamp
+- jpbetz
- smarterclayton
- wojtek-t
- deads2k
- derekwaynecarr
-- caesarxuchao
- mikedanese
- liggitt
-- gmarek
- sttts
-- ncdc
- tallclair
labels:
- sig/api-machinery
diff --git a/vendor/sigs.k8s.io/yaml/README.md b/vendor/sigs.k8s.io/yaml/README.md
index 5a651d916..e81cc426b 100644
--- a/vendor/sigs.k8s.io/yaml/README.md
+++ b/vendor/sigs.k8s.io/yaml/README.md
@@ -107,8 +107,8 @@ func main() {
}
fmt.Println(string(y))
/* Output:
- name: John
age: 30
+ name: John
*/
j2, err := yaml.YAMLToJSON(y)
if err != nil {
diff --git a/vendor/sigs.k8s.io/yaml/fields.go b/vendor/sigs.k8s.io/yaml/fields.go
index 235b7f2cf..0ea28bd03 100644
--- a/vendor/sigs.k8s.io/yaml/fields.go
+++ b/vendor/sigs.k8s.io/yaml/fields.go
@@ -16,53 +16,53 @@ import (
"unicode/utf8"
)
-// indirect walks down v allocating pointers as needed,
+// indirect walks down 'value' allocating pointers as needed,
// until it gets to a non-pointer.
// if it encounters an Unmarshaler, indirect stops and returns that.
// if decodingNull is true, indirect stops at the last pointer so it can be set to nil.
-func indirect(v reflect.Value, decodingNull bool) (json.Unmarshaler, encoding.TextUnmarshaler, reflect.Value) {
- // If v is a named type and is addressable,
+func indirect(value reflect.Value, decodingNull bool) (json.Unmarshaler, encoding.TextUnmarshaler, reflect.Value) {
+ // If 'value' is a named type and is addressable,
// start with its address, so that if the type has pointer methods,
// we find them.
- if v.Kind() != reflect.Ptr && v.Type().Name() != "" && v.CanAddr() {
- v = v.Addr()
+ if value.Kind() != reflect.Ptr && value.Type().Name() != "" && value.CanAddr() {
+ value = value.Addr()
}
for {
// Load value from interface, but only if the result will be
// usefully addressable.
- if v.Kind() == reflect.Interface && !v.IsNil() {
- e := v.Elem()
- if e.Kind() == reflect.Ptr && !e.IsNil() && (!decodingNull || e.Elem().Kind() == reflect.Ptr) {
- v = e
+ if value.Kind() == reflect.Interface && !value.IsNil() {
+ element := value.Elem()
+ if element.Kind() == reflect.Ptr && !element.IsNil() && (!decodingNull || element.Elem().Kind() == reflect.Ptr) {
+ value = element
continue
}
}
- if v.Kind() != reflect.Ptr {
+ if value.Kind() != reflect.Ptr {
break
}
- if v.Elem().Kind() != reflect.Ptr && decodingNull && v.CanSet() {
+ if value.Elem().Kind() != reflect.Ptr && decodingNull && value.CanSet() {
break
}
- if v.IsNil() {
- if v.CanSet() {
- v.Set(reflect.New(v.Type().Elem()))
+ if value.IsNil() {
+ if value.CanSet() {
+ value.Set(reflect.New(value.Type().Elem()))
} else {
- v = reflect.New(v.Type().Elem())
+ value = reflect.New(value.Type().Elem())
}
}
- if v.Type().NumMethod() > 0 {
- if u, ok := v.Interface().(json.Unmarshaler); ok {
+ if value.Type().NumMethod() > 0 {
+ if u, ok := value.Interface().(json.Unmarshaler); ok {
return u, nil, reflect.Value{}
}
- if u, ok := v.Interface().(encoding.TextUnmarshaler); ok {
+ if u, ok := value.Interface().(encoding.TextUnmarshaler); ok {
return nil, u, reflect.Value{}
}
}
- v = v.Elem()
+ value = value.Elem()
}
- return nil, nil, v
+ return nil, nil, value
}
// A field represents a single field found in a struct.
@@ -134,8 +134,8 @@ func typeFields(t reflect.Type) []field {
next := []field{{typ: t}}
// Count of queued names for current level and the next.
- count := map[reflect.Type]int{}
- nextCount := map[reflect.Type]int{}
+ var count map[reflect.Type]int
+ var nextCount map[reflect.Type]int
// Types already visited at an earlier level.
visited := map[reflect.Type]bool{}
@@ -348,8 +348,9 @@ const (
// 4) simpleLetterEqualFold, no specials, no non-letters.
//
// The letters S and K are special because they map to 3 runes, not just 2:
-// * S maps to s and to U+017F 'ſ' Latin small letter long s
-// * k maps to K and to U+212A 'K' Kelvin sign
+// - S maps to s and to U+017F 'ſ' Latin small letter long s
+// - k maps to K and to U+212A 'K' Kelvin sign
+//
// See http://play.golang.org/p/tTxjOc0OGo
//
// The returned function is specialized for matching against s and
@@ -420,10 +421,8 @@ func equalFoldRight(s, t []byte) bool {
t = t[size:]
}
- if len(t) > 0 {
- return false
- }
- return true
+
+ return len(t) <= 0
}
// asciiEqualFold is a specialization of bytes.EqualFold for use when
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/LICENSE b/vendor/sigs.k8s.io/yaml/goyaml.v2/LICENSE
new file mode 100644
index 000000000..8dada3eda
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/LICENSE.libyaml b/vendor/sigs.k8s.io/yaml/goyaml.v2/LICENSE.libyaml
new file mode 100644
index 000000000..8da58fbf6
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/LICENSE.libyaml
@@ -0,0 +1,31 @@
+The following files were ported to Go from C files of libyaml, and thus
+are still covered by their original copyright and license:
+
+ apic.go
+ emitterc.go
+ parserc.go
+ readerc.go
+ scannerc.go
+ writerc.go
+ yamlh.go
+ yamlprivateh.go
+
+Copyright (c) 2006 Kirill Simonov
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/NOTICE b/vendor/sigs.k8s.io/yaml/goyaml.v2/NOTICE
new file mode 100644
index 000000000..866d74a7a
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/NOTICE
@@ -0,0 +1,13 @@
+Copyright 2011-2016 Canonical Ltd.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/OWNERS b/vendor/sigs.k8s.io/yaml/goyaml.v2/OWNERS
new file mode 100644
index 000000000..73be0a3a9
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/OWNERS
@@ -0,0 +1,24 @@
+# See the OWNERS docs at https://go.k8s.io/owners
+
+approvers:
+- dims
+- jpbetz
+- smarterclayton
+- deads2k
+- sttts
+- liggitt
+- natasha41575
+- knverey
+reviewers:
+- dims
+- thockin
+- jpbetz
+- smarterclayton
+- deads2k
+- derekwaynecarr
+- mikedanese
+- liggitt
+- sttts
+- tallclair
+labels:
+- sig/api-machinery
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/README.md b/vendor/sigs.k8s.io/yaml/goyaml.v2/README.md
new file mode 100644
index 000000000..53f4139dc
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/README.md
@@ -0,0 +1,143 @@
+# go-yaml fork
+
+This package is a fork of the go-yaml library and is intended solely for consumption
+by kubernetes projects. In this fork, we plan to support only critical changes required for
+kubernetes, such as small bug fixes and regressions. Larger, general-purpose feature requests
+should be made in the upstream go-yaml library, and we will reject such changes in this fork
+unless we are pulling them from upstream.
+
+This fork is based on v2.4.0: https://github.com/go-yaml/yaml/releases/tag/v2.4.0
+
+# YAML support for the Go language
+
+Introduction
+------------
+
+The yaml package enables Go programs to comfortably encode and decode YAML
+values. It was developed within [Canonical](https://www.canonical.com) as
+part of the [juju](https://juju.ubuntu.com) project, and is based on a
+pure Go port of the well-known [libyaml](http://pyyaml.org/wiki/LibYAML)
+C library to parse and generate YAML data quickly and reliably.
+
+Compatibility
+-------------
+
+The yaml package supports most of YAML 1.1 and 1.2, including support for
+anchors, tags, map merging, etc. Multi-document unmarshalling is not yet
+implemented, and base-60 floats from YAML 1.1 are purposefully not
+supported since they're a poor design and are gone in YAML 1.2.
+
+Installation and usage
+----------------------
+
+The import path for the package is *gopkg.in/yaml.v2*.
+
+To install it, run:
+
+ go get gopkg.in/yaml.v2
+
+API documentation
+-----------------
+
+If opened in a browser, the import path itself leads to the API documentation:
+
+ * [https://gopkg.in/yaml.v2](https://gopkg.in/yaml.v2)
+
+API stability
+-------------
+
+The package API for yaml v2 will remain stable as described in [gopkg.in](https://gopkg.in).
+
+
+License
+-------
+
+The yaml package is licensed under the Apache License 2.0. Please see the LICENSE file for details.
+
+
+Example
+-------
+
+```Go
+package main
+
+import (
+ "fmt"
+ "log"
+
+ "gopkg.in/yaml.v2"
+)
+
+var data = `
+a: Easy!
+b:
+ c: 2
+ d: [3, 4]
+`
+
+// Note: struct fields must be public in order for unmarshal to
+// correctly populate the data.
+type T struct {
+ A string
+ B struct {
+ RenamedC int `yaml:"c"`
+ D []int `yaml:",flow"`
+ }
+}
+
+func main() {
+ t := T{}
+
+ err := yaml.Unmarshal([]byte(data), &t)
+ if err != nil {
+ log.Fatalf("error: %v", err)
+ }
+ fmt.Printf("--- t:\n%v\n\n", t)
+
+ d, err := yaml.Marshal(&t)
+ if err != nil {
+ log.Fatalf("error: %v", err)
+ }
+ fmt.Printf("--- t dump:\n%s\n\n", string(d))
+
+ m := make(map[interface{}]interface{})
+
+ err = yaml.Unmarshal([]byte(data), &m)
+ if err != nil {
+ log.Fatalf("error: %v", err)
+ }
+ fmt.Printf("--- m:\n%v\n\n", m)
+
+ d, err = yaml.Marshal(&m)
+ if err != nil {
+ log.Fatalf("error: %v", err)
+ }
+ fmt.Printf("--- m dump:\n%s\n\n", string(d))
+}
+```
+
+This example will generate the following output:
+
+```
+--- t:
+{Easy! {2 [3 4]}}
+
+--- t dump:
+a: Easy!
+b:
+ c: 2
+ d: [3, 4]
+
+
+--- m:
+map[a:Easy! b:map[c:2 d:[3 4]]]
+
+--- m dump:
+a: Easy!
+b:
+ c: 2
+ d:
+ - 3
+ - 4
+```
+
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/apic.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/apic.go
new file mode 100644
index 000000000..acf71402c
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/apic.go
@@ -0,0 +1,744 @@
+package yaml
+
+import (
+ "io"
+)
+
+func yaml_insert_token(parser *yaml_parser_t, pos int, token *yaml_token_t) {
+ //fmt.Println("yaml_insert_token", "pos:", pos, "typ:", token.typ, "head:", parser.tokens_head, "len:", len(parser.tokens))
+
+ // Check if we can move the queue at the beginning of the buffer.
+ if parser.tokens_head > 0 && len(parser.tokens) == cap(parser.tokens) {
+ if parser.tokens_head != len(parser.tokens) {
+ copy(parser.tokens, parser.tokens[parser.tokens_head:])
+ }
+ parser.tokens = parser.tokens[:len(parser.tokens)-parser.tokens_head]
+ parser.tokens_head = 0
+ }
+ parser.tokens = append(parser.tokens, *token)
+ if pos < 0 {
+ return
+ }
+ copy(parser.tokens[parser.tokens_head+pos+1:], parser.tokens[parser.tokens_head+pos:])
+ parser.tokens[parser.tokens_head+pos] = *token
+}
+
+// Create a new parser object.
+func yaml_parser_initialize(parser *yaml_parser_t) bool {
+ *parser = yaml_parser_t{
+ raw_buffer: make([]byte, 0, input_raw_buffer_size),
+ buffer: make([]byte, 0, input_buffer_size),
+ }
+ return true
+}
+
+// Destroy a parser object.
+func yaml_parser_delete(parser *yaml_parser_t) {
+ *parser = yaml_parser_t{}
+}
+
+// String read handler.
+func yaml_string_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) {
+ if parser.input_pos == len(parser.input) {
+ return 0, io.EOF
+ }
+ n = copy(buffer, parser.input[parser.input_pos:])
+ parser.input_pos += n
+ return n, nil
+}
+
+// Reader read handler.
+func yaml_reader_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) {
+ return parser.input_reader.Read(buffer)
+}
+
+// Set a string input.
+func yaml_parser_set_input_string(parser *yaml_parser_t, input []byte) {
+ if parser.read_handler != nil {
+ panic("must set the input source only once")
+ }
+ parser.read_handler = yaml_string_read_handler
+ parser.input = input
+ parser.input_pos = 0
+}
+
+// Set a file input.
+func yaml_parser_set_input_reader(parser *yaml_parser_t, r io.Reader) {
+ if parser.read_handler != nil {
+ panic("must set the input source only once")
+ }
+ parser.read_handler = yaml_reader_read_handler
+ parser.input_reader = r
+}
+
+// Set the source encoding.
+func yaml_parser_set_encoding(parser *yaml_parser_t, encoding yaml_encoding_t) {
+ if parser.encoding != yaml_ANY_ENCODING {
+ panic("must set the encoding only once")
+ }
+ parser.encoding = encoding
+}
+
+var disableLineWrapping = false
+
+// Create a new emitter object.
+func yaml_emitter_initialize(emitter *yaml_emitter_t) {
+ *emitter = yaml_emitter_t{
+ buffer: make([]byte, output_buffer_size),
+ raw_buffer: make([]byte, 0, output_raw_buffer_size),
+ states: make([]yaml_emitter_state_t, 0, initial_stack_size),
+ events: make([]yaml_event_t, 0, initial_queue_size),
+ }
+ if disableLineWrapping {
+ emitter.best_width = -1
+ }
+}
+
+// Destroy an emitter object.
+func yaml_emitter_delete(emitter *yaml_emitter_t) {
+ *emitter = yaml_emitter_t{}
+}
+
+// String write handler.
+func yaml_string_write_handler(emitter *yaml_emitter_t, buffer []byte) error {
+ *emitter.output_buffer = append(*emitter.output_buffer, buffer...)
+ return nil
+}
+
+// yaml_writer_write_handler uses emitter.output_writer to write the
+// emitted text.
+func yaml_writer_write_handler(emitter *yaml_emitter_t, buffer []byte) error {
+ _, err := emitter.output_writer.Write(buffer)
+ return err
+}
+
+// Set a string output.
+func yaml_emitter_set_output_string(emitter *yaml_emitter_t, output_buffer *[]byte) {
+ if emitter.write_handler != nil {
+ panic("must set the output target only once")
+ }
+ emitter.write_handler = yaml_string_write_handler
+ emitter.output_buffer = output_buffer
+}
+
+// Set a file output.
+func yaml_emitter_set_output_writer(emitter *yaml_emitter_t, w io.Writer) {
+ if emitter.write_handler != nil {
+ panic("must set the output target only once")
+ }
+ emitter.write_handler = yaml_writer_write_handler
+ emitter.output_writer = w
+}
+
+// Set the output encoding.
+func yaml_emitter_set_encoding(emitter *yaml_emitter_t, encoding yaml_encoding_t) {
+ if emitter.encoding != yaml_ANY_ENCODING {
+ panic("must set the output encoding only once")
+ }
+ emitter.encoding = encoding
+}
+
+// Set the canonical output style.
+func yaml_emitter_set_canonical(emitter *yaml_emitter_t, canonical bool) {
+ emitter.canonical = canonical
+}
+
+//// Set the indentation increment.
+func yaml_emitter_set_indent(emitter *yaml_emitter_t, indent int) {
+ if indent < 2 || indent > 9 {
+ indent = 2
+ }
+ emitter.best_indent = indent
+}
+
+// Set the preferred line width.
+func yaml_emitter_set_width(emitter *yaml_emitter_t, width int) {
+ if width < 0 {
+ width = -1
+ }
+ emitter.best_width = width
+}
+
+// Set if unescaped non-ASCII characters are allowed.
+func yaml_emitter_set_unicode(emitter *yaml_emitter_t, unicode bool) {
+ emitter.unicode = unicode
+}
+
+// Set the preferred line break character.
+func yaml_emitter_set_break(emitter *yaml_emitter_t, line_break yaml_break_t) {
+ emitter.line_break = line_break
+}
+
+///*
+// * Destroy a token object.
+// */
+//
+//YAML_DECLARE(void)
+//yaml_token_delete(yaml_token_t *token)
+//{
+// assert(token); // Non-NULL token object expected.
+//
+// switch (token.type)
+// {
+// case YAML_TAG_DIRECTIVE_TOKEN:
+// yaml_free(token.data.tag_directive.handle);
+// yaml_free(token.data.tag_directive.prefix);
+// break;
+//
+// case YAML_ALIAS_TOKEN:
+// yaml_free(token.data.alias.value);
+// break;
+//
+// case YAML_ANCHOR_TOKEN:
+// yaml_free(token.data.anchor.value);
+// break;
+//
+// case YAML_TAG_TOKEN:
+// yaml_free(token.data.tag.handle);
+// yaml_free(token.data.tag.suffix);
+// break;
+//
+// case YAML_SCALAR_TOKEN:
+// yaml_free(token.data.scalar.value);
+// break;
+//
+// default:
+// break;
+// }
+//
+// memset(token, 0, sizeof(yaml_token_t));
+//}
+//
+///*
+// * Check if a string is a valid UTF-8 sequence.
+// *
+// * Check 'reader.c' for more details on UTF-8 encoding.
+// */
+//
+//static int
+//yaml_check_utf8(yaml_char_t *start, size_t length)
+//{
+// yaml_char_t *end = start+length;
+// yaml_char_t *pointer = start;
+//
+// while (pointer < end) {
+// unsigned char octet;
+// unsigned int width;
+// unsigned int value;
+// size_t k;
+//
+// octet = pointer[0];
+// width = (octet & 0x80) == 0x00 ? 1 :
+// (octet & 0xE0) == 0xC0 ? 2 :
+// (octet & 0xF0) == 0xE0 ? 3 :
+// (octet & 0xF8) == 0xF0 ? 4 : 0;
+// value = (octet & 0x80) == 0x00 ? octet & 0x7F :
+// (octet & 0xE0) == 0xC0 ? octet & 0x1F :
+// (octet & 0xF0) == 0xE0 ? octet & 0x0F :
+// (octet & 0xF8) == 0xF0 ? octet & 0x07 : 0;
+// if (!width) return 0;
+// if (pointer+width > end) return 0;
+// for (k = 1; k < width; k ++) {
+// octet = pointer[k];
+// if ((octet & 0xC0) != 0x80) return 0;
+// value = (value << 6) + (octet & 0x3F);
+// }
+// if (!((width == 1) ||
+// (width == 2 && value >= 0x80) ||
+// (width == 3 && value >= 0x800) ||
+// (width == 4 && value >= 0x10000))) return 0;
+//
+// pointer += width;
+// }
+//
+// return 1;
+//}
+//
+
+// Create STREAM-START.
+func yaml_stream_start_event_initialize(event *yaml_event_t, encoding yaml_encoding_t) {
+ *event = yaml_event_t{
+ typ: yaml_STREAM_START_EVENT,
+ encoding: encoding,
+ }
+}
+
+// Create STREAM-END.
+func yaml_stream_end_event_initialize(event *yaml_event_t) {
+ *event = yaml_event_t{
+ typ: yaml_STREAM_END_EVENT,
+ }
+}
+
+// Create DOCUMENT-START.
+func yaml_document_start_event_initialize(
+ event *yaml_event_t,
+ version_directive *yaml_version_directive_t,
+ tag_directives []yaml_tag_directive_t,
+ implicit bool,
+) {
+ *event = yaml_event_t{
+ typ: yaml_DOCUMENT_START_EVENT,
+ version_directive: version_directive,
+ tag_directives: tag_directives,
+ implicit: implicit,
+ }
+}
+
+// Create DOCUMENT-END.
+func yaml_document_end_event_initialize(event *yaml_event_t, implicit bool) {
+ *event = yaml_event_t{
+ typ: yaml_DOCUMENT_END_EVENT,
+ implicit: implicit,
+ }
+}
+
+///*
+// * Create ALIAS.
+// */
+//
+//YAML_DECLARE(int)
+//yaml_alias_event_initialize(event *yaml_event_t, anchor *yaml_char_t)
+//{
+// mark yaml_mark_t = { 0, 0, 0 }
+// anchor_copy *yaml_char_t = NULL
+//
+// assert(event) // Non-NULL event object is expected.
+// assert(anchor) // Non-NULL anchor is expected.
+//
+// if (!yaml_check_utf8(anchor, strlen((char *)anchor))) return 0
+//
+// anchor_copy = yaml_strdup(anchor)
+// if (!anchor_copy)
+// return 0
+//
+// ALIAS_EVENT_INIT(*event, anchor_copy, mark, mark)
+//
+// return 1
+//}
+
+// Create SCALAR.
+func yaml_scalar_event_initialize(event *yaml_event_t, anchor, tag, value []byte, plain_implicit, quoted_implicit bool, style yaml_scalar_style_t) bool {
+ *event = yaml_event_t{
+ typ: yaml_SCALAR_EVENT,
+ anchor: anchor,
+ tag: tag,
+ value: value,
+ implicit: plain_implicit,
+ quoted_implicit: quoted_implicit,
+ style: yaml_style_t(style),
+ }
+ return true
+}
+
+// Create SEQUENCE-START.
+func yaml_sequence_start_event_initialize(event *yaml_event_t, anchor, tag []byte, implicit bool, style yaml_sequence_style_t) bool {
+ *event = yaml_event_t{
+ typ: yaml_SEQUENCE_START_EVENT,
+ anchor: anchor,
+ tag: tag,
+ implicit: implicit,
+ style: yaml_style_t(style),
+ }
+ return true
+}
+
+// Create SEQUENCE-END.
+func yaml_sequence_end_event_initialize(event *yaml_event_t) bool {
+ *event = yaml_event_t{
+ typ: yaml_SEQUENCE_END_EVENT,
+ }
+ return true
+}
+
+// Create MAPPING-START.
+func yaml_mapping_start_event_initialize(event *yaml_event_t, anchor, tag []byte, implicit bool, style yaml_mapping_style_t) {
+ *event = yaml_event_t{
+ typ: yaml_MAPPING_START_EVENT,
+ anchor: anchor,
+ tag: tag,
+ implicit: implicit,
+ style: yaml_style_t(style),
+ }
+}
+
+// Create MAPPING-END.
+func yaml_mapping_end_event_initialize(event *yaml_event_t) {
+ *event = yaml_event_t{
+ typ: yaml_MAPPING_END_EVENT,
+ }
+}
+
+// Destroy an event object.
+func yaml_event_delete(event *yaml_event_t) {
+ *event = yaml_event_t{}
+}
+
+///*
+// * Create a document object.
+// */
+//
+//YAML_DECLARE(int)
+//yaml_document_initialize(document *yaml_document_t,
+// version_directive *yaml_version_directive_t,
+// tag_directives_start *yaml_tag_directive_t,
+// tag_directives_end *yaml_tag_directive_t,
+// start_implicit int, end_implicit int)
+//{
+// struct {
+// error yaml_error_type_t
+// } context
+// struct {
+// start *yaml_node_t
+// end *yaml_node_t
+// top *yaml_node_t
+// } nodes = { NULL, NULL, NULL }
+// version_directive_copy *yaml_version_directive_t = NULL
+// struct {
+// start *yaml_tag_directive_t
+// end *yaml_tag_directive_t
+// top *yaml_tag_directive_t
+// } tag_directives_copy = { NULL, NULL, NULL }
+// value yaml_tag_directive_t = { NULL, NULL }
+// mark yaml_mark_t = { 0, 0, 0 }
+//
+// assert(document) // Non-NULL document object is expected.
+// assert((tag_directives_start && tag_directives_end) ||
+// (tag_directives_start == tag_directives_end))
+// // Valid tag directives are expected.
+//
+// if (!STACK_INIT(&context, nodes, INITIAL_STACK_SIZE)) goto error
+//
+// if (version_directive) {
+// version_directive_copy = yaml_malloc(sizeof(yaml_version_directive_t))
+// if (!version_directive_copy) goto error
+// version_directive_copy.major = version_directive.major
+// version_directive_copy.minor = version_directive.minor
+// }
+//
+// if (tag_directives_start != tag_directives_end) {
+// tag_directive *yaml_tag_directive_t
+// if (!STACK_INIT(&context, tag_directives_copy, INITIAL_STACK_SIZE))
+// goto error
+// for (tag_directive = tag_directives_start
+// tag_directive != tag_directives_end; tag_directive ++) {
+// assert(tag_directive.handle)
+// assert(tag_directive.prefix)
+// if (!yaml_check_utf8(tag_directive.handle,
+// strlen((char *)tag_directive.handle)))
+// goto error
+// if (!yaml_check_utf8(tag_directive.prefix,
+// strlen((char *)tag_directive.prefix)))
+// goto error
+// value.handle = yaml_strdup(tag_directive.handle)
+// value.prefix = yaml_strdup(tag_directive.prefix)
+// if (!value.handle || !value.prefix) goto error
+// if (!PUSH(&context, tag_directives_copy, value))
+// goto error
+// value.handle = NULL
+// value.prefix = NULL
+// }
+// }
+//
+// DOCUMENT_INIT(*document, nodes.start, nodes.end, version_directive_copy,
+// tag_directives_copy.start, tag_directives_copy.top,
+// start_implicit, end_implicit, mark, mark)
+//
+// return 1
+//
+//error:
+// STACK_DEL(&context, nodes)
+// yaml_free(version_directive_copy)
+// while (!STACK_EMPTY(&context, tag_directives_copy)) {
+// value yaml_tag_directive_t = POP(&context, tag_directives_copy)
+// yaml_free(value.handle)
+// yaml_free(value.prefix)
+// }
+// STACK_DEL(&context, tag_directives_copy)
+// yaml_free(value.handle)
+// yaml_free(value.prefix)
+//
+// return 0
+//}
+//
+///*
+// * Destroy a document object.
+// */
+//
+//YAML_DECLARE(void)
+//yaml_document_delete(document *yaml_document_t)
+//{
+// struct {
+// error yaml_error_type_t
+// } context
+// tag_directive *yaml_tag_directive_t
+//
+// context.error = YAML_NO_ERROR // Eliminate a compiler warning.
+//
+// assert(document) // Non-NULL document object is expected.
+//
+// while (!STACK_EMPTY(&context, document.nodes)) {
+// node yaml_node_t = POP(&context, document.nodes)
+// yaml_free(node.tag)
+// switch (node.type) {
+// case YAML_SCALAR_NODE:
+// yaml_free(node.data.scalar.value)
+// break
+// case YAML_SEQUENCE_NODE:
+// STACK_DEL(&context, node.data.sequence.items)
+// break
+// case YAML_MAPPING_NODE:
+// STACK_DEL(&context, node.data.mapping.pairs)
+// break
+// default:
+// assert(0) // Should not happen.
+// }
+// }
+// STACK_DEL(&context, document.nodes)
+//
+// yaml_free(document.version_directive)
+// for (tag_directive = document.tag_directives.start
+// tag_directive != document.tag_directives.end
+// tag_directive++) {
+// yaml_free(tag_directive.handle)
+// yaml_free(tag_directive.prefix)
+// }
+// yaml_free(document.tag_directives.start)
+//
+// memset(document, 0, sizeof(yaml_document_t))
+//}
+//
+///**
+// * Get a document node.
+// */
+//
+//YAML_DECLARE(yaml_node_t *)
+//yaml_document_get_node(document *yaml_document_t, index int)
+//{
+// assert(document) // Non-NULL document object is expected.
+//
+// if (index > 0 && document.nodes.start + index <= document.nodes.top) {
+// return document.nodes.start + index - 1
+// }
+// return NULL
+//}
+//
+///**
+// * Get the root object.
+// */
+//
+//YAML_DECLARE(yaml_node_t *)
+//yaml_document_get_root_node(document *yaml_document_t)
+//{
+// assert(document) // Non-NULL document object is expected.
+//
+// if (document.nodes.top != document.nodes.start) {
+// return document.nodes.start
+// }
+// return NULL
+//}
+//
+///*
+// * Add a scalar node to a document.
+// */
+//
+//YAML_DECLARE(int)
+//yaml_document_add_scalar(document *yaml_document_t,
+// tag *yaml_char_t, value *yaml_char_t, length int,
+// style yaml_scalar_style_t)
+//{
+// struct {
+// error yaml_error_type_t
+// } context
+// mark yaml_mark_t = { 0, 0, 0 }
+// tag_copy *yaml_char_t = NULL
+// value_copy *yaml_char_t = NULL
+// node yaml_node_t
+//
+// assert(document) // Non-NULL document object is expected.
+// assert(value) // Non-NULL value is expected.
+//
+// if (!tag) {
+// tag = (yaml_char_t *)YAML_DEFAULT_SCALAR_TAG
+// }
+//
+// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error
+// tag_copy = yaml_strdup(tag)
+// if (!tag_copy) goto error
+//
+// if (length < 0) {
+// length = strlen((char *)value)
+// }
+//
+// if (!yaml_check_utf8(value, length)) goto error
+// value_copy = yaml_malloc(length+1)
+// if (!value_copy) goto error
+// memcpy(value_copy, value, length)
+// value_copy[length] = '\0'
+//
+// SCALAR_NODE_INIT(node, tag_copy, value_copy, length, style, mark, mark)
+// if (!PUSH(&context, document.nodes, node)) goto error
+//
+// return document.nodes.top - document.nodes.start
+//
+//error:
+// yaml_free(tag_copy)
+// yaml_free(value_copy)
+//
+// return 0
+//}
+//
+///*
+// * Add a sequence node to a document.
+// */
+//
+//YAML_DECLARE(int)
+//yaml_document_add_sequence(document *yaml_document_t,
+// tag *yaml_char_t, style yaml_sequence_style_t)
+//{
+// struct {
+// error yaml_error_type_t
+// } context
+// mark yaml_mark_t = { 0, 0, 0 }
+// tag_copy *yaml_char_t = NULL
+// struct {
+// start *yaml_node_item_t
+// end *yaml_node_item_t
+// top *yaml_node_item_t
+// } items = { NULL, NULL, NULL }
+// node yaml_node_t
+//
+// assert(document) // Non-NULL document object is expected.
+//
+// if (!tag) {
+// tag = (yaml_char_t *)YAML_DEFAULT_SEQUENCE_TAG
+// }
+//
+// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error
+// tag_copy = yaml_strdup(tag)
+// if (!tag_copy) goto error
+//
+// if (!STACK_INIT(&context, items, INITIAL_STACK_SIZE)) goto error
+//
+// SEQUENCE_NODE_INIT(node, tag_copy, items.start, items.end,
+// style, mark, mark)
+// if (!PUSH(&context, document.nodes, node)) goto error
+//
+// return document.nodes.top - document.nodes.start
+//
+//error:
+// STACK_DEL(&context, items)
+// yaml_free(tag_copy)
+//
+// return 0
+//}
+//
+///*
+// * Add a mapping node to a document.
+// */
+//
+//YAML_DECLARE(int)
+//yaml_document_add_mapping(document *yaml_document_t,
+// tag *yaml_char_t, style yaml_mapping_style_t)
+//{
+// struct {
+// error yaml_error_type_t
+// } context
+// mark yaml_mark_t = { 0, 0, 0 }
+// tag_copy *yaml_char_t = NULL
+// struct {
+// start *yaml_node_pair_t
+// end *yaml_node_pair_t
+// top *yaml_node_pair_t
+// } pairs = { NULL, NULL, NULL }
+// node yaml_node_t
+//
+// assert(document) // Non-NULL document object is expected.
+//
+// if (!tag) {
+// tag = (yaml_char_t *)YAML_DEFAULT_MAPPING_TAG
+// }
+//
+// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error
+// tag_copy = yaml_strdup(tag)
+// if (!tag_copy) goto error
+//
+// if (!STACK_INIT(&context, pairs, INITIAL_STACK_SIZE)) goto error
+//
+// MAPPING_NODE_INIT(node, tag_copy, pairs.start, pairs.end,
+// style, mark, mark)
+// if (!PUSH(&context, document.nodes, node)) goto error
+//
+// return document.nodes.top - document.nodes.start
+//
+//error:
+// STACK_DEL(&context, pairs)
+// yaml_free(tag_copy)
+//
+// return 0
+//}
+//
+///*
+// * Append an item to a sequence node.
+// */
+//
+//YAML_DECLARE(int)
+//yaml_document_append_sequence_item(document *yaml_document_t,
+// sequence int, item int)
+//{
+// struct {
+// error yaml_error_type_t
+// } context
+//
+// assert(document) // Non-NULL document is required.
+// assert(sequence > 0
+// && document.nodes.start + sequence <= document.nodes.top)
+// // Valid sequence id is required.
+// assert(document.nodes.start[sequence-1].type == YAML_SEQUENCE_NODE)
+// // A sequence node is required.
+// assert(item > 0 && document.nodes.start + item <= document.nodes.top)
+// // Valid item id is required.
+//
+// if (!PUSH(&context,
+// document.nodes.start[sequence-1].data.sequence.items, item))
+// return 0
+//
+// return 1
+//}
+//
+///*
+// * Append a pair of a key and a value to a mapping node.
+// */
+//
+//YAML_DECLARE(int)
+//yaml_document_append_mapping_pair(document *yaml_document_t,
+// mapping int, key int, value int)
+//{
+// struct {
+// error yaml_error_type_t
+// } context
+//
+// pair yaml_node_pair_t
+//
+// assert(document) // Non-NULL document is required.
+// assert(mapping > 0
+// && document.nodes.start + mapping <= document.nodes.top)
+// // Valid mapping id is required.
+// assert(document.nodes.start[mapping-1].type == YAML_MAPPING_NODE)
+// // A mapping node is required.
+// assert(key > 0 && document.nodes.start + key <= document.nodes.top)
+// // Valid key id is required.
+// assert(value > 0 && document.nodes.start + value <= document.nodes.top)
+// // Valid value id is required.
+//
+// pair.key = key
+// pair.value = value
+//
+// if (!PUSH(&context,
+// document.nodes.start[mapping-1].data.mapping.pairs, pair))
+// return 0
+//
+// return 1
+//}
+//
+//
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/decode.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/decode.go
new file mode 100644
index 000000000..129bc2a97
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/decode.go
@@ -0,0 +1,815 @@
+package yaml
+
+import (
+ "encoding"
+ "encoding/base64"
+ "fmt"
+ "io"
+ "math"
+ "reflect"
+ "strconv"
+ "time"
+)
+
+const (
+ documentNode = 1 << iota
+ mappingNode
+ sequenceNode
+ scalarNode
+ aliasNode
+)
+
+type node struct {
+ kind int
+ line, column int
+ tag string
+ // For an alias node, alias holds the resolved alias.
+ alias *node
+ value string
+ implicit bool
+ children []*node
+ anchors map[string]*node
+}
+
+// ----------------------------------------------------------------------------
+// Parser, produces a node tree out of a libyaml event stream.
+
+type parser struct {
+ parser yaml_parser_t
+ event yaml_event_t
+ doc *node
+ doneInit bool
+}
+
+func newParser(b []byte) *parser {
+ p := parser{}
+ if !yaml_parser_initialize(&p.parser) {
+ panic("failed to initialize YAML emitter")
+ }
+ if len(b) == 0 {
+ b = []byte{'\n'}
+ }
+ yaml_parser_set_input_string(&p.parser, b)
+ return &p
+}
+
+func newParserFromReader(r io.Reader) *parser {
+ p := parser{}
+ if !yaml_parser_initialize(&p.parser) {
+ panic("failed to initialize YAML emitter")
+ }
+ yaml_parser_set_input_reader(&p.parser, r)
+ return &p
+}
+
+func (p *parser) init() {
+ if p.doneInit {
+ return
+ }
+ p.expect(yaml_STREAM_START_EVENT)
+ p.doneInit = true
+}
+
+func (p *parser) destroy() {
+ if p.event.typ != yaml_NO_EVENT {
+ yaml_event_delete(&p.event)
+ }
+ yaml_parser_delete(&p.parser)
+}
+
+// expect consumes an event from the event stream and
+// checks that it's of the expected type.
+func (p *parser) expect(e yaml_event_type_t) {
+ if p.event.typ == yaml_NO_EVENT {
+ if !yaml_parser_parse(&p.parser, &p.event) {
+ p.fail()
+ }
+ }
+ if p.event.typ == yaml_STREAM_END_EVENT {
+ failf("attempted to go past the end of stream; corrupted value?")
+ }
+ if p.event.typ != e {
+ p.parser.problem = fmt.Sprintf("expected %s event but got %s", e, p.event.typ)
+ p.fail()
+ }
+ yaml_event_delete(&p.event)
+ p.event.typ = yaml_NO_EVENT
+}
+
+// peek peeks at the next event in the event stream,
+// puts the results into p.event and returns the event type.
+func (p *parser) peek() yaml_event_type_t {
+ if p.event.typ != yaml_NO_EVENT {
+ return p.event.typ
+ }
+ if !yaml_parser_parse(&p.parser, &p.event) {
+ p.fail()
+ }
+ return p.event.typ
+}
+
+func (p *parser) fail() {
+ var where string
+ var line int
+ if p.parser.problem_mark.line != 0 {
+ line = p.parser.problem_mark.line
+ // Scanner errors don't iterate line before returning error
+ if p.parser.error == yaml_SCANNER_ERROR {
+ line++
+ }
+ } else if p.parser.context_mark.line != 0 {
+ line = p.parser.context_mark.line
+ }
+ if line != 0 {
+ where = "line " + strconv.Itoa(line) + ": "
+ }
+ var msg string
+ if len(p.parser.problem) > 0 {
+ msg = p.parser.problem
+ } else {
+ msg = "unknown problem parsing YAML content"
+ }
+ failf("%s%s", where, msg)
+}
+
+func (p *parser) anchor(n *node, anchor []byte) {
+ if anchor != nil {
+ p.doc.anchors[string(anchor)] = n
+ }
+}
+
+func (p *parser) parse() *node {
+ p.init()
+ switch p.peek() {
+ case yaml_SCALAR_EVENT:
+ return p.scalar()
+ case yaml_ALIAS_EVENT:
+ return p.alias()
+ case yaml_MAPPING_START_EVENT:
+ return p.mapping()
+ case yaml_SEQUENCE_START_EVENT:
+ return p.sequence()
+ case yaml_DOCUMENT_START_EVENT:
+ return p.document()
+ case yaml_STREAM_END_EVENT:
+ // Happens when attempting to decode an empty buffer.
+ return nil
+ default:
+ panic("attempted to parse unknown event: " + p.event.typ.String())
+ }
+}
+
+func (p *parser) node(kind int) *node {
+ return &node{
+ kind: kind,
+ line: p.event.start_mark.line,
+ column: p.event.start_mark.column,
+ }
+}
+
+func (p *parser) document() *node {
+ n := p.node(documentNode)
+ n.anchors = make(map[string]*node)
+ p.doc = n
+ p.expect(yaml_DOCUMENT_START_EVENT)
+ n.children = append(n.children, p.parse())
+ p.expect(yaml_DOCUMENT_END_EVENT)
+ return n
+}
+
+func (p *parser) alias() *node {
+ n := p.node(aliasNode)
+ n.value = string(p.event.anchor)
+ n.alias = p.doc.anchors[n.value]
+ if n.alias == nil {
+ failf("unknown anchor '%s' referenced", n.value)
+ }
+ p.expect(yaml_ALIAS_EVENT)
+ return n
+}
+
+func (p *parser) scalar() *node {
+ n := p.node(scalarNode)
+ n.value = string(p.event.value)
+ n.tag = string(p.event.tag)
+ n.implicit = p.event.implicit
+ p.anchor(n, p.event.anchor)
+ p.expect(yaml_SCALAR_EVENT)
+ return n
+}
+
+func (p *parser) sequence() *node {
+ n := p.node(sequenceNode)
+ p.anchor(n, p.event.anchor)
+ p.expect(yaml_SEQUENCE_START_EVENT)
+ for p.peek() != yaml_SEQUENCE_END_EVENT {
+ n.children = append(n.children, p.parse())
+ }
+ p.expect(yaml_SEQUENCE_END_EVENT)
+ return n
+}
+
+func (p *parser) mapping() *node {
+ n := p.node(mappingNode)
+ p.anchor(n, p.event.anchor)
+ p.expect(yaml_MAPPING_START_EVENT)
+ for p.peek() != yaml_MAPPING_END_EVENT {
+ n.children = append(n.children, p.parse(), p.parse())
+ }
+ p.expect(yaml_MAPPING_END_EVENT)
+ return n
+}
+
+// ----------------------------------------------------------------------------
+// Decoder, unmarshals a node into a provided value.
+
+type decoder struct {
+ doc *node
+ aliases map[*node]bool
+ mapType reflect.Type
+ terrors []string
+ strict bool
+
+ decodeCount int
+ aliasCount int
+ aliasDepth int
+}
+
+var (
+ mapItemType = reflect.TypeOf(MapItem{})
+ durationType = reflect.TypeOf(time.Duration(0))
+ defaultMapType = reflect.TypeOf(map[interface{}]interface{}{})
+ ifaceType = defaultMapType.Elem()
+ timeType = reflect.TypeOf(time.Time{})
+ ptrTimeType = reflect.TypeOf(&time.Time{})
+)
+
+func newDecoder(strict bool) *decoder {
+ d := &decoder{mapType: defaultMapType, strict: strict}
+ d.aliases = make(map[*node]bool)
+ return d
+}
+
+func (d *decoder) terror(n *node, tag string, out reflect.Value) {
+ if n.tag != "" {
+ tag = n.tag
+ }
+ value := n.value
+ if tag != yaml_SEQ_TAG && tag != yaml_MAP_TAG {
+ if len(value) > 10 {
+ value = " `" + value[:7] + "...`"
+ } else {
+ value = " `" + value + "`"
+ }
+ }
+ d.terrors = append(d.terrors, fmt.Sprintf("line %d: cannot unmarshal %s%s into %s", n.line+1, shortTag(tag), value, out.Type()))
+}
+
+func (d *decoder) callUnmarshaler(n *node, u Unmarshaler) (good bool) {
+ terrlen := len(d.terrors)
+ err := u.UnmarshalYAML(func(v interface{}) (err error) {
+ defer handleErr(&err)
+ d.unmarshal(n, reflect.ValueOf(v))
+ if len(d.terrors) > terrlen {
+ issues := d.terrors[terrlen:]
+ d.terrors = d.terrors[:terrlen]
+ return &TypeError{issues}
+ }
+ return nil
+ })
+ if e, ok := err.(*TypeError); ok {
+ d.terrors = append(d.terrors, e.Errors...)
+ return false
+ }
+ if err != nil {
+ fail(err)
+ }
+ return true
+}
+
+// d.prepare initializes and dereferences pointers and calls UnmarshalYAML
+// if a value is found to implement it.
+// It returns the initialized and dereferenced out value, whether
+// unmarshalling was already done by UnmarshalYAML, and if so whether
+// its types unmarshalled appropriately.
+//
+// If n holds a null value, prepare returns before doing anything.
+func (d *decoder) prepare(n *node, out reflect.Value) (newout reflect.Value, unmarshaled, good bool) {
+ if n.tag == yaml_NULL_TAG || n.kind == scalarNode && n.tag == "" && (n.value == "null" || n.value == "~" || n.value == "" && n.implicit) {
+ return out, false, false
+ }
+ again := true
+ for again {
+ again = false
+ if out.Kind() == reflect.Ptr {
+ if out.IsNil() {
+ out.Set(reflect.New(out.Type().Elem()))
+ }
+ out = out.Elem()
+ again = true
+ }
+ if out.CanAddr() {
+ if u, ok := out.Addr().Interface().(Unmarshaler); ok {
+ good = d.callUnmarshaler(n, u)
+ return out, true, good
+ }
+ }
+ }
+ return out, false, false
+}
+
+const (
+ // 400,000 decode operations is ~500kb of dense object declarations, or
+ // ~5kb of dense object declarations with 10000% alias expansion
+ alias_ratio_range_low = 400000
+
+ // 4,000,000 decode operations is ~5MB of dense object declarations, or
+ // ~4.5MB of dense object declarations with 10% alias expansion
+ alias_ratio_range_high = 4000000
+
+ // alias_ratio_range is the range over which we scale allowed alias ratios
+ alias_ratio_range = float64(alias_ratio_range_high - alias_ratio_range_low)
+)
+
+func allowedAliasRatio(decodeCount int) float64 {
+ switch {
+ case decodeCount <= alias_ratio_range_low:
+ // allow 99% to come from alias expansion for small-to-medium documents
+ return 0.99
+ case decodeCount >= alias_ratio_range_high:
+ // allow 10% to come from alias expansion for very large documents
+ return 0.10
+ default:
+ // scale smoothly from 99% down to 10% over the range.
+ // this maps to 396,000 - 400,000 allowed alias-driven decodes over the range.
+ // 400,000 decode operations is ~100MB of allocations in worst-case scenarios (single-item maps).
+ return 0.99 - 0.89*(float64(decodeCount-alias_ratio_range_low)/alias_ratio_range)
+ }
+}
+
+func (d *decoder) unmarshal(n *node, out reflect.Value) (good bool) {
+ d.decodeCount++
+ if d.aliasDepth > 0 {
+ d.aliasCount++
+ }
+ if d.aliasCount > 100 && d.decodeCount > 1000 && float64(d.aliasCount)/float64(d.decodeCount) > allowedAliasRatio(d.decodeCount) {
+ failf("document contains excessive aliasing")
+ }
+ switch n.kind {
+ case documentNode:
+ return d.document(n, out)
+ case aliasNode:
+ return d.alias(n, out)
+ }
+ out, unmarshaled, good := d.prepare(n, out)
+ if unmarshaled {
+ return good
+ }
+ switch n.kind {
+ case scalarNode:
+ good = d.scalar(n, out)
+ case mappingNode:
+ good = d.mapping(n, out)
+ case sequenceNode:
+ good = d.sequence(n, out)
+ default:
+ panic("internal error: unknown node kind: " + strconv.Itoa(n.kind))
+ }
+ return good
+}
+
+func (d *decoder) document(n *node, out reflect.Value) (good bool) {
+ if len(n.children) == 1 {
+ d.doc = n
+ d.unmarshal(n.children[0], out)
+ return true
+ }
+ return false
+}
+
+func (d *decoder) alias(n *node, out reflect.Value) (good bool) {
+ if d.aliases[n] {
+ // TODO this could actually be allowed in some circumstances.
+ failf("anchor '%s' value contains itself", n.value)
+ }
+ d.aliases[n] = true
+ d.aliasDepth++
+ good = d.unmarshal(n.alias, out)
+ d.aliasDepth--
+ delete(d.aliases, n)
+ return good
+}
+
+var zeroValue reflect.Value
+
+func resetMap(out reflect.Value) {
+ for _, k := range out.MapKeys() {
+ out.SetMapIndex(k, zeroValue)
+ }
+}
+
+func (d *decoder) scalar(n *node, out reflect.Value) bool {
+ var tag string
+ var resolved interface{}
+ if n.tag == "" && !n.implicit {
+ tag = yaml_STR_TAG
+ resolved = n.value
+ } else {
+ tag, resolved = resolve(n.tag, n.value)
+ if tag == yaml_BINARY_TAG {
+ data, err := base64.StdEncoding.DecodeString(resolved.(string))
+ if err != nil {
+ failf("!!binary value contains invalid base64 data")
+ }
+ resolved = string(data)
+ }
+ }
+ if resolved == nil {
+ if out.Kind() == reflect.Map && !out.CanAddr() {
+ resetMap(out)
+ } else {
+ out.Set(reflect.Zero(out.Type()))
+ }
+ return true
+ }
+ if resolvedv := reflect.ValueOf(resolved); out.Type() == resolvedv.Type() {
+ // We've resolved to exactly the type we want, so use that.
+ out.Set(resolvedv)
+ return true
+ }
+ // Perhaps we can use the value as a TextUnmarshaler to
+ // set its value.
+ if out.CanAddr() {
+ u, ok := out.Addr().Interface().(encoding.TextUnmarshaler)
+ if ok {
+ var text []byte
+ if tag == yaml_BINARY_TAG {
+ text = []byte(resolved.(string))
+ } else {
+ // We let any value be unmarshaled into TextUnmarshaler.
+ // That might be more lax than we'd like, but the
+ // TextUnmarshaler itself should bowl out any dubious values.
+ text = []byte(n.value)
+ }
+ err := u.UnmarshalText(text)
+ if err != nil {
+ fail(err)
+ }
+ return true
+ }
+ }
+ switch out.Kind() {
+ case reflect.String:
+ if tag == yaml_BINARY_TAG {
+ out.SetString(resolved.(string))
+ return true
+ }
+ if resolved != nil {
+ out.SetString(n.value)
+ return true
+ }
+ case reflect.Interface:
+ if resolved == nil {
+ out.Set(reflect.Zero(out.Type()))
+ } else if tag == yaml_TIMESTAMP_TAG {
+ // It looks like a timestamp but for backward compatibility
+ // reasons we set it as a string, so that code that unmarshals
+ // timestamp-like values into interface{} will continue to
+ // see a string and not a time.Time.
+ // TODO(v3) Drop this.
+ out.Set(reflect.ValueOf(n.value))
+ } else {
+ out.Set(reflect.ValueOf(resolved))
+ }
+ return true
+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+ switch resolved := resolved.(type) {
+ case int:
+ if !out.OverflowInt(int64(resolved)) {
+ out.SetInt(int64(resolved))
+ return true
+ }
+ case int64:
+ if !out.OverflowInt(resolved) {
+ out.SetInt(resolved)
+ return true
+ }
+ case uint64:
+ if resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) {
+ out.SetInt(int64(resolved))
+ return true
+ }
+ case float64:
+ if resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) {
+ out.SetInt(int64(resolved))
+ return true
+ }
+ case string:
+ if out.Type() == durationType {
+ d, err := time.ParseDuration(resolved)
+ if err == nil {
+ out.SetInt(int64(d))
+ return true
+ }
+ }
+ }
+ case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
+ switch resolved := resolved.(type) {
+ case int:
+ if resolved >= 0 && !out.OverflowUint(uint64(resolved)) {
+ out.SetUint(uint64(resolved))
+ return true
+ }
+ case int64:
+ if resolved >= 0 && !out.OverflowUint(uint64(resolved)) {
+ out.SetUint(uint64(resolved))
+ return true
+ }
+ case uint64:
+ if !out.OverflowUint(uint64(resolved)) {
+ out.SetUint(uint64(resolved))
+ return true
+ }
+ case float64:
+ if resolved <= math.MaxUint64 && !out.OverflowUint(uint64(resolved)) {
+ out.SetUint(uint64(resolved))
+ return true
+ }
+ }
+ case reflect.Bool:
+ switch resolved := resolved.(type) {
+ case bool:
+ out.SetBool(resolved)
+ return true
+ }
+ case reflect.Float32, reflect.Float64:
+ switch resolved := resolved.(type) {
+ case int:
+ out.SetFloat(float64(resolved))
+ return true
+ case int64:
+ out.SetFloat(float64(resolved))
+ return true
+ case uint64:
+ out.SetFloat(float64(resolved))
+ return true
+ case float64:
+ out.SetFloat(resolved)
+ return true
+ }
+ case reflect.Struct:
+ if resolvedv := reflect.ValueOf(resolved); out.Type() == resolvedv.Type() {
+ out.Set(resolvedv)
+ return true
+ }
+ case reflect.Ptr:
+ if out.Type().Elem() == reflect.TypeOf(resolved) {
+ // TODO DOes this make sense? When is out a Ptr except when decoding a nil value?
+ elem := reflect.New(out.Type().Elem())
+ elem.Elem().Set(reflect.ValueOf(resolved))
+ out.Set(elem)
+ return true
+ }
+ }
+ d.terror(n, tag, out)
+ return false
+}
+
+func settableValueOf(i interface{}) reflect.Value {
+ v := reflect.ValueOf(i)
+ sv := reflect.New(v.Type()).Elem()
+ sv.Set(v)
+ return sv
+}
+
+func (d *decoder) sequence(n *node, out reflect.Value) (good bool) {
+ l := len(n.children)
+
+ var iface reflect.Value
+ switch out.Kind() {
+ case reflect.Slice:
+ out.Set(reflect.MakeSlice(out.Type(), l, l))
+ case reflect.Array:
+ if l != out.Len() {
+ failf("invalid array: want %d elements but got %d", out.Len(), l)
+ }
+ case reflect.Interface:
+ // No type hints. Will have to use a generic sequence.
+ iface = out
+ out = settableValueOf(make([]interface{}, l))
+ default:
+ d.terror(n, yaml_SEQ_TAG, out)
+ return false
+ }
+ et := out.Type().Elem()
+
+ j := 0
+ for i := 0; i < l; i++ {
+ e := reflect.New(et).Elem()
+ if ok := d.unmarshal(n.children[i], e); ok {
+ out.Index(j).Set(e)
+ j++
+ }
+ }
+ if out.Kind() != reflect.Array {
+ out.Set(out.Slice(0, j))
+ }
+ if iface.IsValid() {
+ iface.Set(out)
+ }
+ return true
+}
+
+func (d *decoder) mapping(n *node, out reflect.Value) (good bool) {
+ switch out.Kind() {
+ case reflect.Struct:
+ return d.mappingStruct(n, out)
+ case reflect.Slice:
+ return d.mappingSlice(n, out)
+ case reflect.Map:
+ // okay
+ case reflect.Interface:
+ if d.mapType.Kind() == reflect.Map {
+ iface := out
+ out = reflect.MakeMap(d.mapType)
+ iface.Set(out)
+ } else {
+ slicev := reflect.New(d.mapType).Elem()
+ if !d.mappingSlice(n, slicev) {
+ return false
+ }
+ out.Set(slicev)
+ return true
+ }
+ default:
+ d.terror(n, yaml_MAP_TAG, out)
+ return false
+ }
+ outt := out.Type()
+ kt := outt.Key()
+ et := outt.Elem()
+
+ mapType := d.mapType
+ if outt.Key() == ifaceType && outt.Elem() == ifaceType {
+ d.mapType = outt
+ }
+
+ if out.IsNil() {
+ out.Set(reflect.MakeMap(outt))
+ }
+ l := len(n.children)
+ for i := 0; i < l; i += 2 {
+ if isMerge(n.children[i]) {
+ d.merge(n.children[i+1], out)
+ continue
+ }
+ k := reflect.New(kt).Elem()
+ if d.unmarshal(n.children[i], k) {
+ kkind := k.Kind()
+ if kkind == reflect.Interface {
+ kkind = k.Elem().Kind()
+ }
+ if kkind == reflect.Map || kkind == reflect.Slice {
+ failf("invalid map key: %#v", k.Interface())
+ }
+ e := reflect.New(et).Elem()
+ if d.unmarshal(n.children[i+1], e) {
+ d.setMapIndex(n.children[i+1], out, k, e)
+ }
+ }
+ }
+ d.mapType = mapType
+ return true
+}
+
+func (d *decoder) setMapIndex(n *node, out, k, v reflect.Value) {
+ if d.strict && out.MapIndex(k) != zeroValue {
+ d.terrors = append(d.terrors, fmt.Sprintf("line %d: key %#v already set in map", n.line+1, k.Interface()))
+ return
+ }
+ out.SetMapIndex(k, v)
+}
+
+func (d *decoder) mappingSlice(n *node, out reflect.Value) (good bool) {
+ outt := out.Type()
+ if outt.Elem() != mapItemType {
+ d.terror(n, yaml_MAP_TAG, out)
+ return false
+ }
+
+ mapType := d.mapType
+ d.mapType = outt
+
+ var slice []MapItem
+ var l = len(n.children)
+ for i := 0; i < l; i += 2 {
+ if isMerge(n.children[i]) {
+ d.merge(n.children[i+1], out)
+ continue
+ }
+ item := MapItem{}
+ k := reflect.ValueOf(&item.Key).Elem()
+ if d.unmarshal(n.children[i], k) {
+ v := reflect.ValueOf(&item.Value).Elem()
+ if d.unmarshal(n.children[i+1], v) {
+ slice = append(slice, item)
+ }
+ }
+ }
+ out.Set(reflect.ValueOf(slice))
+ d.mapType = mapType
+ return true
+}
+
+func (d *decoder) mappingStruct(n *node, out reflect.Value) (good bool) {
+ sinfo, err := getStructInfo(out.Type())
+ if err != nil {
+ panic(err)
+ }
+ name := settableValueOf("")
+ l := len(n.children)
+
+ var inlineMap reflect.Value
+ var elemType reflect.Type
+ if sinfo.InlineMap != -1 {
+ inlineMap = out.Field(sinfo.InlineMap)
+ inlineMap.Set(reflect.New(inlineMap.Type()).Elem())
+ elemType = inlineMap.Type().Elem()
+ }
+
+ var doneFields []bool
+ if d.strict {
+ doneFields = make([]bool, len(sinfo.FieldsList))
+ }
+ for i := 0; i < l; i += 2 {
+ ni := n.children[i]
+ if isMerge(ni) {
+ d.merge(n.children[i+1], out)
+ continue
+ }
+ if !d.unmarshal(ni, name) {
+ continue
+ }
+ if info, ok := sinfo.FieldsMap[name.String()]; ok {
+ if d.strict {
+ if doneFields[info.Id] {
+ d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s already set in type %s", ni.line+1, name.String(), out.Type()))
+ continue
+ }
+ doneFields[info.Id] = true
+ }
+ var field reflect.Value
+ if info.Inline == nil {
+ field = out.Field(info.Num)
+ } else {
+ field = out.FieldByIndex(info.Inline)
+ }
+ d.unmarshal(n.children[i+1], field)
+ } else if sinfo.InlineMap != -1 {
+ if inlineMap.IsNil() {
+ inlineMap.Set(reflect.MakeMap(inlineMap.Type()))
+ }
+ value := reflect.New(elemType).Elem()
+ d.unmarshal(n.children[i+1], value)
+ d.setMapIndex(n.children[i+1], inlineMap, name, value)
+ } else if d.strict {
+ d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s not found in type %s", ni.line+1, name.String(), out.Type()))
+ }
+ }
+ return true
+}
+
+func failWantMap() {
+ failf("map merge requires map or sequence of maps as the value")
+}
+
+func (d *decoder) merge(n *node, out reflect.Value) {
+ switch n.kind {
+ case mappingNode:
+ d.unmarshal(n, out)
+ case aliasNode:
+ if n.alias != nil && n.alias.kind != mappingNode {
+ failWantMap()
+ }
+ d.unmarshal(n, out)
+ case sequenceNode:
+ // Step backwards as earlier nodes take precedence.
+ for i := len(n.children) - 1; i >= 0; i-- {
+ ni := n.children[i]
+ if ni.kind == aliasNode {
+ if ni.alias != nil && ni.alias.kind != mappingNode {
+ failWantMap()
+ }
+ } else if ni.kind != mappingNode {
+ failWantMap()
+ }
+ d.unmarshal(ni, out)
+ }
+ default:
+ failWantMap()
+ }
+}
+
+func isMerge(n *node) bool {
+ return n.kind == scalarNode && n.value == "<<" && (n.implicit == true || n.tag == yaml_MERGE_TAG)
+}
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/emitterc.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/emitterc.go
new file mode 100644
index 000000000..a1c2cc526
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/emitterc.go
@@ -0,0 +1,1685 @@
+package yaml
+
+import (
+ "bytes"
+ "fmt"
+)
+
+// Flush the buffer if needed.
+func flush(emitter *yaml_emitter_t) bool {
+ if emitter.buffer_pos+5 >= len(emitter.buffer) {
+ return yaml_emitter_flush(emitter)
+ }
+ return true
+}
+
+// Put a character to the output buffer.
+func put(emitter *yaml_emitter_t, value byte) bool {
+ if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) {
+ return false
+ }
+ emitter.buffer[emitter.buffer_pos] = value
+ emitter.buffer_pos++
+ emitter.column++
+ return true
+}
+
+// Put a line break to the output buffer.
+func put_break(emitter *yaml_emitter_t) bool {
+ if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) {
+ return false
+ }
+ switch emitter.line_break {
+ case yaml_CR_BREAK:
+ emitter.buffer[emitter.buffer_pos] = '\r'
+ emitter.buffer_pos += 1
+ case yaml_LN_BREAK:
+ emitter.buffer[emitter.buffer_pos] = '\n'
+ emitter.buffer_pos += 1
+ case yaml_CRLN_BREAK:
+ emitter.buffer[emitter.buffer_pos+0] = '\r'
+ emitter.buffer[emitter.buffer_pos+1] = '\n'
+ emitter.buffer_pos += 2
+ default:
+ panic("unknown line break setting")
+ }
+ emitter.column = 0
+ emitter.line++
+ return true
+}
+
+// Copy a character from a string into buffer.
+func write(emitter *yaml_emitter_t, s []byte, i *int) bool {
+ if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) {
+ return false
+ }
+ p := emitter.buffer_pos
+ w := width(s[*i])
+ switch w {
+ case 4:
+ emitter.buffer[p+3] = s[*i+3]
+ fallthrough
+ case 3:
+ emitter.buffer[p+2] = s[*i+2]
+ fallthrough
+ case 2:
+ emitter.buffer[p+1] = s[*i+1]
+ fallthrough
+ case 1:
+ emitter.buffer[p+0] = s[*i+0]
+ default:
+ panic("unknown character width")
+ }
+ emitter.column++
+ emitter.buffer_pos += w
+ *i += w
+ return true
+}
+
+// Write a whole string into buffer.
+func write_all(emitter *yaml_emitter_t, s []byte) bool {
+ for i := 0; i < len(s); {
+ if !write(emitter, s, &i) {
+ return false
+ }
+ }
+ return true
+}
+
+// Copy a line break character from a string into buffer.
+func write_break(emitter *yaml_emitter_t, s []byte, i *int) bool {
+ if s[*i] == '\n' {
+ if !put_break(emitter) {
+ return false
+ }
+ *i++
+ } else {
+ if !write(emitter, s, i) {
+ return false
+ }
+ emitter.column = 0
+ emitter.line++
+ }
+ return true
+}
+
+// Set an emitter error and return false.
+func yaml_emitter_set_emitter_error(emitter *yaml_emitter_t, problem string) bool {
+ emitter.error = yaml_EMITTER_ERROR
+ emitter.problem = problem
+ return false
+}
+
+// Emit an event.
+func yaml_emitter_emit(emitter *yaml_emitter_t, event *yaml_event_t) bool {
+ emitter.events = append(emitter.events, *event)
+ for !yaml_emitter_need_more_events(emitter) {
+ event := &emitter.events[emitter.events_head]
+ if !yaml_emitter_analyze_event(emitter, event) {
+ return false
+ }
+ if !yaml_emitter_state_machine(emitter, event) {
+ return false
+ }
+ yaml_event_delete(event)
+ emitter.events_head++
+ }
+ return true
+}
+
+// Check if we need to accumulate more events before emitting.
+//
+// We accumulate extra
+// - 1 event for DOCUMENT-START
+// - 2 events for SEQUENCE-START
+// - 3 events for MAPPING-START
+//
+func yaml_emitter_need_more_events(emitter *yaml_emitter_t) bool {
+ if emitter.events_head == len(emitter.events) {
+ return true
+ }
+ var accumulate int
+ switch emitter.events[emitter.events_head].typ {
+ case yaml_DOCUMENT_START_EVENT:
+ accumulate = 1
+ break
+ case yaml_SEQUENCE_START_EVENT:
+ accumulate = 2
+ break
+ case yaml_MAPPING_START_EVENT:
+ accumulate = 3
+ break
+ default:
+ return false
+ }
+ if len(emitter.events)-emitter.events_head > accumulate {
+ return false
+ }
+ var level int
+ for i := emitter.events_head; i < len(emitter.events); i++ {
+ switch emitter.events[i].typ {
+ case yaml_STREAM_START_EVENT, yaml_DOCUMENT_START_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT:
+ level++
+ case yaml_STREAM_END_EVENT, yaml_DOCUMENT_END_EVENT, yaml_SEQUENCE_END_EVENT, yaml_MAPPING_END_EVENT:
+ level--
+ }
+ if level == 0 {
+ return false
+ }
+ }
+ return true
+}
+
+// Append a directive to the directives stack.
+func yaml_emitter_append_tag_directive(emitter *yaml_emitter_t, value *yaml_tag_directive_t, allow_duplicates bool) bool {
+ for i := 0; i < len(emitter.tag_directives); i++ {
+ if bytes.Equal(value.handle, emitter.tag_directives[i].handle) {
+ if allow_duplicates {
+ return true
+ }
+ return yaml_emitter_set_emitter_error(emitter, "duplicate %TAG directive")
+ }
+ }
+
+ // [Go] Do we actually need to copy this given garbage collection
+ // and the lack of deallocating destructors?
+ tag_copy := yaml_tag_directive_t{
+ handle: make([]byte, len(value.handle)),
+ prefix: make([]byte, len(value.prefix)),
+ }
+ copy(tag_copy.handle, value.handle)
+ copy(tag_copy.prefix, value.prefix)
+ emitter.tag_directives = append(emitter.tag_directives, tag_copy)
+ return true
+}
+
+// Increase the indentation level.
+func yaml_emitter_increase_indent(emitter *yaml_emitter_t, flow, indentless bool) bool {
+ emitter.indents = append(emitter.indents, emitter.indent)
+ if emitter.indent < 0 {
+ if flow {
+ emitter.indent = emitter.best_indent
+ } else {
+ emitter.indent = 0
+ }
+ } else if !indentless {
+ emitter.indent += emitter.best_indent
+ }
+ return true
+}
+
+// State dispatcher.
+func yaml_emitter_state_machine(emitter *yaml_emitter_t, event *yaml_event_t) bool {
+ switch emitter.state {
+ default:
+ case yaml_EMIT_STREAM_START_STATE:
+ return yaml_emitter_emit_stream_start(emitter, event)
+
+ case yaml_EMIT_FIRST_DOCUMENT_START_STATE:
+ return yaml_emitter_emit_document_start(emitter, event, true)
+
+ case yaml_EMIT_DOCUMENT_START_STATE:
+ return yaml_emitter_emit_document_start(emitter, event, false)
+
+ case yaml_EMIT_DOCUMENT_CONTENT_STATE:
+ return yaml_emitter_emit_document_content(emitter, event)
+
+ case yaml_EMIT_DOCUMENT_END_STATE:
+ return yaml_emitter_emit_document_end(emitter, event)
+
+ case yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE:
+ return yaml_emitter_emit_flow_sequence_item(emitter, event, true)
+
+ case yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE:
+ return yaml_emitter_emit_flow_sequence_item(emitter, event, false)
+
+ case yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE:
+ return yaml_emitter_emit_flow_mapping_key(emitter, event, true)
+
+ case yaml_EMIT_FLOW_MAPPING_KEY_STATE:
+ return yaml_emitter_emit_flow_mapping_key(emitter, event, false)
+
+ case yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE:
+ return yaml_emitter_emit_flow_mapping_value(emitter, event, true)
+
+ case yaml_EMIT_FLOW_MAPPING_VALUE_STATE:
+ return yaml_emitter_emit_flow_mapping_value(emitter, event, false)
+
+ case yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE:
+ return yaml_emitter_emit_block_sequence_item(emitter, event, true)
+
+ case yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE:
+ return yaml_emitter_emit_block_sequence_item(emitter, event, false)
+
+ case yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE:
+ return yaml_emitter_emit_block_mapping_key(emitter, event, true)
+
+ case yaml_EMIT_BLOCK_MAPPING_KEY_STATE:
+ return yaml_emitter_emit_block_mapping_key(emitter, event, false)
+
+ case yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE:
+ return yaml_emitter_emit_block_mapping_value(emitter, event, true)
+
+ case yaml_EMIT_BLOCK_MAPPING_VALUE_STATE:
+ return yaml_emitter_emit_block_mapping_value(emitter, event, false)
+
+ case yaml_EMIT_END_STATE:
+ return yaml_emitter_set_emitter_error(emitter, "expected nothing after STREAM-END")
+ }
+ panic("invalid emitter state")
+}
+
+// Expect STREAM-START.
+func yaml_emitter_emit_stream_start(emitter *yaml_emitter_t, event *yaml_event_t) bool {
+ if event.typ != yaml_STREAM_START_EVENT {
+ return yaml_emitter_set_emitter_error(emitter, "expected STREAM-START")
+ }
+ if emitter.encoding == yaml_ANY_ENCODING {
+ emitter.encoding = event.encoding
+ if emitter.encoding == yaml_ANY_ENCODING {
+ emitter.encoding = yaml_UTF8_ENCODING
+ }
+ }
+ if emitter.best_indent < 2 || emitter.best_indent > 9 {
+ emitter.best_indent = 2
+ }
+ if emitter.best_width >= 0 && emitter.best_width <= emitter.best_indent*2 {
+ emitter.best_width = 80
+ }
+ if emitter.best_width < 0 {
+ emitter.best_width = 1<<31 - 1
+ }
+ if emitter.line_break == yaml_ANY_BREAK {
+ emitter.line_break = yaml_LN_BREAK
+ }
+
+ emitter.indent = -1
+ emitter.line = 0
+ emitter.column = 0
+ emitter.whitespace = true
+ emitter.indention = true
+
+ if emitter.encoding != yaml_UTF8_ENCODING {
+ if !yaml_emitter_write_bom(emitter) {
+ return false
+ }
+ }
+ emitter.state = yaml_EMIT_FIRST_DOCUMENT_START_STATE
+ return true
+}
+
+// Expect DOCUMENT-START or STREAM-END.
+func yaml_emitter_emit_document_start(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool {
+
+ if event.typ == yaml_DOCUMENT_START_EVENT {
+
+ if event.version_directive != nil {
+ if !yaml_emitter_analyze_version_directive(emitter, event.version_directive) {
+ return false
+ }
+ }
+
+ for i := 0; i < len(event.tag_directives); i++ {
+ tag_directive := &event.tag_directives[i]
+ if !yaml_emitter_analyze_tag_directive(emitter, tag_directive) {
+ return false
+ }
+ if !yaml_emitter_append_tag_directive(emitter, tag_directive, false) {
+ return false
+ }
+ }
+
+ for i := 0; i < len(default_tag_directives); i++ {
+ tag_directive := &default_tag_directives[i]
+ if !yaml_emitter_append_tag_directive(emitter, tag_directive, true) {
+ return false
+ }
+ }
+
+ implicit := event.implicit
+ if !first || emitter.canonical {
+ implicit = false
+ }
+
+ if emitter.open_ended && (event.version_directive != nil || len(event.tag_directives) > 0) {
+ if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) {
+ return false
+ }
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+
+ if event.version_directive != nil {
+ implicit = false
+ if !yaml_emitter_write_indicator(emitter, []byte("%YAML"), true, false, false) {
+ return false
+ }
+ if !yaml_emitter_write_indicator(emitter, []byte("1.1"), true, false, false) {
+ return false
+ }
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+
+ if len(event.tag_directives) > 0 {
+ implicit = false
+ for i := 0; i < len(event.tag_directives); i++ {
+ tag_directive := &event.tag_directives[i]
+ if !yaml_emitter_write_indicator(emitter, []byte("%TAG"), true, false, false) {
+ return false
+ }
+ if !yaml_emitter_write_tag_handle(emitter, tag_directive.handle) {
+ return false
+ }
+ if !yaml_emitter_write_tag_content(emitter, tag_directive.prefix, true) {
+ return false
+ }
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+ }
+
+ if yaml_emitter_check_empty_document(emitter) {
+ implicit = false
+ }
+ if !implicit {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ if !yaml_emitter_write_indicator(emitter, []byte("---"), true, false, false) {
+ return false
+ }
+ if emitter.canonical {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+ }
+
+ emitter.state = yaml_EMIT_DOCUMENT_CONTENT_STATE
+ return true
+ }
+
+ if event.typ == yaml_STREAM_END_EVENT {
+ if emitter.open_ended {
+ if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) {
+ return false
+ }
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+ if !yaml_emitter_flush(emitter) {
+ return false
+ }
+ emitter.state = yaml_EMIT_END_STATE
+ return true
+ }
+
+ return yaml_emitter_set_emitter_error(emitter, "expected DOCUMENT-START or STREAM-END")
+}
+
+// Expect the root node.
+func yaml_emitter_emit_document_content(emitter *yaml_emitter_t, event *yaml_event_t) bool {
+ emitter.states = append(emitter.states, yaml_EMIT_DOCUMENT_END_STATE)
+ return yaml_emitter_emit_node(emitter, event, true, false, false, false)
+}
+
+// Expect DOCUMENT-END.
+func yaml_emitter_emit_document_end(emitter *yaml_emitter_t, event *yaml_event_t) bool {
+ if event.typ != yaml_DOCUMENT_END_EVENT {
+ return yaml_emitter_set_emitter_error(emitter, "expected DOCUMENT-END")
+ }
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ if !event.implicit {
+ // [Go] Allocate the slice elsewhere.
+ if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) {
+ return false
+ }
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+ if !yaml_emitter_flush(emitter) {
+ return false
+ }
+ emitter.state = yaml_EMIT_DOCUMENT_START_STATE
+ emitter.tag_directives = emitter.tag_directives[:0]
+ return true
+}
+
+// Expect a flow item node.
+func yaml_emitter_emit_flow_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool {
+ if first {
+ if !yaml_emitter_write_indicator(emitter, []byte{'['}, true, true, false) {
+ return false
+ }
+ if !yaml_emitter_increase_indent(emitter, true, false) {
+ return false
+ }
+ emitter.flow_level++
+ }
+
+ if event.typ == yaml_SEQUENCE_END_EVENT {
+ emitter.flow_level--
+ emitter.indent = emitter.indents[len(emitter.indents)-1]
+ emitter.indents = emitter.indents[:len(emitter.indents)-1]
+ if emitter.canonical && !first {
+ if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) {
+ return false
+ }
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+ if !yaml_emitter_write_indicator(emitter, []byte{']'}, false, false, false) {
+ return false
+ }
+ emitter.state = emitter.states[len(emitter.states)-1]
+ emitter.states = emitter.states[:len(emitter.states)-1]
+
+ return true
+ }
+
+ if !first {
+ if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) {
+ return false
+ }
+ }
+
+ if emitter.canonical || emitter.column > emitter.best_width {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+ emitter.states = append(emitter.states, yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE)
+ return yaml_emitter_emit_node(emitter, event, false, true, false, false)
+}
+
+// Expect a flow key node.
+func yaml_emitter_emit_flow_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool {
+ if first {
+ if !yaml_emitter_write_indicator(emitter, []byte{'{'}, true, true, false) {
+ return false
+ }
+ if !yaml_emitter_increase_indent(emitter, true, false) {
+ return false
+ }
+ emitter.flow_level++
+ }
+
+ if event.typ == yaml_MAPPING_END_EVENT {
+ emitter.flow_level--
+ emitter.indent = emitter.indents[len(emitter.indents)-1]
+ emitter.indents = emitter.indents[:len(emitter.indents)-1]
+ if emitter.canonical && !first {
+ if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) {
+ return false
+ }
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+ if !yaml_emitter_write_indicator(emitter, []byte{'}'}, false, false, false) {
+ return false
+ }
+ emitter.state = emitter.states[len(emitter.states)-1]
+ emitter.states = emitter.states[:len(emitter.states)-1]
+ return true
+ }
+
+ if !first {
+ if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) {
+ return false
+ }
+ }
+ if emitter.canonical || emitter.column > emitter.best_width {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+
+ if !emitter.canonical && yaml_emitter_check_simple_key(emitter) {
+ emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE)
+ return yaml_emitter_emit_node(emitter, event, false, false, true, true)
+ }
+ if !yaml_emitter_write_indicator(emitter, []byte{'?'}, true, false, false) {
+ return false
+ }
+ emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_VALUE_STATE)
+ return yaml_emitter_emit_node(emitter, event, false, false, true, false)
+}
+
+// Expect a flow value node.
+func yaml_emitter_emit_flow_mapping_value(emitter *yaml_emitter_t, event *yaml_event_t, simple bool) bool {
+ if simple {
+ if !yaml_emitter_write_indicator(emitter, []byte{':'}, false, false, false) {
+ return false
+ }
+ } else {
+ if emitter.canonical || emitter.column > emitter.best_width {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+ if !yaml_emitter_write_indicator(emitter, []byte{':'}, true, false, false) {
+ return false
+ }
+ }
+ emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_KEY_STATE)
+ return yaml_emitter_emit_node(emitter, event, false, false, true, false)
+}
+
+// Expect a block item node.
+func yaml_emitter_emit_block_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool {
+ if first {
+ if !yaml_emitter_increase_indent(emitter, false, emitter.mapping_context && !emitter.indention) {
+ return false
+ }
+ }
+ if event.typ == yaml_SEQUENCE_END_EVENT {
+ emitter.indent = emitter.indents[len(emitter.indents)-1]
+ emitter.indents = emitter.indents[:len(emitter.indents)-1]
+ emitter.state = emitter.states[len(emitter.states)-1]
+ emitter.states = emitter.states[:len(emitter.states)-1]
+ return true
+ }
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ if !yaml_emitter_write_indicator(emitter, []byte{'-'}, true, false, true) {
+ return false
+ }
+ emitter.states = append(emitter.states, yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE)
+ return yaml_emitter_emit_node(emitter, event, false, true, false, false)
+}
+
+// Expect a block key node.
+func yaml_emitter_emit_block_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool {
+ if first {
+ if !yaml_emitter_increase_indent(emitter, false, false) {
+ return false
+ }
+ }
+ if event.typ == yaml_MAPPING_END_EVENT {
+ emitter.indent = emitter.indents[len(emitter.indents)-1]
+ emitter.indents = emitter.indents[:len(emitter.indents)-1]
+ emitter.state = emitter.states[len(emitter.states)-1]
+ emitter.states = emitter.states[:len(emitter.states)-1]
+ return true
+ }
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ if yaml_emitter_check_simple_key(emitter) {
+ emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE)
+ return yaml_emitter_emit_node(emitter, event, false, false, true, true)
+ }
+ if !yaml_emitter_write_indicator(emitter, []byte{'?'}, true, false, true) {
+ return false
+ }
+ emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_VALUE_STATE)
+ return yaml_emitter_emit_node(emitter, event, false, false, true, false)
+}
+
+// Expect a block value node.
+func yaml_emitter_emit_block_mapping_value(emitter *yaml_emitter_t, event *yaml_event_t, simple bool) bool {
+ if simple {
+ if !yaml_emitter_write_indicator(emitter, []byte{':'}, false, false, false) {
+ return false
+ }
+ } else {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ if !yaml_emitter_write_indicator(emitter, []byte{':'}, true, false, true) {
+ return false
+ }
+ }
+ emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_KEY_STATE)
+ return yaml_emitter_emit_node(emitter, event, false, false, true, false)
+}
+
+// Expect a node.
+func yaml_emitter_emit_node(emitter *yaml_emitter_t, event *yaml_event_t,
+ root bool, sequence bool, mapping bool, simple_key bool) bool {
+
+ emitter.root_context = root
+ emitter.sequence_context = sequence
+ emitter.mapping_context = mapping
+ emitter.simple_key_context = simple_key
+
+ switch event.typ {
+ case yaml_ALIAS_EVENT:
+ return yaml_emitter_emit_alias(emitter, event)
+ case yaml_SCALAR_EVENT:
+ return yaml_emitter_emit_scalar(emitter, event)
+ case yaml_SEQUENCE_START_EVENT:
+ return yaml_emitter_emit_sequence_start(emitter, event)
+ case yaml_MAPPING_START_EVENT:
+ return yaml_emitter_emit_mapping_start(emitter, event)
+ default:
+ return yaml_emitter_set_emitter_error(emitter,
+ fmt.Sprintf("expected SCALAR, SEQUENCE-START, MAPPING-START, or ALIAS, but got %v", event.typ))
+ }
+}
+
+// Expect ALIAS.
+func yaml_emitter_emit_alias(emitter *yaml_emitter_t, event *yaml_event_t) bool {
+ if !yaml_emitter_process_anchor(emitter) {
+ return false
+ }
+ emitter.state = emitter.states[len(emitter.states)-1]
+ emitter.states = emitter.states[:len(emitter.states)-1]
+ return true
+}
+
+// Expect SCALAR.
+func yaml_emitter_emit_scalar(emitter *yaml_emitter_t, event *yaml_event_t) bool {
+ if !yaml_emitter_select_scalar_style(emitter, event) {
+ return false
+ }
+ if !yaml_emitter_process_anchor(emitter) {
+ return false
+ }
+ if !yaml_emitter_process_tag(emitter) {
+ return false
+ }
+ if !yaml_emitter_increase_indent(emitter, true, false) {
+ return false
+ }
+ if !yaml_emitter_process_scalar(emitter) {
+ return false
+ }
+ emitter.indent = emitter.indents[len(emitter.indents)-1]
+ emitter.indents = emitter.indents[:len(emitter.indents)-1]
+ emitter.state = emitter.states[len(emitter.states)-1]
+ emitter.states = emitter.states[:len(emitter.states)-1]
+ return true
+}
+
+// Expect SEQUENCE-START.
+func yaml_emitter_emit_sequence_start(emitter *yaml_emitter_t, event *yaml_event_t) bool {
+ if !yaml_emitter_process_anchor(emitter) {
+ return false
+ }
+ if !yaml_emitter_process_tag(emitter) {
+ return false
+ }
+ if emitter.flow_level > 0 || emitter.canonical || event.sequence_style() == yaml_FLOW_SEQUENCE_STYLE ||
+ yaml_emitter_check_empty_sequence(emitter) {
+ emitter.state = yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE
+ } else {
+ emitter.state = yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE
+ }
+ return true
+}
+
+// Expect MAPPING-START.
+func yaml_emitter_emit_mapping_start(emitter *yaml_emitter_t, event *yaml_event_t) bool {
+ if !yaml_emitter_process_anchor(emitter) {
+ return false
+ }
+ if !yaml_emitter_process_tag(emitter) {
+ return false
+ }
+ if emitter.flow_level > 0 || emitter.canonical || event.mapping_style() == yaml_FLOW_MAPPING_STYLE ||
+ yaml_emitter_check_empty_mapping(emitter) {
+ emitter.state = yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE
+ } else {
+ emitter.state = yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE
+ }
+ return true
+}
+
+// Check if the document content is an empty scalar.
+func yaml_emitter_check_empty_document(emitter *yaml_emitter_t) bool {
+ return false // [Go] Huh?
+}
+
+// Check if the next events represent an empty sequence.
+func yaml_emitter_check_empty_sequence(emitter *yaml_emitter_t) bool {
+ if len(emitter.events)-emitter.events_head < 2 {
+ return false
+ }
+ return emitter.events[emitter.events_head].typ == yaml_SEQUENCE_START_EVENT &&
+ emitter.events[emitter.events_head+1].typ == yaml_SEQUENCE_END_EVENT
+}
+
+// Check if the next events represent an empty mapping.
+func yaml_emitter_check_empty_mapping(emitter *yaml_emitter_t) bool {
+ if len(emitter.events)-emitter.events_head < 2 {
+ return false
+ }
+ return emitter.events[emitter.events_head].typ == yaml_MAPPING_START_EVENT &&
+ emitter.events[emitter.events_head+1].typ == yaml_MAPPING_END_EVENT
+}
+
+// Check if the next node can be expressed as a simple key.
+func yaml_emitter_check_simple_key(emitter *yaml_emitter_t) bool {
+ length := 0
+ switch emitter.events[emitter.events_head].typ {
+ case yaml_ALIAS_EVENT:
+ length += len(emitter.anchor_data.anchor)
+ case yaml_SCALAR_EVENT:
+ if emitter.scalar_data.multiline {
+ return false
+ }
+ length += len(emitter.anchor_data.anchor) +
+ len(emitter.tag_data.handle) +
+ len(emitter.tag_data.suffix) +
+ len(emitter.scalar_data.value)
+ case yaml_SEQUENCE_START_EVENT:
+ if !yaml_emitter_check_empty_sequence(emitter) {
+ return false
+ }
+ length += len(emitter.anchor_data.anchor) +
+ len(emitter.tag_data.handle) +
+ len(emitter.tag_data.suffix)
+ case yaml_MAPPING_START_EVENT:
+ if !yaml_emitter_check_empty_mapping(emitter) {
+ return false
+ }
+ length += len(emitter.anchor_data.anchor) +
+ len(emitter.tag_data.handle) +
+ len(emitter.tag_data.suffix)
+ default:
+ return false
+ }
+ return length <= 128
+}
+
+// Determine an acceptable scalar style.
+func yaml_emitter_select_scalar_style(emitter *yaml_emitter_t, event *yaml_event_t) bool {
+
+ no_tag := len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0
+ if no_tag && !event.implicit && !event.quoted_implicit {
+ return yaml_emitter_set_emitter_error(emitter, "neither tag nor implicit flags are specified")
+ }
+
+ style := event.scalar_style()
+ if style == yaml_ANY_SCALAR_STYLE {
+ style = yaml_PLAIN_SCALAR_STYLE
+ }
+ if emitter.canonical {
+ style = yaml_DOUBLE_QUOTED_SCALAR_STYLE
+ }
+ if emitter.simple_key_context && emitter.scalar_data.multiline {
+ style = yaml_DOUBLE_QUOTED_SCALAR_STYLE
+ }
+
+ if style == yaml_PLAIN_SCALAR_STYLE {
+ if emitter.flow_level > 0 && !emitter.scalar_data.flow_plain_allowed ||
+ emitter.flow_level == 0 && !emitter.scalar_data.block_plain_allowed {
+ style = yaml_SINGLE_QUOTED_SCALAR_STYLE
+ }
+ if len(emitter.scalar_data.value) == 0 && (emitter.flow_level > 0 || emitter.simple_key_context) {
+ style = yaml_SINGLE_QUOTED_SCALAR_STYLE
+ }
+ if no_tag && !event.implicit {
+ style = yaml_SINGLE_QUOTED_SCALAR_STYLE
+ }
+ }
+ if style == yaml_SINGLE_QUOTED_SCALAR_STYLE {
+ if !emitter.scalar_data.single_quoted_allowed {
+ style = yaml_DOUBLE_QUOTED_SCALAR_STYLE
+ }
+ }
+ if style == yaml_LITERAL_SCALAR_STYLE || style == yaml_FOLDED_SCALAR_STYLE {
+ if !emitter.scalar_data.block_allowed || emitter.flow_level > 0 || emitter.simple_key_context {
+ style = yaml_DOUBLE_QUOTED_SCALAR_STYLE
+ }
+ }
+
+ if no_tag && !event.quoted_implicit && style != yaml_PLAIN_SCALAR_STYLE {
+ emitter.tag_data.handle = []byte{'!'}
+ }
+ emitter.scalar_data.style = style
+ return true
+}
+
+// Write an anchor.
+func yaml_emitter_process_anchor(emitter *yaml_emitter_t) bool {
+ if emitter.anchor_data.anchor == nil {
+ return true
+ }
+ c := []byte{'&'}
+ if emitter.anchor_data.alias {
+ c[0] = '*'
+ }
+ if !yaml_emitter_write_indicator(emitter, c, true, false, false) {
+ return false
+ }
+ return yaml_emitter_write_anchor(emitter, emitter.anchor_data.anchor)
+}
+
+// Write a tag.
+func yaml_emitter_process_tag(emitter *yaml_emitter_t) bool {
+ if len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0 {
+ return true
+ }
+ if len(emitter.tag_data.handle) > 0 {
+ if !yaml_emitter_write_tag_handle(emitter, emitter.tag_data.handle) {
+ return false
+ }
+ if len(emitter.tag_data.suffix) > 0 {
+ if !yaml_emitter_write_tag_content(emitter, emitter.tag_data.suffix, false) {
+ return false
+ }
+ }
+ } else {
+ // [Go] Allocate these slices elsewhere.
+ if !yaml_emitter_write_indicator(emitter, []byte("!<"), true, false, false) {
+ return false
+ }
+ if !yaml_emitter_write_tag_content(emitter, emitter.tag_data.suffix, false) {
+ return false
+ }
+ if !yaml_emitter_write_indicator(emitter, []byte{'>'}, false, false, false) {
+ return false
+ }
+ }
+ return true
+}
+
+// Write a scalar.
+func yaml_emitter_process_scalar(emitter *yaml_emitter_t) bool {
+ switch emitter.scalar_data.style {
+ case yaml_PLAIN_SCALAR_STYLE:
+ return yaml_emitter_write_plain_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context)
+
+ case yaml_SINGLE_QUOTED_SCALAR_STYLE:
+ return yaml_emitter_write_single_quoted_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context)
+
+ case yaml_DOUBLE_QUOTED_SCALAR_STYLE:
+ return yaml_emitter_write_double_quoted_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context)
+
+ case yaml_LITERAL_SCALAR_STYLE:
+ return yaml_emitter_write_literal_scalar(emitter, emitter.scalar_data.value)
+
+ case yaml_FOLDED_SCALAR_STYLE:
+ return yaml_emitter_write_folded_scalar(emitter, emitter.scalar_data.value)
+ }
+ panic("unknown scalar style")
+}
+
+// Check if a %YAML directive is valid.
+func yaml_emitter_analyze_version_directive(emitter *yaml_emitter_t, version_directive *yaml_version_directive_t) bool {
+ if version_directive.major != 1 || version_directive.minor != 1 {
+ return yaml_emitter_set_emitter_error(emitter, "incompatible %YAML directive")
+ }
+ return true
+}
+
+// Check if a %TAG directive is valid.
+func yaml_emitter_analyze_tag_directive(emitter *yaml_emitter_t, tag_directive *yaml_tag_directive_t) bool {
+ handle := tag_directive.handle
+ prefix := tag_directive.prefix
+ if len(handle) == 0 {
+ return yaml_emitter_set_emitter_error(emitter, "tag handle must not be empty")
+ }
+ if handle[0] != '!' {
+ return yaml_emitter_set_emitter_error(emitter, "tag handle must start with '!'")
+ }
+ if handle[len(handle)-1] != '!' {
+ return yaml_emitter_set_emitter_error(emitter, "tag handle must end with '!'")
+ }
+ for i := 1; i < len(handle)-1; i += width(handle[i]) {
+ if !is_alpha(handle, i) {
+ return yaml_emitter_set_emitter_error(emitter, "tag handle must contain alphanumerical characters only")
+ }
+ }
+ if len(prefix) == 0 {
+ return yaml_emitter_set_emitter_error(emitter, "tag prefix must not be empty")
+ }
+ return true
+}
+
+// Check if an anchor is valid.
+func yaml_emitter_analyze_anchor(emitter *yaml_emitter_t, anchor []byte, alias bool) bool {
+ if len(anchor) == 0 {
+ problem := "anchor value must not be empty"
+ if alias {
+ problem = "alias value must not be empty"
+ }
+ return yaml_emitter_set_emitter_error(emitter, problem)
+ }
+ for i := 0; i < len(anchor); i += width(anchor[i]) {
+ if !is_alpha(anchor, i) {
+ problem := "anchor value must contain alphanumerical characters only"
+ if alias {
+ problem = "alias value must contain alphanumerical characters only"
+ }
+ return yaml_emitter_set_emitter_error(emitter, problem)
+ }
+ }
+ emitter.anchor_data.anchor = anchor
+ emitter.anchor_data.alias = alias
+ return true
+}
+
+// Check if a tag is valid.
+func yaml_emitter_analyze_tag(emitter *yaml_emitter_t, tag []byte) bool {
+ if len(tag) == 0 {
+ return yaml_emitter_set_emitter_error(emitter, "tag value must not be empty")
+ }
+ for i := 0; i < len(emitter.tag_directives); i++ {
+ tag_directive := &emitter.tag_directives[i]
+ if bytes.HasPrefix(tag, tag_directive.prefix) {
+ emitter.tag_data.handle = tag_directive.handle
+ emitter.tag_data.suffix = tag[len(tag_directive.prefix):]
+ return true
+ }
+ }
+ emitter.tag_data.suffix = tag
+ return true
+}
+
+// Check if a scalar is valid.
+func yaml_emitter_analyze_scalar(emitter *yaml_emitter_t, value []byte) bool {
+ var (
+ block_indicators = false
+ flow_indicators = false
+ line_breaks = false
+ special_characters = false
+
+ leading_space = false
+ leading_break = false
+ trailing_space = false
+ trailing_break = false
+ break_space = false
+ space_break = false
+
+ preceded_by_whitespace = false
+ followed_by_whitespace = false
+ previous_space = false
+ previous_break = false
+ )
+
+ emitter.scalar_data.value = value
+
+ if len(value) == 0 {
+ emitter.scalar_data.multiline = false
+ emitter.scalar_data.flow_plain_allowed = false
+ emitter.scalar_data.block_plain_allowed = true
+ emitter.scalar_data.single_quoted_allowed = true
+ emitter.scalar_data.block_allowed = false
+ return true
+ }
+
+ if len(value) >= 3 && ((value[0] == '-' && value[1] == '-' && value[2] == '-') || (value[0] == '.' && value[1] == '.' && value[2] == '.')) {
+ block_indicators = true
+ flow_indicators = true
+ }
+
+ preceded_by_whitespace = true
+ for i, w := 0, 0; i < len(value); i += w {
+ w = width(value[i])
+ followed_by_whitespace = i+w >= len(value) || is_blank(value, i+w)
+
+ if i == 0 {
+ switch value[i] {
+ case '#', ',', '[', ']', '{', '}', '&', '*', '!', '|', '>', '\'', '"', '%', '@', '`':
+ flow_indicators = true
+ block_indicators = true
+ case '?', ':':
+ flow_indicators = true
+ if followed_by_whitespace {
+ block_indicators = true
+ }
+ case '-':
+ if followed_by_whitespace {
+ flow_indicators = true
+ block_indicators = true
+ }
+ }
+ } else {
+ switch value[i] {
+ case ',', '?', '[', ']', '{', '}':
+ flow_indicators = true
+ case ':':
+ flow_indicators = true
+ if followed_by_whitespace {
+ block_indicators = true
+ }
+ case '#':
+ if preceded_by_whitespace {
+ flow_indicators = true
+ block_indicators = true
+ }
+ }
+ }
+
+ if !is_printable(value, i) || !is_ascii(value, i) && !emitter.unicode {
+ special_characters = true
+ }
+ if is_space(value, i) {
+ if i == 0 {
+ leading_space = true
+ }
+ if i+width(value[i]) == len(value) {
+ trailing_space = true
+ }
+ if previous_break {
+ break_space = true
+ }
+ previous_space = true
+ previous_break = false
+ } else if is_break(value, i) {
+ line_breaks = true
+ if i == 0 {
+ leading_break = true
+ }
+ if i+width(value[i]) == len(value) {
+ trailing_break = true
+ }
+ if previous_space {
+ space_break = true
+ }
+ previous_space = false
+ previous_break = true
+ } else {
+ previous_space = false
+ previous_break = false
+ }
+
+ // [Go]: Why 'z'? Couldn't be the end of the string as that's the loop condition.
+ preceded_by_whitespace = is_blankz(value, i)
+ }
+
+ emitter.scalar_data.multiline = line_breaks
+ emitter.scalar_data.flow_plain_allowed = true
+ emitter.scalar_data.block_plain_allowed = true
+ emitter.scalar_data.single_quoted_allowed = true
+ emitter.scalar_data.block_allowed = true
+
+ if leading_space || leading_break || trailing_space || trailing_break {
+ emitter.scalar_data.flow_plain_allowed = false
+ emitter.scalar_data.block_plain_allowed = false
+ }
+ if trailing_space {
+ emitter.scalar_data.block_allowed = false
+ }
+ if break_space {
+ emitter.scalar_data.flow_plain_allowed = false
+ emitter.scalar_data.block_plain_allowed = false
+ emitter.scalar_data.single_quoted_allowed = false
+ }
+ if space_break || special_characters {
+ emitter.scalar_data.flow_plain_allowed = false
+ emitter.scalar_data.block_plain_allowed = false
+ emitter.scalar_data.single_quoted_allowed = false
+ emitter.scalar_data.block_allowed = false
+ }
+ if line_breaks {
+ emitter.scalar_data.flow_plain_allowed = false
+ emitter.scalar_data.block_plain_allowed = false
+ }
+ if flow_indicators {
+ emitter.scalar_data.flow_plain_allowed = false
+ }
+ if block_indicators {
+ emitter.scalar_data.block_plain_allowed = false
+ }
+ return true
+}
+
+// Check if the event data is valid.
+func yaml_emitter_analyze_event(emitter *yaml_emitter_t, event *yaml_event_t) bool {
+
+ emitter.anchor_data.anchor = nil
+ emitter.tag_data.handle = nil
+ emitter.tag_data.suffix = nil
+ emitter.scalar_data.value = nil
+
+ switch event.typ {
+ case yaml_ALIAS_EVENT:
+ if !yaml_emitter_analyze_anchor(emitter, event.anchor, true) {
+ return false
+ }
+
+ case yaml_SCALAR_EVENT:
+ if len(event.anchor) > 0 {
+ if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) {
+ return false
+ }
+ }
+ if len(event.tag) > 0 && (emitter.canonical || (!event.implicit && !event.quoted_implicit)) {
+ if !yaml_emitter_analyze_tag(emitter, event.tag) {
+ return false
+ }
+ }
+ if !yaml_emitter_analyze_scalar(emitter, event.value) {
+ return false
+ }
+
+ case yaml_SEQUENCE_START_EVENT:
+ if len(event.anchor) > 0 {
+ if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) {
+ return false
+ }
+ }
+ if len(event.tag) > 0 && (emitter.canonical || !event.implicit) {
+ if !yaml_emitter_analyze_tag(emitter, event.tag) {
+ return false
+ }
+ }
+
+ case yaml_MAPPING_START_EVENT:
+ if len(event.anchor) > 0 {
+ if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) {
+ return false
+ }
+ }
+ if len(event.tag) > 0 && (emitter.canonical || !event.implicit) {
+ if !yaml_emitter_analyze_tag(emitter, event.tag) {
+ return false
+ }
+ }
+ }
+ return true
+}
+
+// Write the BOM character.
+func yaml_emitter_write_bom(emitter *yaml_emitter_t) bool {
+ if !flush(emitter) {
+ return false
+ }
+ pos := emitter.buffer_pos
+ emitter.buffer[pos+0] = '\xEF'
+ emitter.buffer[pos+1] = '\xBB'
+ emitter.buffer[pos+2] = '\xBF'
+ emitter.buffer_pos += 3
+ return true
+}
+
+func yaml_emitter_write_indent(emitter *yaml_emitter_t) bool {
+ indent := emitter.indent
+ if indent < 0 {
+ indent = 0
+ }
+ if !emitter.indention || emitter.column > indent || (emitter.column == indent && !emitter.whitespace) {
+ if !put_break(emitter) {
+ return false
+ }
+ }
+ for emitter.column < indent {
+ if !put(emitter, ' ') {
+ return false
+ }
+ }
+ emitter.whitespace = true
+ emitter.indention = true
+ return true
+}
+
+func yaml_emitter_write_indicator(emitter *yaml_emitter_t, indicator []byte, need_whitespace, is_whitespace, is_indention bool) bool {
+ if need_whitespace && !emitter.whitespace {
+ if !put(emitter, ' ') {
+ return false
+ }
+ }
+ if !write_all(emitter, indicator) {
+ return false
+ }
+ emitter.whitespace = is_whitespace
+ emitter.indention = (emitter.indention && is_indention)
+ emitter.open_ended = false
+ return true
+}
+
+func yaml_emitter_write_anchor(emitter *yaml_emitter_t, value []byte) bool {
+ if !write_all(emitter, value) {
+ return false
+ }
+ emitter.whitespace = false
+ emitter.indention = false
+ return true
+}
+
+func yaml_emitter_write_tag_handle(emitter *yaml_emitter_t, value []byte) bool {
+ if !emitter.whitespace {
+ if !put(emitter, ' ') {
+ return false
+ }
+ }
+ if !write_all(emitter, value) {
+ return false
+ }
+ emitter.whitespace = false
+ emitter.indention = false
+ return true
+}
+
+func yaml_emitter_write_tag_content(emitter *yaml_emitter_t, value []byte, need_whitespace bool) bool {
+ if need_whitespace && !emitter.whitespace {
+ if !put(emitter, ' ') {
+ return false
+ }
+ }
+ for i := 0; i < len(value); {
+ var must_write bool
+ switch value[i] {
+ case ';', '/', '?', ':', '@', '&', '=', '+', '$', ',', '_', '.', '~', '*', '\'', '(', ')', '[', ']':
+ must_write = true
+ default:
+ must_write = is_alpha(value, i)
+ }
+ if must_write {
+ if !write(emitter, value, &i) {
+ return false
+ }
+ } else {
+ w := width(value[i])
+ for k := 0; k < w; k++ {
+ octet := value[i]
+ i++
+ if !put(emitter, '%') {
+ return false
+ }
+
+ c := octet >> 4
+ if c < 10 {
+ c += '0'
+ } else {
+ c += 'A' - 10
+ }
+ if !put(emitter, c) {
+ return false
+ }
+
+ c = octet & 0x0f
+ if c < 10 {
+ c += '0'
+ } else {
+ c += 'A' - 10
+ }
+ if !put(emitter, c) {
+ return false
+ }
+ }
+ }
+ }
+ emitter.whitespace = false
+ emitter.indention = false
+ return true
+}
+
+func yaml_emitter_write_plain_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool {
+ if !emitter.whitespace {
+ if !put(emitter, ' ') {
+ return false
+ }
+ }
+
+ spaces := false
+ breaks := false
+ for i := 0; i < len(value); {
+ if is_space(value, i) {
+ if allow_breaks && !spaces && emitter.column > emitter.best_width && !is_space(value, i+1) {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ i += width(value[i])
+ } else {
+ if !write(emitter, value, &i) {
+ return false
+ }
+ }
+ spaces = true
+ } else if is_break(value, i) {
+ if !breaks && value[i] == '\n' {
+ if !put_break(emitter) {
+ return false
+ }
+ }
+ if !write_break(emitter, value, &i) {
+ return false
+ }
+ emitter.indention = true
+ breaks = true
+ } else {
+ if breaks {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+ if !write(emitter, value, &i) {
+ return false
+ }
+ emitter.indention = false
+ spaces = false
+ breaks = false
+ }
+ }
+
+ emitter.whitespace = false
+ emitter.indention = false
+ if emitter.root_context {
+ emitter.open_ended = true
+ }
+
+ return true
+}
+
+func yaml_emitter_write_single_quoted_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool {
+
+ if !yaml_emitter_write_indicator(emitter, []byte{'\''}, true, false, false) {
+ return false
+ }
+
+ spaces := false
+ breaks := false
+ for i := 0; i < len(value); {
+ if is_space(value, i) {
+ if allow_breaks && !spaces && emitter.column > emitter.best_width && i > 0 && i < len(value)-1 && !is_space(value, i+1) {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ i += width(value[i])
+ } else {
+ if !write(emitter, value, &i) {
+ return false
+ }
+ }
+ spaces = true
+ } else if is_break(value, i) {
+ if !breaks && value[i] == '\n' {
+ if !put_break(emitter) {
+ return false
+ }
+ }
+ if !write_break(emitter, value, &i) {
+ return false
+ }
+ emitter.indention = true
+ breaks = true
+ } else {
+ if breaks {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+ if value[i] == '\'' {
+ if !put(emitter, '\'') {
+ return false
+ }
+ }
+ if !write(emitter, value, &i) {
+ return false
+ }
+ emitter.indention = false
+ spaces = false
+ breaks = false
+ }
+ }
+ if !yaml_emitter_write_indicator(emitter, []byte{'\''}, false, false, false) {
+ return false
+ }
+ emitter.whitespace = false
+ emitter.indention = false
+ return true
+}
+
+func yaml_emitter_write_double_quoted_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool {
+ spaces := false
+ if !yaml_emitter_write_indicator(emitter, []byte{'"'}, true, false, false) {
+ return false
+ }
+
+ for i := 0; i < len(value); {
+ if !is_printable(value, i) || (!emitter.unicode && !is_ascii(value, i)) ||
+ is_bom(value, i) || is_break(value, i) ||
+ value[i] == '"' || value[i] == '\\' {
+
+ octet := value[i]
+
+ var w int
+ var v rune
+ switch {
+ case octet&0x80 == 0x00:
+ w, v = 1, rune(octet&0x7F)
+ case octet&0xE0 == 0xC0:
+ w, v = 2, rune(octet&0x1F)
+ case octet&0xF0 == 0xE0:
+ w, v = 3, rune(octet&0x0F)
+ case octet&0xF8 == 0xF0:
+ w, v = 4, rune(octet&0x07)
+ }
+ for k := 1; k < w; k++ {
+ octet = value[i+k]
+ v = (v << 6) + (rune(octet) & 0x3F)
+ }
+ i += w
+
+ if !put(emitter, '\\') {
+ return false
+ }
+
+ var ok bool
+ switch v {
+ case 0x00:
+ ok = put(emitter, '0')
+ case 0x07:
+ ok = put(emitter, 'a')
+ case 0x08:
+ ok = put(emitter, 'b')
+ case 0x09:
+ ok = put(emitter, 't')
+ case 0x0A:
+ ok = put(emitter, 'n')
+ case 0x0b:
+ ok = put(emitter, 'v')
+ case 0x0c:
+ ok = put(emitter, 'f')
+ case 0x0d:
+ ok = put(emitter, 'r')
+ case 0x1b:
+ ok = put(emitter, 'e')
+ case 0x22:
+ ok = put(emitter, '"')
+ case 0x5c:
+ ok = put(emitter, '\\')
+ case 0x85:
+ ok = put(emitter, 'N')
+ case 0xA0:
+ ok = put(emitter, '_')
+ case 0x2028:
+ ok = put(emitter, 'L')
+ case 0x2029:
+ ok = put(emitter, 'P')
+ default:
+ if v <= 0xFF {
+ ok = put(emitter, 'x')
+ w = 2
+ } else if v <= 0xFFFF {
+ ok = put(emitter, 'u')
+ w = 4
+ } else {
+ ok = put(emitter, 'U')
+ w = 8
+ }
+ for k := (w - 1) * 4; ok && k >= 0; k -= 4 {
+ digit := byte((v >> uint(k)) & 0x0F)
+ if digit < 10 {
+ ok = put(emitter, digit+'0')
+ } else {
+ ok = put(emitter, digit+'A'-10)
+ }
+ }
+ }
+ if !ok {
+ return false
+ }
+ spaces = false
+ } else if is_space(value, i) {
+ if allow_breaks && !spaces && emitter.column > emitter.best_width && i > 0 && i < len(value)-1 {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ if is_space(value, i+1) {
+ if !put(emitter, '\\') {
+ return false
+ }
+ }
+ i += width(value[i])
+ } else if !write(emitter, value, &i) {
+ return false
+ }
+ spaces = true
+ } else {
+ if !write(emitter, value, &i) {
+ return false
+ }
+ spaces = false
+ }
+ }
+ if !yaml_emitter_write_indicator(emitter, []byte{'"'}, false, false, false) {
+ return false
+ }
+ emitter.whitespace = false
+ emitter.indention = false
+ return true
+}
+
+func yaml_emitter_write_block_scalar_hints(emitter *yaml_emitter_t, value []byte) bool {
+ if is_space(value, 0) || is_break(value, 0) {
+ indent_hint := []byte{'0' + byte(emitter.best_indent)}
+ if !yaml_emitter_write_indicator(emitter, indent_hint, false, false, false) {
+ return false
+ }
+ }
+
+ emitter.open_ended = false
+
+ var chomp_hint [1]byte
+ if len(value) == 0 {
+ chomp_hint[0] = '-'
+ } else {
+ i := len(value) - 1
+ for value[i]&0xC0 == 0x80 {
+ i--
+ }
+ if !is_break(value, i) {
+ chomp_hint[0] = '-'
+ } else if i == 0 {
+ chomp_hint[0] = '+'
+ emitter.open_ended = true
+ } else {
+ i--
+ for value[i]&0xC0 == 0x80 {
+ i--
+ }
+ if is_break(value, i) {
+ chomp_hint[0] = '+'
+ emitter.open_ended = true
+ }
+ }
+ }
+ if chomp_hint[0] != 0 {
+ if !yaml_emitter_write_indicator(emitter, chomp_hint[:], false, false, false) {
+ return false
+ }
+ }
+ return true
+}
+
+func yaml_emitter_write_literal_scalar(emitter *yaml_emitter_t, value []byte) bool {
+ if !yaml_emitter_write_indicator(emitter, []byte{'|'}, true, false, false) {
+ return false
+ }
+ if !yaml_emitter_write_block_scalar_hints(emitter, value) {
+ return false
+ }
+ if !put_break(emitter) {
+ return false
+ }
+ emitter.indention = true
+ emitter.whitespace = true
+ breaks := true
+ for i := 0; i < len(value); {
+ if is_break(value, i) {
+ if !write_break(emitter, value, &i) {
+ return false
+ }
+ emitter.indention = true
+ breaks = true
+ } else {
+ if breaks {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+ if !write(emitter, value, &i) {
+ return false
+ }
+ emitter.indention = false
+ breaks = false
+ }
+ }
+
+ return true
+}
+
+func yaml_emitter_write_folded_scalar(emitter *yaml_emitter_t, value []byte) bool {
+ if !yaml_emitter_write_indicator(emitter, []byte{'>'}, true, false, false) {
+ return false
+ }
+ if !yaml_emitter_write_block_scalar_hints(emitter, value) {
+ return false
+ }
+
+ if !put_break(emitter) {
+ return false
+ }
+ emitter.indention = true
+ emitter.whitespace = true
+
+ breaks := true
+ leading_spaces := true
+ for i := 0; i < len(value); {
+ if is_break(value, i) {
+ if !breaks && !leading_spaces && value[i] == '\n' {
+ k := 0
+ for is_break(value, k) {
+ k += width(value[k])
+ }
+ if !is_blankz(value, k) {
+ if !put_break(emitter) {
+ return false
+ }
+ }
+ }
+ if !write_break(emitter, value, &i) {
+ return false
+ }
+ emitter.indention = true
+ breaks = true
+ } else {
+ if breaks {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ leading_spaces = is_blank(value, i)
+ }
+ if !breaks && is_space(value, i) && !is_space(value, i+1) && emitter.column > emitter.best_width {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ i += width(value[i])
+ } else {
+ if !write(emitter, value, &i) {
+ return false
+ }
+ }
+ emitter.indention = false
+ breaks = false
+ }
+ }
+ return true
+}
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/encode.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/encode.go
new file mode 100644
index 000000000..0ee738e11
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/encode.go
@@ -0,0 +1,390 @@
+package yaml
+
+import (
+ "encoding"
+ "fmt"
+ "io"
+ "reflect"
+ "regexp"
+ "sort"
+ "strconv"
+ "strings"
+ "time"
+ "unicode/utf8"
+)
+
+// jsonNumber is the interface of the encoding/json.Number datatype.
+// Repeating the interface here avoids a dependency on encoding/json, and also
+// supports other libraries like jsoniter, which use a similar datatype with
+// the same interface. Detecting this interface is useful when dealing with
+// structures containing json.Number, which is a string under the hood. The
+// encoder should prefer the use of Int64(), Float64() and string(), in that
+// order, when encoding this type.
+type jsonNumber interface {
+ Float64() (float64, error)
+ Int64() (int64, error)
+ String() string
+}
+
+type encoder struct {
+ emitter yaml_emitter_t
+ event yaml_event_t
+ out []byte
+ flow bool
+ // doneInit holds whether the initial stream_start_event has been
+ // emitted.
+ doneInit bool
+}
+
+func newEncoder() *encoder {
+ e := &encoder{}
+ yaml_emitter_initialize(&e.emitter)
+ yaml_emitter_set_output_string(&e.emitter, &e.out)
+ yaml_emitter_set_unicode(&e.emitter, true)
+ return e
+}
+
+func newEncoderWithWriter(w io.Writer) *encoder {
+ e := &encoder{}
+ yaml_emitter_initialize(&e.emitter)
+ yaml_emitter_set_output_writer(&e.emitter, w)
+ yaml_emitter_set_unicode(&e.emitter, true)
+ return e
+}
+
+func (e *encoder) init() {
+ if e.doneInit {
+ return
+ }
+ yaml_stream_start_event_initialize(&e.event, yaml_UTF8_ENCODING)
+ e.emit()
+ e.doneInit = true
+}
+
+func (e *encoder) finish() {
+ e.emitter.open_ended = false
+ yaml_stream_end_event_initialize(&e.event)
+ e.emit()
+}
+
+func (e *encoder) destroy() {
+ yaml_emitter_delete(&e.emitter)
+}
+
+func (e *encoder) emit() {
+ // This will internally delete the e.event value.
+ e.must(yaml_emitter_emit(&e.emitter, &e.event))
+}
+
+func (e *encoder) must(ok bool) {
+ if !ok {
+ msg := e.emitter.problem
+ if msg == "" {
+ msg = "unknown problem generating YAML content"
+ }
+ failf("%s", msg)
+ }
+}
+
+func (e *encoder) marshalDoc(tag string, in reflect.Value) {
+ e.init()
+ yaml_document_start_event_initialize(&e.event, nil, nil, true)
+ e.emit()
+ e.marshal(tag, in)
+ yaml_document_end_event_initialize(&e.event, true)
+ e.emit()
+}
+
+func (e *encoder) marshal(tag string, in reflect.Value) {
+ if !in.IsValid() || in.Kind() == reflect.Ptr && in.IsNil() {
+ e.nilv()
+ return
+ }
+ iface := in.Interface()
+ switch m := iface.(type) {
+ case jsonNumber:
+ integer, err := m.Int64()
+ if err == nil {
+ // In this case the json.Number is a valid int64
+ in = reflect.ValueOf(integer)
+ break
+ }
+ float, err := m.Float64()
+ if err == nil {
+ // In this case the json.Number is a valid float64
+ in = reflect.ValueOf(float)
+ break
+ }
+ // fallback case - no number could be obtained
+ in = reflect.ValueOf(m.String())
+ case time.Time, *time.Time:
+ // Although time.Time implements TextMarshaler,
+ // we don't want to treat it as a string for YAML
+ // purposes because YAML has special support for
+ // timestamps.
+ case Marshaler:
+ v, err := m.MarshalYAML()
+ if err != nil {
+ fail(err)
+ }
+ if v == nil {
+ e.nilv()
+ return
+ }
+ in = reflect.ValueOf(v)
+ case encoding.TextMarshaler:
+ text, err := m.MarshalText()
+ if err != nil {
+ fail(err)
+ }
+ in = reflect.ValueOf(string(text))
+ case nil:
+ e.nilv()
+ return
+ }
+ switch in.Kind() {
+ case reflect.Interface:
+ e.marshal(tag, in.Elem())
+ case reflect.Map:
+ e.mapv(tag, in)
+ case reflect.Ptr:
+ if in.Type() == ptrTimeType {
+ e.timev(tag, in.Elem())
+ } else {
+ e.marshal(tag, in.Elem())
+ }
+ case reflect.Struct:
+ if in.Type() == timeType {
+ e.timev(tag, in)
+ } else {
+ e.structv(tag, in)
+ }
+ case reflect.Slice, reflect.Array:
+ if in.Type().Elem() == mapItemType {
+ e.itemsv(tag, in)
+ } else {
+ e.slicev(tag, in)
+ }
+ case reflect.String:
+ e.stringv(tag, in)
+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+ if in.Type() == durationType {
+ e.stringv(tag, reflect.ValueOf(iface.(time.Duration).String()))
+ } else {
+ e.intv(tag, in)
+ }
+ case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
+ e.uintv(tag, in)
+ case reflect.Float32, reflect.Float64:
+ e.floatv(tag, in)
+ case reflect.Bool:
+ e.boolv(tag, in)
+ default:
+ panic("cannot marshal type: " + in.Type().String())
+ }
+}
+
+func (e *encoder) mapv(tag string, in reflect.Value) {
+ e.mappingv(tag, func() {
+ keys := keyList(in.MapKeys())
+ sort.Sort(keys)
+ for _, k := range keys {
+ e.marshal("", k)
+ e.marshal("", in.MapIndex(k))
+ }
+ })
+}
+
+func (e *encoder) itemsv(tag string, in reflect.Value) {
+ e.mappingv(tag, func() {
+ slice := in.Convert(reflect.TypeOf([]MapItem{})).Interface().([]MapItem)
+ for _, item := range slice {
+ e.marshal("", reflect.ValueOf(item.Key))
+ e.marshal("", reflect.ValueOf(item.Value))
+ }
+ })
+}
+
+func (e *encoder) structv(tag string, in reflect.Value) {
+ sinfo, err := getStructInfo(in.Type())
+ if err != nil {
+ panic(err)
+ }
+ e.mappingv(tag, func() {
+ for _, info := range sinfo.FieldsList {
+ var value reflect.Value
+ if info.Inline == nil {
+ value = in.Field(info.Num)
+ } else {
+ value = in.FieldByIndex(info.Inline)
+ }
+ if info.OmitEmpty && isZero(value) {
+ continue
+ }
+ e.marshal("", reflect.ValueOf(info.Key))
+ e.flow = info.Flow
+ e.marshal("", value)
+ }
+ if sinfo.InlineMap >= 0 {
+ m := in.Field(sinfo.InlineMap)
+ if m.Len() > 0 {
+ e.flow = false
+ keys := keyList(m.MapKeys())
+ sort.Sort(keys)
+ for _, k := range keys {
+ if _, found := sinfo.FieldsMap[k.String()]; found {
+ panic(fmt.Sprintf("Can't have key %q in inlined map; conflicts with struct field", k.String()))
+ }
+ e.marshal("", k)
+ e.flow = false
+ e.marshal("", m.MapIndex(k))
+ }
+ }
+ }
+ })
+}
+
+func (e *encoder) mappingv(tag string, f func()) {
+ implicit := tag == ""
+ style := yaml_BLOCK_MAPPING_STYLE
+ if e.flow {
+ e.flow = false
+ style = yaml_FLOW_MAPPING_STYLE
+ }
+ yaml_mapping_start_event_initialize(&e.event, nil, []byte(tag), implicit, style)
+ e.emit()
+ f()
+ yaml_mapping_end_event_initialize(&e.event)
+ e.emit()
+}
+
+func (e *encoder) slicev(tag string, in reflect.Value) {
+ implicit := tag == ""
+ style := yaml_BLOCK_SEQUENCE_STYLE
+ if e.flow {
+ e.flow = false
+ style = yaml_FLOW_SEQUENCE_STYLE
+ }
+ e.must(yaml_sequence_start_event_initialize(&e.event, nil, []byte(tag), implicit, style))
+ e.emit()
+ n := in.Len()
+ for i := 0; i < n; i++ {
+ e.marshal("", in.Index(i))
+ }
+ e.must(yaml_sequence_end_event_initialize(&e.event))
+ e.emit()
+}
+
+// isBase60 returns whether s is in base 60 notation as defined in YAML 1.1.
+//
+// The base 60 float notation in YAML 1.1 is a terrible idea and is unsupported
+// in YAML 1.2 and by this package, but these should be marshalled quoted for
+// the time being for compatibility with other parsers.
+func isBase60Float(s string) (result bool) {
+ // Fast path.
+ if s == "" {
+ return false
+ }
+ c := s[0]
+ if !(c == '+' || c == '-' || c >= '0' && c <= '9') || strings.IndexByte(s, ':') < 0 {
+ return false
+ }
+ // Do the full match.
+ return base60float.MatchString(s)
+}
+
+// From http://yaml.org/type/float.html, except the regular expression there
+// is bogus. In practice parsers do not enforce the "\.[0-9_]*" suffix.
+var base60float = regexp.MustCompile(`^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+(?:\.[0-9_]*)?$`)
+
+func (e *encoder) stringv(tag string, in reflect.Value) {
+ var style yaml_scalar_style_t
+ s := in.String()
+ canUsePlain := true
+ switch {
+ case !utf8.ValidString(s):
+ if tag == yaml_BINARY_TAG {
+ failf("explicitly tagged !!binary data must be base64-encoded")
+ }
+ if tag != "" {
+ failf("cannot marshal invalid UTF-8 data as %s", shortTag(tag))
+ }
+ // It can't be encoded directly as YAML so use a binary tag
+ // and encode it as base64.
+ tag = yaml_BINARY_TAG
+ s = encodeBase64(s)
+ case tag == "":
+ // Check to see if it would resolve to a specific
+ // tag when encoded unquoted. If it doesn't,
+ // there's no need to quote it.
+ rtag, _ := resolve("", s)
+ canUsePlain = rtag == yaml_STR_TAG && !isBase60Float(s)
+ }
+ // Note: it's possible for user code to emit invalid YAML
+ // if they explicitly specify a tag and a string containing
+ // text that's incompatible with that tag.
+ switch {
+ case strings.Contains(s, "\n"):
+ style = yaml_LITERAL_SCALAR_STYLE
+ case canUsePlain:
+ style = yaml_PLAIN_SCALAR_STYLE
+ default:
+ style = yaml_DOUBLE_QUOTED_SCALAR_STYLE
+ }
+ e.emitScalar(s, "", tag, style)
+}
+
+func (e *encoder) boolv(tag string, in reflect.Value) {
+ var s string
+ if in.Bool() {
+ s = "true"
+ } else {
+ s = "false"
+ }
+ e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE)
+}
+
+func (e *encoder) intv(tag string, in reflect.Value) {
+ s := strconv.FormatInt(in.Int(), 10)
+ e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE)
+}
+
+func (e *encoder) uintv(tag string, in reflect.Value) {
+ s := strconv.FormatUint(in.Uint(), 10)
+ e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE)
+}
+
+func (e *encoder) timev(tag string, in reflect.Value) {
+ t := in.Interface().(time.Time)
+ s := t.Format(time.RFC3339Nano)
+ e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE)
+}
+
+func (e *encoder) floatv(tag string, in reflect.Value) {
+ // Issue #352: When formatting, use the precision of the underlying value
+ precision := 64
+ if in.Kind() == reflect.Float32 {
+ precision = 32
+ }
+
+ s := strconv.FormatFloat(in.Float(), 'g', -1, precision)
+ switch s {
+ case "+Inf":
+ s = ".inf"
+ case "-Inf":
+ s = "-.inf"
+ case "NaN":
+ s = ".nan"
+ }
+ e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE)
+}
+
+func (e *encoder) nilv() {
+ e.emitScalar("null", "", "", yaml_PLAIN_SCALAR_STYLE)
+}
+
+func (e *encoder) emitScalar(value, anchor, tag string, style yaml_scalar_style_t) {
+ implicit := tag == ""
+ e.must(yaml_scalar_event_initialize(&e.event, []byte(anchor), []byte(tag), []byte(value), implicit, implicit, style))
+ e.emit()
+}
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/parserc.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/parserc.go
new file mode 100644
index 000000000..81d05dfe5
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/parserc.go
@@ -0,0 +1,1095 @@
+package yaml
+
+import (
+ "bytes"
+)
+
+// The parser implements the following grammar:
+//
+// stream ::= STREAM-START implicit_document? explicit_document* STREAM-END
+// implicit_document ::= block_node DOCUMENT-END*
+// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
+// block_node_or_indentless_sequence ::=
+// ALIAS
+// | properties (block_content | indentless_block_sequence)?
+// | block_content
+// | indentless_block_sequence
+// block_node ::= ALIAS
+// | properties block_content?
+// | block_content
+// flow_node ::= ALIAS
+// | properties flow_content?
+// | flow_content
+// properties ::= TAG ANCHOR? | ANCHOR TAG?
+// block_content ::= block_collection | flow_collection | SCALAR
+// flow_content ::= flow_collection | SCALAR
+// block_collection ::= block_sequence | block_mapping
+// flow_collection ::= flow_sequence | flow_mapping
+// block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END
+// indentless_sequence ::= (BLOCK-ENTRY block_node?)+
+// block_mapping ::= BLOCK-MAPPING_START
+// ((KEY block_node_or_indentless_sequence?)?
+// (VALUE block_node_or_indentless_sequence?)?)*
+// BLOCK-END
+// flow_sequence ::= FLOW-SEQUENCE-START
+// (flow_sequence_entry FLOW-ENTRY)*
+// flow_sequence_entry?
+// FLOW-SEQUENCE-END
+// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
+// flow_mapping ::= FLOW-MAPPING-START
+// (flow_mapping_entry FLOW-ENTRY)*
+// flow_mapping_entry?
+// FLOW-MAPPING-END
+// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
+
+// Peek the next token in the token queue.
+func peek_token(parser *yaml_parser_t) *yaml_token_t {
+ if parser.token_available || yaml_parser_fetch_more_tokens(parser) {
+ return &parser.tokens[parser.tokens_head]
+ }
+ return nil
+}
+
+// Remove the next token from the queue (must be called after peek_token).
+func skip_token(parser *yaml_parser_t) {
+ parser.token_available = false
+ parser.tokens_parsed++
+ parser.stream_end_produced = parser.tokens[parser.tokens_head].typ == yaml_STREAM_END_TOKEN
+ parser.tokens_head++
+}
+
+// Get the next event.
+func yaml_parser_parse(parser *yaml_parser_t, event *yaml_event_t) bool {
+ // Erase the event object.
+ *event = yaml_event_t{}
+
+ // No events after the end of the stream or error.
+ if parser.stream_end_produced || parser.error != yaml_NO_ERROR || parser.state == yaml_PARSE_END_STATE {
+ return true
+ }
+
+ // Generate the next event.
+ return yaml_parser_state_machine(parser, event)
+}
+
+// Set parser error.
+func yaml_parser_set_parser_error(parser *yaml_parser_t, problem string, problem_mark yaml_mark_t) bool {
+ parser.error = yaml_PARSER_ERROR
+ parser.problem = problem
+ parser.problem_mark = problem_mark
+ return false
+}
+
+func yaml_parser_set_parser_error_context(parser *yaml_parser_t, context string, context_mark yaml_mark_t, problem string, problem_mark yaml_mark_t) bool {
+ parser.error = yaml_PARSER_ERROR
+ parser.context = context
+ parser.context_mark = context_mark
+ parser.problem = problem
+ parser.problem_mark = problem_mark
+ return false
+}
+
+// State dispatcher.
+func yaml_parser_state_machine(parser *yaml_parser_t, event *yaml_event_t) bool {
+ //trace("yaml_parser_state_machine", "state:", parser.state.String())
+
+ switch parser.state {
+ case yaml_PARSE_STREAM_START_STATE:
+ return yaml_parser_parse_stream_start(parser, event)
+
+ case yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE:
+ return yaml_parser_parse_document_start(parser, event, true)
+
+ case yaml_PARSE_DOCUMENT_START_STATE:
+ return yaml_parser_parse_document_start(parser, event, false)
+
+ case yaml_PARSE_DOCUMENT_CONTENT_STATE:
+ return yaml_parser_parse_document_content(parser, event)
+
+ case yaml_PARSE_DOCUMENT_END_STATE:
+ return yaml_parser_parse_document_end(parser, event)
+
+ case yaml_PARSE_BLOCK_NODE_STATE:
+ return yaml_parser_parse_node(parser, event, true, false)
+
+ case yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE:
+ return yaml_parser_parse_node(parser, event, true, true)
+
+ case yaml_PARSE_FLOW_NODE_STATE:
+ return yaml_parser_parse_node(parser, event, false, false)
+
+ case yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE:
+ return yaml_parser_parse_block_sequence_entry(parser, event, true)
+
+ case yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE:
+ return yaml_parser_parse_block_sequence_entry(parser, event, false)
+
+ case yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE:
+ return yaml_parser_parse_indentless_sequence_entry(parser, event)
+
+ case yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE:
+ return yaml_parser_parse_block_mapping_key(parser, event, true)
+
+ case yaml_PARSE_BLOCK_MAPPING_KEY_STATE:
+ return yaml_parser_parse_block_mapping_key(parser, event, false)
+
+ case yaml_PARSE_BLOCK_MAPPING_VALUE_STATE:
+ return yaml_parser_parse_block_mapping_value(parser, event)
+
+ case yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE:
+ return yaml_parser_parse_flow_sequence_entry(parser, event, true)
+
+ case yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE:
+ return yaml_parser_parse_flow_sequence_entry(parser, event, false)
+
+ case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE:
+ return yaml_parser_parse_flow_sequence_entry_mapping_key(parser, event)
+
+ case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE:
+ return yaml_parser_parse_flow_sequence_entry_mapping_value(parser, event)
+
+ case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE:
+ return yaml_parser_parse_flow_sequence_entry_mapping_end(parser, event)
+
+ case yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE:
+ return yaml_parser_parse_flow_mapping_key(parser, event, true)
+
+ case yaml_PARSE_FLOW_MAPPING_KEY_STATE:
+ return yaml_parser_parse_flow_mapping_key(parser, event, false)
+
+ case yaml_PARSE_FLOW_MAPPING_VALUE_STATE:
+ return yaml_parser_parse_flow_mapping_value(parser, event, false)
+
+ case yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE:
+ return yaml_parser_parse_flow_mapping_value(parser, event, true)
+
+ default:
+ panic("invalid parser state")
+ }
+}
+
+// Parse the production:
+// stream ::= STREAM-START implicit_document? explicit_document* STREAM-END
+// ************
+func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) bool {
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ != yaml_STREAM_START_TOKEN {
+ return yaml_parser_set_parser_error(parser, "did not find expected ", token.start_mark)
+ }
+ parser.state = yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE
+ *event = yaml_event_t{
+ typ: yaml_STREAM_START_EVENT,
+ start_mark: token.start_mark,
+ end_mark: token.end_mark,
+ encoding: token.encoding,
+ }
+ skip_token(parser)
+ return true
+}
+
+// Parse the productions:
+// implicit_document ::= block_node DOCUMENT-END*
+// *
+// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
+// *************************
+func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t, implicit bool) bool {
+
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+
+ // Parse extra document end indicators.
+ if !implicit {
+ for token.typ == yaml_DOCUMENT_END_TOKEN {
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ }
+ }
+
+ if implicit && token.typ != yaml_VERSION_DIRECTIVE_TOKEN &&
+ token.typ != yaml_TAG_DIRECTIVE_TOKEN &&
+ token.typ != yaml_DOCUMENT_START_TOKEN &&
+ token.typ != yaml_STREAM_END_TOKEN {
+ // Parse an implicit document.
+ if !yaml_parser_process_directives(parser, nil, nil) {
+ return false
+ }
+ parser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE)
+ parser.state = yaml_PARSE_BLOCK_NODE_STATE
+
+ *event = yaml_event_t{
+ typ: yaml_DOCUMENT_START_EVENT,
+ start_mark: token.start_mark,
+ end_mark: token.end_mark,
+ }
+
+ } else if token.typ != yaml_STREAM_END_TOKEN {
+ // Parse an explicit document.
+ var version_directive *yaml_version_directive_t
+ var tag_directives []yaml_tag_directive_t
+ start_mark := token.start_mark
+ if !yaml_parser_process_directives(parser, &version_directive, &tag_directives) {
+ return false
+ }
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ != yaml_DOCUMENT_START_TOKEN {
+ yaml_parser_set_parser_error(parser,
+ "did not find expected ", token.start_mark)
+ return false
+ }
+ parser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE)
+ parser.state = yaml_PARSE_DOCUMENT_CONTENT_STATE
+ end_mark := token.end_mark
+
+ *event = yaml_event_t{
+ typ: yaml_DOCUMENT_START_EVENT,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ version_directive: version_directive,
+ tag_directives: tag_directives,
+ implicit: false,
+ }
+ skip_token(parser)
+
+ } else {
+ // Parse the stream end.
+ parser.state = yaml_PARSE_END_STATE
+ *event = yaml_event_t{
+ typ: yaml_STREAM_END_EVENT,
+ start_mark: token.start_mark,
+ end_mark: token.end_mark,
+ }
+ skip_token(parser)
+ }
+
+ return true
+}
+
+// Parse the productions:
+// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
+// ***********
+//
+func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event_t) bool {
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ == yaml_VERSION_DIRECTIVE_TOKEN ||
+ token.typ == yaml_TAG_DIRECTIVE_TOKEN ||
+ token.typ == yaml_DOCUMENT_START_TOKEN ||
+ token.typ == yaml_DOCUMENT_END_TOKEN ||
+ token.typ == yaml_STREAM_END_TOKEN {
+ parser.state = parser.states[len(parser.states)-1]
+ parser.states = parser.states[:len(parser.states)-1]
+ return yaml_parser_process_empty_scalar(parser, event,
+ token.start_mark)
+ }
+ return yaml_parser_parse_node(parser, event, true, false)
+}
+
+// Parse the productions:
+// implicit_document ::= block_node DOCUMENT-END*
+// *************
+// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
+//
+func yaml_parser_parse_document_end(parser *yaml_parser_t, event *yaml_event_t) bool {
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+
+ start_mark := token.start_mark
+ end_mark := token.start_mark
+
+ implicit := true
+ if token.typ == yaml_DOCUMENT_END_TOKEN {
+ end_mark = token.end_mark
+ skip_token(parser)
+ implicit = false
+ }
+
+ parser.tag_directives = parser.tag_directives[:0]
+
+ parser.state = yaml_PARSE_DOCUMENT_START_STATE
+ *event = yaml_event_t{
+ typ: yaml_DOCUMENT_END_EVENT,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ implicit: implicit,
+ }
+ return true
+}
+
+// Parse the productions:
+// block_node_or_indentless_sequence ::=
+// ALIAS
+// *****
+// | properties (block_content | indentless_block_sequence)?
+// ********** *
+// | block_content | indentless_block_sequence
+// *
+// block_node ::= ALIAS
+// *****
+// | properties block_content?
+// ********** *
+// | block_content
+// *
+// flow_node ::= ALIAS
+// *****
+// | properties flow_content?
+// ********** *
+// | flow_content
+// *
+// properties ::= TAG ANCHOR? | ANCHOR TAG?
+// *************************
+// block_content ::= block_collection | flow_collection | SCALAR
+// ******
+// flow_content ::= flow_collection | SCALAR
+// ******
+func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, indentless_sequence bool) bool {
+ //defer trace("yaml_parser_parse_node", "block:", block, "indentless_sequence:", indentless_sequence)()
+
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+
+ if token.typ == yaml_ALIAS_TOKEN {
+ parser.state = parser.states[len(parser.states)-1]
+ parser.states = parser.states[:len(parser.states)-1]
+ *event = yaml_event_t{
+ typ: yaml_ALIAS_EVENT,
+ start_mark: token.start_mark,
+ end_mark: token.end_mark,
+ anchor: token.value,
+ }
+ skip_token(parser)
+ return true
+ }
+
+ start_mark := token.start_mark
+ end_mark := token.start_mark
+
+ var tag_token bool
+ var tag_handle, tag_suffix, anchor []byte
+ var tag_mark yaml_mark_t
+ if token.typ == yaml_ANCHOR_TOKEN {
+ anchor = token.value
+ start_mark = token.start_mark
+ end_mark = token.end_mark
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ == yaml_TAG_TOKEN {
+ tag_token = true
+ tag_handle = token.value
+ tag_suffix = token.suffix
+ tag_mark = token.start_mark
+ end_mark = token.end_mark
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ }
+ } else if token.typ == yaml_TAG_TOKEN {
+ tag_token = true
+ tag_handle = token.value
+ tag_suffix = token.suffix
+ start_mark = token.start_mark
+ tag_mark = token.start_mark
+ end_mark = token.end_mark
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ == yaml_ANCHOR_TOKEN {
+ anchor = token.value
+ end_mark = token.end_mark
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ }
+ }
+
+ var tag []byte
+ if tag_token {
+ if len(tag_handle) == 0 {
+ tag = tag_suffix
+ tag_suffix = nil
+ } else {
+ for i := range parser.tag_directives {
+ if bytes.Equal(parser.tag_directives[i].handle, tag_handle) {
+ tag = append([]byte(nil), parser.tag_directives[i].prefix...)
+ tag = append(tag, tag_suffix...)
+ break
+ }
+ }
+ if len(tag) == 0 {
+ yaml_parser_set_parser_error_context(parser,
+ "while parsing a node", start_mark,
+ "found undefined tag handle", tag_mark)
+ return false
+ }
+ }
+ }
+
+ implicit := len(tag) == 0
+ if indentless_sequence && token.typ == yaml_BLOCK_ENTRY_TOKEN {
+ end_mark = token.end_mark
+ parser.state = yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE
+ *event = yaml_event_t{
+ typ: yaml_SEQUENCE_START_EVENT,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ anchor: anchor,
+ tag: tag,
+ implicit: implicit,
+ style: yaml_style_t(yaml_BLOCK_SEQUENCE_STYLE),
+ }
+ return true
+ }
+ if token.typ == yaml_SCALAR_TOKEN {
+ var plain_implicit, quoted_implicit bool
+ end_mark = token.end_mark
+ if (len(tag) == 0 && token.style == yaml_PLAIN_SCALAR_STYLE) || (len(tag) == 1 && tag[0] == '!') {
+ plain_implicit = true
+ } else if len(tag) == 0 {
+ quoted_implicit = true
+ }
+ parser.state = parser.states[len(parser.states)-1]
+ parser.states = parser.states[:len(parser.states)-1]
+
+ *event = yaml_event_t{
+ typ: yaml_SCALAR_EVENT,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ anchor: anchor,
+ tag: tag,
+ value: token.value,
+ implicit: plain_implicit,
+ quoted_implicit: quoted_implicit,
+ style: yaml_style_t(token.style),
+ }
+ skip_token(parser)
+ return true
+ }
+ if token.typ == yaml_FLOW_SEQUENCE_START_TOKEN {
+ // [Go] Some of the events below can be merged as they differ only on style.
+ end_mark = token.end_mark
+ parser.state = yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE
+ *event = yaml_event_t{
+ typ: yaml_SEQUENCE_START_EVENT,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ anchor: anchor,
+ tag: tag,
+ implicit: implicit,
+ style: yaml_style_t(yaml_FLOW_SEQUENCE_STYLE),
+ }
+ return true
+ }
+ if token.typ == yaml_FLOW_MAPPING_START_TOKEN {
+ end_mark = token.end_mark
+ parser.state = yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE
+ *event = yaml_event_t{
+ typ: yaml_MAPPING_START_EVENT,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ anchor: anchor,
+ tag: tag,
+ implicit: implicit,
+ style: yaml_style_t(yaml_FLOW_MAPPING_STYLE),
+ }
+ return true
+ }
+ if block && token.typ == yaml_BLOCK_SEQUENCE_START_TOKEN {
+ end_mark = token.end_mark
+ parser.state = yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE
+ *event = yaml_event_t{
+ typ: yaml_SEQUENCE_START_EVENT,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ anchor: anchor,
+ tag: tag,
+ implicit: implicit,
+ style: yaml_style_t(yaml_BLOCK_SEQUENCE_STYLE),
+ }
+ return true
+ }
+ if block && token.typ == yaml_BLOCK_MAPPING_START_TOKEN {
+ end_mark = token.end_mark
+ parser.state = yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE
+ *event = yaml_event_t{
+ typ: yaml_MAPPING_START_EVENT,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ anchor: anchor,
+ tag: tag,
+ implicit: implicit,
+ style: yaml_style_t(yaml_BLOCK_MAPPING_STYLE),
+ }
+ return true
+ }
+ if len(anchor) > 0 || len(tag) > 0 {
+ parser.state = parser.states[len(parser.states)-1]
+ parser.states = parser.states[:len(parser.states)-1]
+
+ *event = yaml_event_t{
+ typ: yaml_SCALAR_EVENT,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ anchor: anchor,
+ tag: tag,
+ implicit: implicit,
+ quoted_implicit: false,
+ style: yaml_style_t(yaml_PLAIN_SCALAR_STYLE),
+ }
+ return true
+ }
+
+ context := "while parsing a flow node"
+ if block {
+ context = "while parsing a block node"
+ }
+ yaml_parser_set_parser_error_context(parser, context, start_mark,
+ "did not find expected node content", token.start_mark)
+ return false
+}
+
+// Parse the productions:
+// block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END
+// ******************** *********** * *********
+//
+func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool {
+ if first {
+ token := peek_token(parser)
+ parser.marks = append(parser.marks, token.start_mark)
+ skip_token(parser)
+ }
+
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+
+ if token.typ == yaml_BLOCK_ENTRY_TOKEN {
+ mark := token.end_mark
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ != yaml_BLOCK_ENTRY_TOKEN && token.typ != yaml_BLOCK_END_TOKEN {
+ parser.states = append(parser.states, yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE)
+ return yaml_parser_parse_node(parser, event, true, false)
+ } else {
+ parser.state = yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE
+ return yaml_parser_process_empty_scalar(parser, event, mark)
+ }
+ }
+ if token.typ == yaml_BLOCK_END_TOKEN {
+ parser.state = parser.states[len(parser.states)-1]
+ parser.states = parser.states[:len(parser.states)-1]
+ parser.marks = parser.marks[:len(parser.marks)-1]
+
+ *event = yaml_event_t{
+ typ: yaml_SEQUENCE_END_EVENT,
+ start_mark: token.start_mark,
+ end_mark: token.end_mark,
+ }
+
+ skip_token(parser)
+ return true
+ }
+
+ context_mark := parser.marks[len(parser.marks)-1]
+ parser.marks = parser.marks[:len(parser.marks)-1]
+ return yaml_parser_set_parser_error_context(parser,
+ "while parsing a block collection", context_mark,
+ "did not find expected '-' indicator", token.start_mark)
+}
+
+// Parse the productions:
+// indentless_sequence ::= (BLOCK-ENTRY block_node?)+
+// *********** *
+func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, event *yaml_event_t) bool {
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+
+ if token.typ == yaml_BLOCK_ENTRY_TOKEN {
+ mark := token.end_mark
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ != yaml_BLOCK_ENTRY_TOKEN &&
+ token.typ != yaml_KEY_TOKEN &&
+ token.typ != yaml_VALUE_TOKEN &&
+ token.typ != yaml_BLOCK_END_TOKEN {
+ parser.states = append(parser.states, yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE)
+ return yaml_parser_parse_node(parser, event, true, false)
+ }
+ parser.state = yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE
+ return yaml_parser_process_empty_scalar(parser, event, mark)
+ }
+ parser.state = parser.states[len(parser.states)-1]
+ parser.states = parser.states[:len(parser.states)-1]
+
+ *event = yaml_event_t{
+ typ: yaml_SEQUENCE_END_EVENT,
+ start_mark: token.start_mark,
+ end_mark: token.start_mark, // [Go] Shouldn't this be token.end_mark?
+ }
+ return true
+}
+
+// Parse the productions:
+// block_mapping ::= BLOCK-MAPPING_START
+// *******************
+// ((KEY block_node_or_indentless_sequence?)?
+// *** *
+// (VALUE block_node_or_indentless_sequence?)?)*
+//
+// BLOCK-END
+// *********
+//
+func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool {
+ if first {
+ token := peek_token(parser)
+ parser.marks = append(parser.marks, token.start_mark)
+ skip_token(parser)
+ }
+
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+
+ if token.typ == yaml_KEY_TOKEN {
+ mark := token.end_mark
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ != yaml_KEY_TOKEN &&
+ token.typ != yaml_VALUE_TOKEN &&
+ token.typ != yaml_BLOCK_END_TOKEN {
+ parser.states = append(parser.states, yaml_PARSE_BLOCK_MAPPING_VALUE_STATE)
+ return yaml_parser_parse_node(parser, event, true, true)
+ } else {
+ parser.state = yaml_PARSE_BLOCK_MAPPING_VALUE_STATE
+ return yaml_parser_process_empty_scalar(parser, event, mark)
+ }
+ } else if token.typ == yaml_BLOCK_END_TOKEN {
+ parser.state = parser.states[len(parser.states)-1]
+ parser.states = parser.states[:len(parser.states)-1]
+ parser.marks = parser.marks[:len(parser.marks)-1]
+ *event = yaml_event_t{
+ typ: yaml_MAPPING_END_EVENT,
+ start_mark: token.start_mark,
+ end_mark: token.end_mark,
+ }
+ skip_token(parser)
+ return true
+ }
+
+ context_mark := parser.marks[len(parser.marks)-1]
+ parser.marks = parser.marks[:len(parser.marks)-1]
+ return yaml_parser_set_parser_error_context(parser,
+ "while parsing a block mapping", context_mark,
+ "did not find expected key", token.start_mark)
+}
+
+// Parse the productions:
+// block_mapping ::= BLOCK-MAPPING_START
+//
+// ((KEY block_node_or_indentless_sequence?)?
+//
+// (VALUE block_node_or_indentless_sequence?)?)*
+// ***** *
+// BLOCK-END
+//
+//
+func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool {
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ == yaml_VALUE_TOKEN {
+ mark := token.end_mark
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ != yaml_KEY_TOKEN &&
+ token.typ != yaml_VALUE_TOKEN &&
+ token.typ != yaml_BLOCK_END_TOKEN {
+ parser.states = append(parser.states, yaml_PARSE_BLOCK_MAPPING_KEY_STATE)
+ return yaml_parser_parse_node(parser, event, true, true)
+ }
+ parser.state = yaml_PARSE_BLOCK_MAPPING_KEY_STATE
+ return yaml_parser_process_empty_scalar(parser, event, mark)
+ }
+ parser.state = yaml_PARSE_BLOCK_MAPPING_KEY_STATE
+ return yaml_parser_process_empty_scalar(parser, event, token.start_mark)
+}
+
+// Parse the productions:
+// flow_sequence ::= FLOW-SEQUENCE-START
+// *******************
+// (flow_sequence_entry FLOW-ENTRY)*
+// * **********
+// flow_sequence_entry?
+// *
+// FLOW-SEQUENCE-END
+// *****************
+// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
+// *
+//
+func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool {
+ if first {
+ token := peek_token(parser)
+ parser.marks = append(parser.marks, token.start_mark)
+ skip_token(parser)
+ }
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ != yaml_FLOW_SEQUENCE_END_TOKEN {
+ if !first {
+ if token.typ == yaml_FLOW_ENTRY_TOKEN {
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ } else {
+ context_mark := parser.marks[len(parser.marks)-1]
+ parser.marks = parser.marks[:len(parser.marks)-1]
+ return yaml_parser_set_parser_error_context(parser,
+ "while parsing a flow sequence", context_mark,
+ "did not find expected ',' or ']'", token.start_mark)
+ }
+ }
+
+ if token.typ == yaml_KEY_TOKEN {
+ parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE
+ *event = yaml_event_t{
+ typ: yaml_MAPPING_START_EVENT,
+ start_mark: token.start_mark,
+ end_mark: token.end_mark,
+ implicit: true,
+ style: yaml_style_t(yaml_FLOW_MAPPING_STYLE),
+ }
+ skip_token(parser)
+ return true
+ } else if token.typ != yaml_FLOW_SEQUENCE_END_TOKEN {
+ parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE)
+ return yaml_parser_parse_node(parser, event, false, false)
+ }
+ }
+
+ parser.state = parser.states[len(parser.states)-1]
+ parser.states = parser.states[:len(parser.states)-1]
+ parser.marks = parser.marks[:len(parser.marks)-1]
+
+ *event = yaml_event_t{
+ typ: yaml_SEQUENCE_END_EVENT,
+ start_mark: token.start_mark,
+ end_mark: token.end_mark,
+ }
+
+ skip_token(parser)
+ return true
+}
+
+//
+// Parse the productions:
+// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
+// *** *
+//
+func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, event *yaml_event_t) bool {
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ != yaml_VALUE_TOKEN &&
+ token.typ != yaml_FLOW_ENTRY_TOKEN &&
+ token.typ != yaml_FLOW_SEQUENCE_END_TOKEN {
+ parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE)
+ return yaml_parser_parse_node(parser, event, false, false)
+ }
+ mark := token.end_mark
+ skip_token(parser)
+ parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE
+ return yaml_parser_process_empty_scalar(parser, event, mark)
+}
+
+// Parse the productions:
+// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
+// ***** *
+//
+func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool {
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ == yaml_VALUE_TOKEN {
+ skip_token(parser)
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ != yaml_FLOW_ENTRY_TOKEN && token.typ != yaml_FLOW_SEQUENCE_END_TOKEN {
+ parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE)
+ return yaml_parser_parse_node(parser, event, false, false)
+ }
+ }
+ parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE
+ return yaml_parser_process_empty_scalar(parser, event, token.start_mark)
+}
+
+// Parse the productions:
+// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
+// *
+//
+func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, event *yaml_event_t) bool {
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+ parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE
+ *event = yaml_event_t{
+ typ: yaml_MAPPING_END_EVENT,
+ start_mark: token.start_mark,
+ end_mark: token.start_mark, // [Go] Shouldn't this be end_mark?
+ }
+ return true
+}
+
+// Parse the productions:
+// flow_mapping ::= FLOW-MAPPING-START
+// ******************
+// (flow_mapping_entry FLOW-ENTRY)*
+// * **********
+// flow_mapping_entry?
+// ******************
+// FLOW-MAPPING-END
+// ****************
+// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
+// * *** *
+//
+func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool {
+ if first {
+ token := peek_token(parser)
+ parser.marks = append(parser.marks, token.start_mark)
+ skip_token(parser)
+ }
+
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+
+ if token.typ != yaml_FLOW_MAPPING_END_TOKEN {
+ if !first {
+ if token.typ == yaml_FLOW_ENTRY_TOKEN {
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ } else {
+ context_mark := parser.marks[len(parser.marks)-1]
+ parser.marks = parser.marks[:len(parser.marks)-1]
+ return yaml_parser_set_parser_error_context(parser,
+ "while parsing a flow mapping", context_mark,
+ "did not find expected ',' or '}'", token.start_mark)
+ }
+ }
+
+ if token.typ == yaml_KEY_TOKEN {
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ != yaml_VALUE_TOKEN &&
+ token.typ != yaml_FLOW_ENTRY_TOKEN &&
+ token.typ != yaml_FLOW_MAPPING_END_TOKEN {
+ parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_VALUE_STATE)
+ return yaml_parser_parse_node(parser, event, false, false)
+ } else {
+ parser.state = yaml_PARSE_FLOW_MAPPING_VALUE_STATE
+ return yaml_parser_process_empty_scalar(parser, event, token.start_mark)
+ }
+ } else if token.typ != yaml_FLOW_MAPPING_END_TOKEN {
+ parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE)
+ return yaml_parser_parse_node(parser, event, false, false)
+ }
+ }
+
+ parser.state = parser.states[len(parser.states)-1]
+ parser.states = parser.states[:len(parser.states)-1]
+ parser.marks = parser.marks[:len(parser.marks)-1]
+ *event = yaml_event_t{
+ typ: yaml_MAPPING_END_EVENT,
+ start_mark: token.start_mark,
+ end_mark: token.end_mark,
+ }
+ skip_token(parser)
+ return true
+}
+
+// Parse the productions:
+// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
+// * ***** *
+//
+func yaml_parser_parse_flow_mapping_value(parser *yaml_parser_t, event *yaml_event_t, empty bool) bool {
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if empty {
+ parser.state = yaml_PARSE_FLOW_MAPPING_KEY_STATE
+ return yaml_parser_process_empty_scalar(parser, event, token.start_mark)
+ }
+ if token.typ == yaml_VALUE_TOKEN {
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ != yaml_FLOW_ENTRY_TOKEN && token.typ != yaml_FLOW_MAPPING_END_TOKEN {
+ parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_KEY_STATE)
+ return yaml_parser_parse_node(parser, event, false, false)
+ }
+ }
+ parser.state = yaml_PARSE_FLOW_MAPPING_KEY_STATE
+ return yaml_parser_process_empty_scalar(parser, event, token.start_mark)
+}
+
+// Generate an empty scalar event.
+func yaml_parser_process_empty_scalar(parser *yaml_parser_t, event *yaml_event_t, mark yaml_mark_t) bool {
+ *event = yaml_event_t{
+ typ: yaml_SCALAR_EVENT,
+ start_mark: mark,
+ end_mark: mark,
+ value: nil, // Empty
+ implicit: true,
+ style: yaml_style_t(yaml_PLAIN_SCALAR_STYLE),
+ }
+ return true
+}
+
+var default_tag_directives = []yaml_tag_directive_t{
+ {[]byte("!"), []byte("!")},
+ {[]byte("!!"), []byte("tag:yaml.org,2002:")},
+}
+
+// Parse directives.
+func yaml_parser_process_directives(parser *yaml_parser_t,
+ version_directive_ref **yaml_version_directive_t,
+ tag_directives_ref *[]yaml_tag_directive_t) bool {
+
+ var version_directive *yaml_version_directive_t
+ var tag_directives []yaml_tag_directive_t
+
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+
+ for token.typ == yaml_VERSION_DIRECTIVE_TOKEN || token.typ == yaml_TAG_DIRECTIVE_TOKEN {
+ if token.typ == yaml_VERSION_DIRECTIVE_TOKEN {
+ if version_directive != nil {
+ yaml_parser_set_parser_error(parser,
+ "found duplicate %YAML directive", token.start_mark)
+ return false
+ }
+ if token.major != 1 || token.minor != 1 {
+ yaml_parser_set_parser_error(parser,
+ "found incompatible YAML document", token.start_mark)
+ return false
+ }
+ version_directive = &yaml_version_directive_t{
+ major: token.major,
+ minor: token.minor,
+ }
+ } else if token.typ == yaml_TAG_DIRECTIVE_TOKEN {
+ value := yaml_tag_directive_t{
+ handle: token.value,
+ prefix: token.prefix,
+ }
+ if !yaml_parser_append_tag_directive(parser, value, false, token.start_mark) {
+ return false
+ }
+ tag_directives = append(tag_directives, value)
+ }
+
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ }
+
+ for i := range default_tag_directives {
+ if !yaml_parser_append_tag_directive(parser, default_tag_directives[i], true, token.start_mark) {
+ return false
+ }
+ }
+
+ if version_directive_ref != nil {
+ *version_directive_ref = version_directive
+ }
+ if tag_directives_ref != nil {
+ *tag_directives_ref = tag_directives
+ }
+ return true
+}
+
+// Append a tag directive to the directives stack.
+func yaml_parser_append_tag_directive(parser *yaml_parser_t, value yaml_tag_directive_t, allow_duplicates bool, mark yaml_mark_t) bool {
+ for i := range parser.tag_directives {
+ if bytes.Equal(value.handle, parser.tag_directives[i].handle) {
+ if allow_duplicates {
+ return true
+ }
+ return yaml_parser_set_parser_error(parser, "found duplicate %TAG directive", mark)
+ }
+ }
+
+ // [Go] I suspect the copy is unnecessary. This was likely done
+ // because there was no way to track ownership of the data.
+ value_copy := yaml_tag_directive_t{
+ handle: make([]byte, len(value.handle)),
+ prefix: make([]byte, len(value.prefix)),
+ }
+ copy(value_copy.handle, value.handle)
+ copy(value_copy.prefix, value.prefix)
+ parser.tag_directives = append(parser.tag_directives, value_copy)
+ return true
+}
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/readerc.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/readerc.go
new file mode 100644
index 000000000..7c1f5fac3
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/readerc.go
@@ -0,0 +1,412 @@
+package yaml
+
+import (
+ "io"
+)
+
+// Set the reader error and return 0.
+func yaml_parser_set_reader_error(parser *yaml_parser_t, problem string, offset int, value int) bool {
+ parser.error = yaml_READER_ERROR
+ parser.problem = problem
+ parser.problem_offset = offset
+ parser.problem_value = value
+ return false
+}
+
+// Byte order marks.
+const (
+ bom_UTF8 = "\xef\xbb\xbf"
+ bom_UTF16LE = "\xff\xfe"
+ bom_UTF16BE = "\xfe\xff"
+)
+
+// Determine the input stream encoding by checking the BOM symbol. If no BOM is
+// found, the UTF-8 encoding is assumed. Return 1 on success, 0 on failure.
+func yaml_parser_determine_encoding(parser *yaml_parser_t) bool {
+ // Ensure that we had enough bytes in the raw buffer.
+ for !parser.eof && len(parser.raw_buffer)-parser.raw_buffer_pos < 3 {
+ if !yaml_parser_update_raw_buffer(parser) {
+ return false
+ }
+ }
+
+ // Determine the encoding.
+ buf := parser.raw_buffer
+ pos := parser.raw_buffer_pos
+ avail := len(buf) - pos
+ if avail >= 2 && buf[pos] == bom_UTF16LE[0] && buf[pos+1] == bom_UTF16LE[1] {
+ parser.encoding = yaml_UTF16LE_ENCODING
+ parser.raw_buffer_pos += 2
+ parser.offset += 2
+ } else if avail >= 2 && buf[pos] == bom_UTF16BE[0] && buf[pos+1] == bom_UTF16BE[1] {
+ parser.encoding = yaml_UTF16BE_ENCODING
+ parser.raw_buffer_pos += 2
+ parser.offset += 2
+ } else if avail >= 3 && buf[pos] == bom_UTF8[0] && buf[pos+1] == bom_UTF8[1] && buf[pos+2] == bom_UTF8[2] {
+ parser.encoding = yaml_UTF8_ENCODING
+ parser.raw_buffer_pos += 3
+ parser.offset += 3
+ } else {
+ parser.encoding = yaml_UTF8_ENCODING
+ }
+ return true
+}
+
+// Update the raw buffer.
+func yaml_parser_update_raw_buffer(parser *yaml_parser_t) bool {
+ size_read := 0
+
+ // Return if the raw buffer is full.
+ if parser.raw_buffer_pos == 0 && len(parser.raw_buffer) == cap(parser.raw_buffer) {
+ return true
+ }
+
+ // Return on EOF.
+ if parser.eof {
+ return true
+ }
+
+ // Move the remaining bytes in the raw buffer to the beginning.
+ if parser.raw_buffer_pos > 0 && parser.raw_buffer_pos < len(parser.raw_buffer) {
+ copy(parser.raw_buffer, parser.raw_buffer[parser.raw_buffer_pos:])
+ }
+ parser.raw_buffer = parser.raw_buffer[:len(parser.raw_buffer)-parser.raw_buffer_pos]
+ parser.raw_buffer_pos = 0
+
+ // Call the read handler to fill the buffer.
+ size_read, err := parser.read_handler(parser, parser.raw_buffer[len(parser.raw_buffer):cap(parser.raw_buffer)])
+ parser.raw_buffer = parser.raw_buffer[:len(parser.raw_buffer)+size_read]
+ if err == io.EOF {
+ parser.eof = true
+ } else if err != nil {
+ return yaml_parser_set_reader_error(parser, "input error: "+err.Error(), parser.offset, -1)
+ }
+ return true
+}
+
+// Ensure that the buffer contains at least `length` characters.
+// Return true on success, false on failure.
+//
+// The length is supposed to be significantly less that the buffer size.
+func yaml_parser_update_buffer(parser *yaml_parser_t, length int) bool {
+ if parser.read_handler == nil {
+ panic("read handler must be set")
+ }
+
+ // [Go] This function was changed to guarantee the requested length size at EOF.
+ // The fact we need to do this is pretty awful, but the description above implies
+ // for that to be the case, and there are tests
+
+ // If the EOF flag is set and the raw buffer is empty, do nothing.
+ if parser.eof && parser.raw_buffer_pos == len(parser.raw_buffer) {
+ // [Go] ACTUALLY! Read the documentation of this function above.
+ // This is just broken. To return true, we need to have the
+ // given length in the buffer. Not doing that means every single
+ // check that calls this function to make sure the buffer has a
+ // given length is Go) panicking; or C) accessing invalid memory.
+ //return true
+ }
+
+ // Return if the buffer contains enough characters.
+ if parser.unread >= length {
+ return true
+ }
+
+ // Determine the input encoding if it is not known yet.
+ if parser.encoding == yaml_ANY_ENCODING {
+ if !yaml_parser_determine_encoding(parser) {
+ return false
+ }
+ }
+
+ // Move the unread characters to the beginning of the buffer.
+ buffer_len := len(parser.buffer)
+ if parser.buffer_pos > 0 && parser.buffer_pos < buffer_len {
+ copy(parser.buffer, parser.buffer[parser.buffer_pos:])
+ buffer_len -= parser.buffer_pos
+ parser.buffer_pos = 0
+ } else if parser.buffer_pos == buffer_len {
+ buffer_len = 0
+ parser.buffer_pos = 0
+ }
+
+ // Open the whole buffer for writing, and cut it before returning.
+ parser.buffer = parser.buffer[:cap(parser.buffer)]
+
+ // Fill the buffer until it has enough characters.
+ first := true
+ for parser.unread < length {
+
+ // Fill the raw buffer if necessary.
+ if !first || parser.raw_buffer_pos == len(parser.raw_buffer) {
+ if !yaml_parser_update_raw_buffer(parser) {
+ parser.buffer = parser.buffer[:buffer_len]
+ return false
+ }
+ }
+ first = false
+
+ // Decode the raw buffer.
+ inner:
+ for parser.raw_buffer_pos != len(parser.raw_buffer) {
+ var value rune
+ var width int
+
+ raw_unread := len(parser.raw_buffer) - parser.raw_buffer_pos
+
+ // Decode the next character.
+ switch parser.encoding {
+ case yaml_UTF8_ENCODING:
+ // Decode a UTF-8 character. Check RFC 3629
+ // (http://www.ietf.org/rfc/rfc3629.txt) for more details.
+ //
+ // The following table (taken from the RFC) is used for
+ // decoding.
+ //
+ // Char. number range | UTF-8 octet sequence
+ // (hexadecimal) | (binary)
+ // --------------------+------------------------------------
+ // 0000 0000-0000 007F | 0xxxxxxx
+ // 0000 0080-0000 07FF | 110xxxxx 10xxxxxx
+ // 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx
+ // 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+ //
+ // Additionally, the characters in the range 0xD800-0xDFFF
+ // are prohibited as they are reserved for use with UTF-16
+ // surrogate pairs.
+
+ // Determine the length of the UTF-8 sequence.
+ octet := parser.raw_buffer[parser.raw_buffer_pos]
+ switch {
+ case octet&0x80 == 0x00:
+ width = 1
+ case octet&0xE0 == 0xC0:
+ width = 2
+ case octet&0xF0 == 0xE0:
+ width = 3
+ case octet&0xF8 == 0xF0:
+ width = 4
+ default:
+ // The leading octet is invalid.
+ return yaml_parser_set_reader_error(parser,
+ "invalid leading UTF-8 octet",
+ parser.offset, int(octet))
+ }
+
+ // Check if the raw buffer contains an incomplete character.
+ if width > raw_unread {
+ if parser.eof {
+ return yaml_parser_set_reader_error(parser,
+ "incomplete UTF-8 octet sequence",
+ parser.offset, -1)
+ }
+ break inner
+ }
+
+ // Decode the leading octet.
+ switch {
+ case octet&0x80 == 0x00:
+ value = rune(octet & 0x7F)
+ case octet&0xE0 == 0xC0:
+ value = rune(octet & 0x1F)
+ case octet&0xF0 == 0xE0:
+ value = rune(octet & 0x0F)
+ case octet&0xF8 == 0xF0:
+ value = rune(octet & 0x07)
+ default:
+ value = 0
+ }
+
+ // Check and decode the trailing octets.
+ for k := 1; k < width; k++ {
+ octet = parser.raw_buffer[parser.raw_buffer_pos+k]
+
+ // Check if the octet is valid.
+ if (octet & 0xC0) != 0x80 {
+ return yaml_parser_set_reader_error(parser,
+ "invalid trailing UTF-8 octet",
+ parser.offset+k, int(octet))
+ }
+
+ // Decode the octet.
+ value = (value << 6) + rune(octet&0x3F)
+ }
+
+ // Check the length of the sequence against the value.
+ switch {
+ case width == 1:
+ case width == 2 && value >= 0x80:
+ case width == 3 && value >= 0x800:
+ case width == 4 && value >= 0x10000:
+ default:
+ return yaml_parser_set_reader_error(parser,
+ "invalid length of a UTF-8 sequence",
+ parser.offset, -1)
+ }
+
+ // Check the range of the value.
+ if value >= 0xD800 && value <= 0xDFFF || value > 0x10FFFF {
+ return yaml_parser_set_reader_error(parser,
+ "invalid Unicode character",
+ parser.offset, int(value))
+ }
+
+ case yaml_UTF16LE_ENCODING, yaml_UTF16BE_ENCODING:
+ var low, high int
+ if parser.encoding == yaml_UTF16LE_ENCODING {
+ low, high = 0, 1
+ } else {
+ low, high = 1, 0
+ }
+
+ // The UTF-16 encoding is not as simple as one might
+ // naively think. Check RFC 2781
+ // (http://www.ietf.org/rfc/rfc2781.txt).
+ //
+ // Normally, two subsequent bytes describe a Unicode
+ // character. However a special technique (called a
+ // surrogate pair) is used for specifying character
+ // values larger than 0xFFFF.
+ //
+ // A surrogate pair consists of two pseudo-characters:
+ // high surrogate area (0xD800-0xDBFF)
+ // low surrogate area (0xDC00-0xDFFF)
+ //
+ // The following formulas are used for decoding
+ // and encoding characters using surrogate pairs:
+ //
+ // U = U' + 0x10000 (0x01 00 00 <= U <= 0x10 FF FF)
+ // U' = yyyyyyyyyyxxxxxxxxxx (0 <= U' <= 0x0F FF FF)
+ // W1 = 110110yyyyyyyyyy
+ // W2 = 110111xxxxxxxxxx
+ //
+ // where U is the character value, W1 is the high surrogate
+ // area, W2 is the low surrogate area.
+
+ // Check for incomplete UTF-16 character.
+ if raw_unread < 2 {
+ if parser.eof {
+ return yaml_parser_set_reader_error(parser,
+ "incomplete UTF-16 character",
+ parser.offset, -1)
+ }
+ break inner
+ }
+
+ // Get the character.
+ value = rune(parser.raw_buffer[parser.raw_buffer_pos+low]) +
+ (rune(parser.raw_buffer[parser.raw_buffer_pos+high]) << 8)
+
+ // Check for unexpected low surrogate area.
+ if value&0xFC00 == 0xDC00 {
+ return yaml_parser_set_reader_error(parser,
+ "unexpected low surrogate area",
+ parser.offset, int(value))
+ }
+
+ // Check for a high surrogate area.
+ if value&0xFC00 == 0xD800 {
+ width = 4
+
+ // Check for incomplete surrogate pair.
+ if raw_unread < 4 {
+ if parser.eof {
+ return yaml_parser_set_reader_error(parser,
+ "incomplete UTF-16 surrogate pair",
+ parser.offset, -1)
+ }
+ break inner
+ }
+
+ // Get the next character.
+ value2 := rune(parser.raw_buffer[parser.raw_buffer_pos+low+2]) +
+ (rune(parser.raw_buffer[parser.raw_buffer_pos+high+2]) << 8)
+
+ // Check for a low surrogate area.
+ if value2&0xFC00 != 0xDC00 {
+ return yaml_parser_set_reader_error(parser,
+ "expected low surrogate area",
+ parser.offset+2, int(value2))
+ }
+
+ // Generate the value of the surrogate pair.
+ value = 0x10000 + ((value & 0x3FF) << 10) + (value2 & 0x3FF)
+ } else {
+ width = 2
+ }
+
+ default:
+ panic("impossible")
+ }
+
+ // Check if the character is in the allowed range:
+ // #x9 | #xA | #xD | [#x20-#x7E] (8 bit)
+ // | #x85 | [#xA0-#xD7FF] | [#xE000-#xFFFD] (16 bit)
+ // | [#x10000-#x10FFFF] (32 bit)
+ switch {
+ case value == 0x09:
+ case value == 0x0A:
+ case value == 0x0D:
+ case value >= 0x20 && value <= 0x7E:
+ case value == 0x85:
+ case value >= 0xA0 && value <= 0xD7FF:
+ case value >= 0xE000 && value <= 0xFFFD:
+ case value >= 0x10000 && value <= 0x10FFFF:
+ default:
+ return yaml_parser_set_reader_error(parser,
+ "control characters are not allowed",
+ parser.offset, int(value))
+ }
+
+ // Move the raw pointers.
+ parser.raw_buffer_pos += width
+ parser.offset += width
+
+ // Finally put the character into the buffer.
+ if value <= 0x7F {
+ // 0000 0000-0000 007F . 0xxxxxxx
+ parser.buffer[buffer_len+0] = byte(value)
+ buffer_len += 1
+ } else if value <= 0x7FF {
+ // 0000 0080-0000 07FF . 110xxxxx 10xxxxxx
+ parser.buffer[buffer_len+0] = byte(0xC0 + (value >> 6))
+ parser.buffer[buffer_len+1] = byte(0x80 + (value & 0x3F))
+ buffer_len += 2
+ } else if value <= 0xFFFF {
+ // 0000 0800-0000 FFFF . 1110xxxx 10xxxxxx 10xxxxxx
+ parser.buffer[buffer_len+0] = byte(0xE0 + (value >> 12))
+ parser.buffer[buffer_len+1] = byte(0x80 + ((value >> 6) & 0x3F))
+ parser.buffer[buffer_len+2] = byte(0x80 + (value & 0x3F))
+ buffer_len += 3
+ } else {
+ // 0001 0000-0010 FFFF . 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+ parser.buffer[buffer_len+0] = byte(0xF0 + (value >> 18))
+ parser.buffer[buffer_len+1] = byte(0x80 + ((value >> 12) & 0x3F))
+ parser.buffer[buffer_len+2] = byte(0x80 + ((value >> 6) & 0x3F))
+ parser.buffer[buffer_len+3] = byte(0x80 + (value & 0x3F))
+ buffer_len += 4
+ }
+
+ parser.unread++
+ }
+
+ // On EOF, put NUL into the buffer and return.
+ if parser.eof {
+ parser.buffer[buffer_len] = 0
+ buffer_len++
+ parser.unread++
+ break
+ }
+ }
+ // [Go] Read the documentation of this function above. To return true,
+ // we need to have the given length in the buffer. Not doing that means
+ // every single check that calls this function to make sure the buffer
+ // has a given length is Go) panicking; or C) accessing invalid memory.
+ // This happens here due to the EOF above breaking early.
+ for buffer_len < length {
+ parser.buffer[buffer_len] = 0
+ buffer_len++
+ }
+ parser.buffer = parser.buffer[:buffer_len]
+ return true
+}
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/resolve.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/resolve.go
new file mode 100644
index 000000000..4120e0c91
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/resolve.go
@@ -0,0 +1,258 @@
+package yaml
+
+import (
+ "encoding/base64"
+ "math"
+ "regexp"
+ "strconv"
+ "strings"
+ "time"
+)
+
+type resolveMapItem struct {
+ value interface{}
+ tag string
+}
+
+var resolveTable = make([]byte, 256)
+var resolveMap = make(map[string]resolveMapItem)
+
+func init() {
+ t := resolveTable
+ t[int('+')] = 'S' // Sign
+ t[int('-')] = 'S'
+ for _, c := range "0123456789" {
+ t[int(c)] = 'D' // Digit
+ }
+ for _, c := range "yYnNtTfFoO~" {
+ t[int(c)] = 'M' // In map
+ }
+ t[int('.')] = '.' // Float (potentially in map)
+
+ var resolveMapList = []struct {
+ v interface{}
+ tag string
+ l []string
+ }{
+ {true, yaml_BOOL_TAG, []string{"y", "Y", "yes", "Yes", "YES"}},
+ {true, yaml_BOOL_TAG, []string{"true", "True", "TRUE"}},
+ {true, yaml_BOOL_TAG, []string{"on", "On", "ON"}},
+ {false, yaml_BOOL_TAG, []string{"n", "N", "no", "No", "NO"}},
+ {false, yaml_BOOL_TAG, []string{"false", "False", "FALSE"}},
+ {false, yaml_BOOL_TAG, []string{"off", "Off", "OFF"}},
+ {nil, yaml_NULL_TAG, []string{"", "~", "null", "Null", "NULL"}},
+ {math.NaN(), yaml_FLOAT_TAG, []string{".nan", ".NaN", ".NAN"}},
+ {math.Inf(+1), yaml_FLOAT_TAG, []string{".inf", ".Inf", ".INF"}},
+ {math.Inf(+1), yaml_FLOAT_TAG, []string{"+.inf", "+.Inf", "+.INF"}},
+ {math.Inf(-1), yaml_FLOAT_TAG, []string{"-.inf", "-.Inf", "-.INF"}},
+ {"<<", yaml_MERGE_TAG, []string{"<<"}},
+ }
+
+ m := resolveMap
+ for _, item := range resolveMapList {
+ for _, s := range item.l {
+ m[s] = resolveMapItem{item.v, item.tag}
+ }
+ }
+}
+
+const longTagPrefix = "tag:yaml.org,2002:"
+
+func shortTag(tag string) string {
+ // TODO This can easily be made faster and produce less garbage.
+ if strings.HasPrefix(tag, longTagPrefix) {
+ return "!!" + tag[len(longTagPrefix):]
+ }
+ return tag
+}
+
+func longTag(tag string) string {
+ if strings.HasPrefix(tag, "!!") {
+ return longTagPrefix + tag[2:]
+ }
+ return tag
+}
+
+func resolvableTag(tag string) bool {
+ switch tag {
+ case "", yaml_STR_TAG, yaml_BOOL_TAG, yaml_INT_TAG, yaml_FLOAT_TAG, yaml_NULL_TAG, yaml_TIMESTAMP_TAG:
+ return true
+ }
+ return false
+}
+
+var yamlStyleFloat = regexp.MustCompile(`^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$`)
+
+func resolve(tag string, in string) (rtag string, out interface{}) {
+ if !resolvableTag(tag) {
+ return tag, in
+ }
+
+ defer func() {
+ switch tag {
+ case "", rtag, yaml_STR_TAG, yaml_BINARY_TAG:
+ return
+ case yaml_FLOAT_TAG:
+ if rtag == yaml_INT_TAG {
+ switch v := out.(type) {
+ case int64:
+ rtag = yaml_FLOAT_TAG
+ out = float64(v)
+ return
+ case int:
+ rtag = yaml_FLOAT_TAG
+ out = float64(v)
+ return
+ }
+ }
+ }
+ failf("cannot decode %s `%s` as a %s", shortTag(rtag), in, shortTag(tag))
+ }()
+
+ // Any data is accepted as a !!str or !!binary.
+ // Otherwise, the prefix is enough of a hint about what it might be.
+ hint := byte('N')
+ if in != "" {
+ hint = resolveTable[in[0]]
+ }
+ if hint != 0 && tag != yaml_STR_TAG && tag != yaml_BINARY_TAG {
+ // Handle things we can lookup in a map.
+ if item, ok := resolveMap[in]; ok {
+ return item.tag, item.value
+ }
+
+ // Base 60 floats are a bad idea, were dropped in YAML 1.2, and
+ // are purposefully unsupported here. They're still quoted on
+ // the way out for compatibility with other parser, though.
+
+ switch hint {
+ case 'M':
+ // We've already checked the map above.
+
+ case '.':
+ // Not in the map, so maybe a normal float.
+ floatv, err := strconv.ParseFloat(in, 64)
+ if err == nil {
+ return yaml_FLOAT_TAG, floatv
+ }
+
+ case 'D', 'S':
+ // Int, float, or timestamp.
+ // Only try values as a timestamp if the value is unquoted or there's an explicit
+ // !!timestamp tag.
+ if tag == "" || tag == yaml_TIMESTAMP_TAG {
+ t, ok := parseTimestamp(in)
+ if ok {
+ return yaml_TIMESTAMP_TAG, t
+ }
+ }
+
+ plain := strings.Replace(in, "_", "", -1)
+ intv, err := strconv.ParseInt(plain, 0, 64)
+ if err == nil {
+ if intv == int64(int(intv)) {
+ return yaml_INT_TAG, int(intv)
+ } else {
+ return yaml_INT_TAG, intv
+ }
+ }
+ uintv, err := strconv.ParseUint(plain, 0, 64)
+ if err == nil {
+ return yaml_INT_TAG, uintv
+ }
+ if yamlStyleFloat.MatchString(plain) {
+ floatv, err := strconv.ParseFloat(plain, 64)
+ if err == nil {
+ return yaml_FLOAT_TAG, floatv
+ }
+ }
+ if strings.HasPrefix(plain, "0b") {
+ intv, err := strconv.ParseInt(plain[2:], 2, 64)
+ if err == nil {
+ if intv == int64(int(intv)) {
+ return yaml_INT_TAG, int(intv)
+ } else {
+ return yaml_INT_TAG, intv
+ }
+ }
+ uintv, err := strconv.ParseUint(plain[2:], 2, 64)
+ if err == nil {
+ return yaml_INT_TAG, uintv
+ }
+ } else if strings.HasPrefix(plain, "-0b") {
+ intv, err := strconv.ParseInt("-" + plain[3:], 2, 64)
+ if err == nil {
+ if true || intv == int64(int(intv)) {
+ return yaml_INT_TAG, int(intv)
+ } else {
+ return yaml_INT_TAG, intv
+ }
+ }
+ }
+ default:
+ panic("resolveTable item not yet handled: " + string(rune(hint)) + " (with " + in + ")")
+ }
+ }
+ return yaml_STR_TAG, in
+}
+
+// encodeBase64 encodes s as base64 that is broken up into multiple lines
+// as appropriate for the resulting length.
+func encodeBase64(s string) string {
+ const lineLen = 70
+ encLen := base64.StdEncoding.EncodedLen(len(s))
+ lines := encLen/lineLen + 1
+ buf := make([]byte, encLen*2+lines)
+ in := buf[0:encLen]
+ out := buf[encLen:]
+ base64.StdEncoding.Encode(in, []byte(s))
+ k := 0
+ for i := 0; i < len(in); i += lineLen {
+ j := i + lineLen
+ if j > len(in) {
+ j = len(in)
+ }
+ k += copy(out[k:], in[i:j])
+ if lines > 1 {
+ out[k] = '\n'
+ k++
+ }
+ }
+ return string(out[:k])
+}
+
+// This is a subset of the formats allowed by the regular expression
+// defined at http://yaml.org/type/timestamp.html.
+var allowedTimestampFormats = []string{
+ "2006-1-2T15:4:5.999999999Z07:00", // RCF3339Nano with short date fields.
+ "2006-1-2t15:4:5.999999999Z07:00", // RFC3339Nano with short date fields and lower-case "t".
+ "2006-1-2 15:4:5.999999999", // space separated with no time zone
+ "2006-1-2", // date only
+ // Notable exception: time.Parse cannot handle: "2001-12-14 21:59:43.10 -5"
+ // from the set of examples.
+}
+
+// parseTimestamp parses s as a timestamp string and
+// returns the timestamp and reports whether it succeeded.
+// Timestamp formats are defined at http://yaml.org/type/timestamp.html
+func parseTimestamp(s string) (time.Time, bool) {
+ // TODO write code to check all the formats supported by
+ // http://yaml.org/type/timestamp.html instead of using time.Parse.
+
+ // Quick check: all date formats start with YYYY-.
+ i := 0
+ for ; i < len(s); i++ {
+ if c := s[i]; c < '0' || c > '9' {
+ break
+ }
+ }
+ if i != 4 || i == len(s) || s[i] != '-' {
+ return time.Time{}, false
+ }
+ for _, format := range allowedTimestampFormats {
+ if t, err := time.Parse(format, s); err == nil {
+ return t, true
+ }
+ }
+ return time.Time{}, false
+}
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/scannerc.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/scannerc.go
new file mode 100644
index 000000000..0b9bb6030
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/scannerc.go
@@ -0,0 +1,2711 @@
+package yaml
+
+import (
+ "bytes"
+ "fmt"
+)
+
+// Introduction
+// ************
+//
+// The following notes assume that you are familiar with the YAML specification
+// (http://yaml.org/spec/1.2/spec.html). We mostly follow it, although in
+// some cases we are less restrictive that it requires.
+//
+// The process of transforming a YAML stream into a sequence of events is
+// divided on two steps: Scanning and Parsing.
+//
+// The Scanner transforms the input stream into a sequence of tokens, while the
+// parser transform the sequence of tokens produced by the Scanner into a
+// sequence of parsing events.
+//
+// The Scanner is rather clever and complicated. The Parser, on the contrary,
+// is a straightforward implementation of a recursive-descendant parser (or,
+// LL(1) parser, as it is usually called).
+//
+// Actually there are two issues of Scanning that might be called "clever", the
+// rest is quite straightforward. The issues are "block collection start" and
+// "simple keys". Both issues are explained below in details.
+//
+// Here the Scanning step is explained and implemented. We start with the list
+// of all the tokens produced by the Scanner together with short descriptions.
+//
+// Now, tokens:
+//
+// STREAM-START(encoding) # The stream start.
+// STREAM-END # The stream end.
+// VERSION-DIRECTIVE(major,minor) # The '%YAML' directive.
+// TAG-DIRECTIVE(handle,prefix) # The '%TAG' directive.
+// DOCUMENT-START # '---'
+// DOCUMENT-END # '...'
+// BLOCK-SEQUENCE-START # Indentation increase denoting a block
+// BLOCK-MAPPING-START # sequence or a block mapping.
+// BLOCK-END # Indentation decrease.
+// FLOW-SEQUENCE-START # '['
+// FLOW-SEQUENCE-END # ']'
+// BLOCK-SEQUENCE-START # '{'
+// BLOCK-SEQUENCE-END # '}'
+// BLOCK-ENTRY # '-'
+// FLOW-ENTRY # ','
+// KEY # '?' or nothing (simple keys).
+// VALUE # ':'
+// ALIAS(anchor) # '*anchor'
+// ANCHOR(anchor) # '&anchor'
+// TAG(handle,suffix) # '!handle!suffix'
+// SCALAR(value,style) # A scalar.
+//
+// The following two tokens are "virtual" tokens denoting the beginning and the
+// end of the stream:
+//
+// STREAM-START(encoding)
+// STREAM-END
+//
+// We pass the information about the input stream encoding with the
+// STREAM-START token.
+//
+// The next two tokens are responsible for tags:
+//
+// VERSION-DIRECTIVE(major,minor)
+// TAG-DIRECTIVE(handle,prefix)
+//
+// Example:
+//
+// %YAML 1.1
+// %TAG ! !foo
+// %TAG !yaml! tag:yaml.org,2002:
+// ---
+//
+// The correspoding sequence of tokens:
+//
+// STREAM-START(utf-8)
+// VERSION-DIRECTIVE(1,1)
+// TAG-DIRECTIVE("!","!foo")
+// TAG-DIRECTIVE("!yaml","tag:yaml.org,2002:")
+// DOCUMENT-START
+// STREAM-END
+//
+// Note that the VERSION-DIRECTIVE and TAG-DIRECTIVE tokens occupy a whole
+// line.
+//
+// The document start and end indicators are represented by:
+//
+// DOCUMENT-START
+// DOCUMENT-END
+//
+// Note that if a YAML stream contains an implicit document (without '---'
+// and '...' indicators), no DOCUMENT-START and DOCUMENT-END tokens will be
+// produced.
+//
+// In the following examples, we present whole documents together with the
+// produced tokens.
+//
+// 1. An implicit document:
+//
+// 'a scalar'
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// SCALAR("a scalar",single-quoted)
+// STREAM-END
+//
+// 2. An explicit document:
+//
+// ---
+// 'a scalar'
+// ...
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// DOCUMENT-START
+// SCALAR("a scalar",single-quoted)
+// DOCUMENT-END
+// STREAM-END
+//
+// 3. Several documents in a stream:
+//
+// 'a scalar'
+// ---
+// 'another scalar'
+// ---
+// 'yet another scalar'
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// SCALAR("a scalar",single-quoted)
+// DOCUMENT-START
+// SCALAR("another scalar",single-quoted)
+// DOCUMENT-START
+// SCALAR("yet another scalar",single-quoted)
+// STREAM-END
+//
+// We have already introduced the SCALAR token above. The following tokens are
+// used to describe aliases, anchors, tag, and scalars:
+//
+// ALIAS(anchor)
+// ANCHOR(anchor)
+// TAG(handle,suffix)
+// SCALAR(value,style)
+//
+// The following series of examples illustrate the usage of these tokens:
+//
+// 1. A recursive sequence:
+//
+// &A [ *A ]
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// ANCHOR("A")
+// FLOW-SEQUENCE-START
+// ALIAS("A")
+// FLOW-SEQUENCE-END
+// STREAM-END
+//
+// 2. A tagged scalar:
+//
+// !!float "3.14" # A good approximation.
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// TAG("!!","float")
+// SCALAR("3.14",double-quoted)
+// STREAM-END
+//
+// 3. Various scalar styles:
+//
+// --- # Implicit empty plain scalars do not produce tokens.
+// --- a plain scalar
+// --- 'a single-quoted scalar'
+// --- "a double-quoted scalar"
+// --- |-
+// a literal scalar
+// --- >-
+// a folded
+// scalar
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// DOCUMENT-START
+// DOCUMENT-START
+// SCALAR("a plain scalar",plain)
+// DOCUMENT-START
+// SCALAR("a single-quoted scalar",single-quoted)
+// DOCUMENT-START
+// SCALAR("a double-quoted scalar",double-quoted)
+// DOCUMENT-START
+// SCALAR("a literal scalar",literal)
+// DOCUMENT-START
+// SCALAR("a folded scalar",folded)
+// STREAM-END
+//
+// Now it's time to review collection-related tokens. We will start with
+// flow collections:
+//
+// FLOW-SEQUENCE-START
+// FLOW-SEQUENCE-END
+// FLOW-MAPPING-START
+// FLOW-MAPPING-END
+// FLOW-ENTRY
+// KEY
+// VALUE
+//
+// The tokens FLOW-SEQUENCE-START, FLOW-SEQUENCE-END, FLOW-MAPPING-START, and
+// FLOW-MAPPING-END represent the indicators '[', ']', '{', and '}'
+// correspondingly. FLOW-ENTRY represent the ',' indicator. Finally the
+// indicators '?' and ':', which are used for denoting mapping keys and values,
+// are represented by the KEY and VALUE tokens.
+//
+// The following examples show flow collections:
+//
+// 1. A flow sequence:
+//
+// [item 1, item 2, item 3]
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// FLOW-SEQUENCE-START
+// SCALAR("item 1",plain)
+// FLOW-ENTRY
+// SCALAR("item 2",plain)
+// FLOW-ENTRY
+// SCALAR("item 3",plain)
+// FLOW-SEQUENCE-END
+// STREAM-END
+//
+// 2. A flow mapping:
+//
+// {
+// a simple key: a value, # Note that the KEY token is produced.
+// ? a complex key: another value,
+// }
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// FLOW-MAPPING-START
+// KEY
+// SCALAR("a simple key",plain)
+// VALUE
+// SCALAR("a value",plain)
+// FLOW-ENTRY
+// KEY
+// SCALAR("a complex key",plain)
+// VALUE
+// SCALAR("another value",plain)
+// FLOW-ENTRY
+// FLOW-MAPPING-END
+// STREAM-END
+//
+// A simple key is a key which is not denoted by the '?' indicator. Note that
+// the Scanner still produce the KEY token whenever it encounters a simple key.
+//
+// For scanning block collections, the following tokens are used (note that we
+// repeat KEY and VALUE here):
+//
+// BLOCK-SEQUENCE-START
+// BLOCK-MAPPING-START
+// BLOCK-END
+// BLOCK-ENTRY
+// KEY
+// VALUE
+//
+// The tokens BLOCK-SEQUENCE-START and BLOCK-MAPPING-START denote indentation
+// increase that precedes a block collection (cf. the INDENT token in Python).
+// The token BLOCK-END denote indentation decrease that ends a block collection
+// (cf. the DEDENT token in Python). However YAML has some syntax pecularities
+// that makes detections of these tokens more complex.
+//
+// The tokens BLOCK-ENTRY, KEY, and VALUE are used to represent the indicators
+// '-', '?', and ':' correspondingly.
+//
+// The following examples show how the tokens BLOCK-SEQUENCE-START,
+// BLOCK-MAPPING-START, and BLOCK-END are emitted by the Scanner:
+//
+// 1. Block sequences:
+//
+// - item 1
+// - item 2
+// -
+// - item 3.1
+// - item 3.2
+// -
+// key 1: value 1
+// key 2: value 2
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// BLOCK-SEQUENCE-START
+// BLOCK-ENTRY
+// SCALAR("item 1",plain)
+// BLOCK-ENTRY
+// SCALAR("item 2",plain)
+// BLOCK-ENTRY
+// BLOCK-SEQUENCE-START
+// BLOCK-ENTRY
+// SCALAR("item 3.1",plain)
+// BLOCK-ENTRY
+// SCALAR("item 3.2",plain)
+// BLOCK-END
+// BLOCK-ENTRY
+// BLOCK-MAPPING-START
+// KEY
+// SCALAR("key 1",plain)
+// VALUE
+// SCALAR("value 1",plain)
+// KEY
+// SCALAR("key 2",plain)
+// VALUE
+// SCALAR("value 2",plain)
+// BLOCK-END
+// BLOCK-END
+// STREAM-END
+//
+// 2. Block mappings:
+//
+// a simple key: a value # The KEY token is produced here.
+// ? a complex key
+// : another value
+// a mapping:
+// key 1: value 1
+// key 2: value 2
+// a sequence:
+// - item 1
+// - item 2
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// BLOCK-MAPPING-START
+// KEY
+// SCALAR("a simple key",plain)
+// VALUE
+// SCALAR("a value",plain)
+// KEY
+// SCALAR("a complex key",plain)
+// VALUE
+// SCALAR("another value",plain)
+// KEY
+// SCALAR("a mapping",plain)
+// BLOCK-MAPPING-START
+// KEY
+// SCALAR("key 1",plain)
+// VALUE
+// SCALAR("value 1",plain)
+// KEY
+// SCALAR("key 2",plain)
+// VALUE
+// SCALAR("value 2",plain)
+// BLOCK-END
+// KEY
+// SCALAR("a sequence",plain)
+// VALUE
+// BLOCK-SEQUENCE-START
+// BLOCK-ENTRY
+// SCALAR("item 1",plain)
+// BLOCK-ENTRY
+// SCALAR("item 2",plain)
+// BLOCK-END
+// BLOCK-END
+// STREAM-END
+//
+// YAML does not always require to start a new block collection from a new
+// line. If the current line contains only '-', '?', and ':' indicators, a new
+// block collection may start at the current line. The following examples
+// illustrate this case:
+//
+// 1. Collections in a sequence:
+//
+// - - item 1
+// - item 2
+// - key 1: value 1
+// key 2: value 2
+// - ? complex key
+// : complex value
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// BLOCK-SEQUENCE-START
+// BLOCK-ENTRY
+// BLOCK-SEQUENCE-START
+// BLOCK-ENTRY
+// SCALAR("item 1",plain)
+// BLOCK-ENTRY
+// SCALAR("item 2",plain)
+// BLOCK-END
+// BLOCK-ENTRY
+// BLOCK-MAPPING-START
+// KEY
+// SCALAR("key 1",plain)
+// VALUE
+// SCALAR("value 1",plain)
+// KEY
+// SCALAR("key 2",plain)
+// VALUE
+// SCALAR("value 2",plain)
+// BLOCK-END
+// BLOCK-ENTRY
+// BLOCK-MAPPING-START
+// KEY
+// SCALAR("complex key")
+// VALUE
+// SCALAR("complex value")
+// BLOCK-END
+// BLOCK-END
+// STREAM-END
+//
+// 2. Collections in a mapping:
+//
+// ? a sequence
+// : - item 1
+// - item 2
+// ? a mapping
+// : key 1: value 1
+// key 2: value 2
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// BLOCK-MAPPING-START
+// KEY
+// SCALAR("a sequence",plain)
+// VALUE
+// BLOCK-SEQUENCE-START
+// BLOCK-ENTRY
+// SCALAR("item 1",plain)
+// BLOCK-ENTRY
+// SCALAR("item 2",plain)
+// BLOCK-END
+// KEY
+// SCALAR("a mapping",plain)
+// VALUE
+// BLOCK-MAPPING-START
+// KEY
+// SCALAR("key 1",plain)
+// VALUE
+// SCALAR("value 1",plain)
+// KEY
+// SCALAR("key 2",plain)
+// VALUE
+// SCALAR("value 2",plain)
+// BLOCK-END
+// BLOCK-END
+// STREAM-END
+//
+// YAML also permits non-indented sequences if they are included into a block
+// mapping. In this case, the token BLOCK-SEQUENCE-START is not produced:
+//
+// key:
+// - item 1 # BLOCK-SEQUENCE-START is NOT produced here.
+// - item 2
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// BLOCK-MAPPING-START
+// KEY
+// SCALAR("key",plain)
+// VALUE
+// BLOCK-ENTRY
+// SCALAR("item 1",plain)
+// BLOCK-ENTRY
+// SCALAR("item 2",plain)
+// BLOCK-END
+//
+
+// Ensure that the buffer contains the required number of characters.
+// Return true on success, false on failure (reader error or memory error).
+func cache(parser *yaml_parser_t, length int) bool {
+ // [Go] This was inlined: !cache(A, B) -> unread < B && !update(A, B)
+ return parser.unread >= length || yaml_parser_update_buffer(parser, length)
+}
+
+// Advance the buffer pointer.
+func skip(parser *yaml_parser_t) {
+ parser.mark.index++
+ parser.mark.column++
+ parser.unread--
+ parser.buffer_pos += width(parser.buffer[parser.buffer_pos])
+}
+
+func skip_line(parser *yaml_parser_t) {
+ if is_crlf(parser.buffer, parser.buffer_pos) {
+ parser.mark.index += 2
+ parser.mark.column = 0
+ parser.mark.line++
+ parser.unread -= 2
+ parser.buffer_pos += 2
+ } else if is_break(parser.buffer, parser.buffer_pos) {
+ parser.mark.index++
+ parser.mark.column = 0
+ parser.mark.line++
+ parser.unread--
+ parser.buffer_pos += width(parser.buffer[parser.buffer_pos])
+ }
+}
+
+// Copy a character to a string buffer and advance pointers.
+func read(parser *yaml_parser_t, s []byte) []byte {
+ w := width(parser.buffer[parser.buffer_pos])
+ if w == 0 {
+ panic("invalid character sequence")
+ }
+ if len(s) == 0 {
+ s = make([]byte, 0, 32)
+ }
+ if w == 1 && len(s)+w <= cap(s) {
+ s = s[:len(s)+1]
+ s[len(s)-1] = parser.buffer[parser.buffer_pos]
+ parser.buffer_pos++
+ } else {
+ s = append(s, parser.buffer[parser.buffer_pos:parser.buffer_pos+w]...)
+ parser.buffer_pos += w
+ }
+ parser.mark.index++
+ parser.mark.column++
+ parser.unread--
+ return s
+}
+
+// Copy a line break character to a string buffer and advance pointers.
+func read_line(parser *yaml_parser_t, s []byte) []byte {
+ buf := parser.buffer
+ pos := parser.buffer_pos
+ switch {
+ case buf[pos] == '\r' && buf[pos+1] == '\n':
+ // CR LF . LF
+ s = append(s, '\n')
+ parser.buffer_pos += 2
+ parser.mark.index++
+ parser.unread--
+ case buf[pos] == '\r' || buf[pos] == '\n':
+ // CR|LF . LF
+ s = append(s, '\n')
+ parser.buffer_pos += 1
+ case buf[pos] == '\xC2' && buf[pos+1] == '\x85':
+ // NEL . LF
+ s = append(s, '\n')
+ parser.buffer_pos += 2
+ case buf[pos] == '\xE2' && buf[pos+1] == '\x80' && (buf[pos+2] == '\xA8' || buf[pos+2] == '\xA9'):
+ // LS|PS . LS|PS
+ s = append(s, buf[parser.buffer_pos:pos+3]...)
+ parser.buffer_pos += 3
+ default:
+ return s
+ }
+ parser.mark.index++
+ parser.mark.column = 0
+ parser.mark.line++
+ parser.unread--
+ return s
+}
+
+// Get the next token.
+func yaml_parser_scan(parser *yaml_parser_t, token *yaml_token_t) bool {
+ // Erase the token object.
+ *token = yaml_token_t{} // [Go] Is this necessary?
+
+ // No tokens after STREAM-END or error.
+ if parser.stream_end_produced || parser.error != yaml_NO_ERROR {
+ return true
+ }
+
+ // Ensure that the tokens queue contains enough tokens.
+ if !parser.token_available {
+ if !yaml_parser_fetch_more_tokens(parser) {
+ return false
+ }
+ }
+
+ // Fetch the next token from the queue.
+ *token = parser.tokens[parser.tokens_head]
+ parser.tokens_head++
+ parser.tokens_parsed++
+ parser.token_available = false
+
+ if token.typ == yaml_STREAM_END_TOKEN {
+ parser.stream_end_produced = true
+ }
+ return true
+}
+
+// Set the scanner error and return false.
+func yaml_parser_set_scanner_error(parser *yaml_parser_t, context string, context_mark yaml_mark_t, problem string) bool {
+ parser.error = yaml_SCANNER_ERROR
+ parser.context = context
+ parser.context_mark = context_mark
+ parser.problem = problem
+ parser.problem_mark = parser.mark
+ return false
+}
+
+func yaml_parser_set_scanner_tag_error(parser *yaml_parser_t, directive bool, context_mark yaml_mark_t, problem string) bool {
+ context := "while parsing a tag"
+ if directive {
+ context = "while parsing a %TAG directive"
+ }
+ return yaml_parser_set_scanner_error(parser, context, context_mark, problem)
+}
+
+func trace(args ...interface{}) func() {
+ pargs := append([]interface{}{"+++"}, args...)
+ fmt.Println(pargs...)
+ pargs = append([]interface{}{"---"}, args...)
+ return func() { fmt.Println(pargs...) }
+}
+
+// Ensure that the tokens queue contains at least one token which can be
+// returned to the Parser.
+func yaml_parser_fetch_more_tokens(parser *yaml_parser_t) bool {
+ // While we need more tokens to fetch, do it.
+ for {
+ if parser.tokens_head != len(parser.tokens) {
+ // If queue is non-empty, check if any potential simple key may
+ // occupy the head position.
+ head_tok_idx, ok := parser.simple_keys_by_tok[parser.tokens_parsed]
+ if !ok {
+ break
+ } else if valid, ok := yaml_simple_key_is_valid(parser, &parser.simple_keys[head_tok_idx]); !ok {
+ return false
+ } else if !valid {
+ break
+ }
+ }
+ // Fetch the next token.
+ if !yaml_parser_fetch_next_token(parser) {
+ return false
+ }
+ }
+
+ parser.token_available = true
+ return true
+}
+
+// The dispatcher for token fetchers.
+func yaml_parser_fetch_next_token(parser *yaml_parser_t) bool {
+ // Ensure that the buffer is initialized.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+
+ // Check if we just started scanning. Fetch STREAM-START then.
+ if !parser.stream_start_produced {
+ return yaml_parser_fetch_stream_start(parser)
+ }
+
+ // Eat whitespaces and comments until we reach the next token.
+ if !yaml_parser_scan_to_next_token(parser) {
+ return false
+ }
+
+ // Check the indentation level against the current column.
+ if !yaml_parser_unroll_indent(parser, parser.mark.column) {
+ return false
+ }
+
+ // Ensure that the buffer contains at least 4 characters. 4 is the length
+ // of the longest indicators ('--- ' and '... ').
+ if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) {
+ return false
+ }
+
+ // Is it the end of the stream?
+ if is_z(parser.buffer, parser.buffer_pos) {
+ return yaml_parser_fetch_stream_end(parser)
+ }
+
+ // Is it a directive?
+ if parser.mark.column == 0 && parser.buffer[parser.buffer_pos] == '%' {
+ return yaml_parser_fetch_directive(parser)
+ }
+
+ buf := parser.buffer
+ pos := parser.buffer_pos
+
+ // Is it the document start indicator?
+ if parser.mark.column == 0 && buf[pos] == '-' && buf[pos+1] == '-' && buf[pos+2] == '-' && is_blankz(buf, pos+3) {
+ return yaml_parser_fetch_document_indicator(parser, yaml_DOCUMENT_START_TOKEN)
+ }
+
+ // Is it the document end indicator?
+ if parser.mark.column == 0 && buf[pos] == '.' && buf[pos+1] == '.' && buf[pos+2] == '.' && is_blankz(buf, pos+3) {
+ return yaml_parser_fetch_document_indicator(parser, yaml_DOCUMENT_END_TOKEN)
+ }
+
+ // Is it the flow sequence start indicator?
+ if buf[pos] == '[' {
+ return yaml_parser_fetch_flow_collection_start(parser, yaml_FLOW_SEQUENCE_START_TOKEN)
+ }
+
+ // Is it the flow mapping start indicator?
+ if parser.buffer[parser.buffer_pos] == '{' {
+ return yaml_parser_fetch_flow_collection_start(parser, yaml_FLOW_MAPPING_START_TOKEN)
+ }
+
+ // Is it the flow sequence end indicator?
+ if parser.buffer[parser.buffer_pos] == ']' {
+ return yaml_parser_fetch_flow_collection_end(parser,
+ yaml_FLOW_SEQUENCE_END_TOKEN)
+ }
+
+ // Is it the flow mapping end indicator?
+ if parser.buffer[parser.buffer_pos] == '}' {
+ return yaml_parser_fetch_flow_collection_end(parser,
+ yaml_FLOW_MAPPING_END_TOKEN)
+ }
+
+ // Is it the flow entry indicator?
+ if parser.buffer[parser.buffer_pos] == ',' {
+ return yaml_parser_fetch_flow_entry(parser)
+ }
+
+ // Is it the block entry indicator?
+ if parser.buffer[parser.buffer_pos] == '-' && is_blankz(parser.buffer, parser.buffer_pos+1) {
+ return yaml_parser_fetch_block_entry(parser)
+ }
+
+ // Is it the key indicator?
+ if parser.buffer[parser.buffer_pos] == '?' && (parser.flow_level > 0 || is_blankz(parser.buffer, parser.buffer_pos+1)) {
+ return yaml_parser_fetch_key(parser)
+ }
+
+ // Is it the value indicator?
+ if parser.buffer[parser.buffer_pos] == ':' && (parser.flow_level > 0 || is_blankz(parser.buffer, parser.buffer_pos+1)) {
+ return yaml_parser_fetch_value(parser)
+ }
+
+ // Is it an alias?
+ if parser.buffer[parser.buffer_pos] == '*' {
+ return yaml_parser_fetch_anchor(parser, yaml_ALIAS_TOKEN)
+ }
+
+ // Is it an anchor?
+ if parser.buffer[parser.buffer_pos] == '&' {
+ return yaml_parser_fetch_anchor(parser, yaml_ANCHOR_TOKEN)
+ }
+
+ // Is it a tag?
+ if parser.buffer[parser.buffer_pos] == '!' {
+ return yaml_parser_fetch_tag(parser)
+ }
+
+ // Is it a literal scalar?
+ if parser.buffer[parser.buffer_pos] == '|' && parser.flow_level == 0 {
+ return yaml_parser_fetch_block_scalar(parser, true)
+ }
+
+ // Is it a folded scalar?
+ if parser.buffer[parser.buffer_pos] == '>' && parser.flow_level == 0 {
+ return yaml_parser_fetch_block_scalar(parser, false)
+ }
+
+ // Is it a single-quoted scalar?
+ if parser.buffer[parser.buffer_pos] == '\'' {
+ return yaml_parser_fetch_flow_scalar(parser, true)
+ }
+
+ // Is it a double-quoted scalar?
+ if parser.buffer[parser.buffer_pos] == '"' {
+ return yaml_parser_fetch_flow_scalar(parser, false)
+ }
+
+ // Is it a plain scalar?
+ //
+ // A plain scalar may start with any non-blank characters except
+ //
+ // '-', '?', ':', ',', '[', ']', '{', '}',
+ // '#', '&', '*', '!', '|', '>', '\'', '\"',
+ // '%', '@', '`'.
+ //
+ // In the block context (and, for the '-' indicator, in the flow context
+ // too), it may also start with the characters
+ //
+ // '-', '?', ':'
+ //
+ // if it is followed by a non-space character.
+ //
+ // The last rule is more restrictive than the specification requires.
+ // [Go] Make this logic more reasonable.
+ //switch parser.buffer[parser.buffer_pos] {
+ //case '-', '?', ':', ',', '?', '-', ',', ':', ']', '[', '}', '{', '&', '#', '!', '*', '>', '|', '"', '\'', '@', '%', '-', '`':
+ //}
+ if !(is_blankz(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == '-' ||
+ parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == ':' ||
+ parser.buffer[parser.buffer_pos] == ',' || parser.buffer[parser.buffer_pos] == '[' ||
+ parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '{' ||
+ parser.buffer[parser.buffer_pos] == '}' || parser.buffer[parser.buffer_pos] == '#' ||
+ parser.buffer[parser.buffer_pos] == '&' || parser.buffer[parser.buffer_pos] == '*' ||
+ parser.buffer[parser.buffer_pos] == '!' || parser.buffer[parser.buffer_pos] == '|' ||
+ parser.buffer[parser.buffer_pos] == '>' || parser.buffer[parser.buffer_pos] == '\'' ||
+ parser.buffer[parser.buffer_pos] == '"' || parser.buffer[parser.buffer_pos] == '%' ||
+ parser.buffer[parser.buffer_pos] == '@' || parser.buffer[parser.buffer_pos] == '`') ||
+ (parser.buffer[parser.buffer_pos] == '-' && !is_blank(parser.buffer, parser.buffer_pos+1)) ||
+ (parser.flow_level == 0 &&
+ (parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == ':') &&
+ !is_blankz(parser.buffer, parser.buffer_pos+1)) {
+ return yaml_parser_fetch_plain_scalar(parser)
+ }
+
+ // If we don't determine the token type so far, it is an error.
+ return yaml_parser_set_scanner_error(parser,
+ "while scanning for the next token", parser.mark,
+ "found character that cannot start any token")
+}
+
+func yaml_simple_key_is_valid(parser *yaml_parser_t, simple_key *yaml_simple_key_t) (valid, ok bool) {
+ if !simple_key.possible {
+ return false, true
+ }
+
+ // The 1.2 specification says:
+ //
+ // "If the ? indicator is omitted, parsing needs to see past the
+ // implicit key to recognize it as such. To limit the amount of
+ // lookahead required, the “:” indicator must appear at most 1024
+ // Unicode characters beyond the start of the key. In addition, the key
+ // is restricted to a single line."
+ //
+ if simple_key.mark.line < parser.mark.line || simple_key.mark.index+1024 < parser.mark.index {
+ // Check if the potential simple key to be removed is required.
+ if simple_key.required {
+ return false, yaml_parser_set_scanner_error(parser,
+ "while scanning a simple key", simple_key.mark,
+ "could not find expected ':'")
+ }
+ simple_key.possible = false
+ return false, true
+ }
+ return true, true
+}
+
+// Check if a simple key may start at the current position and add it if
+// needed.
+func yaml_parser_save_simple_key(parser *yaml_parser_t) bool {
+ // A simple key is required at the current position if the scanner is in
+ // the block context and the current column coincides with the indentation
+ // level.
+
+ required := parser.flow_level == 0 && parser.indent == parser.mark.column
+
+ //
+ // If the current position may start a simple key, save it.
+ //
+ if parser.simple_key_allowed {
+ simple_key := yaml_simple_key_t{
+ possible: true,
+ required: required,
+ token_number: parser.tokens_parsed + (len(parser.tokens) - parser.tokens_head),
+ mark: parser.mark,
+ }
+
+ if !yaml_parser_remove_simple_key(parser) {
+ return false
+ }
+ parser.simple_keys[len(parser.simple_keys)-1] = simple_key
+ parser.simple_keys_by_tok[simple_key.token_number] = len(parser.simple_keys) - 1
+ }
+ return true
+}
+
+// Remove a potential simple key at the current flow level.
+func yaml_parser_remove_simple_key(parser *yaml_parser_t) bool {
+ i := len(parser.simple_keys) - 1
+ if parser.simple_keys[i].possible {
+ // If the key is required, it is an error.
+ if parser.simple_keys[i].required {
+ return yaml_parser_set_scanner_error(parser,
+ "while scanning a simple key", parser.simple_keys[i].mark,
+ "could not find expected ':'")
+ }
+ // Remove the key from the stack.
+ parser.simple_keys[i].possible = false
+ delete(parser.simple_keys_by_tok, parser.simple_keys[i].token_number)
+ }
+ return true
+}
+
+// max_flow_level limits the flow_level
+const max_flow_level = 10000
+
+// Increase the flow level and resize the simple key list if needed.
+func yaml_parser_increase_flow_level(parser *yaml_parser_t) bool {
+ // Reset the simple key on the next level.
+ parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{
+ possible: false,
+ required: false,
+ token_number: parser.tokens_parsed + (len(parser.tokens) - parser.tokens_head),
+ mark: parser.mark,
+ })
+
+ // Increase the flow level.
+ parser.flow_level++
+ if parser.flow_level > max_flow_level {
+ return yaml_parser_set_scanner_error(parser,
+ "while increasing flow level", parser.simple_keys[len(parser.simple_keys)-1].mark,
+ fmt.Sprintf("exceeded max depth of %d", max_flow_level))
+ }
+ return true
+}
+
+// Decrease the flow level.
+func yaml_parser_decrease_flow_level(parser *yaml_parser_t) bool {
+ if parser.flow_level > 0 {
+ parser.flow_level--
+ last := len(parser.simple_keys) - 1
+ delete(parser.simple_keys_by_tok, parser.simple_keys[last].token_number)
+ parser.simple_keys = parser.simple_keys[:last]
+ }
+ return true
+}
+
+// max_indents limits the indents stack size
+const max_indents = 10000
+
+// Push the current indentation level to the stack and set the new level
+// the current column is greater than the indentation level. In this case,
+// append or insert the specified token into the token queue.
+func yaml_parser_roll_indent(parser *yaml_parser_t, column, number int, typ yaml_token_type_t, mark yaml_mark_t) bool {
+ // In the flow context, do nothing.
+ if parser.flow_level > 0 {
+ return true
+ }
+
+ if parser.indent < column {
+ // Push the current indentation level to the stack and set the new
+ // indentation level.
+ parser.indents = append(parser.indents, parser.indent)
+ parser.indent = column
+ if len(parser.indents) > max_indents {
+ return yaml_parser_set_scanner_error(parser,
+ "while increasing indent level", parser.simple_keys[len(parser.simple_keys)-1].mark,
+ fmt.Sprintf("exceeded max depth of %d", max_indents))
+ }
+
+ // Create a token and insert it into the queue.
+ token := yaml_token_t{
+ typ: typ,
+ start_mark: mark,
+ end_mark: mark,
+ }
+ if number > -1 {
+ number -= parser.tokens_parsed
+ }
+ yaml_insert_token(parser, number, &token)
+ }
+ return true
+}
+
+// Pop indentation levels from the indents stack until the current level
+// becomes less or equal to the column. For each indentation level, append
+// the BLOCK-END token.
+func yaml_parser_unroll_indent(parser *yaml_parser_t, column int) bool {
+ // In the flow context, do nothing.
+ if parser.flow_level > 0 {
+ return true
+ }
+
+ // Loop through the indentation levels in the stack.
+ for parser.indent > column {
+ // Create a token and append it to the queue.
+ token := yaml_token_t{
+ typ: yaml_BLOCK_END_TOKEN,
+ start_mark: parser.mark,
+ end_mark: parser.mark,
+ }
+ yaml_insert_token(parser, -1, &token)
+
+ // Pop the indentation level.
+ parser.indent = parser.indents[len(parser.indents)-1]
+ parser.indents = parser.indents[:len(parser.indents)-1]
+ }
+ return true
+}
+
+// Initialize the scanner and produce the STREAM-START token.
+func yaml_parser_fetch_stream_start(parser *yaml_parser_t) bool {
+
+ // Set the initial indentation.
+ parser.indent = -1
+
+ // Initialize the simple key stack.
+ parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{})
+
+ parser.simple_keys_by_tok = make(map[int]int)
+
+ // A simple key is allowed at the beginning of the stream.
+ parser.simple_key_allowed = true
+
+ // We have started.
+ parser.stream_start_produced = true
+
+ // Create the STREAM-START token and append it to the queue.
+ token := yaml_token_t{
+ typ: yaml_STREAM_START_TOKEN,
+ start_mark: parser.mark,
+ end_mark: parser.mark,
+ encoding: parser.encoding,
+ }
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the STREAM-END token and shut down the scanner.
+func yaml_parser_fetch_stream_end(parser *yaml_parser_t) bool {
+
+ // Force new line.
+ if parser.mark.column != 0 {
+ parser.mark.column = 0
+ parser.mark.line++
+ }
+
+ // Reset the indentation level.
+ if !yaml_parser_unroll_indent(parser, -1) {
+ return false
+ }
+
+ // Reset simple keys.
+ if !yaml_parser_remove_simple_key(parser) {
+ return false
+ }
+
+ parser.simple_key_allowed = false
+
+ // Create the STREAM-END token and append it to the queue.
+ token := yaml_token_t{
+ typ: yaml_STREAM_END_TOKEN,
+ start_mark: parser.mark,
+ end_mark: parser.mark,
+ }
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce a VERSION-DIRECTIVE or TAG-DIRECTIVE token.
+func yaml_parser_fetch_directive(parser *yaml_parser_t) bool {
+ // Reset the indentation level.
+ if !yaml_parser_unroll_indent(parser, -1) {
+ return false
+ }
+
+ // Reset simple keys.
+ if !yaml_parser_remove_simple_key(parser) {
+ return false
+ }
+
+ parser.simple_key_allowed = false
+
+ // Create the YAML-DIRECTIVE or TAG-DIRECTIVE token.
+ token := yaml_token_t{}
+ if !yaml_parser_scan_directive(parser, &token) {
+ return false
+ }
+ // Append the token to the queue.
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the DOCUMENT-START or DOCUMENT-END token.
+func yaml_parser_fetch_document_indicator(parser *yaml_parser_t, typ yaml_token_type_t) bool {
+ // Reset the indentation level.
+ if !yaml_parser_unroll_indent(parser, -1) {
+ return false
+ }
+
+ // Reset simple keys.
+ if !yaml_parser_remove_simple_key(parser) {
+ return false
+ }
+
+ parser.simple_key_allowed = false
+
+ // Consume the token.
+ start_mark := parser.mark
+
+ skip(parser)
+ skip(parser)
+ skip(parser)
+
+ end_mark := parser.mark
+
+ // Create the DOCUMENT-START or DOCUMENT-END token.
+ token := yaml_token_t{
+ typ: typ,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ }
+ // Append the token to the queue.
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the FLOW-SEQUENCE-START or FLOW-MAPPING-START token.
+func yaml_parser_fetch_flow_collection_start(parser *yaml_parser_t, typ yaml_token_type_t) bool {
+ // The indicators '[' and '{' may start a simple key.
+ if !yaml_parser_save_simple_key(parser) {
+ return false
+ }
+
+ // Increase the flow level.
+ if !yaml_parser_increase_flow_level(parser) {
+ return false
+ }
+
+ // A simple key may follow the indicators '[' and '{'.
+ parser.simple_key_allowed = true
+
+ // Consume the token.
+ start_mark := parser.mark
+ skip(parser)
+ end_mark := parser.mark
+
+ // Create the FLOW-SEQUENCE-START of FLOW-MAPPING-START token.
+ token := yaml_token_t{
+ typ: typ,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ }
+ // Append the token to the queue.
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the FLOW-SEQUENCE-END or FLOW-MAPPING-END token.
+func yaml_parser_fetch_flow_collection_end(parser *yaml_parser_t, typ yaml_token_type_t) bool {
+ // Reset any potential simple key on the current flow level.
+ if !yaml_parser_remove_simple_key(parser) {
+ return false
+ }
+
+ // Decrease the flow level.
+ if !yaml_parser_decrease_flow_level(parser) {
+ return false
+ }
+
+ // No simple keys after the indicators ']' and '}'.
+ parser.simple_key_allowed = false
+
+ // Consume the token.
+
+ start_mark := parser.mark
+ skip(parser)
+ end_mark := parser.mark
+
+ // Create the FLOW-SEQUENCE-END of FLOW-MAPPING-END token.
+ token := yaml_token_t{
+ typ: typ,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ }
+ // Append the token to the queue.
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the FLOW-ENTRY token.
+func yaml_parser_fetch_flow_entry(parser *yaml_parser_t) bool {
+ // Reset any potential simple keys on the current flow level.
+ if !yaml_parser_remove_simple_key(parser) {
+ return false
+ }
+
+ // Simple keys are allowed after ','.
+ parser.simple_key_allowed = true
+
+ // Consume the token.
+ start_mark := parser.mark
+ skip(parser)
+ end_mark := parser.mark
+
+ // Create the FLOW-ENTRY token and append it to the queue.
+ token := yaml_token_t{
+ typ: yaml_FLOW_ENTRY_TOKEN,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ }
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the BLOCK-ENTRY token.
+func yaml_parser_fetch_block_entry(parser *yaml_parser_t) bool {
+ // Check if the scanner is in the block context.
+ if parser.flow_level == 0 {
+ // Check if we are allowed to start a new entry.
+ if !parser.simple_key_allowed {
+ return yaml_parser_set_scanner_error(parser, "", parser.mark,
+ "block sequence entries are not allowed in this context")
+ }
+ // Add the BLOCK-SEQUENCE-START token if needed.
+ if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_SEQUENCE_START_TOKEN, parser.mark) {
+ return false
+ }
+ } else {
+ // It is an error for the '-' indicator to occur in the flow context,
+ // but we let the Parser detect and report about it because the Parser
+ // is able to point to the context.
+ }
+
+ // Reset any potential simple keys on the current flow level.
+ if !yaml_parser_remove_simple_key(parser) {
+ return false
+ }
+
+ // Simple keys are allowed after '-'.
+ parser.simple_key_allowed = true
+
+ // Consume the token.
+ start_mark := parser.mark
+ skip(parser)
+ end_mark := parser.mark
+
+ // Create the BLOCK-ENTRY token and append it to the queue.
+ token := yaml_token_t{
+ typ: yaml_BLOCK_ENTRY_TOKEN,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ }
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the KEY token.
+func yaml_parser_fetch_key(parser *yaml_parser_t) bool {
+
+ // In the block context, additional checks are required.
+ if parser.flow_level == 0 {
+ // Check if we are allowed to start a new key (not nessesary simple).
+ if !parser.simple_key_allowed {
+ return yaml_parser_set_scanner_error(parser, "", parser.mark,
+ "mapping keys are not allowed in this context")
+ }
+ // Add the BLOCK-MAPPING-START token if needed.
+ if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_MAPPING_START_TOKEN, parser.mark) {
+ return false
+ }
+ }
+
+ // Reset any potential simple keys on the current flow level.
+ if !yaml_parser_remove_simple_key(parser) {
+ return false
+ }
+
+ // Simple keys are allowed after '?' in the block context.
+ parser.simple_key_allowed = parser.flow_level == 0
+
+ // Consume the token.
+ start_mark := parser.mark
+ skip(parser)
+ end_mark := parser.mark
+
+ // Create the KEY token and append it to the queue.
+ token := yaml_token_t{
+ typ: yaml_KEY_TOKEN,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ }
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the VALUE token.
+func yaml_parser_fetch_value(parser *yaml_parser_t) bool {
+
+ simple_key := &parser.simple_keys[len(parser.simple_keys)-1]
+
+ // Have we found a simple key?
+ if valid, ok := yaml_simple_key_is_valid(parser, simple_key); !ok {
+ return false
+
+ } else if valid {
+
+ // Create the KEY token and insert it into the queue.
+ token := yaml_token_t{
+ typ: yaml_KEY_TOKEN,
+ start_mark: simple_key.mark,
+ end_mark: simple_key.mark,
+ }
+ yaml_insert_token(parser, simple_key.token_number-parser.tokens_parsed, &token)
+
+ // In the block context, we may need to add the BLOCK-MAPPING-START token.
+ if !yaml_parser_roll_indent(parser, simple_key.mark.column,
+ simple_key.token_number,
+ yaml_BLOCK_MAPPING_START_TOKEN, simple_key.mark) {
+ return false
+ }
+
+ // Remove the simple key.
+ simple_key.possible = false
+ delete(parser.simple_keys_by_tok, simple_key.token_number)
+
+ // A simple key cannot follow another simple key.
+ parser.simple_key_allowed = false
+
+ } else {
+ // The ':' indicator follows a complex key.
+
+ // In the block context, extra checks are required.
+ if parser.flow_level == 0 {
+
+ // Check if we are allowed to start a complex value.
+ if !parser.simple_key_allowed {
+ return yaml_parser_set_scanner_error(parser, "", parser.mark,
+ "mapping values are not allowed in this context")
+ }
+
+ // Add the BLOCK-MAPPING-START token if needed.
+ if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_MAPPING_START_TOKEN, parser.mark) {
+ return false
+ }
+ }
+
+ // Simple keys after ':' are allowed in the block context.
+ parser.simple_key_allowed = parser.flow_level == 0
+ }
+
+ // Consume the token.
+ start_mark := parser.mark
+ skip(parser)
+ end_mark := parser.mark
+
+ // Create the VALUE token and append it to the queue.
+ token := yaml_token_t{
+ typ: yaml_VALUE_TOKEN,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ }
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the ALIAS or ANCHOR token.
+func yaml_parser_fetch_anchor(parser *yaml_parser_t, typ yaml_token_type_t) bool {
+ // An anchor or an alias could be a simple key.
+ if !yaml_parser_save_simple_key(parser) {
+ return false
+ }
+
+ // A simple key cannot follow an anchor or an alias.
+ parser.simple_key_allowed = false
+
+ // Create the ALIAS or ANCHOR token and append it to the queue.
+ var token yaml_token_t
+ if !yaml_parser_scan_anchor(parser, &token, typ) {
+ return false
+ }
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the TAG token.
+func yaml_parser_fetch_tag(parser *yaml_parser_t) bool {
+ // A tag could be a simple key.
+ if !yaml_parser_save_simple_key(parser) {
+ return false
+ }
+
+ // A simple key cannot follow a tag.
+ parser.simple_key_allowed = false
+
+ // Create the TAG token and append it to the queue.
+ var token yaml_token_t
+ if !yaml_parser_scan_tag(parser, &token) {
+ return false
+ }
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the SCALAR(...,literal) or SCALAR(...,folded) tokens.
+func yaml_parser_fetch_block_scalar(parser *yaml_parser_t, literal bool) bool {
+ // Remove any potential simple keys.
+ if !yaml_parser_remove_simple_key(parser) {
+ return false
+ }
+
+ // A simple key may follow a block scalar.
+ parser.simple_key_allowed = true
+
+ // Create the SCALAR token and append it to the queue.
+ var token yaml_token_t
+ if !yaml_parser_scan_block_scalar(parser, &token, literal) {
+ return false
+ }
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the SCALAR(...,single-quoted) or SCALAR(...,double-quoted) tokens.
+func yaml_parser_fetch_flow_scalar(parser *yaml_parser_t, single bool) bool {
+ // A plain scalar could be a simple key.
+ if !yaml_parser_save_simple_key(parser) {
+ return false
+ }
+
+ // A simple key cannot follow a flow scalar.
+ parser.simple_key_allowed = false
+
+ // Create the SCALAR token and append it to the queue.
+ var token yaml_token_t
+ if !yaml_parser_scan_flow_scalar(parser, &token, single) {
+ return false
+ }
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the SCALAR(...,plain) token.
+func yaml_parser_fetch_plain_scalar(parser *yaml_parser_t) bool {
+ // A plain scalar could be a simple key.
+ if !yaml_parser_save_simple_key(parser) {
+ return false
+ }
+
+ // A simple key cannot follow a flow scalar.
+ parser.simple_key_allowed = false
+
+ // Create the SCALAR token and append it to the queue.
+ var token yaml_token_t
+ if !yaml_parser_scan_plain_scalar(parser, &token) {
+ return false
+ }
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Eat whitespaces and comments until the next token is found.
+func yaml_parser_scan_to_next_token(parser *yaml_parser_t) bool {
+
+ // Until the next token is not found.
+ for {
+ // Allow the BOM mark to start a line.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ if parser.mark.column == 0 && is_bom(parser.buffer, parser.buffer_pos) {
+ skip(parser)
+ }
+
+ // Eat whitespaces.
+ // Tabs are allowed:
+ // - in the flow context
+ // - in the block context, but not at the beginning of the line or
+ // after '-', '?', or ':' (complex value).
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+
+ for parser.buffer[parser.buffer_pos] == ' ' || ((parser.flow_level > 0 || !parser.simple_key_allowed) && parser.buffer[parser.buffer_pos] == '\t') {
+ skip(parser)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+
+ // Eat a comment until a line break.
+ if parser.buffer[parser.buffer_pos] == '#' {
+ for !is_breakz(parser.buffer, parser.buffer_pos) {
+ skip(parser)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+ }
+
+ // If it is a line break, eat it.
+ if is_break(parser.buffer, parser.buffer_pos) {
+ if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) {
+ return false
+ }
+ skip_line(parser)
+
+ // In the block context, a new line may start a simple key.
+ if parser.flow_level == 0 {
+ parser.simple_key_allowed = true
+ }
+ } else {
+ break // We have found a token.
+ }
+ }
+
+ return true
+}
+
+// Scan a YAML-DIRECTIVE or TAG-DIRECTIVE token.
+//
+// Scope:
+// %YAML 1.1 # a comment \n
+// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+// %TAG !yaml! tag:yaml.org,2002: \n
+// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+//
+func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool {
+ // Eat '%'.
+ start_mark := parser.mark
+ skip(parser)
+
+ // Scan the directive name.
+ var name []byte
+ if !yaml_parser_scan_directive_name(parser, start_mark, &name) {
+ return false
+ }
+
+ // Is it a YAML directive?
+ if bytes.Equal(name, []byte("YAML")) {
+ // Scan the VERSION directive value.
+ var major, minor int8
+ if !yaml_parser_scan_version_directive_value(parser, start_mark, &major, &minor) {
+ return false
+ }
+ end_mark := parser.mark
+
+ // Create a VERSION-DIRECTIVE token.
+ *token = yaml_token_t{
+ typ: yaml_VERSION_DIRECTIVE_TOKEN,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ major: major,
+ minor: minor,
+ }
+
+ // Is it a TAG directive?
+ } else if bytes.Equal(name, []byte("TAG")) {
+ // Scan the TAG directive value.
+ var handle, prefix []byte
+ if !yaml_parser_scan_tag_directive_value(parser, start_mark, &handle, &prefix) {
+ return false
+ }
+ end_mark := parser.mark
+
+ // Create a TAG-DIRECTIVE token.
+ *token = yaml_token_t{
+ typ: yaml_TAG_DIRECTIVE_TOKEN,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ value: handle,
+ prefix: prefix,
+ }
+
+ // Unknown directive.
+ } else {
+ yaml_parser_set_scanner_error(parser, "while scanning a directive",
+ start_mark, "found unknown directive name")
+ return false
+ }
+
+ // Eat the rest of the line including any comments.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+
+ for is_blank(parser.buffer, parser.buffer_pos) {
+ skip(parser)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+
+ if parser.buffer[parser.buffer_pos] == '#' {
+ for !is_breakz(parser.buffer, parser.buffer_pos) {
+ skip(parser)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+ }
+
+ // Check if we are at the end of the line.
+ if !is_breakz(parser.buffer, parser.buffer_pos) {
+ yaml_parser_set_scanner_error(parser, "while scanning a directive",
+ start_mark, "did not find expected comment or line break")
+ return false
+ }
+
+ // Eat a line break.
+ if is_break(parser.buffer, parser.buffer_pos) {
+ if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) {
+ return false
+ }
+ skip_line(parser)
+ }
+
+ return true
+}
+
+// Scan the directive name.
+//
+// Scope:
+// %YAML 1.1 # a comment \n
+// ^^^^
+// %TAG !yaml! tag:yaml.org,2002: \n
+// ^^^
+//
+func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark_t, name *[]byte) bool {
+ // Consume the directive name.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+
+ var s []byte
+ for is_alpha(parser.buffer, parser.buffer_pos) {
+ s = read(parser, s)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+
+ // Check if the name is empty.
+ if len(s) == 0 {
+ yaml_parser_set_scanner_error(parser, "while scanning a directive",
+ start_mark, "could not find expected directive name")
+ return false
+ }
+
+ // Check for an blank character after the name.
+ if !is_blankz(parser.buffer, parser.buffer_pos) {
+ yaml_parser_set_scanner_error(parser, "while scanning a directive",
+ start_mark, "found unexpected non-alphabetical character")
+ return false
+ }
+ *name = s
+ return true
+}
+
+// Scan the value of VERSION-DIRECTIVE.
+//
+// Scope:
+// %YAML 1.1 # a comment \n
+// ^^^^^^
+func yaml_parser_scan_version_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, major, minor *int8) bool {
+ // Eat whitespaces.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ for is_blank(parser.buffer, parser.buffer_pos) {
+ skip(parser)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+
+ // Consume the major version number.
+ if !yaml_parser_scan_version_directive_number(parser, start_mark, major) {
+ return false
+ }
+
+ // Eat '.'.
+ if parser.buffer[parser.buffer_pos] != '.' {
+ return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive",
+ start_mark, "did not find expected digit or '.' character")
+ }
+
+ skip(parser)
+
+ // Consume the minor version number.
+ if !yaml_parser_scan_version_directive_number(parser, start_mark, minor) {
+ return false
+ }
+ return true
+}
+
+const max_number_length = 2
+
+// Scan the version number of VERSION-DIRECTIVE.
+//
+// Scope:
+// %YAML 1.1 # a comment \n
+// ^
+// %YAML 1.1 # a comment \n
+// ^
+func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark yaml_mark_t, number *int8) bool {
+
+ // Repeat while the next character is digit.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ var value, length int8
+ for is_digit(parser.buffer, parser.buffer_pos) {
+ // Check if the number is too long.
+ length++
+ if length > max_number_length {
+ return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive",
+ start_mark, "found extremely long version number")
+ }
+ value = value*10 + int8(as_digit(parser.buffer, parser.buffer_pos))
+ skip(parser)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+
+ // Check if the number was present.
+ if length == 0 {
+ return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive",
+ start_mark, "did not find expected version number")
+ }
+ *number = value
+ return true
+}
+
+// Scan the value of a TAG-DIRECTIVE token.
+//
+// Scope:
+// %TAG !yaml! tag:yaml.org,2002: \n
+// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+//
+func yaml_parser_scan_tag_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, handle, prefix *[]byte) bool {
+ var handle_value, prefix_value []byte
+
+ // Eat whitespaces.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+
+ for is_blank(parser.buffer, parser.buffer_pos) {
+ skip(parser)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+
+ // Scan a handle.
+ if !yaml_parser_scan_tag_handle(parser, true, start_mark, &handle_value) {
+ return false
+ }
+
+ // Expect a whitespace.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ if !is_blank(parser.buffer, parser.buffer_pos) {
+ yaml_parser_set_scanner_error(parser, "while scanning a %TAG directive",
+ start_mark, "did not find expected whitespace")
+ return false
+ }
+
+ // Eat whitespaces.
+ for is_blank(parser.buffer, parser.buffer_pos) {
+ skip(parser)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+
+ // Scan a prefix.
+ if !yaml_parser_scan_tag_uri(parser, true, nil, start_mark, &prefix_value) {
+ return false
+ }
+
+ // Expect a whitespace or line break.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ if !is_blankz(parser.buffer, parser.buffer_pos) {
+ yaml_parser_set_scanner_error(parser, "while scanning a %TAG directive",
+ start_mark, "did not find expected whitespace or line break")
+ return false
+ }
+
+ *handle = handle_value
+ *prefix = prefix_value
+ return true
+}
+
+func yaml_parser_scan_anchor(parser *yaml_parser_t, token *yaml_token_t, typ yaml_token_type_t) bool {
+ var s []byte
+
+ // Eat the indicator character.
+ start_mark := parser.mark
+ skip(parser)
+
+ // Consume the value.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+
+ for is_alpha(parser.buffer, parser.buffer_pos) {
+ s = read(parser, s)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+
+ end_mark := parser.mark
+
+ /*
+ * Check if length of the anchor is greater than 0 and it is followed by
+ * a whitespace character or one of the indicators:
+ *
+ * '?', ':', ',', ']', '}', '%', '@', '`'.
+ */
+
+ if len(s) == 0 ||
+ !(is_blankz(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == '?' ||
+ parser.buffer[parser.buffer_pos] == ':' || parser.buffer[parser.buffer_pos] == ',' ||
+ parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '}' ||
+ parser.buffer[parser.buffer_pos] == '%' || parser.buffer[parser.buffer_pos] == '@' ||
+ parser.buffer[parser.buffer_pos] == '`') {
+ context := "while scanning an alias"
+ if typ == yaml_ANCHOR_TOKEN {
+ context = "while scanning an anchor"
+ }
+ yaml_parser_set_scanner_error(parser, context, start_mark,
+ "did not find expected alphabetic or numeric character")
+ return false
+ }
+
+ // Create a token.
+ *token = yaml_token_t{
+ typ: typ,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ value: s,
+ }
+
+ return true
+}
+
+/*
+ * Scan a TAG token.
+ */
+
+func yaml_parser_scan_tag(parser *yaml_parser_t, token *yaml_token_t) bool {
+ var handle, suffix []byte
+
+ start_mark := parser.mark
+
+ // Check if the tag is in the canonical form.
+ if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) {
+ return false
+ }
+
+ if parser.buffer[parser.buffer_pos+1] == '<' {
+ // Keep the handle as ''
+
+ // Eat '!<'
+ skip(parser)
+ skip(parser)
+
+ // Consume the tag value.
+ if !yaml_parser_scan_tag_uri(parser, false, nil, start_mark, &suffix) {
+ return false
+ }
+
+ // Check for '>' and eat it.
+ if parser.buffer[parser.buffer_pos] != '>' {
+ yaml_parser_set_scanner_error(parser, "while scanning a tag",
+ start_mark, "did not find the expected '>'")
+ return false
+ }
+
+ skip(parser)
+ } else {
+ // The tag has either the '!suffix' or the '!handle!suffix' form.
+
+ // First, try to scan a handle.
+ if !yaml_parser_scan_tag_handle(parser, false, start_mark, &handle) {
+ return false
+ }
+
+ // Check if it is, indeed, handle.
+ if handle[0] == '!' && len(handle) > 1 && handle[len(handle)-1] == '!' {
+ // Scan the suffix now.
+ if !yaml_parser_scan_tag_uri(parser, false, nil, start_mark, &suffix) {
+ return false
+ }
+ } else {
+ // It wasn't a handle after all. Scan the rest of the tag.
+ if !yaml_parser_scan_tag_uri(parser, false, handle, start_mark, &suffix) {
+ return false
+ }
+
+ // Set the handle to '!'.
+ handle = []byte{'!'}
+
+ // A special case: the '!' tag. Set the handle to '' and the
+ // suffix to '!'.
+ if len(suffix) == 0 {
+ handle, suffix = suffix, handle
+ }
+ }
+ }
+
+ // Check the character which ends the tag.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ if !is_blankz(parser.buffer, parser.buffer_pos) {
+ yaml_parser_set_scanner_error(parser, "while scanning a tag",
+ start_mark, "did not find expected whitespace or line break")
+ return false
+ }
+
+ end_mark := parser.mark
+
+ // Create a token.
+ *token = yaml_token_t{
+ typ: yaml_TAG_TOKEN,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ value: handle,
+ suffix: suffix,
+ }
+ return true
+}
+
+// Scan a tag handle.
+func yaml_parser_scan_tag_handle(parser *yaml_parser_t, directive bool, start_mark yaml_mark_t, handle *[]byte) bool {
+ // Check the initial '!' character.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ if parser.buffer[parser.buffer_pos] != '!' {
+ yaml_parser_set_scanner_tag_error(parser, directive,
+ start_mark, "did not find expected '!'")
+ return false
+ }
+
+ var s []byte
+
+ // Copy the '!' character.
+ s = read(parser, s)
+
+ // Copy all subsequent alphabetical and numerical characters.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ for is_alpha(parser.buffer, parser.buffer_pos) {
+ s = read(parser, s)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+
+ // Check if the trailing character is '!' and copy it.
+ if parser.buffer[parser.buffer_pos] == '!' {
+ s = read(parser, s)
+ } else {
+ // It's either the '!' tag or not really a tag handle. If it's a %TAG
+ // directive, it's an error. If it's a tag token, it must be a part of URI.
+ if directive && string(s) != "!" {
+ yaml_parser_set_scanner_tag_error(parser, directive,
+ start_mark, "did not find expected '!'")
+ return false
+ }
+ }
+
+ *handle = s
+ return true
+}
+
+// Scan a tag.
+func yaml_parser_scan_tag_uri(parser *yaml_parser_t, directive bool, head []byte, start_mark yaml_mark_t, uri *[]byte) bool {
+ //size_t length = head ? strlen((char *)head) : 0
+ var s []byte
+ hasTag := len(head) > 0
+
+ // Copy the head if needed.
+ //
+ // Note that we don't copy the leading '!' character.
+ if len(head) > 1 {
+ s = append(s, head[1:]...)
+ }
+
+ // Scan the tag.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+
+ // The set of characters that may appear in URI is as follows:
+ //
+ // '0'-'9', 'A'-'Z', 'a'-'z', '_', '-', ';', '/', '?', ':', '@', '&',
+ // '=', '+', '$', ',', '.', '!', '~', '*', '\'', '(', ')', '[', ']',
+ // '%'.
+ // [Go] Convert this into more reasonable logic.
+ for is_alpha(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == ';' ||
+ parser.buffer[parser.buffer_pos] == '/' || parser.buffer[parser.buffer_pos] == '?' ||
+ parser.buffer[parser.buffer_pos] == ':' || parser.buffer[parser.buffer_pos] == '@' ||
+ parser.buffer[parser.buffer_pos] == '&' || parser.buffer[parser.buffer_pos] == '=' ||
+ parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '$' ||
+ parser.buffer[parser.buffer_pos] == ',' || parser.buffer[parser.buffer_pos] == '.' ||
+ parser.buffer[parser.buffer_pos] == '!' || parser.buffer[parser.buffer_pos] == '~' ||
+ parser.buffer[parser.buffer_pos] == '*' || parser.buffer[parser.buffer_pos] == '\'' ||
+ parser.buffer[parser.buffer_pos] == '(' || parser.buffer[parser.buffer_pos] == ')' ||
+ parser.buffer[parser.buffer_pos] == '[' || parser.buffer[parser.buffer_pos] == ']' ||
+ parser.buffer[parser.buffer_pos] == '%' {
+ // Check if it is a URI-escape sequence.
+ if parser.buffer[parser.buffer_pos] == '%' {
+ if !yaml_parser_scan_uri_escapes(parser, directive, start_mark, &s) {
+ return false
+ }
+ } else {
+ s = read(parser, s)
+ }
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ hasTag = true
+ }
+
+ if !hasTag {
+ yaml_parser_set_scanner_tag_error(parser, directive,
+ start_mark, "did not find expected tag URI")
+ return false
+ }
+ *uri = s
+ return true
+}
+
+// Decode an URI-escape sequence corresponding to a single UTF-8 character.
+func yaml_parser_scan_uri_escapes(parser *yaml_parser_t, directive bool, start_mark yaml_mark_t, s *[]byte) bool {
+
+ // Decode the required number of characters.
+ w := 1024
+ for w > 0 {
+ // Check for a URI-escaped octet.
+ if parser.unread < 3 && !yaml_parser_update_buffer(parser, 3) {
+ return false
+ }
+
+ if !(parser.buffer[parser.buffer_pos] == '%' &&
+ is_hex(parser.buffer, parser.buffer_pos+1) &&
+ is_hex(parser.buffer, parser.buffer_pos+2)) {
+ return yaml_parser_set_scanner_tag_error(parser, directive,
+ start_mark, "did not find URI escaped octet")
+ }
+
+ // Get the octet.
+ octet := byte((as_hex(parser.buffer, parser.buffer_pos+1) << 4) + as_hex(parser.buffer, parser.buffer_pos+2))
+
+ // If it is the leading octet, determine the length of the UTF-8 sequence.
+ if w == 1024 {
+ w = width(octet)
+ if w == 0 {
+ return yaml_parser_set_scanner_tag_error(parser, directive,
+ start_mark, "found an incorrect leading UTF-8 octet")
+ }
+ } else {
+ // Check if the trailing octet is correct.
+ if octet&0xC0 != 0x80 {
+ return yaml_parser_set_scanner_tag_error(parser, directive,
+ start_mark, "found an incorrect trailing UTF-8 octet")
+ }
+ }
+
+ // Copy the octet and move the pointers.
+ *s = append(*s, octet)
+ skip(parser)
+ skip(parser)
+ skip(parser)
+ w--
+ }
+ return true
+}
+
+// Scan a block scalar.
+func yaml_parser_scan_block_scalar(parser *yaml_parser_t, token *yaml_token_t, literal bool) bool {
+ // Eat the indicator '|' or '>'.
+ start_mark := parser.mark
+ skip(parser)
+
+ // Scan the additional block scalar indicators.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+
+ // Check for a chomping indicator.
+ var chomping, increment int
+ if parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '-' {
+ // Set the chomping method and eat the indicator.
+ if parser.buffer[parser.buffer_pos] == '+' {
+ chomping = +1
+ } else {
+ chomping = -1
+ }
+ skip(parser)
+
+ // Check for an indentation indicator.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ if is_digit(parser.buffer, parser.buffer_pos) {
+ // Check that the indentation is greater than 0.
+ if parser.buffer[parser.buffer_pos] == '0' {
+ yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
+ start_mark, "found an indentation indicator equal to 0")
+ return false
+ }
+
+ // Get the indentation level and eat the indicator.
+ increment = as_digit(parser.buffer, parser.buffer_pos)
+ skip(parser)
+ }
+
+ } else if is_digit(parser.buffer, parser.buffer_pos) {
+ // Do the same as above, but in the opposite order.
+
+ if parser.buffer[parser.buffer_pos] == '0' {
+ yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
+ start_mark, "found an indentation indicator equal to 0")
+ return false
+ }
+ increment = as_digit(parser.buffer, parser.buffer_pos)
+ skip(parser)
+
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ if parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '-' {
+ if parser.buffer[parser.buffer_pos] == '+' {
+ chomping = +1
+ } else {
+ chomping = -1
+ }
+ skip(parser)
+ }
+ }
+
+ // Eat whitespaces and comments to the end of the line.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ for is_blank(parser.buffer, parser.buffer_pos) {
+ skip(parser)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+ if parser.buffer[parser.buffer_pos] == '#' {
+ for !is_breakz(parser.buffer, parser.buffer_pos) {
+ skip(parser)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+ }
+
+ // Check if we are at the end of the line.
+ if !is_breakz(parser.buffer, parser.buffer_pos) {
+ yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
+ start_mark, "did not find expected comment or line break")
+ return false
+ }
+
+ // Eat a line break.
+ if is_break(parser.buffer, parser.buffer_pos) {
+ if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) {
+ return false
+ }
+ skip_line(parser)
+ }
+
+ end_mark := parser.mark
+
+ // Set the indentation level if it was specified.
+ var indent int
+ if increment > 0 {
+ if parser.indent >= 0 {
+ indent = parser.indent + increment
+ } else {
+ indent = increment
+ }
+ }
+
+ // Scan the leading line breaks and determine the indentation level if needed.
+ var s, leading_break, trailing_breaks []byte
+ if !yaml_parser_scan_block_scalar_breaks(parser, &indent, &trailing_breaks, start_mark, &end_mark) {
+ return false
+ }
+
+ // Scan the block scalar content.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ var leading_blank, trailing_blank bool
+ for parser.mark.column == indent && !is_z(parser.buffer, parser.buffer_pos) {
+ // We are at the beginning of a non-empty line.
+
+ // Is it a trailing whitespace?
+ trailing_blank = is_blank(parser.buffer, parser.buffer_pos)
+
+ // Check if we need to fold the leading line break.
+ if !literal && !leading_blank && !trailing_blank && len(leading_break) > 0 && leading_break[0] == '\n' {
+ // Do we need to join the lines by space?
+ if len(trailing_breaks) == 0 {
+ s = append(s, ' ')
+ }
+ } else {
+ s = append(s, leading_break...)
+ }
+ leading_break = leading_break[:0]
+
+ // Append the remaining line breaks.
+ s = append(s, trailing_breaks...)
+ trailing_breaks = trailing_breaks[:0]
+
+ // Is it a leading whitespace?
+ leading_blank = is_blank(parser.buffer, parser.buffer_pos)
+
+ // Consume the current line.
+ for !is_breakz(parser.buffer, parser.buffer_pos) {
+ s = read(parser, s)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+
+ // Consume the line break.
+ if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) {
+ return false
+ }
+
+ leading_break = read_line(parser, leading_break)
+
+ // Eat the following indentation spaces and line breaks.
+ if !yaml_parser_scan_block_scalar_breaks(parser, &indent, &trailing_breaks, start_mark, &end_mark) {
+ return false
+ }
+ }
+
+ // Chomp the tail.
+ if chomping != -1 {
+ s = append(s, leading_break...)
+ }
+ if chomping == 1 {
+ s = append(s, trailing_breaks...)
+ }
+
+ // Create a token.
+ *token = yaml_token_t{
+ typ: yaml_SCALAR_TOKEN,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ value: s,
+ style: yaml_LITERAL_SCALAR_STYLE,
+ }
+ if !literal {
+ token.style = yaml_FOLDED_SCALAR_STYLE
+ }
+ return true
+}
+
+// Scan indentation spaces and line breaks for a block scalar. Determine the
+// indentation level if needed.
+func yaml_parser_scan_block_scalar_breaks(parser *yaml_parser_t, indent *int, breaks *[]byte, start_mark yaml_mark_t, end_mark *yaml_mark_t) bool {
+ *end_mark = parser.mark
+
+ // Eat the indentation spaces and line breaks.
+ max_indent := 0
+ for {
+ // Eat the indentation spaces.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ for (*indent == 0 || parser.mark.column < *indent) && is_space(parser.buffer, parser.buffer_pos) {
+ skip(parser)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+ if parser.mark.column > max_indent {
+ max_indent = parser.mark.column
+ }
+
+ // Check for a tab character messing the indentation.
+ if (*indent == 0 || parser.mark.column < *indent) && is_tab(parser.buffer, parser.buffer_pos) {
+ return yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
+ start_mark, "found a tab character where an indentation space is expected")
+ }
+
+ // Have we found a non-empty line?
+ if !is_break(parser.buffer, parser.buffer_pos) {
+ break
+ }
+
+ // Consume the line break.
+ if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) {
+ return false
+ }
+ // [Go] Should really be returning breaks instead.
+ *breaks = read_line(parser, *breaks)
+ *end_mark = parser.mark
+ }
+
+ // Determine the indentation level if needed.
+ if *indent == 0 {
+ *indent = max_indent
+ if *indent < parser.indent+1 {
+ *indent = parser.indent + 1
+ }
+ if *indent < 1 {
+ *indent = 1
+ }
+ }
+ return true
+}
+
+// Scan a quoted scalar.
+func yaml_parser_scan_flow_scalar(parser *yaml_parser_t, token *yaml_token_t, single bool) bool {
+ // Eat the left quote.
+ start_mark := parser.mark
+ skip(parser)
+
+ // Consume the content of the quoted scalar.
+ var s, leading_break, trailing_breaks, whitespaces []byte
+ for {
+ // Check that there are no document indicators at the beginning of the line.
+ if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) {
+ return false
+ }
+
+ if parser.mark.column == 0 &&
+ ((parser.buffer[parser.buffer_pos+0] == '-' &&
+ parser.buffer[parser.buffer_pos+1] == '-' &&
+ parser.buffer[parser.buffer_pos+2] == '-') ||
+ (parser.buffer[parser.buffer_pos+0] == '.' &&
+ parser.buffer[parser.buffer_pos+1] == '.' &&
+ parser.buffer[parser.buffer_pos+2] == '.')) &&
+ is_blankz(parser.buffer, parser.buffer_pos+3) {
+ yaml_parser_set_scanner_error(parser, "while scanning a quoted scalar",
+ start_mark, "found unexpected document indicator")
+ return false
+ }
+
+ // Check for EOF.
+ if is_z(parser.buffer, parser.buffer_pos) {
+ yaml_parser_set_scanner_error(parser, "while scanning a quoted scalar",
+ start_mark, "found unexpected end of stream")
+ return false
+ }
+
+ // Consume non-blank characters.
+ leading_blanks := false
+ for !is_blankz(parser.buffer, parser.buffer_pos) {
+ if single && parser.buffer[parser.buffer_pos] == '\'' && parser.buffer[parser.buffer_pos+1] == '\'' {
+ // Is is an escaped single quote.
+ s = append(s, '\'')
+ skip(parser)
+ skip(parser)
+
+ } else if single && parser.buffer[parser.buffer_pos] == '\'' {
+ // It is a right single quote.
+ break
+ } else if !single && parser.buffer[parser.buffer_pos] == '"' {
+ // It is a right double quote.
+ break
+
+ } else if !single && parser.buffer[parser.buffer_pos] == '\\' && is_break(parser.buffer, parser.buffer_pos+1) {
+ // It is an escaped line break.
+ if parser.unread < 3 && !yaml_parser_update_buffer(parser, 3) {
+ return false
+ }
+ skip(parser)
+ skip_line(parser)
+ leading_blanks = true
+ break
+
+ } else if !single && parser.buffer[parser.buffer_pos] == '\\' {
+ // It is an escape sequence.
+ code_length := 0
+
+ // Check the escape character.
+ switch parser.buffer[parser.buffer_pos+1] {
+ case '0':
+ s = append(s, 0)
+ case 'a':
+ s = append(s, '\x07')
+ case 'b':
+ s = append(s, '\x08')
+ case 't', '\t':
+ s = append(s, '\x09')
+ case 'n':
+ s = append(s, '\x0A')
+ case 'v':
+ s = append(s, '\x0B')
+ case 'f':
+ s = append(s, '\x0C')
+ case 'r':
+ s = append(s, '\x0D')
+ case 'e':
+ s = append(s, '\x1B')
+ case ' ':
+ s = append(s, '\x20')
+ case '"':
+ s = append(s, '"')
+ case '\'':
+ s = append(s, '\'')
+ case '\\':
+ s = append(s, '\\')
+ case 'N': // NEL (#x85)
+ s = append(s, '\xC2')
+ s = append(s, '\x85')
+ case '_': // #xA0
+ s = append(s, '\xC2')
+ s = append(s, '\xA0')
+ case 'L': // LS (#x2028)
+ s = append(s, '\xE2')
+ s = append(s, '\x80')
+ s = append(s, '\xA8')
+ case 'P': // PS (#x2029)
+ s = append(s, '\xE2')
+ s = append(s, '\x80')
+ s = append(s, '\xA9')
+ case 'x':
+ code_length = 2
+ case 'u':
+ code_length = 4
+ case 'U':
+ code_length = 8
+ default:
+ yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar",
+ start_mark, "found unknown escape character")
+ return false
+ }
+
+ skip(parser)
+ skip(parser)
+
+ // Consume an arbitrary escape code.
+ if code_length > 0 {
+ var value int
+
+ // Scan the character value.
+ if parser.unread < code_length && !yaml_parser_update_buffer(parser, code_length) {
+ return false
+ }
+ for k := 0; k < code_length; k++ {
+ if !is_hex(parser.buffer, parser.buffer_pos+k) {
+ yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar",
+ start_mark, "did not find expected hexdecimal number")
+ return false
+ }
+ value = (value << 4) + as_hex(parser.buffer, parser.buffer_pos+k)
+ }
+
+ // Check the value and write the character.
+ if (value >= 0xD800 && value <= 0xDFFF) || value > 0x10FFFF {
+ yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar",
+ start_mark, "found invalid Unicode character escape code")
+ return false
+ }
+ if value <= 0x7F {
+ s = append(s, byte(value))
+ } else if value <= 0x7FF {
+ s = append(s, byte(0xC0+(value>>6)))
+ s = append(s, byte(0x80+(value&0x3F)))
+ } else if value <= 0xFFFF {
+ s = append(s, byte(0xE0+(value>>12)))
+ s = append(s, byte(0x80+((value>>6)&0x3F)))
+ s = append(s, byte(0x80+(value&0x3F)))
+ } else {
+ s = append(s, byte(0xF0+(value>>18)))
+ s = append(s, byte(0x80+((value>>12)&0x3F)))
+ s = append(s, byte(0x80+((value>>6)&0x3F)))
+ s = append(s, byte(0x80+(value&0x3F)))
+ }
+
+ // Advance the pointer.
+ for k := 0; k < code_length; k++ {
+ skip(parser)
+ }
+ }
+ } else {
+ // It is a non-escaped non-blank character.
+ s = read(parser, s)
+ }
+ if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) {
+ return false
+ }
+ }
+
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+
+ // Check if we are at the end of the scalar.
+ if single {
+ if parser.buffer[parser.buffer_pos] == '\'' {
+ break
+ }
+ } else {
+ if parser.buffer[parser.buffer_pos] == '"' {
+ break
+ }
+ }
+
+ // Consume blank characters.
+ for is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos) {
+ if is_blank(parser.buffer, parser.buffer_pos) {
+ // Consume a space or a tab character.
+ if !leading_blanks {
+ whitespaces = read(parser, whitespaces)
+ } else {
+ skip(parser)
+ }
+ } else {
+ if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) {
+ return false
+ }
+
+ // Check if it is a first line break.
+ if !leading_blanks {
+ whitespaces = whitespaces[:0]
+ leading_break = read_line(parser, leading_break)
+ leading_blanks = true
+ } else {
+ trailing_breaks = read_line(parser, trailing_breaks)
+ }
+ }
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+
+ // Join the whitespaces or fold line breaks.
+ if leading_blanks {
+ // Do we need to fold line breaks?
+ if len(leading_break) > 0 && leading_break[0] == '\n' {
+ if len(trailing_breaks) == 0 {
+ s = append(s, ' ')
+ } else {
+ s = append(s, trailing_breaks...)
+ }
+ } else {
+ s = append(s, leading_break...)
+ s = append(s, trailing_breaks...)
+ }
+ trailing_breaks = trailing_breaks[:0]
+ leading_break = leading_break[:0]
+ } else {
+ s = append(s, whitespaces...)
+ whitespaces = whitespaces[:0]
+ }
+ }
+
+ // Eat the right quote.
+ skip(parser)
+ end_mark := parser.mark
+
+ // Create a token.
+ *token = yaml_token_t{
+ typ: yaml_SCALAR_TOKEN,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ value: s,
+ style: yaml_SINGLE_QUOTED_SCALAR_STYLE,
+ }
+ if !single {
+ token.style = yaml_DOUBLE_QUOTED_SCALAR_STYLE
+ }
+ return true
+}
+
+// Scan a plain scalar.
+func yaml_parser_scan_plain_scalar(parser *yaml_parser_t, token *yaml_token_t) bool {
+
+ var s, leading_break, trailing_breaks, whitespaces []byte
+ var leading_blanks bool
+ var indent = parser.indent + 1
+
+ start_mark := parser.mark
+ end_mark := parser.mark
+
+ // Consume the content of the plain scalar.
+ for {
+ // Check for a document indicator.
+ if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) {
+ return false
+ }
+ if parser.mark.column == 0 &&
+ ((parser.buffer[parser.buffer_pos+0] == '-' &&
+ parser.buffer[parser.buffer_pos+1] == '-' &&
+ parser.buffer[parser.buffer_pos+2] == '-') ||
+ (parser.buffer[parser.buffer_pos+0] == '.' &&
+ parser.buffer[parser.buffer_pos+1] == '.' &&
+ parser.buffer[parser.buffer_pos+2] == '.')) &&
+ is_blankz(parser.buffer, parser.buffer_pos+3) {
+ break
+ }
+
+ // Check for a comment.
+ if parser.buffer[parser.buffer_pos] == '#' {
+ break
+ }
+
+ // Consume non-blank characters.
+ for !is_blankz(parser.buffer, parser.buffer_pos) {
+
+ // Check for indicators that may end a plain scalar.
+ if (parser.buffer[parser.buffer_pos] == ':' && is_blankz(parser.buffer, parser.buffer_pos+1)) ||
+ (parser.flow_level > 0 &&
+ (parser.buffer[parser.buffer_pos] == ',' ||
+ parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == '[' ||
+ parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '{' ||
+ parser.buffer[parser.buffer_pos] == '}')) {
+ break
+ }
+
+ // Check if we need to join whitespaces and breaks.
+ if leading_blanks || len(whitespaces) > 0 {
+ if leading_blanks {
+ // Do we need to fold line breaks?
+ if leading_break[0] == '\n' {
+ if len(trailing_breaks) == 0 {
+ s = append(s, ' ')
+ } else {
+ s = append(s, trailing_breaks...)
+ }
+ } else {
+ s = append(s, leading_break...)
+ s = append(s, trailing_breaks...)
+ }
+ trailing_breaks = trailing_breaks[:0]
+ leading_break = leading_break[:0]
+ leading_blanks = false
+ } else {
+ s = append(s, whitespaces...)
+ whitespaces = whitespaces[:0]
+ }
+ }
+
+ // Copy the character.
+ s = read(parser, s)
+
+ end_mark = parser.mark
+ if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) {
+ return false
+ }
+ }
+
+ // Is it the end?
+ if !(is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos)) {
+ break
+ }
+
+ // Consume blank characters.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+
+ for is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos) {
+ if is_blank(parser.buffer, parser.buffer_pos) {
+
+ // Check for tab characters that abuse indentation.
+ if leading_blanks && parser.mark.column < indent && is_tab(parser.buffer, parser.buffer_pos) {
+ yaml_parser_set_scanner_error(parser, "while scanning a plain scalar",
+ start_mark, "found a tab character that violates indentation")
+ return false
+ }
+
+ // Consume a space or a tab character.
+ if !leading_blanks {
+ whitespaces = read(parser, whitespaces)
+ } else {
+ skip(parser)
+ }
+ } else {
+ if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) {
+ return false
+ }
+
+ // Check if it is a first line break.
+ if !leading_blanks {
+ whitespaces = whitespaces[:0]
+ leading_break = read_line(parser, leading_break)
+ leading_blanks = true
+ } else {
+ trailing_breaks = read_line(parser, trailing_breaks)
+ }
+ }
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+
+ // Check indentation level.
+ if parser.flow_level == 0 && parser.mark.column < indent {
+ break
+ }
+ }
+
+ // Create a token.
+ *token = yaml_token_t{
+ typ: yaml_SCALAR_TOKEN,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ value: s,
+ style: yaml_PLAIN_SCALAR_STYLE,
+ }
+
+ // Note that we change the 'simple_key_allowed' flag.
+ if leading_blanks {
+ parser.simple_key_allowed = true
+ }
+ return true
+}
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/sorter.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/sorter.go
new file mode 100644
index 000000000..4c45e660a
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/sorter.go
@@ -0,0 +1,113 @@
+package yaml
+
+import (
+ "reflect"
+ "unicode"
+)
+
+type keyList []reflect.Value
+
+func (l keyList) Len() int { return len(l) }
+func (l keyList) Swap(i, j int) { l[i], l[j] = l[j], l[i] }
+func (l keyList) Less(i, j int) bool {
+ a := l[i]
+ b := l[j]
+ ak := a.Kind()
+ bk := b.Kind()
+ for (ak == reflect.Interface || ak == reflect.Ptr) && !a.IsNil() {
+ a = a.Elem()
+ ak = a.Kind()
+ }
+ for (bk == reflect.Interface || bk == reflect.Ptr) && !b.IsNil() {
+ b = b.Elem()
+ bk = b.Kind()
+ }
+ af, aok := keyFloat(a)
+ bf, bok := keyFloat(b)
+ if aok && bok {
+ if af != bf {
+ return af < bf
+ }
+ if ak != bk {
+ return ak < bk
+ }
+ return numLess(a, b)
+ }
+ if ak != reflect.String || bk != reflect.String {
+ return ak < bk
+ }
+ ar, br := []rune(a.String()), []rune(b.String())
+ for i := 0; i < len(ar) && i < len(br); i++ {
+ if ar[i] == br[i] {
+ continue
+ }
+ al := unicode.IsLetter(ar[i])
+ bl := unicode.IsLetter(br[i])
+ if al && bl {
+ return ar[i] < br[i]
+ }
+ if al || bl {
+ return bl
+ }
+ var ai, bi int
+ var an, bn int64
+ if ar[i] == '0' || br[i] == '0' {
+ for j := i-1; j >= 0 && unicode.IsDigit(ar[j]); j-- {
+ if ar[j] != '0' {
+ an = 1
+ bn = 1
+ break
+ }
+ }
+ }
+ for ai = i; ai < len(ar) && unicode.IsDigit(ar[ai]); ai++ {
+ an = an*10 + int64(ar[ai]-'0')
+ }
+ for bi = i; bi < len(br) && unicode.IsDigit(br[bi]); bi++ {
+ bn = bn*10 + int64(br[bi]-'0')
+ }
+ if an != bn {
+ return an < bn
+ }
+ if ai != bi {
+ return ai < bi
+ }
+ return ar[i] < br[i]
+ }
+ return len(ar) < len(br)
+}
+
+// keyFloat returns a float value for v if it is a number/bool
+// and whether it is a number/bool or not.
+func keyFloat(v reflect.Value) (f float64, ok bool) {
+ switch v.Kind() {
+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+ return float64(v.Int()), true
+ case reflect.Float32, reflect.Float64:
+ return v.Float(), true
+ case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
+ return float64(v.Uint()), true
+ case reflect.Bool:
+ if v.Bool() {
+ return 1, true
+ }
+ return 0, true
+ }
+ return 0, false
+}
+
+// numLess returns whether a < b.
+// a and b must necessarily have the same kind.
+func numLess(a, b reflect.Value) bool {
+ switch a.Kind() {
+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+ return a.Int() < b.Int()
+ case reflect.Float32, reflect.Float64:
+ return a.Float() < b.Float()
+ case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
+ return a.Uint() < b.Uint()
+ case reflect.Bool:
+ return !a.Bool() && b.Bool()
+ }
+ panic("not a number")
+}
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/writerc.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/writerc.go
new file mode 100644
index 000000000..a2dde608c
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/writerc.go
@@ -0,0 +1,26 @@
+package yaml
+
+// Set the writer error and return false.
+func yaml_emitter_set_writer_error(emitter *yaml_emitter_t, problem string) bool {
+ emitter.error = yaml_WRITER_ERROR
+ emitter.problem = problem
+ return false
+}
+
+// Flush the output buffer.
+func yaml_emitter_flush(emitter *yaml_emitter_t) bool {
+ if emitter.write_handler == nil {
+ panic("write handler not set")
+ }
+
+ // Check if the buffer is empty.
+ if emitter.buffer_pos == 0 {
+ return true
+ }
+
+ if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil {
+ return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error())
+ }
+ emitter.buffer_pos = 0
+ return true
+}
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/yaml.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/yaml.go
new file mode 100644
index 000000000..30813884c
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/yaml.go
@@ -0,0 +1,478 @@
+// Package yaml implements YAML support for the Go language.
+//
+// Source code and other details for the project are available at GitHub:
+//
+// https://github.com/go-yaml/yaml
+//
+package yaml
+
+import (
+ "errors"
+ "fmt"
+ "io"
+ "reflect"
+ "strings"
+ "sync"
+)
+
+// MapSlice encodes and decodes as a YAML map.
+// The order of keys is preserved when encoding and decoding.
+type MapSlice []MapItem
+
+// MapItem is an item in a MapSlice.
+type MapItem struct {
+ Key, Value interface{}
+}
+
+// The Unmarshaler interface may be implemented by types to customize their
+// behavior when being unmarshaled from a YAML document. The UnmarshalYAML
+// method receives a function that may be called to unmarshal the original
+// YAML value into a field or variable. It is safe to call the unmarshal
+// function parameter more than once if necessary.
+type Unmarshaler interface {
+ UnmarshalYAML(unmarshal func(interface{}) error) error
+}
+
+// The Marshaler interface may be implemented by types to customize their
+// behavior when being marshaled into a YAML document. The returned value
+// is marshaled in place of the original value implementing Marshaler.
+//
+// If an error is returned by MarshalYAML, the marshaling procedure stops
+// and returns with the provided error.
+type Marshaler interface {
+ MarshalYAML() (interface{}, error)
+}
+
+// Unmarshal decodes the first document found within the in byte slice
+// and assigns decoded values into the out value.
+//
+// Maps and pointers (to a struct, string, int, etc) are accepted as out
+// values. If an internal pointer within a struct is not initialized,
+// the yaml package will initialize it if necessary for unmarshalling
+// the provided data. The out parameter must not be nil.
+//
+// The type of the decoded values should be compatible with the respective
+// values in out. If one or more values cannot be decoded due to a type
+// mismatches, decoding continues partially until the end of the YAML
+// content, and a *yaml.TypeError is returned with details for all
+// missed values.
+//
+// Struct fields are only unmarshalled if they are exported (have an
+// upper case first letter), and are unmarshalled using the field name
+// lowercased as the default key. Custom keys may be defined via the
+// "yaml" name in the field tag: the content preceding the first comma
+// is used as the key, and the following comma-separated options are
+// used to tweak the marshalling process (see Marshal).
+// Conflicting names result in a runtime error.
+//
+// For example:
+//
+// type T struct {
+// F int `yaml:"a,omitempty"`
+// B int
+// }
+// var t T
+// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t)
+//
+// See the documentation of Marshal for the format of tags and a list of
+// supported tag options.
+//
+func Unmarshal(in []byte, out interface{}) (err error) {
+ return unmarshal(in, out, false)
+}
+
+// UnmarshalStrict is like Unmarshal except that any fields that are found
+// in the data that do not have corresponding struct members, or mapping
+// keys that are duplicates, will result in
+// an error.
+func UnmarshalStrict(in []byte, out interface{}) (err error) {
+ return unmarshal(in, out, true)
+}
+
+// A Decoder reads and decodes YAML values from an input stream.
+type Decoder struct {
+ strict bool
+ parser *parser
+}
+
+// NewDecoder returns a new decoder that reads from r.
+//
+// The decoder introduces its own buffering and may read
+// data from r beyond the YAML values requested.
+func NewDecoder(r io.Reader) *Decoder {
+ return &Decoder{
+ parser: newParserFromReader(r),
+ }
+}
+
+// SetStrict sets whether strict decoding behaviour is enabled when
+// decoding items in the data (see UnmarshalStrict). By default, decoding is not strict.
+func (dec *Decoder) SetStrict(strict bool) {
+ dec.strict = strict
+}
+
+// Decode reads the next YAML-encoded value from its input
+// and stores it in the value pointed to by v.
+//
+// See the documentation for Unmarshal for details about the
+// conversion of YAML into a Go value.
+func (dec *Decoder) Decode(v interface{}) (err error) {
+ d := newDecoder(dec.strict)
+ defer handleErr(&err)
+ node := dec.parser.parse()
+ if node == nil {
+ return io.EOF
+ }
+ out := reflect.ValueOf(v)
+ if out.Kind() == reflect.Ptr && !out.IsNil() {
+ out = out.Elem()
+ }
+ d.unmarshal(node, out)
+ if len(d.terrors) > 0 {
+ return &TypeError{d.terrors}
+ }
+ return nil
+}
+
+func unmarshal(in []byte, out interface{}, strict bool) (err error) {
+ defer handleErr(&err)
+ d := newDecoder(strict)
+ p := newParser(in)
+ defer p.destroy()
+ node := p.parse()
+ if node != nil {
+ v := reflect.ValueOf(out)
+ if v.Kind() == reflect.Ptr && !v.IsNil() {
+ v = v.Elem()
+ }
+ d.unmarshal(node, v)
+ }
+ if len(d.terrors) > 0 {
+ return &TypeError{d.terrors}
+ }
+ return nil
+}
+
+// Marshal serializes the value provided into a YAML document. The structure
+// of the generated document will reflect the structure of the value itself.
+// Maps and pointers (to struct, string, int, etc) are accepted as the in value.
+//
+// Struct fields are only marshalled if they are exported (have an upper case
+// first letter), and are marshalled using the field name lowercased as the
+// default key. Custom keys may be defined via the "yaml" name in the field
+// tag: the content preceding the first comma is used as the key, and the
+// following comma-separated options are used to tweak the marshalling process.
+// Conflicting names result in a runtime error.
+//
+// The field tag format accepted is:
+//
+// `(...) yaml:"[][,[,]]" (...)`
+//
+// The following flags are currently supported:
+//
+// omitempty Only include the field if it's not set to the zero
+// value for the type or to empty slices or maps.
+// Zero valued structs will be omitted if all their public
+// fields are zero, unless they implement an IsZero
+// method (see the IsZeroer interface type), in which
+// case the field will be excluded if IsZero returns true.
+//
+// flow Marshal using a flow style (useful for structs,
+// sequences and maps).
+//
+// inline Inline the field, which must be a struct or a map,
+// causing all of its fields or keys to be processed as if
+// they were part of the outer struct. For maps, keys must
+// not conflict with the yaml keys of other struct fields.
+//
+// In addition, if the key is "-", the field is ignored.
+//
+// For example:
+//
+// type T struct {
+// F int `yaml:"a,omitempty"`
+// B int
+// }
+// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n"
+// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n"
+//
+func Marshal(in interface{}) (out []byte, err error) {
+ defer handleErr(&err)
+ e := newEncoder()
+ defer e.destroy()
+ e.marshalDoc("", reflect.ValueOf(in))
+ e.finish()
+ out = e.out
+ return
+}
+
+// An Encoder writes YAML values to an output stream.
+type Encoder struct {
+ encoder *encoder
+}
+
+// NewEncoder returns a new encoder that writes to w.
+// The Encoder should be closed after use to flush all data
+// to w.
+func NewEncoder(w io.Writer) *Encoder {
+ return &Encoder{
+ encoder: newEncoderWithWriter(w),
+ }
+}
+
+// Encode writes the YAML encoding of v to the stream.
+// If multiple items are encoded to the stream, the
+// second and subsequent document will be preceded
+// with a "---" document separator, but the first will not.
+//
+// See the documentation for Marshal for details about the conversion of Go
+// values to YAML.
+func (e *Encoder) Encode(v interface{}) (err error) {
+ defer handleErr(&err)
+ e.encoder.marshalDoc("", reflect.ValueOf(v))
+ return nil
+}
+
+// Close closes the encoder by writing any remaining data.
+// It does not write a stream terminating string "...".
+func (e *Encoder) Close() (err error) {
+ defer handleErr(&err)
+ e.encoder.finish()
+ return nil
+}
+
+func handleErr(err *error) {
+ if v := recover(); v != nil {
+ if e, ok := v.(yamlError); ok {
+ *err = e.err
+ } else {
+ panic(v)
+ }
+ }
+}
+
+type yamlError struct {
+ err error
+}
+
+func fail(err error) {
+ panic(yamlError{err})
+}
+
+func failf(format string, args ...interface{}) {
+ panic(yamlError{fmt.Errorf("yaml: "+format, args...)})
+}
+
+// A TypeError is returned by Unmarshal when one or more fields in
+// the YAML document cannot be properly decoded into the requested
+// types. When this error is returned, the value is still
+// unmarshaled partially.
+type TypeError struct {
+ Errors []string
+}
+
+func (e *TypeError) Error() string {
+ return fmt.Sprintf("yaml: unmarshal errors:\n %s", strings.Join(e.Errors, "\n "))
+}
+
+// --------------------------------------------------------------------------
+// Maintain a mapping of keys to structure field indexes
+
+// The code in this section was copied from mgo/bson.
+
+// structInfo holds details for the serialization of fields of
+// a given struct.
+type structInfo struct {
+ FieldsMap map[string]fieldInfo
+ FieldsList []fieldInfo
+
+ // InlineMap is the number of the field in the struct that
+ // contains an ,inline map, or -1 if there's none.
+ InlineMap int
+}
+
+type fieldInfo struct {
+ Key string
+ Num int
+ OmitEmpty bool
+ Flow bool
+ // Id holds the unique field identifier, so we can cheaply
+ // check for field duplicates without maintaining an extra map.
+ Id int
+
+ // Inline holds the field index if the field is part of an inlined struct.
+ Inline []int
+}
+
+var structMap = make(map[reflect.Type]*structInfo)
+var fieldMapMutex sync.RWMutex
+
+func getStructInfo(st reflect.Type) (*structInfo, error) {
+ fieldMapMutex.RLock()
+ sinfo, found := structMap[st]
+ fieldMapMutex.RUnlock()
+ if found {
+ return sinfo, nil
+ }
+
+ n := st.NumField()
+ fieldsMap := make(map[string]fieldInfo)
+ fieldsList := make([]fieldInfo, 0, n)
+ inlineMap := -1
+ for i := 0; i != n; i++ {
+ field := st.Field(i)
+ if field.PkgPath != "" && !field.Anonymous {
+ continue // Private field
+ }
+
+ info := fieldInfo{Num: i}
+
+ tag := field.Tag.Get("yaml")
+ if tag == "" && strings.Index(string(field.Tag), ":") < 0 {
+ tag = string(field.Tag)
+ }
+ if tag == "-" {
+ continue
+ }
+
+ inline := false
+ fields := strings.Split(tag, ",")
+ if len(fields) > 1 {
+ for _, flag := range fields[1:] {
+ switch flag {
+ case "omitempty":
+ info.OmitEmpty = true
+ case "flow":
+ info.Flow = true
+ case "inline":
+ inline = true
+ default:
+ return nil, errors.New(fmt.Sprintf("Unsupported flag %q in tag %q of type %s", flag, tag, st))
+ }
+ }
+ tag = fields[0]
+ }
+
+ if inline {
+ switch field.Type.Kind() {
+ case reflect.Map:
+ if inlineMap >= 0 {
+ return nil, errors.New("Multiple ,inline maps in struct " + st.String())
+ }
+ if field.Type.Key() != reflect.TypeOf("") {
+ return nil, errors.New("Option ,inline needs a map with string keys in struct " + st.String())
+ }
+ inlineMap = info.Num
+ case reflect.Struct:
+ sinfo, err := getStructInfo(field.Type)
+ if err != nil {
+ return nil, err
+ }
+ for _, finfo := range sinfo.FieldsList {
+ if _, found := fieldsMap[finfo.Key]; found {
+ msg := "Duplicated key '" + finfo.Key + "' in struct " + st.String()
+ return nil, errors.New(msg)
+ }
+ if finfo.Inline == nil {
+ finfo.Inline = []int{i, finfo.Num}
+ } else {
+ finfo.Inline = append([]int{i}, finfo.Inline...)
+ }
+ finfo.Id = len(fieldsList)
+ fieldsMap[finfo.Key] = finfo
+ fieldsList = append(fieldsList, finfo)
+ }
+ default:
+ //return nil, errors.New("Option ,inline needs a struct value or map field")
+ return nil, errors.New("Option ,inline needs a struct value field")
+ }
+ continue
+ }
+
+ if tag != "" {
+ info.Key = tag
+ } else {
+ info.Key = strings.ToLower(field.Name)
+ }
+
+ if _, found = fieldsMap[info.Key]; found {
+ msg := "Duplicated key '" + info.Key + "' in struct " + st.String()
+ return nil, errors.New(msg)
+ }
+
+ info.Id = len(fieldsList)
+ fieldsList = append(fieldsList, info)
+ fieldsMap[info.Key] = info
+ }
+
+ sinfo = &structInfo{
+ FieldsMap: fieldsMap,
+ FieldsList: fieldsList,
+ InlineMap: inlineMap,
+ }
+
+ fieldMapMutex.Lock()
+ structMap[st] = sinfo
+ fieldMapMutex.Unlock()
+ return sinfo, nil
+}
+
+// IsZeroer is used to check whether an object is zero to
+// determine whether it should be omitted when marshaling
+// with the omitempty flag. One notable implementation
+// is time.Time.
+type IsZeroer interface {
+ IsZero() bool
+}
+
+func isZero(v reflect.Value) bool {
+ kind := v.Kind()
+ if z, ok := v.Interface().(IsZeroer); ok {
+ if (kind == reflect.Ptr || kind == reflect.Interface) && v.IsNil() {
+ return true
+ }
+ return z.IsZero()
+ }
+ switch kind {
+ case reflect.String:
+ return len(v.String()) == 0
+ case reflect.Interface, reflect.Ptr:
+ return v.IsNil()
+ case reflect.Slice:
+ return v.Len() == 0
+ case reflect.Map:
+ return v.Len() == 0
+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+ return v.Int() == 0
+ case reflect.Float32, reflect.Float64:
+ return v.Float() == 0
+ case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
+ return v.Uint() == 0
+ case reflect.Bool:
+ return !v.Bool()
+ case reflect.Struct:
+ vt := v.Type()
+ for i := v.NumField() - 1; i >= 0; i-- {
+ if vt.Field(i).PkgPath != "" {
+ continue // Private field
+ }
+ if !isZero(v.Field(i)) {
+ return false
+ }
+ }
+ return true
+ }
+ return false
+}
+
+// FutureLineWrap globally disables line wrapping when encoding long strings.
+// This is a temporary and thus deprecated method introduced to faciliate
+// migration towards v3, which offers more control of line lengths on
+// individual encodings, and has a default matching the behavior introduced
+// by this function.
+//
+// The default formatting of v2 was erroneously changed in v2.3.0 and reverted
+// in v2.4.0, at which point this function was introduced to help migration.
+func FutureLineWrap() {
+ disableLineWrapping = true
+}
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/yamlh.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/yamlh.go
new file mode 100644
index 000000000..f6a9c8e34
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/yamlh.go
@@ -0,0 +1,739 @@
+package yaml
+
+import (
+ "fmt"
+ "io"
+)
+
+// The version directive data.
+type yaml_version_directive_t struct {
+ major int8 // The major version number.
+ minor int8 // The minor version number.
+}
+
+// The tag directive data.
+type yaml_tag_directive_t struct {
+ handle []byte // The tag handle.
+ prefix []byte // The tag prefix.
+}
+
+type yaml_encoding_t int
+
+// The stream encoding.
+const (
+ // Let the parser choose the encoding.
+ yaml_ANY_ENCODING yaml_encoding_t = iota
+
+ yaml_UTF8_ENCODING // The default UTF-8 encoding.
+ yaml_UTF16LE_ENCODING // The UTF-16-LE encoding with BOM.
+ yaml_UTF16BE_ENCODING // The UTF-16-BE encoding with BOM.
+)
+
+type yaml_break_t int
+
+// Line break types.
+const (
+ // Let the parser choose the break type.
+ yaml_ANY_BREAK yaml_break_t = iota
+
+ yaml_CR_BREAK // Use CR for line breaks (Mac style).
+ yaml_LN_BREAK // Use LN for line breaks (Unix style).
+ yaml_CRLN_BREAK // Use CR LN for line breaks (DOS style).
+)
+
+type yaml_error_type_t int
+
+// Many bad things could happen with the parser and emitter.
+const (
+ // No error is produced.
+ yaml_NO_ERROR yaml_error_type_t = iota
+
+ yaml_MEMORY_ERROR // Cannot allocate or reallocate a block of memory.
+ yaml_READER_ERROR // Cannot read or decode the input stream.
+ yaml_SCANNER_ERROR // Cannot scan the input stream.
+ yaml_PARSER_ERROR // Cannot parse the input stream.
+ yaml_COMPOSER_ERROR // Cannot compose a YAML document.
+ yaml_WRITER_ERROR // Cannot write to the output stream.
+ yaml_EMITTER_ERROR // Cannot emit a YAML stream.
+)
+
+// The pointer position.
+type yaml_mark_t struct {
+ index int // The position index.
+ line int // The position line.
+ column int // The position column.
+}
+
+// Node Styles
+
+type yaml_style_t int8
+
+type yaml_scalar_style_t yaml_style_t
+
+// Scalar styles.
+const (
+ // Let the emitter choose the style.
+ yaml_ANY_SCALAR_STYLE yaml_scalar_style_t = iota
+
+ yaml_PLAIN_SCALAR_STYLE // The plain scalar style.
+ yaml_SINGLE_QUOTED_SCALAR_STYLE // The single-quoted scalar style.
+ yaml_DOUBLE_QUOTED_SCALAR_STYLE // The double-quoted scalar style.
+ yaml_LITERAL_SCALAR_STYLE // The literal scalar style.
+ yaml_FOLDED_SCALAR_STYLE // The folded scalar style.
+)
+
+type yaml_sequence_style_t yaml_style_t
+
+// Sequence styles.
+const (
+ // Let the emitter choose the style.
+ yaml_ANY_SEQUENCE_STYLE yaml_sequence_style_t = iota
+
+ yaml_BLOCK_SEQUENCE_STYLE // The block sequence style.
+ yaml_FLOW_SEQUENCE_STYLE // The flow sequence style.
+)
+
+type yaml_mapping_style_t yaml_style_t
+
+// Mapping styles.
+const (
+ // Let the emitter choose the style.
+ yaml_ANY_MAPPING_STYLE yaml_mapping_style_t = iota
+
+ yaml_BLOCK_MAPPING_STYLE // The block mapping style.
+ yaml_FLOW_MAPPING_STYLE // The flow mapping style.
+)
+
+// Tokens
+
+type yaml_token_type_t int
+
+// Token types.
+const (
+ // An empty token.
+ yaml_NO_TOKEN yaml_token_type_t = iota
+
+ yaml_STREAM_START_TOKEN // A STREAM-START token.
+ yaml_STREAM_END_TOKEN // A STREAM-END token.
+
+ yaml_VERSION_DIRECTIVE_TOKEN // A VERSION-DIRECTIVE token.
+ yaml_TAG_DIRECTIVE_TOKEN // A TAG-DIRECTIVE token.
+ yaml_DOCUMENT_START_TOKEN // A DOCUMENT-START token.
+ yaml_DOCUMENT_END_TOKEN // A DOCUMENT-END token.
+
+ yaml_BLOCK_SEQUENCE_START_TOKEN // A BLOCK-SEQUENCE-START token.
+ yaml_BLOCK_MAPPING_START_TOKEN // A BLOCK-SEQUENCE-END token.
+ yaml_BLOCK_END_TOKEN // A BLOCK-END token.
+
+ yaml_FLOW_SEQUENCE_START_TOKEN // A FLOW-SEQUENCE-START token.
+ yaml_FLOW_SEQUENCE_END_TOKEN // A FLOW-SEQUENCE-END token.
+ yaml_FLOW_MAPPING_START_TOKEN // A FLOW-MAPPING-START token.
+ yaml_FLOW_MAPPING_END_TOKEN // A FLOW-MAPPING-END token.
+
+ yaml_BLOCK_ENTRY_TOKEN // A BLOCK-ENTRY token.
+ yaml_FLOW_ENTRY_TOKEN // A FLOW-ENTRY token.
+ yaml_KEY_TOKEN // A KEY token.
+ yaml_VALUE_TOKEN // A VALUE token.
+
+ yaml_ALIAS_TOKEN // An ALIAS token.
+ yaml_ANCHOR_TOKEN // An ANCHOR token.
+ yaml_TAG_TOKEN // A TAG token.
+ yaml_SCALAR_TOKEN // A SCALAR token.
+)
+
+func (tt yaml_token_type_t) String() string {
+ switch tt {
+ case yaml_NO_TOKEN:
+ return "yaml_NO_TOKEN"
+ case yaml_STREAM_START_TOKEN:
+ return "yaml_STREAM_START_TOKEN"
+ case yaml_STREAM_END_TOKEN:
+ return "yaml_STREAM_END_TOKEN"
+ case yaml_VERSION_DIRECTIVE_TOKEN:
+ return "yaml_VERSION_DIRECTIVE_TOKEN"
+ case yaml_TAG_DIRECTIVE_TOKEN:
+ return "yaml_TAG_DIRECTIVE_TOKEN"
+ case yaml_DOCUMENT_START_TOKEN:
+ return "yaml_DOCUMENT_START_TOKEN"
+ case yaml_DOCUMENT_END_TOKEN:
+ return "yaml_DOCUMENT_END_TOKEN"
+ case yaml_BLOCK_SEQUENCE_START_TOKEN:
+ return "yaml_BLOCK_SEQUENCE_START_TOKEN"
+ case yaml_BLOCK_MAPPING_START_TOKEN:
+ return "yaml_BLOCK_MAPPING_START_TOKEN"
+ case yaml_BLOCK_END_TOKEN:
+ return "yaml_BLOCK_END_TOKEN"
+ case yaml_FLOW_SEQUENCE_START_TOKEN:
+ return "yaml_FLOW_SEQUENCE_START_TOKEN"
+ case yaml_FLOW_SEQUENCE_END_TOKEN:
+ return "yaml_FLOW_SEQUENCE_END_TOKEN"
+ case yaml_FLOW_MAPPING_START_TOKEN:
+ return "yaml_FLOW_MAPPING_START_TOKEN"
+ case yaml_FLOW_MAPPING_END_TOKEN:
+ return "yaml_FLOW_MAPPING_END_TOKEN"
+ case yaml_BLOCK_ENTRY_TOKEN:
+ return "yaml_BLOCK_ENTRY_TOKEN"
+ case yaml_FLOW_ENTRY_TOKEN:
+ return "yaml_FLOW_ENTRY_TOKEN"
+ case yaml_KEY_TOKEN:
+ return "yaml_KEY_TOKEN"
+ case yaml_VALUE_TOKEN:
+ return "yaml_VALUE_TOKEN"
+ case yaml_ALIAS_TOKEN:
+ return "yaml_ALIAS_TOKEN"
+ case yaml_ANCHOR_TOKEN:
+ return "yaml_ANCHOR_TOKEN"
+ case yaml_TAG_TOKEN:
+ return "yaml_TAG_TOKEN"
+ case yaml_SCALAR_TOKEN:
+ return "yaml_SCALAR_TOKEN"
+ }
+ return ""
+}
+
+// The token structure.
+type yaml_token_t struct {
+ // The token type.
+ typ yaml_token_type_t
+
+ // The start/end of the token.
+ start_mark, end_mark yaml_mark_t
+
+ // The stream encoding (for yaml_STREAM_START_TOKEN).
+ encoding yaml_encoding_t
+
+ // The alias/anchor/scalar value or tag/tag directive handle
+ // (for yaml_ALIAS_TOKEN, yaml_ANCHOR_TOKEN, yaml_SCALAR_TOKEN, yaml_TAG_TOKEN, yaml_TAG_DIRECTIVE_TOKEN).
+ value []byte
+
+ // The tag suffix (for yaml_TAG_TOKEN).
+ suffix []byte
+
+ // The tag directive prefix (for yaml_TAG_DIRECTIVE_TOKEN).
+ prefix []byte
+
+ // The scalar style (for yaml_SCALAR_TOKEN).
+ style yaml_scalar_style_t
+
+ // The version directive major/minor (for yaml_VERSION_DIRECTIVE_TOKEN).
+ major, minor int8
+}
+
+// Events
+
+type yaml_event_type_t int8
+
+// Event types.
+const (
+ // An empty event.
+ yaml_NO_EVENT yaml_event_type_t = iota
+
+ yaml_STREAM_START_EVENT // A STREAM-START event.
+ yaml_STREAM_END_EVENT // A STREAM-END event.
+ yaml_DOCUMENT_START_EVENT // A DOCUMENT-START event.
+ yaml_DOCUMENT_END_EVENT // A DOCUMENT-END event.
+ yaml_ALIAS_EVENT // An ALIAS event.
+ yaml_SCALAR_EVENT // A SCALAR event.
+ yaml_SEQUENCE_START_EVENT // A SEQUENCE-START event.
+ yaml_SEQUENCE_END_EVENT // A SEQUENCE-END event.
+ yaml_MAPPING_START_EVENT // A MAPPING-START event.
+ yaml_MAPPING_END_EVENT // A MAPPING-END event.
+)
+
+var eventStrings = []string{
+ yaml_NO_EVENT: "none",
+ yaml_STREAM_START_EVENT: "stream start",
+ yaml_STREAM_END_EVENT: "stream end",
+ yaml_DOCUMENT_START_EVENT: "document start",
+ yaml_DOCUMENT_END_EVENT: "document end",
+ yaml_ALIAS_EVENT: "alias",
+ yaml_SCALAR_EVENT: "scalar",
+ yaml_SEQUENCE_START_EVENT: "sequence start",
+ yaml_SEQUENCE_END_EVENT: "sequence end",
+ yaml_MAPPING_START_EVENT: "mapping start",
+ yaml_MAPPING_END_EVENT: "mapping end",
+}
+
+func (e yaml_event_type_t) String() string {
+ if e < 0 || int(e) >= len(eventStrings) {
+ return fmt.Sprintf("unknown event %d", e)
+ }
+ return eventStrings[e]
+}
+
+// The event structure.
+type yaml_event_t struct {
+
+ // The event type.
+ typ yaml_event_type_t
+
+ // The start and end of the event.
+ start_mark, end_mark yaml_mark_t
+
+ // The document encoding (for yaml_STREAM_START_EVENT).
+ encoding yaml_encoding_t
+
+ // The version directive (for yaml_DOCUMENT_START_EVENT).
+ version_directive *yaml_version_directive_t
+
+ // The list of tag directives (for yaml_DOCUMENT_START_EVENT).
+ tag_directives []yaml_tag_directive_t
+
+ // The anchor (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT, yaml_ALIAS_EVENT).
+ anchor []byte
+
+ // The tag (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT).
+ tag []byte
+
+ // The scalar value (for yaml_SCALAR_EVENT).
+ value []byte
+
+ // Is the document start/end indicator implicit, or the tag optional?
+ // (for yaml_DOCUMENT_START_EVENT, yaml_DOCUMENT_END_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT, yaml_SCALAR_EVENT).
+ implicit bool
+
+ // Is the tag optional for any non-plain style? (for yaml_SCALAR_EVENT).
+ quoted_implicit bool
+
+ // The style (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT).
+ style yaml_style_t
+}
+
+func (e *yaml_event_t) scalar_style() yaml_scalar_style_t { return yaml_scalar_style_t(e.style) }
+func (e *yaml_event_t) sequence_style() yaml_sequence_style_t { return yaml_sequence_style_t(e.style) }
+func (e *yaml_event_t) mapping_style() yaml_mapping_style_t { return yaml_mapping_style_t(e.style) }
+
+// Nodes
+
+const (
+ yaml_NULL_TAG = "tag:yaml.org,2002:null" // The tag !!null with the only possible value: null.
+ yaml_BOOL_TAG = "tag:yaml.org,2002:bool" // The tag !!bool with the values: true and false.
+ yaml_STR_TAG = "tag:yaml.org,2002:str" // The tag !!str for string values.
+ yaml_INT_TAG = "tag:yaml.org,2002:int" // The tag !!int for integer values.
+ yaml_FLOAT_TAG = "tag:yaml.org,2002:float" // The tag !!float for float values.
+ yaml_TIMESTAMP_TAG = "tag:yaml.org,2002:timestamp" // The tag !!timestamp for date and time values.
+
+ yaml_SEQ_TAG = "tag:yaml.org,2002:seq" // The tag !!seq is used to denote sequences.
+ yaml_MAP_TAG = "tag:yaml.org,2002:map" // The tag !!map is used to denote mapping.
+
+ // Not in original libyaml.
+ yaml_BINARY_TAG = "tag:yaml.org,2002:binary"
+ yaml_MERGE_TAG = "tag:yaml.org,2002:merge"
+
+ yaml_DEFAULT_SCALAR_TAG = yaml_STR_TAG // The default scalar tag is !!str.
+ yaml_DEFAULT_SEQUENCE_TAG = yaml_SEQ_TAG // The default sequence tag is !!seq.
+ yaml_DEFAULT_MAPPING_TAG = yaml_MAP_TAG // The default mapping tag is !!map.
+)
+
+type yaml_node_type_t int
+
+// Node types.
+const (
+ // An empty node.
+ yaml_NO_NODE yaml_node_type_t = iota
+
+ yaml_SCALAR_NODE // A scalar node.
+ yaml_SEQUENCE_NODE // A sequence node.
+ yaml_MAPPING_NODE // A mapping node.
+)
+
+// An element of a sequence node.
+type yaml_node_item_t int
+
+// An element of a mapping node.
+type yaml_node_pair_t struct {
+ key int // The key of the element.
+ value int // The value of the element.
+}
+
+// The node structure.
+type yaml_node_t struct {
+ typ yaml_node_type_t // The node type.
+ tag []byte // The node tag.
+
+ // The node data.
+
+ // The scalar parameters (for yaml_SCALAR_NODE).
+ scalar struct {
+ value []byte // The scalar value.
+ length int // The length of the scalar value.
+ style yaml_scalar_style_t // The scalar style.
+ }
+
+ // The sequence parameters (for YAML_SEQUENCE_NODE).
+ sequence struct {
+ items_data []yaml_node_item_t // The stack of sequence items.
+ style yaml_sequence_style_t // The sequence style.
+ }
+
+ // The mapping parameters (for yaml_MAPPING_NODE).
+ mapping struct {
+ pairs_data []yaml_node_pair_t // The stack of mapping pairs (key, value).
+ pairs_start *yaml_node_pair_t // The beginning of the stack.
+ pairs_end *yaml_node_pair_t // The end of the stack.
+ pairs_top *yaml_node_pair_t // The top of the stack.
+ style yaml_mapping_style_t // The mapping style.
+ }
+
+ start_mark yaml_mark_t // The beginning of the node.
+ end_mark yaml_mark_t // The end of the node.
+
+}
+
+// The document structure.
+type yaml_document_t struct {
+
+ // The document nodes.
+ nodes []yaml_node_t
+
+ // The version directive.
+ version_directive *yaml_version_directive_t
+
+ // The list of tag directives.
+ tag_directives_data []yaml_tag_directive_t
+ tag_directives_start int // The beginning of the tag directives list.
+ tag_directives_end int // The end of the tag directives list.
+
+ start_implicit int // Is the document start indicator implicit?
+ end_implicit int // Is the document end indicator implicit?
+
+ // The start/end of the document.
+ start_mark, end_mark yaml_mark_t
+}
+
+// The prototype of a read handler.
+//
+// The read handler is called when the parser needs to read more bytes from the
+// source. The handler should write not more than size bytes to the buffer.
+// The number of written bytes should be set to the size_read variable.
+//
+// [in,out] data A pointer to an application data specified by
+// yaml_parser_set_input().
+// [out] buffer The buffer to write the data from the source.
+// [in] size The size of the buffer.
+// [out] size_read The actual number of bytes read from the source.
+//
+// On success, the handler should return 1. If the handler failed,
+// the returned value should be 0. On EOF, the handler should set the
+// size_read to 0 and return 1.
+type yaml_read_handler_t func(parser *yaml_parser_t, buffer []byte) (n int, err error)
+
+// This structure holds information about a potential simple key.
+type yaml_simple_key_t struct {
+ possible bool // Is a simple key possible?
+ required bool // Is a simple key required?
+ token_number int // The number of the token.
+ mark yaml_mark_t // The position mark.
+}
+
+// The states of the parser.
+type yaml_parser_state_t int
+
+const (
+ yaml_PARSE_STREAM_START_STATE yaml_parser_state_t = iota
+
+ yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE // Expect the beginning of an implicit document.
+ yaml_PARSE_DOCUMENT_START_STATE // Expect DOCUMENT-START.
+ yaml_PARSE_DOCUMENT_CONTENT_STATE // Expect the content of a document.
+ yaml_PARSE_DOCUMENT_END_STATE // Expect DOCUMENT-END.
+ yaml_PARSE_BLOCK_NODE_STATE // Expect a block node.
+ yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE // Expect a block node or indentless sequence.
+ yaml_PARSE_FLOW_NODE_STATE // Expect a flow node.
+ yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE // Expect the first entry of a block sequence.
+ yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE // Expect an entry of a block sequence.
+ yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE // Expect an entry of an indentless sequence.
+ yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE // Expect the first key of a block mapping.
+ yaml_PARSE_BLOCK_MAPPING_KEY_STATE // Expect a block mapping key.
+ yaml_PARSE_BLOCK_MAPPING_VALUE_STATE // Expect a block mapping value.
+ yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE // Expect the first entry of a flow sequence.
+ yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE // Expect an entry of a flow sequence.
+ yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE // Expect a key of an ordered mapping.
+ yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE // Expect a value of an ordered mapping.
+ yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE // Expect the and of an ordered mapping entry.
+ yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE // Expect the first key of a flow mapping.
+ yaml_PARSE_FLOW_MAPPING_KEY_STATE // Expect a key of a flow mapping.
+ yaml_PARSE_FLOW_MAPPING_VALUE_STATE // Expect a value of a flow mapping.
+ yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE // Expect an empty value of a flow mapping.
+ yaml_PARSE_END_STATE // Expect nothing.
+)
+
+func (ps yaml_parser_state_t) String() string {
+ switch ps {
+ case yaml_PARSE_STREAM_START_STATE:
+ return "yaml_PARSE_STREAM_START_STATE"
+ case yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE:
+ return "yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE"
+ case yaml_PARSE_DOCUMENT_START_STATE:
+ return "yaml_PARSE_DOCUMENT_START_STATE"
+ case yaml_PARSE_DOCUMENT_CONTENT_STATE:
+ return "yaml_PARSE_DOCUMENT_CONTENT_STATE"
+ case yaml_PARSE_DOCUMENT_END_STATE:
+ return "yaml_PARSE_DOCUMENT_END_STATE"
+ case yaml_PARSE_BLOCK_NODE_STATE:
+ return "yaml_PARSE_BLOCK_NODE_STATE"
+ case yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE:
+ return "yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE"
+ case yaml_PARSE_FLOW_NODE_STATE:
+ return "yaml_PARSE_FLOW_NODE_STATE"
+ case yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE:
+ return "yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE"
+ case yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE:
+ return "yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE"
+ case yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE:
+ return "yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE"
+ case yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE:
+ return "yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE"
+ case yaml_PARSE_BLOCK_MAPPING_KEY_STATE:
+ return "yaml_PARSE_BLOCK_MAPPING_KEY_STATE"
+ case yaml_PARSE_BLOCK_MAPPING_VALUE_STATE:
+ return "yaml_PARSE_BLOCK_MAPPING_VALUE_STATE"
+ case yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE:
+ return "yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE"
+ case yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE:
+ return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE"
+ case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE:
+ return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE"
+ case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE:
+ return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE"
+ case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE:
+ return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE"
+ case yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE:
+ return "yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE"
+ case yaml_PARSE_FLOW_MAPPING_KEY_STATE:
+ return "yaml_PARSE_FLOW_MAPPING_KEY_STATE"
+ case yaml_PARSE_FLOW_MAPPING_VALUE_STATE:
+ return "yaml_PARSE_FLOW_MAPPING_VALUE_STATE"
+ case yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE:
+ return "yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE"
+ case yaml_PARSE_END_STATE:
+ return "yaml_PARSE_END_STATE"
+ }
+ return ""
+}
+
+// This structure holds aliases data.
+type yaml_alias_data_t struct {
+ anchor []byte // The anchor.
+ index int // The node id.
+ mark yaml_mark_t // The anchor mark.
+}
+
+// The parser structure.
+//
+// All members are internal. Manage the structure using the
+// yaml_parser_ family of functions.
+type yaml_parser_t struct {
+
+ // Error handling
+
+ error yaml_error_type_t // Error type.
+
+ problem string // Error description.
+
+ // The byte about which the problem occurred.
+ problem_offset int
+ problem_value int
+ problem_mark yaml_mark_t
+
+ // The error context.
+ context string
+ context_mark yaml_mark_t
+
+ // Reader stuff
+
+ read_handler yaml_read_handler_t // Read handler.
+
+ input_reader io.Reader // File input data.
+ input []byte // String input data.
+ input_pos int
+
+ eof bool // EOF flag
+
+ buffer []byte // The working buffer.
+ buffer_pos int // The current position of the buffer.
+
+ unread int // The number of unread characters in the buffer.
+
+ raw_buffer []byte // The raw buffer.
+ raw_buffer_pos int // The current position of the buffer.
+
+ encoding yaml_encoding_t // The input encoding.
+
+ offset int // The offset of the current position (in bytes).
+ mark yaml_mark_t // The mark of the current position.
+
+ // Scanner stuff
+
+ stream_start_produced bool // Have we started to scan the input stream?
+ stream_end_produced bool // Have we reached the end of the input stream?
+
+ flow_level int // The number of unclosed '[' and '{' indicators.
+
+ tokens []yaml_token_t // The tokens queue.
+ tokens_head int // The head of the tokens queue.
+ tokens_parsed int // The number of tokens fetched from the queue.
+ token_available bool // Does the tokens queue contain a token ready for dequeueing.
+
+ indent int // The current indentation level.
+ indents []int // The indentation levels stack.
+
+ simple_key_allowed bool // May a simple key occur at the current position?
+ simple_keys []yaml_simple_key_t // The stack of simple keys.
+ simple_keys_by_tok map[int]int // possible simple_key indexes indexed by token_number
+
+ // Parser stuff
+
+ state yaml_parser_state_t // The current parser state.
+ states []yaml_parser_state_t // The parser states stack.
+ marks []yaml_mark_t // The stack of marks.
+ tag_directives []yaml_tag_directive_t // The list of TAG directives.
+
+ // Dumper stuff
+
+ aliases []yaml_alias_data_t // The alias data.
+
+ document *yaml_document_t // The currently parsed document.
+}
+
+// Emitter Definitions
+
+// The prototype of a write handler.
+//
+// The write handler is called when the emitter needs to flush the accumulated
+// characters to the output. The handler should write @a size bytes of the
+// @a buffer to the output.
+//
+// @param[in,out] data A pointer to an application data specified by
+// yaml_emitter_set_output().
+// @param[in] buffer The buffer with bytes to be written.
+// @param[in] size The size of the buffer.
+//
+// @returns On success, the handler should return @c 1. If the handler failed,
+// the returned value should be @c 0.
+//
+type yaml_write_handler_t func(emitter *yaml_emitter_t, buffer []byte) error
+
+type yaml_emitter_state_t int
+
+// The emitter states.
+const (
+ // Expect STREAM-START.
+ yaml_EMIT_STREAM_START_STATE yaml_emitter_state_t = iota
+
+ yaml_EMIT_FIRST_DOCUMENT_START_STATE // Expect the first DOCUMENT-START or STREAM-END.
+ yaml_EMIT_DOCUMENT_START_STATE // Expect DOCUMENT-START or STREAM-END.
+ yaml_EMIT_DOCUMENT_CONTENT_STATE // Expect the content of a document.
+ yaml_EMIT_DOCUMENT_END_STATE // Expect DOCUMENT-END.
+ yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE // Expect the first item of a flow sequence.
+ yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE // Expect an item of a flow sequence.
+ yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE // Expect the first key of a flow mapping.
+ yaml_EMIT_FLOW_MAPPING_KEY_STATE // Expect a key of a flow mapping.
+ yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE // Expect a value for a simple key of a flow mapping.
+ yaml_EMIT_FLOW_MAPPING_VALUE_STATE // Expect a value of a flow mapping.
+ yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE // Expect the first item of a block sequence.
+ yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE // Expect an item of a block sequence.
+ yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE // Expect the first key of a block mapping.
+ yaml_EMIT_BLOCK_MAPPING_KEY_STATE // Expect the key of a block mapping.
+ yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE // Expect a value for a simple key of a block mapping.
+ yaml_EMIT_BLOCK_MAPPING_VALUE_STATE // Expect a value of a block mapping.
+ yaml_EMIT_END_STATE // Expect nothing.
+)
+
+// The emitter structure.
+//
+// All members are internal. Manage the structure using the @c yaml_emitter_
+// family of functions.
+type yaml_emitter_t struct {
+
+ // Error handling
+
+ error yaml_error_type_t // Error type.
+ problem string // Error description.
+
+ // Writer stuff
+
+ write_handler yaml_write_handler_t // Write handler.
+
+ output_buffer *[]byte // String output data.
+ output_writer io.Writer // File output data.
+
+ buffer []byte // The working buffer.
+ buffer_pos int // The current position of the buffer.
+
+ raw_buffer []byte // The raw buffer.
+ raw_buffer_pos int // The current position of the buffer.
+
+ encoding yaml_encoding_t // The stream encoding.
+
+ // Emitter stuff
+
+ canonical bool // If the output is in the canonical style?
+ best_indent int // The number of indentation spaces.
+ best_width int // The preferred width of the output lines.
+ unicode bool // Allow unescaped non-ASCII characters?
+ line_break yaml_break_t // The preferred line break.
+
+ state yaml_emitter_state_t // The current emitter state.
+ states []yaml_emitter_state_t // The stack of states.
+
+ events []yaml_event_t // The event queue.
+ events_head int // The head of the event queue.
+
+ indents []int // The stack of indentation levels.
+
+ tag_directives []yaml_tag_directive_t // The list of tag directives.
+
+ indent int // The current indentation level.
+
+ flow_level int // The current flow level.
+
+ root_context bool // Is it the document root context?
+ sequence_context bool // Is it a sequence context?
+ mapping_context bool // Is it a mapping context?
+ simple_key_context bool // Is it a simple mapping key context?
+
+ line int // The current line.
+ column int // The current column.
+ whitespace bool // If the last character was a whitespace?
+ indention bool // If the last character was an indentation character (' ', '-', '?', ':')?
+ open_ended bool // If an explicit document end is required?
+
+ // Anchor analysis.
+ anchor_data struct {
+ anchor []byte // The anchor value.
+ alias bool // Is it an alias?
+ }
+
+ // Tag analysis.
+ tag_data struct {
+ handle []byte // The tag handle.
+ suffix []byte // The tag suffix.
+ }
+
+ // Scalar analysis.
+ scalar_data struct {
+ value []byte // The scalar value.
+ multiline bool // Does the scalar contain line breaks?
+ flow_plain_allowed bool // Can the scalar be expessed in the flow plain style?
+ block_plain_allowed bool // Can the scalar be expressed in the block plain style?
+ single_quoted_allowed bool // Can the scalar be expressed in the single quoted style?
+ block_allowed bool // Can the scalar be expressed in the literal or folded styles?
+ style yaml_scalar_style_t // The output style.
+ }
+
+ // Dumper stuff
+
+ opened bool // If the stream was already opened?
+ closed bool // If the stream was already closed?
+
+ // The information associated with the document nodes.
+ anchors *struct {
+ references int // The number of references.
+ anchor int // The anchor id.
+ serialized bool // If the node has been emitted?
+ }
+
+ last_anchor_id int // The last assigned anchor id.
+
+ document *yaml_document_t // The currently emitted document.
+}
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/yamlprivateh.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/yamlprivateh.go
new file mode 100644
index 000000000..8110ce3c3
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/yamlprivateh.go
@@ -0,0 +1,173 @@
+package yaml
+
+const (
+ // The size of the input raw buffer.
+ input_raw_buffer_size = 512
+
+ // The size of the input buffer.
+ // It should be possible to decode the whole raw buffer.
+ input_buffer_size = input_raw_buffer_size * 3
+
+ // The size of the output buffer.
+ output_buffer_size = 128
+
+ // The size of the output raw buffer.
+ // It should be possible to encode the whole output buffer.
+ output_raw_buffer_size = (output_buffer_size*2 + 2)
+
+ // The size of other stacks and queues.
+ initial_stack_size = 16
+ initial_queue_size = 16
+ initial_string_size = 16
+)
+
+// Check if the character at the specified position is an alphabetical
+// character, a digit, '_', or '-'.
+func is_alpha(b []byte, i int) bool {
+ return b[i] >= '0' && b[i] <= '9' || b[i] >= 'A' && b[i] <= 'Z' || b[i] >= 'a' && b[i] <= 'z' || b[i] == '_' || b[i] == '-'
+}
+
+// Check if the character at the specified position is a digit.
+func is_digit(b []byte, i int) bool {
+ return b[i] >= '0' && b[i] <= '9'
+}
+
+// Get the value of a digit.
+func as_digit(b []byte, i int) int {
+ return int(b[i]) - '0'
+}
+
+// Check if the character at the specified position is a hex-digit.
+func is_hex(b []byte, i int) bool {
+ return b[i] >= '0' && b[i] <= '9' || b[i] >= 'A' && b[i] <= 'F' || b[i] >= 'a' && b[i] <= 'f'
+}
+
+// Get the value of a hex-digit.
+func as_hex(b []byte, i int) int {
+ bi := b[i]
+ if bi >= 'A' && bi <= 'F' {
+ return int(bi) - 'A' + 10
+ }
+ if bi >= 'a' && bi <= 'f' {
+ return int(bi) - 'a' + 10
+ }
+ return int(bi) - '0'
+}
+
+// Check if the character is ASCII.
+func is_ascii(b []byte, i int) bool {
+ return b[i] <= 0x7F
+}
+
+// Check if the character at the start of the buffer can be printed unescaped.
+func is_printable(b []byte, i int) bool {
+ return ((b[i] == 0x0A) || // . == #x0A
+ (b[i] >= 0x20 && b[i] <= 0x7E) || // #x20 <= . <= #x7E
+ (b[i] == 0xC2 && b[i+1] >= 0xA0) || // #0xA0 <= . <= #xD7FF
+ (b[i] > 0xC2 && b[i] < 0xED) ||
+ (b[i] == 0xED && b[i+1] < 0xA0) ||
+ (b[i] == 0xEE) ||
+ (b[i] == 0xEF && // #xE000 <= . <= #xFFFD
+ !(b[i+1] == 0xBB && b[i+2] == 0xBF) && // && . != #xFEFF
+ !(b[i+1] == 0xBF && (b[i+2] == 0xBE || b[i+2] == 0xBF))))
+}
+
+// Check if the character at the specified position is NUL.
+func is_z(b []byte, i int) bool {
+ return b[i] == 0x00
+}
+
+// Check if the beginning of the buffer is a BOM.
+func is_bom(b []byte, i int) bool {
+ return b[0] == 0xEF && b[1] == 0xBB && b[2] == 0xBF
+}
+
+// Check if the character at the specified position is space.
+func is_space(b []byte, i int) bool {
+ return b[i] == ' '
+}
+
+// Check if the character at the specified position is tab.
+func is_tab(b []byte, i int) bool {
+ return b[i] == '\t'
+}
+
+// Check if the character at the specified position is blank (space or tab).
+func is_blank(b []byte, i int) bool {
+ //return is_space(b, i) || is_tab(b, i)
+ return b[i] == ' ' || b[i] == '\t'
+}
+
+// Check if the character at the specified position is a line break.
+func is_break(b []byte, i int) bool {
+ return (b[i] == '\r' || // CR (#xD)
+ b[i] == '\n' || // LF (#xA)
+ b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85)
+ b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028)
+ b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9) // PS (#x2029)
+}
+
+func is_crlf(b []byte, i int) bool {
+ return b[i] == '\r' && b[i+1] == '\n'
+}
+
+// Check if the character is a line break or NUL.
+func is_breakz(b []byte, i int) bool {
+ //return is_break(b, i) || is_z(b, i)
+ return ( // is_break:
+ b[i] == '\r' || // CR (#xD)
+ b[i] == '\n' || // LF (#xA)
+ b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85)
+ b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028)
+ b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029)
+ // is_z:
+ b[i] == 0)
+}
+
+// Check if the character is a line break, space, or NUL.
+func is_spacez(b []byte, i int) bool {
+ //return is_space(b, i) || is_breakz(b, i)
+ return ( // is_space:
+ b[i] == ' ' ||
+ // is_breakz:
+ b[i] == '\r' || // CR (#xD)
+ b[i] == '\n' || // LF (#xA)
+ b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85)
+ b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028)
+ b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029)
+ b[i] == 0)
+}
+
+// Check if the character is a line break, space, tab, or NUL.
+func is_blankz(b []byte, i int) bool {
+ //return is_blank(b, i) || is_breakz(b, i)
+ return ( // is_blank:
+ b[i] == ' ' || b[i] == '\t' ||
+ // is_breakz:
+ b[i] == '\r' || // CR (#xD)
+ b[i] == '\n' || // LF (#xA)
+ b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85)
+ b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028)
+ b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029)
+ b[i] == 0)
+}
+
+// Determine the width of the character.
+func width(b byte) int {
+ // Don't replace these by a switch without first
+ // confirming that it is being inlined.
+ if b&0x80 == 0x00 {
+ return 1
+ }
+ if b&0xE0 == 0xC0 {
+ return 2
+ }
+ if b&0xF0 == 0xE0 {
+ return 3
+ }
+ if b&0xF8 == 0xF0 {
+ return 4
+ }
+ return 0
+
+}
diff --git a/vendor/sigs.k8s.io/yaml/yaml.go b/vendor/sigs.k8s.io/yaml/yaml.go
index efbc535d4..fc10246bd 100644
--- a/vendor/sigs.k8s.io/yaml/yaml.go
+++ b/vendor/sigs.k8s.io/yaml/yaml.go
@@ -1,3 +1,19 @@
+/*
+Copyright 2021 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
package yaml
import (
@@ -8,56 +24,59 @@ import (
"reflect"
"strconv"
- "gopkg.in/yaml.v2"
+ "sigs.k8s.io/yaml/goyaml.v2"
)
-// Marshal marshals the object into JSON then converts JSON to YAML and returns the
-// YAML.
-func Marshal(o interface{}) ([]byte, error) {
- j, err := json.Marshal(o)
+// Marshal marshals obj into JSON using stdlib json.Marshal, and then converts JSON to YAML using JSONToYAML (see that method for more reference)
+func Marshal(obj interface{}) ([]byte, error) {
+ jsonBytes, err := json.Marshal(obj)
if err != nil {
- return nil, fmt.Errorf("error marshaling into JSON: %v", err)
+ return nil, fmt.Errorf("error marshaling into JSON: %w", err)
}
- y, err := JSONToYAML(j)
- if err != nil {
- return nil, fmt.Errorf("error converting JSON to YAML: %v", err)
- }
-
- return y, nil
+ return JSONToYAML(jsonBytes)
}
// JSONOpt is a decoding option for decoding from JSON format.
type JSONOpt func(*json.Decoder) *json.Decoder
-// Unmarshal converts YAML to JSON then uses JSON to unmarshal into an object,
-// optionally configuring the behavior of the JSON unmarshal.
-func Unmarshal(y []byte, o interface{}, opts ...JSONOpt) error {
- return yamlUnmarshal(y, o, false, opts...)
+// Unmarshal first converts the given YAML to JSON, and then unmarshals the JSON into obj. Options for the
+// standard library json.Decoder can be optionally specified, e.g. to decode untyped numbers into json.Number instead of float64, or to disallow unknown fields (but for that purpose, see also UnmarshalStrict). obj must be a non-nil pointer.
+//
+// Important notes about the Unmarshal logic:
+//
+// - Decoding is case-insensitive, unlike the rest of Kubernetes API machinery, as this is using the stdlib json library. This might be confusing to users.
+// - This decodes any number (although it is an integer) into a float64 if the type of obj is unknown, e.g. *map[string]interface{}, *interface{}, or *[]interface{}. This means integers above +/- 2^53 will lose precision when round-tripping. Make a JSONOpt that calls d.UseNumber() to avoid this.
+// - Duplicate fields, including in-case-sensitive matches, are ignored in an undefined order. Note that the YAML specification forbids duplicate fields, so this logic is more permissive than it needs to. See UnmarshalStrict for an alternative.
+// - Unknown fields, i.e. serialized data that do not map to a field in obj, are ignored. Use d.DisallowUnknownFields() or UnmarshalStrict to override.
+// - As per the YAML 1.1 specification, which yaml.v2 used underneath implements, literal 'yes' and 'no' strings without quotation marks will be converted to true/false implicitly.
+// - YAML non-string keys, e.g. ints, bools and floats, are converted to strings implicitly during the YAML to JSON conversion process.
+// - There are no compatibility guarantees for returned error values.
+func Unmarshal(yamlBytes []byte, obj interface{}, opts ...JSONOpt) error {
+ return unmarshal(yamlBytes, obj, yaml.Unmarshal, opts...)
}
-// UnmarshalStrict strictly converts YAML to JSON then uses JSON to unmarshal
-// into an object, optionally configuring the behavior of the JSON unmarshal.
-func UnmarshalStrict(y []byte, o interface{}, opts ...JSONOpt) error {
- return yamlUnmarshal(y, o, true, append(opts, DisallowUnknownFields)...)
+// UnmarshalStrict is similar to Unmarshal (please read its documentation for reference), with the following exceptions:
+//
+// - Duplicate fields in an object yield an error. This is according to the YAML specification.
+// - If obj, or any of its recursive children, is a struct, presence of fields in the serialized data unknown to the struct will yield an error.
+func UnmarshalStrict(yamlBytes []byte, obj interface{}, opts ...JSONOpt) error {
+ return unmarshal(yamlBytes, obj, yaml.UnmarshalStrict, append(opts, DisallowUnknownFields)...)
}
-// yamlUnmarshal unmarshals the given YAML byte stream into the given interface,
+// unmarshal unmarshals the given YAML byte stream into the given interface,
// optionally performing the unmarshalling strictly
-func yamlUnmarshal(y []byte, o interface{}, strict bool, opts ...JSONOpt) error {
- vo := reflect.ValueOf(o)
- unmarshalFn := yaml.Unmarshal
- if strict {
- unmarshalFn = yaml.UnmarshalStrict
- }
- j, err := yamlToJSON(y, &vo, unmarshalFn)
+func unmarshal(yamlBytes []byte, obj interface{}, unmarshalFn func([]byte, interface{}) error, opts ...JSONOpt) error {
+ jsonTarget := reflect.ValueOf(obj)
+
+ jsonBytes, err := yamlToJSONTarget(yamlBytes, &jsonTarget, unmarshalFn)
if err != nil {
- return fmt.Errorf("error converting YAML to JSON: %v", err)
+ return fmt.Errorf("error converting YAML to JSON: %w", err)
}
- err = jsonUnmarshal(bytes.NewReader(j), o, opts...)
+ err = jsonUnmarshal(bytes.NewReader(jsonBytes), obj, opts...)
if err != nil {
- return fmt.Errorf("error unmarshaling JSON: %v", err)
+ return fmt.Errorf("error unmarshaling JSON: %w", err)
}
return nil
@@ -67,21 +86,26 @@ func yamlUnmarshal(y []byte, o interface{}, strict bool, opts ...JSONOpt) error
// object, optionally applying decoder options prior to decoding. We are not
// using json.Unmarshal directly as we want the chance to pass in non-default
// options.
-func jsonUnmarshal(r io.Reader, o interface{}, opts ...JSONOpt) error {
- d := json.NewDecoder(r)
+func jsonUnmarshal(reader io.Reader, obj interface{}, opts ...JSONOpt) error {
+ d := json.NewDecoder(reader)
for _, opt := range opts {
d = opt(d)
}
- if err := d.Decode(&o); err != nil {
+ if err := d.Decode(&obj); err != nil {
return fmt.Errorf("while decoding JSON: %v", err)
}
return nil
}
-// JSONToYAML Converts JSON to YAML.
+// JSONToYAML converts JSON to YAML. Notable implementation details:
+//
+// - Duplicate fields, are case-sensitively ignored in an undefined order.
+// - The sequence indentation style is compact, which means that the "- " marker for a YAML sequence will be on the same indentation level as the sequence field name.
+// - Unlike Unmarshal, all integers, up to 64 bits, are preserved during this round-trip.
func JSONToYAML(j []byte) ([]byte, error) {
// Convert the JSON to an object.
var jsonObj interface{}
+
// We are using yaml.Unmarshal here (instead of json.Unmarshal) because the
// Go JSON library doesn't try to pick the right number type (int, float,
// etc.) when unmarshalling to interface{}, it just picks float64
@@ -93,35 +117,46 @@ func JSONToYAML(j []byte) ([]byte, error) {
}
// Marshal this object into YAML.
- return yaml.Marshal(jsonObj)
+ yamlBytes, err := yaml.Marshal(jsonObj)
+ if err != nil {
+ return nil, err
+ }
+
+ return yamlBytes, nil
}
// YAMLToJSON converts YAML to JSON. Since JSON is a subset of YAML,
// passing JSON through this method should be a no-op.
//
-// Things YAML can do that are not supported by JSON:
-// * In YAML you can have binary and null keys in your maps. These are invalid
-// in JSON. (int and float keys are converted to strings.)
-// * Binary data in YAML with the !!binary tag is not supported. If you want to
-// use binary data with this library, encode the data as base64 as usual but do
-// not use the !!binary tag in your YAML. This will ensure the original base64
-// encoded data makes it all the way through to the JSON.
+// Some things YAML can do that are not supported by JSON:
+// - In YAML you can have binary and null keys in your maps. These are invalid
+// in JSON, and therefore int, bool and float keys are converted to strings implicitly.
+// - Binary data in YAML with the !!binary tag is not supported. If you want to
+// use binary data with this library, encode the data as base64 as usual but do
+// not use the !!binary tag in your YAML. This will ensure the original base64
+// encoded data makes it all the way through to the JSON.
+// - And more... read the YAML specification for more details.
+//
+// Notable about the implementation:
//
-// For strict decoding of YAML, use YAMLToJSONStrict.
+// - Duplicate fields are case-sensitively ignored in an undefined order. Note that the YAML specification forbids duplicate fields, so this logic is more permissive than it needs to. See YAMLToJSONStrict for an alternative.
+// - As per the YAML 1.1 specification, which yaml.v2 used underneath implements, literal 'yes' and 'no' strings without quotation marks will be converted to true/false implicitly.
+// - Unlike Unmarshal, all integers, up to 64 bits, are preserved during this round-trip.
+// - There are no compatibility guarantees for returned error values.
func YAMLToJSON(y []byte) ([]byte, error) {
- return yamlToJSON(y, nil, yaml.Unmarshal)
+ return yamlToJSONTarget(y, nil, yaml.Unmarshal)
}
// YAMLToJSONStrict is like YAMLToJSON but enables strict YAML decoding,
// returning an error on any duplicate field names.
func YAMLToJSONStrict(y []byte) ([]byte, error) {
- return yamlToJSON(y, nil, yaml.UnmarshalStrict)
+ return yamlToJSONTarget(y, nil, yaml.UnmarshalStrict)
}
-func yamlToJSON(y []byte, jsonTarget *reflect.Value, yamlUnmarshal func([]byte, interface{}) error) ([]byte, error) {
+func yamlToJSONTarget(yamlBytes []byte, jsonTarget *reflect.Value, unmarshalFn func([]byte, interface{}) error) ([]byte, error) {
// Convert the YAML to an object.
var yamlObj interface{}
- err := yamlUnmarshal(y, &yamlObj)
+ err := unmarshalFn(yamlBytes, &yamlObj)
if err != nil {
return nil, err
}
@@ -136,7 +171,11 @@ func yamlToJSON(y []byte, jsonTarget *reflect.Value, yamlUnmarshal func([]byte,
}
// Convert this object to JSON and return the data.
- return json.Marshal(jsonObj)
+ jsonBytes, err := json.Marshal(jsonObj)
+ if err != nil {
+ return nil, err
+ }
+ return jsonBytes, nil
}
func convertToJSONableObject(yamlObj interface{}, jsonTarget *reflect.Value) (interface{}, error) {
@@ -147,13 +186,13 @@ func convertToJSONableObject(yamlObj interface{}, jsonTarget *reflect.Value) (in
// decoding into the value, we're just checking if the ultimate target is a
// string.
if jsonTarget != nil {
- ju, tu, pv := indirect(*jsonTarget, false)
+ jsonUnmarshaler, textUnmarshaler, pointerValue := indirect(*jsonTarget, false)
// We have a JSON or Text Umarshaler at this level, so we can't be trying
// to decode into a string.
- if ju != nil || tu != nil {
+ if jsonUnmarshaler != nil || textUnmarshaler != nil {
jsonTarget = nil
} else {
- jsonTarget = &pv
+ jsonTarget = &pointerValue
}
}
@@ -205,7 +244,7 @@ func convertToJSONableObject(yamlObj interface{}, jsonTarget *reflect.Value) (in
keyString = "false"
}
default:
- return nil, fmt.Errorf("Unsupported map key of type: %s, key: %+#v, value: %+#v",
+ return nil, fmt.Errorf("unsupported map key of type: %s, key: %+#v, value: %+#v",
reflect.TypeOf(k), k, v)
}
diff --git a/vendor/sigs.k8s.io/yaml/yaml_go110.go b/vendor/sigs.k8s.io/yaml/yaml_go110.go
index ab3e06a22..94abc1719 100644
--- a/vendor/sigs.k8s.io/yaml/yaml_go110.go
+++ b/vendor/sigs.k8s.io/yaml/yaml_go110.go
@@ -1,7 +1,24 @@
// This file contains changes that are only compatible with go 1.10 and onwards.
+//go:build go1.10
// +build go1.10
+/*
+Copyright 2021 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
package yaml
import "encoding/json"