Bumping k8s dependencies to 1.13

This commit is contained in:
Cheng Xing
2018-11-16 14:08:25 -08:00
parent 305407125c
commit b4c0b68ec7
8002 changed files with 884099 additions and 276228 deletions

View File

@@ -1,3 +1,5 @@
# IntelliJ IDEA
.idea
# Eclipse
.checkstyle
.project
@@ -5,6 +7,10 @@
# Swift
.build
Packages
# Node
node_modules
package-lock.json
bundle.json
# vi
*.swp
# vscode
@@ -12,3 +18,4 @@ Packages
.DS_Store
*~
Package.resolved
extensions/sample/generated

View File

@@ -32,13 +32,16 @@ script:
- pushd plugins/gnostic-go-generator/examples/v2.0/bookstore
- make test
- popd
- pushd plugins/gnostic-go-generator/examples/v2.0/sample
- make test
- popd
- pushd plugins/gnostic-go-generator/examples/v3.0/bookstore
- make test
- popd
- export PATH=.:$HOME/local/bin:$PATH
- export LD_LIBRARY_PATH=$HOME/local/lib
- pushd plugins/gnostic-swift-generator
- make
- make install
- cd examples/bookstore
- make
- .build/debug/Server &

View File

@@ -22,6 +22,7 @@ protoc \
OpenAPIv2/OpenAPIv2.proto
protoc \
-I.:$GOPATH/src \
--go_out=:. \
plugins/plugin.proto

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,5 @@
// Code generated by protoc-gen-go.
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: OpenAPIv2/OpenAPIv2.proto
// DO NOT EDIT!
/*
Package openapi_v2 is a generated protocol buffer package.
@@ -4257,7 +4256,7 @@ func init() { proto.RegisterFile("OpenAPIv2/OpenAPIv2.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 3129 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xec, 0x3b, 0x4b, 0x73, 0x1c, 0x57,
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x3b, 0x4b, 0x73, 0x1c, 0x57,
0xd5, 0xf3, 0x7e, 0x1c, 0x69, 0x46, 0xa3, 0x96, 0x2c, 0xb7, 0x24, 0xc7, 0x71, 0xe4, 0x3c, 0x6c,
0xe7, 0xb3, 0x9c, 0x4f, 0x29, 0x48, 0x05, 0x2a, 0x05, 0xf2, 0xab, 0xc6, 0xc4, 0x44, 0x4a, 0xcb,
0x0e, 0x09, 0x04, 0xba, 0xae, 0x66, 0xee, 0x48, 0x9d, 0x74, 0xf7, 0x6d, 0x77, 0xf7, 0xc8, 0x1a,

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,5 @@
// Code generated by protoc-gen-go.
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: OpenAPIv3/OpenAPIv3.proto
// DO NOT EDIT!
/*
Package openapi_v3 is a generated protocol buffer package.
@@ -25,7 +24,6 @@ It has these top-level messages:
Encodings
Example
ExampleOrReference
Examples
ExamplesOrReferences
Expression
ExternalDocs
@@ -1170,14 +1168,6 @@ func _ExampleOrReference_OneofSizer(msg proto.Message) (n int) {
return n
}
type Examples struct {
}
func (m *Examples) Reset() { *m = Examples{} }
func (m *Examples) String() string { return proto.CompactTextString(m) }
func (*Examples) ProtoMessage() {}
func (*Examples) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} }
type ExamplesOrReferences struct {
AdditionalProperties []*NamedExampleOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties" json:"additional_properties,omitempty"`
}
@@ -1185,7 +1175,7 @@ type ExamplesOrReferences struct {
func (m *ExamplesOrReferences) Reset() { *m = ExamplesOrReferences{} }
func (m *ExamplesOrReferences) String() string { return proto.CompactTextString(m) }
func (*ExamplesOrReferences) ProtoMessage() {}
func (*ExamplesOrReferences) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} }
func (*ExamplesOrReferences) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} }
func (m *ExamplesOrReferences) GetAdditionalProperties() []*NamedExampleOrReference {
if m != nil {
@@ -1201,7 +1191,7 @@ type Expression struct {
func (m *Expression) Reset() { *m = Expression{} }
func (m *Expression) String() string { return proto.CompactTextString(m) }
func (*Expression) ProtoMessage() {}
func (*Expression) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} }
func (*Expression) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} }
func (m *Expression) GetAdditionalProperties() []*NamedAny {
if m != nil {
@@ -1220,7 +1210,7 @@ type ExternalDocs struct {
func (m *ExternalDocs) Reset() { *m = ExternalDocs{} }
func (m *ExternalDocs) String() string { return proto.CompactTextString(m) }
func (*ExternalDocs) ProtoMessage() {}
func (*ExternalDocs) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} }
func (*ExternalDocs) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} }
func (m *ExternalDocs) GetDescription() string {
if m != nil {
@@ -1262,7 +1252,7 @@ type Header struct {
func (m *Header) Reset() { *m = Header{} }
func (m *Header) String() string { return proto.CompactTextString(m) }
func (*Header) ProtoMessage() {}
func (*Header) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} }
func (*Header) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} }
func (m *Header) GetDescription() string {
if m != nil {
@@ -1358,7 +1348,7 @@ type HeaderOrReference struct {
func (m *HeaderOrReference) Reset() { *m = HeaderOrReference{} }
func (m *HeaderOrReference) String() string { return proto.CompactTextString(m) }
func (*HeaderOrReference) ProtoMessage() {}
func (*HeaderOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} }
func (*HeaderOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} }
type isHeaderOrReference_Oneof interface {
isHeaderOrReference_Oneof()
@@ -1476,7 +1466,7 @@ type HeadersOrReferences struct {
func (m *HeadersOrReferences) Reset() { *m = HeadersOrReferences{} }
func (m *HeadersOrReferences) String() string { return proto.CompactTextString(m) }
func (*HeadersOrReferences) ProtoMessage() {}
func (*HeadersOrReferences) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} }
func (*HeadersOrReferences) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} }
func (m *HeadersOrReferences) GetAdditionalProperties() []*NamedHeaderOrReference {
if m != nil {
@@ -1499,7 +1489,7 @@ type Info struct {
func (m *Info) Reset() { *m = Info{} }
func (m *Info) String() string { return proto.CompactTextString(m) }
func (*Info) ProtoMessage() {}
func (*Info) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} }
func (*Info) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} }
func (m *Info) GetTitle() string {
if m != nil {
@@ -1557,7 +1547,7 @@ type ItemsItem struct {
func (m *ItemsItem) Reset() { *m = ItemsItem{} }
func (m *ItemsItem) String() string { return proto.CompactTextString(m) }
func (*ItemsItem) ProtoMessage() {}
func (*ItemsItem) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{24} }
func (*ItemsItem) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} }
func (m *ItemsItem) GetSchemaOrReference() []*SchemaOrReference {
if m != nil {
@@ -1576,7 +1566,7 @@ type License struct {
func (m *License) Reset() { *m = License{} }
func (m *License) String() string { return proto.CompactTextString(m) }
func (*License) ProtoMessage() {}
func (*License) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} }
func (*License) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{24} }
func (m *License) GetName() string {
if m != nil {
@@ -1613,7 +1603,7 @@ type Link struct {
func (m *Link) Reset() { *m = Link{} }
func (m *Link) String() string { return proto.CompactTextString(m) }
func (*Link) ProtoMessage() {}
func (*Link) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} }
func (*Link) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} }
func (m *Link) GetOperationRef() string {
if m != nil {
@@ -1674,7 +1664,7 @@ type LinkOrReference struct {
func (m *LinkOrReference) Reset() { *m = LinkOrReference{} }
func (m *LinkOrReference) String() string { return proto.CompactTextString(m) }
func (*LinkOrReference) ProtoMessage() {}
func (*LinkOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{27} }
func (*LinkOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} }
type isLinkOrReference_Oneof interface {
isLinkOrReference_Oneof()
@@ -1792,7 +1782,7 @@ type LinksOrReferences struct {
func (m *LinksOrReferences) Reset() { *m = LinksOrReferences{} }
func (m *LinksOrReferences) String() string { return proto.CompactTextString(m) }
func (*LinksOrReferences) ProtoMessage() {}
func (*LinksOrReferences) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} }
func (*LinksOrReferences) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{27} }
func (m *LinksOrReferences) GetAdditionalProperties() []*NamedLinkOrReference {
if m != nil {
@@ -1813,7 +1803,7 @@ type MediaType struct {
func (m *MediaType) Reset() { *m = MediaType{} }
func (m *MediaType) String() string { return proto.CompactTextString(m) }
func (*MediaType) ProtoMessage() {}
func (*MediaType) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} }
func (*MediaType) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} }
func (m *MediaType) GetSchema() *SchemaOrReference {
if m != nil {
@@ -1857,7 +1847,7 @@ type MediaTypes struct {
func (m *MediaTypes) Reset() { *m = MediaTypes{} }
func (m *MediaTypes) String() string { return proto.CompactTextString(m) }
func (*MediaTypes) ProtoMessage() {}
func (*MediaTypes) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{30} }
func (*MediaTypes) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} }
func (m *MediaTypes) GetAdditionalProperties() []*NamedMediaType {
if m != nil {
@@ -1877,7 +1867,7 @@ type NamedAny struct {
func (m *NamedAny) Reset() { *m = NamedAny{} }
func (m *NamedAny) String() string { return proto.CompactTextString(m) }
func (*NamedAny) ProtoMessage() {}
func (*NamedAny) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{31} }
func (*NamedAny) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{30} }
func (m *NamedAny) GetName() string {
if m != nil {
@@ -1904,7 +1894,7 @@ type NamedAnyOrExpression struct {
func (m *NamedAnyOrExpression) Reset() { *m = NamedAnyOrExpression{} }
func (m *NamedAnyOrExpression) String() string { return proto.CompactTextString(m) }
func (*NamedAnyOrExpression) ProtoMessage() {}
func (*NamedAnyOrExpression) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{32} }
func (*NamedAnyOrExpression) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{31} }
func (m *NamedAnyOrExpression) GetName() string {
if m != nil {
@@ -1931,7 +1921,7 @@ type NamedCallbackOrReference struct {
func (m *NamedCallbackOrReference) Reset() { *m = NamedCallbackOrReference{} }
func (m *NamedCallbackOrReference) String() string { return proto.CompactTextString(m) }
func (*NamedCallbackOrReference) ProtoMessage() {}
func (*NamedCallbackOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{33} }
func (*NamedCallbackOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{32} }
func (m *NamedCallbackOrReference) GetName() string {
if m != nil {
@@ -1958,7 +1948,7 @@ type NamedEncoding struct {
func (m *NamedEncoding) Reset() { *m = NamedEncoding{} }
func (m *NamedEncoding) String() string { return proto.CompactTextString(m) }
func (*NamedEncoding) ProtoMessage() {}
func (*NamedEncoding) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{34} }
func (*NamedEncoding) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{33} }
func (m *NamedEncoding) GetName() string {
if m != nil {
@@ -1985,7 +1975,7 @@ type NamedExampleOrReference struct {
func (m *NamedExampleOrReference) Reset() { *m = NamedExampleOrReference{} }
func (m *NamedExampleOrReference) String() string { return proto.CompactTextString(m) }
func (*NamedExampleOrReference) ProtoMessage() {}
func (*NamedExampleOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{35} }
func (*NamedExampleOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{34} }
func (m *NamedExampleOrReference) GetName() string {
if m != nil {
@@ -2012,7 +2002,7 @@ type NamedHeaderOrReference struct {
func (m *NamedHeaderOrReference) Reset() { *m = NamedHeaderOrReference{} }
func (m *NamedHeaderOrReference) String() string { return proto.CompactTextString(m) }
func (*NamedHeaderOrReference) ProtoMessage() {}
func (*NamedHeaderOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{36} }
func (*NamedHeaderOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{35} }
func (m *NamedHeaderOrReference) GetName() string {
if m != nil {
@@ -2039,7 +2029,7 @@ type NamedLinkOrReference struct {
func (m *NamedLinkOrReference) Reset() { *m = NamedLinkOrReference{} }
func (m *NamedLinkOrReference) String() string { return proto.CompactTextString(m) }
func (*NamedLinkOrReference) ProtoMessage() {}
func (*NamedLinkOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{37} }
func (*NamedLinkOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{36} }
func (m *NamedLinkOrReference) GetName() string {
if m != nil {
@@ -2066,7 +2056,7 @@ type NamedMediaType struct {
func (m *NamedMediaType) Reset() { *m = NamedMediaType{} }
func (m *NamedMediaType) String() string { return proto.CompactTextString(m) }
func (*NamedMediaType) ProtoMessage() {}
func (*NamedMediaType) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{38} }
func (*NamedMediaType) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{37} }
func (m *NamedMediaType) GetName() string {
if m != nil {
@@ -2093,7 +2083,7 @@ type NamedParameterOrReference struct {
func (m *NamedParameterOrReference) Reset() { *m = NamedParameterOrReference{} }
func (m *NamedParameterOrReference) String() string { return proto.CompactTextString(m) }
func (*NamedParameterOrReference) ProtoMessage() {}
func (*NamedParameterOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{39} }
func (*NamedParameterOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{38} }
func (m *NamedParameterOrReference) GetName() string {
if m != nil {
@@ -2120,7 +2110,7 @@ type NamedPathItem struct {
func (m *NamedPathItem) Reset() { *m = NamedPathItem{} }
func (m *NamedPathItem) String() string { return proto.CompactTextString(m) }
func (*NamedPathItem) ProtoMessage() {}
func (*NamedPathItem) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{40} }
func (*NamedPathItem) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{39} }
func (m *NamedPathItem) GetName() string {
if m != nil {
@@ -2147,7 +2137,7 @@ type NamedRequestBodyOrReference struct {
func (m *NamedRequestBodyOrReference) Reset() { *m = NamedRequestBodyOrReference{} }
func (m *NamedRequestBodyOrReference) String() string { return proto.CompactTextString(m) }
func (*NamedRequestBodyOrReference) ProtoMessage() {}
func (*NamedRequestBodyOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{41} }
func (*NamedRequestBodyOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{40} }
func (m *NamedRequestBodyOrReference) GetName() string {
if m != nil {
@@ -2174,7 +2164,7 @@ type NamedResponseOrReference struct {
func (m *NamedResponseOrReference) Reset() { *m = NamedResponseOrReference{} }
func (m *NamedResponseOrReference) String() string { return proto.CompactTextString(m) }
func (*NamedResponseOrReference) ProtoMessage() {}
func (*NamedResponseOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{42} }
func (*NamedResponseOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{41} }
func (m *NamedResponseOrReference) GetName() string {
if m != nil {
@@ -2201,7 +2191,7 @@ type NamedSchemaOrReference struct {
func (m *NamedSchemaOrReference) Reset() { *m = NamedSchemaOrReference{} }
func (m *NamedSchemaOrReference) String() string { return proto.CompactTextString(m) }
func (*NamedSchemaOrReference) ProtoMessage() {}
func (*NamedSchemaOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{43} }
func (*NamedSchemaOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{42} }
func (m *NamedSchemaOrReference) GetName() string {
if m != nil {
@@ -2228,7 +2218,7 @@ type NamedSecuritySchemeOrReference struct {
func (m *NamedSecuritySchemeOrReference) Reset() { *m = NamedSecuritySchemeOrReference{} }
func (m *NamedSecuritySchemeOrReference) String() string { return proto.CompactTextString(m) }
func (*NamedSecuritySchemeOrReference) ProtoMessage() {}
func (*NamedSecuritySchemeOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{44} }
func (*NamedSecuritySchemeOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{43} }
func (m *NamedSecuritySchemeOrReference) GetName() string {
if m != nil {
@@ -2255,7 +2245,7 @@ type NamedServerVariable struct {
func (m *NamedServerVariable) Reset() { *m = NamedServerVariable{} }
func (m *NamedServerVariable) String() string { return proto.CompactTextString(m) }
func (*NamedServerVariable) ProtoMessage() {}
func (*NamedServerVariable) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{45} }
func (*NamedServerVariable) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{44} }
func (m *NamedServerVariable) GetName() string {
if m != nil {
@@ -2282,7 +2272,7 @@ type NamedString struct {
func (m *NamedString) Reset() { *m = NamedString{} }
func (m *NamedString) String() string { return proto.CompactTextString(m) }
func (*NamedString) ProtoMessage() {}
func (*NamedString) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{46} }
func (*NamedString) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{45} }
func (m *NamedString) GetName() string {
if m != nil {
@@ -2310,7 +2300,7 @@ type OauthFlow struct {
func (m *OauthFlow) Reset() { *m = OauthFlow{} }
func (m *OauthFlow) String() string { return proto.CompactTextString(m) }
func (*OauthFlow) ProtoMessage() {}
func (*OauthFlow) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{47} }
func (*OauthFlow) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{46} }
func (m *OauthFlow) GetAuthorizationUrl() string {
if m != nil {
@@ -2359,7 +2349,7 @@ type OauthFlows struct {
func (m *OauthFlows) Reset() { *m = OauthFlows{} }
func (m *OauthFlows) String() string { return proto.CompactTextString(m) }
func (*OauthFlows) ProtoMessage() {}
func (*OauthFlows) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{48} }
func (*OauthFlows) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{47} }
func (m *OauthFlows) GetImplicit() *OauthFlow {
if m != nil {
@@ -2403,7 +2393,7 @@ type Object struct {
func (m *Object) Reset() { *m = Object{} }
func (m *Object) String() string { return proto.CompactTextString(m) }
func (*Object) ProtoMessage() {}
func (*Object) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{49} }
func (*Object) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{48} }
func (m *Object) GetAdditionalProperties() []*NamedAny {
if m != nil {
@@ -2432,7 +2422,7 @@ type Operation struct {
func (m *Operation) Reset() { *m = Operation{} }
func (m *Operation) String() string { return proto.CompactTextString(m) }
func (*Operation) ProtoMessage() {}
func (*Operation) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{50} }
func (*Operation) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{49} }
func (m *Operation) GetTags() []string {
if m != nil {
@@ -2546,7 +2536,7 @@ type Parameter struct {
func (m *Parameter) Reset() { *m = Parameter{} }
func (m *Parameter) String() string { return proto.CompactTextString(m) }
func (*Parameter) ProtoMessage() {}
func (*Parameter) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{51} }
func (*Parameter) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{50} }
func (m *Parameter) GetName() string {
if m != nil {
@@ -2656,7 +2646,7 @@ type ParameterOrReference struct {
func (m *ParameterOrReference) Reset() { *m = ParameterOrReference{} }
func (m *ParameterOrReference) String() string { return proto.CompactTextString(m) }
func (*ParameterOrReference) ProtoMessage() {}
func (*ParameterOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{52} }
func (*ParameterOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{51} }
type isParameterOrReference_Oneof interface {
isParameterOrReference_Oneof()
@@ -2774,7 +2764,7 @@ type ParametersOrReferences struct {
func (m *ParametersOrReferences) Reset() { *m = ParametersOrReferences{} }
func (m *ParametersOrReferences) String() string { return proto.CompactTextString(m) }
func (*ParametersOrReferences) ProtoMessage() {}
func (*ParametersOrReferences) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{53} }
func (*ParametersOrReferences) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{52} }
func (m *ParametersOrReferences) GetAdditionalProperties() []*NamedParameterOrReference {
if m != nil {
@@ -2804,7 +2794,7 @@ type PathItem struct {
func (m *PathItem) Reset() { *m = PathItem{} }
func (m *PathItem) String() string { return proto.CompactTextString(m) }
func (*PathItem) ProtoMessage() {}
func (*PathItem) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{54} }
func (*PathItem) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{53} }
func (m *PathItem) GetXRef() string {
if m != nil {
@@ -2913,7 +2903,7 @@ type Paths struct {
func (m *Paths) Reset() { *m = Paths{} }
func (m *Paths) String() string { return proto.CompactTextString(m) }
func (*Paths) ProtoMessage() {}
func (*Paths) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{55} }
func (*Paths) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{54} }
func (m *Paths) GetPath() []*NamedPathItem {
if m != nil {
@@ -2936,7 +2926,7 @@ type Properties struct {
func (m *Properties) Reset() { *m = Properties{} }
func (m *Properties) String() string { return proto.CompactTextString(m) }
func (*Properties) ProtoMessage() {}
func (*Properties) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{56} }
func (*Properties) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{55} }
func (m *Properties) GetAdditionalProperties() []*NamedSchemaOrReference {
if m != nil {
@@ -2953,7 +2943,7 @@ type Reference struct {
func (m *Reference) Reset() { *m = Reference{} }
func (m *Reference) String() string { return proto.CompactTextString(m) }
func (*Reference) ProtoMessage() {}
func (*Reference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{57} }
func (*Reference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{56} }
func (m *Reference) GetXRef() string {
if m != nil {
@@ -2969,7 +2959,7 @@ type RequestBodiesOrReferences struct {
func (m *RequestBodiesOrReferences) Reset() { *m = RequestBodiesOrReferences{} }
func (m *RequestBodiesOrReferences) String() string { return proto.CompactTextString(m) }
func (*RequestBodiesOrReferences) ProtoMessage() {}
func (*RequestBodiesOrReferences) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{58} }
func (*RequestBodiesOrReferences) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{57} }
func (m *RequestBodiesOrReferences) GetAdditionalProperties() []*NamedRequestBodyOrReference {
if m != nil {
@@ -2989,7 +2979,7 @@ type RequestBody struct {
func (m *RequestBody) Reset() { *m = RequestBody{} }
func (m *RequestBody) String() string { return proto.CompactTextString(m) }
func (*RequestBody) ProtoMessage() {}
func (*RequestBody) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{59} }
func (*RequestBody) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{58} }
func (m *RequestBody) GetDescription() string {
if m != nil {
@@ -3029,7 +3019,7 @@ type RequestBodyOrReference struct {
func (m *RequestBodyOrReference) Reset() { *m = RequestBodyOrReference{} }
func (m *RequestBodyOrReference) String() string { return proto.CompactTextString(m) }
func (*RequestBodyOrReference) ProtoMessage() {}
func (*RequestBodyOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{60} }
func (*RequestBodyOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{59} }
type isRequestBodyOrReference_Oneof interface {
isRequestBodyOrReference_Oneof()
@@ -3152,7 +3142,7 @@ type Response struct {
func (m *Response) Reset() { *m = Response{} }
func (m *Response) String() string { return proto.CompactTextString(m) }
func (*Response) ProtoMessage() {}
func (*Response) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{61} }
func (*Response) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{60} }
func (m *Response) GetDescription() string {
if m != nil {
@@ -3199,7 +3189,7 @@ type ResponseOrReference struct {
func (m *ResponseOrReference) Reset() { *m = ResponseOrReference{} }
func (m *ResponseOrReference) String() string { return proto.CompactTextString(m) }
func (*ResponseOrReference) ProtoMessage() {}
func (*ResponseOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{62} }
func (*ResponseOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{61} }
type isResponseOrReference_Oneof interface {
isResponseOrReference_Oneof()
@@ -3320,7 +3310,7 @@ type Responses struct {
func (m *Responses) Reset() { *m = Responses{} }
func (m *Responses) String() string { return proto.CompactTextString(m) }
func (*Responses) ProtoMessage() {}
func (*Responses) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{63} }
func (*Responses) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{62} }
func (m *Responses) GetDefault() *ResponseOrReference {
if m != nil {
@@ -3350,7 +3340,7 @@ type ResponsesOrReferences struct {
func (m *ResponsesOrReferences) Reset() { *m = ResponsesOrReferences{} }
func (m *ResponsesOrReferences) String() string { return proto.CompactTextString(m) }
func (*ResponsesOrReferences) ProtoMessage() {}
func (*ResponsesOrReferences) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{64} }
func (*ResponsesOrReferences) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{63} }
func (m *ResponsesOrReferences) GetAdditionalProperties() []*NamedResponseOrReference {
if m != nil {
@@ -3402,7 +3392,7 @@ type Schema struct {
func (m *Schema) Reset() { *m = Schema{} }
func (m *Schema) String() string { return proto.CompactTextString(m) }
func (*Schema) ProtoMessage() {}
func (*Schema) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{65} }
func (*Schema) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{64} }
func (m *Schema) GetNullable() bool {
if m != nil {
@@ -3666,7 +3656,7 @@ type SchemaOrReference struct {
func (m *SchemaOrReference) Reset() { *m = SchemaOrReference{} }
func (m *SchemaOrReference) String() string { return proto.CompactTextString(m) }
func (*SchemaOrReference) ProtoMessage() {}
func (*SchemaOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{66} }
func (*SchemaOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{65} }
type isSchemaOrReference_Oneof interface {
isSchemaOrReference_Oneof()
@@ -3784,7 +3774,7 @@ type SchemasOrReferences struct {
func (m *SchemasOrReferences) Reset() { *m = SchemasOrReferences{} }
func (m *SchemasOrReferences) String() string { return proto.CompactTextString(m) }
func (*SchemasOrReferences) ProtoMessage() {}
func (*SchemasOrReferences) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{67} }
func (*SchemasOrReferences) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{66} }
func (m *SchemasOrReferences) GetAdditionalProperties() []*NamedSchemaOrReference {
if m != nil {
@@ -3800,7 +3790,7 @@ type SecurityRequirement struct {
func (m *SecurityRequirement) Reset() { *m = SecurityRequirement{} }
func (m *SecurityRequirement) String() string { return proto.CompactTextString(m) }
func (*SecurityRequirement) ProtoMessage() {}
func (*SecurityRequirement) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{68} }
func (*SecurityRequirement) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{67} }
// Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2's common flows (implicit, password, application and access code) as defined in RFC6749, and OpenID Connect Discovery.
type SecurityScheme struct {
@@ -3818,7 +3808,7 @@ type SecurityScheme struct {
func (m *SecurityScheme) Reset() { *m = SecurityScheme{} }
func (m *SecurityScheme) String() string { return proto.CompactTextString(m) }
func (*SecurityScheme) ProtoMessage() {}
func (*SecurityScheme) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{69} }
func (*SecurityScheme) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{68} }
func (m *SecurityScheme) GetType() string {
if m != nil {
@@ -3893,7 +3883,7 @@ type SecuritySchemeOrReference struct {
func (m *SecuritySchemeOrReference) Reset() { *m = SecuritySchemeOrReference{} }
func (m *SecuritySchemeOrReference) String() string { return proto.CompactTextString(m) }
func (*SecuritySchemeOrReference) ProtoMessage() {}
func (*SecuritySchemeOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{70} }
func (*SecuritySchemeOrReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{69} }
type isSecuritySchemeOrReference_Oneof interface {
isSecuritySchemeOrReference_Oneof()
@@ -4011,7 +4001,7 @@ type SecuritySchemesOrReferences struct {
func (m *SecuritySchemesOrReferences) Reset() { *m = SecuritySchemesOrReferences{} }
func (m *SecuritySchemesOrReferences) String() string { return proto.CompactTextString(m) }
func (*SecuritySchemesOrReferences) ProtoMessage() {}
func (*SecuritySchemesOrReferences) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{71} }
func (*SecuritySchemesOrReferences) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{70} }
func (m *SecuritySchemesOrReferences) GetAdditionalProperties() []*NamedSecuritySchemeOrReference {
if m != nil {
@@ -4031,7 +4021,7 @@ type Server struct {
func (m *Server) Reset() { *m = Server{} }
func (m *Server) String() string { return proto.CompactTextString(m) }
func (*Server) ProtoMessage() {}
func (*Server) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{72} }
func (*Server) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{71} }
func (m *Server) GetUrl() string {
if m != nil {
@@ -4072,7 +4062,7 @@ type ServerVariable struct {
func (m *ServerVariable) Reset() { *m = ServerVariable{} }
func (m *ServerVariable) String() string { return proto.CompactTextString(m) }
func (*ServerVariable) ProtoMessage() {}
func (*ServerVariable) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{73} }
func (*ServerVariable) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{72} }
func (m *ServerVariable) GetEnum() []string {
if m != nil {
@@ -4109,7 +4099,7 @@ type ServerVariables struct {
func (m *ServerVariables) Reset() { *m = ServerVariables{} }
func (m *ServerVariables) String() string { return proto.CompactTextString(m) }
func (*ServerVariables) ProtoMessage() {}
func (*ServerVariables) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{74} }
func (*ServerVariables) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{73} }
func (m *ServerVariables) GetAdditionalProperties() []*NamedServerVariable {
if m != nil {
@@ -4130,7 +4120,7 @@ type SpecificationExtension struct {
func (m *SpecificationExtension) Reset() { *m = SpecificationExtension{} }
func (m *SpecificationExtension) String() string { return proto.CompactTextString(m) }
func (*SpecificationExtension) ProtoMessage() {}
func (*SpecificationExtension) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{75} }
func (*SpecificationExtension) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{74} }
type isSpecificationExtension_Oneof interface {
isSpecificationExtension_Oneof()
@@ -4268,7 +4258,7 @@ type StringArray struct {
func (m *StringArray) Reset() { *m = StringArray{} }
func (m *StringArray) String() string { return proto.CompactTextString(m) }
func (*StringArray) ProtoMessage() {}
func (*StringArray) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{76} }
func (*StringArray) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{75} }
func (m *StringArray) GetValue() []string {
if m != nil {
@@ -4284,7 +4274,7 @@ type Strings struct {
func (m *Strings) Reset() { *m = Strings{} }
func (m *Strings) String() string { return proto.CompactTextString(m) }
func (*Strings) ProtoMessage() {}
func (*Strings) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{77} }
func (*Strings) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{76} }
func (m *Strings) GetAdditionalProperties() []*NamedString {
if m != nil {
@@ -4304,7 +4294,7 @@ type Tag struct {
func (m *Tag) Reset() { *m = Tag{} }
func (m *Tag) String() string { return proto.CompactTextString(m) }
func (*Tag) ProtoMessage() {}
func (*Tag) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{78} }
func (*Tag) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{77} }
func (m *Tag) GetName() string {
if m != nil {
@@ -4347,7 +4337,7 @@ type Xml struct {
func (m *Xml) Reset() { *m = Xml{} }
func (m *Xml) String() string { return proto.CompactTextString(m) }
func (*Xml) ProtoMessage() {}
func (*Xml) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{79} }
func (*Xml) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{78} }
func (m *Xml) GetName() string {
if m != nil {
@@ -4408,7 +4398,6 @@ func init() {
proto.RegisterType((*Encodings)(nil), "openapi.v3.Encodings")
proto.RegisterType((*Example)(nil), "openapi.v3.Example")
proto.RegisterType((*ExampleOrReference)(nil), "openapi.v3.ExampleOrReference")
proto.RegisterType((*Examples)(nil), "openapi.v3.Examples")
proto.RegisterType((*ExamplesOrReferences)(nil), "openapi.v3.ExamplesOrReferences")
proto.RegisterType((*Expression)(nil), "openapi.v3.Expression")
proto.RegisterType((*ExternalDocs)(nil), "openapi.v3.ExternalDocs")
@@ -4477,8 +4466,8 @@ func init() {
func init() { proto.RegisterFile("OpenAPIv3/OpenAPIv3.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 3544 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xc4, 0x5b, 0x49, 0x6f, 0x1c, 0x47,
// 3539 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x5b, 0x49, 0x6f, 0x1c, 0x47,
0x96, 0x66, 0xd6, 0x5e, 0xaf, 0xb8, 0x06, 0x17, 0x95, 0x24, 0x4b, 0xa2, 0x48, 0xc9, 0x92, 0xb5,
0xda, 0x92, 0xe5, 0xb1, 0x61, 0x7b, 0x3c, 0x94, 0x44, 0x83, 0x02, 0x24, 0x97, 0x26, 0x25, 0xdb,
0x1a, 0x7b, 0x8c, 0x42, 0x30, 0x2b, 0x8a, 0x4c, 0x2b, 0x37, 0x65, 0x66, 0x49, 0xac, 0x39, 0x18,
@@ -4552,152 +4541,152 @@ var fileDescriptor0 = []byte{
0xea, 0x93, 0x11, 0xe4, 0x45, 0x98, 0x8f, 0x44, 0x8d, 0xe3, 0x2b, 0x8c, 0x57, 0x24, 0x80, 0x9f,
0x31, 0x58, 0xc1, 0x0e, 0x56, 0x27, 0xd8,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0x0b,
0x67, 0x1d, 0x73, 0x16, 0xfc, 0x93, 0x06, 0xe5, 0xa7, 0x58, 0x5d, 0x2c, 0x3d, 0x5c, 0xa6, 0x33,
0x31, 0x78, 0x79, 0x5a, 0x3f, 0x62, 0x98, 0x44, 0x4a, 0xfe, 0xa8, 0x41, 0xf9, 0x99, 0x6d, 0x29,
0xd7, 0xf2, 0x1a, 0x34, 0xe9, 0xdf, 0xc0, 0xc3, 0x86, 0x2c, 0xfe, 0xc6, 0x0d, 0xd4, 0xd0, 0x7b,
0x3e, 0xe9, 0x9b, 0x07, 0x42, 0x96, 0xc5, 0x17, 0xed, 0x85, 0xc3, 0xd0, 0x37, 0x77, 0x07, 0xa1,
0x7c, 0x6b, 0x1c, 0x37, 0x50, 0x05, 0x79, 0xe5, 0x63, 0xcf, 0x8b, 0x0a, 0x12, 0xf2, 0x73, 0xca,
0x3f, 0x46, 0xb8, 0xfb, 0x3a, 0xcc, 0xbb, 0xfe, 0x9e, 0xec, 0xd2, 0x7d, 0x79, 0xfb, 0xee, 0xac,
0xf8, 0x49, 0xec, 0x63, 0xdf, 0x0d, 0xdd, 0xc7, 0xda, 0x0f, 0xa5, 0x72, 0x67, 0xeb, 0xc9, 0x6e,
0x8d, 0xfd, 0x7e, 0xf4, 0xf6, 0xdf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xcc, 0x96, 0x1a, 0x1f, 0x3b,
0x3b, 0x00, 0x00,
}

View File

@@ -158,9 +158,6 @@ message ExampleOrReference {
}
}
message Examples {
}
message ExamplesOrReferences {
repeated NamedExampleOrReference additional_properties = 1;
}

View File

@@ -102,10 +102,12 @@
"type": "string"
},
"url": {
"type": "string"
"type": "string",
"format": "uri"
},
"email": {
"type": "string"
"type": "string",
"format": "email"
}
}
},
@@ -692,11 +694,6 @@
}
}
},
"examples": {
"type": "object",
"description": "",
"additionalProperties": false
},
"reference": {
"type": "object",
"description": "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.",

File diff suppressed because it is too large Load Diff

View File

@@ -4,10 +4,7 @@ This directory contains a support tool that reads (scrapes) the
Markdown text specification for OpenAPI 3.0 and builds a
corresponding JSON schema.
It also contains "3.0.md", a local copy of the OpenAPI specification
with modifications that fix minor inconsistencies and make it easier
to read. We hope to have these changes merged into the official
document.
It also contains "3.0.1.md", a local copy of the OpenAPI specification.
## Disclaimer

View File

@@ -303,7 +303,7 @@ func (m *SchemaModel) objectWithID(id string) *SchemaObject {
// NewSchemaModel returns a new SchemaModel.
func NewSchemaModel(filename string) (schemaModel *SchemaModel, err error) {
b, err := ioutil.ReadFile("3.0.md")
b, err := ioutil.ReadFile("3.0.1.md")
if err != nil {
return nil, err
}
@@ -837,6 +837,19 @@ func main() {
*(contentObject.PatternProperties) = append(*(contentObject.PatternProperties), namedSchema)
}
// fix the contact object
contactObject := schema.DefinitionWithName("contact")
if contactObject != nil {
emailProperty := contactObject.PropertyWithName("email")
if emailProperty != nil {
emailProperty.Format = stringptr("email");
}
urlProperty := contactObject.PropertyWithName("url")
if urlProperty != nil {
urlProperty.Format = stringptr("uri");
}
}
// write the updated schema
output := schema.JSONString()
err = ioutil.WriteFile("schema.json", []byte(output), 0644)

View File

@@ -61,8 +61,14 @@ buffers. Pre-generated versions of these files are in the OpenAPIv2 directory.
3. [Optional] Generate Protocol Buffer support code.
A pre-generated version of this file is checked into the OpenAPIv2 directory.
This step requires a local installation of protoc, the Protocol Buffer Compiler.
This step requires a local installation of protoc, the Protocol Buffer Compiler,
and the Go protoc plugin.
You can get protoc [here](https://github.com/google/protobuf).
You can install the plugin with this command:
go get -u github.com/golang/protobuf/protoc-gen-go
Then use the following to recompile the Gnostic Protocol Buffer models:
./COMPILE-PROTOS.sh
@@ -74,7 +80,7 @@ You can get protoc [here](https://github.com/google/protobuf).
5. Run **gnostic**. This will create a file in the current directory named "petstore.pb" that contains a binary
Protocol Buffer description of a sample API.
gnostic --pb-out=. examples/petstore.json
gnostic --pb-out=. examples/v2.0/json/petstore.json
6. You can also compile files that you specify with a URL. Here's another way to compile the previous
example. This time we're creating "petstore.text", which contains a textual representation of the
@@ -92,7 +98,7 @@ that reports some basic information about an API. The "-" causes the plugin to
write its output to stdout.
go install github.com/googleapis/gnostic/plugins/gnostic-go-sample
gnostic examples/petstore.json --go-sample-out=-
gnostic examples/v2.0/json/petstore.json --go-sample-out=-
## Copyright

View File

@@ -151,7 +151,7 @@ Usage:
func handleExportArgumentsForBytes(arguments map[string]interface{}, bytes []byte) (handled bool, err error) {
// Unpack the discovery document.
info, err := compiler.ReadInfoFromBytes("source", bytes)
info, err := compiler.ReadInfoFromBytes("", bytes)
if err != nil {
return true, err
}

View File

@@ -18,8 +18,8 @@ import (
"net/url"
"strings"
discovery "github.com/googleapis/gnostic/discovery"
openapi3 "github.com/googleapis/gnostic/OpenAPIv3"
discovery "github.com/googleapis/gnostic/discovery"
)
func pathForMethod(path string) string {
@@ -59,9 +59,9 @@ func buildOpenAPI3SchemaOrReferenceForSchema(schema *discovery.Schema) *openapi3
}
}
if schema.Items != nil {
s2 := buildOpenAPI3SchemaOrReferenceForSchema(schema.Items)
s.Items = &openapi3.ItemsItem{}
s.Items.SchemaOrReference = append(s.Items.SchemaOrReference, s2)
s.Items = &openapi3.ItemsItem{
SchemaOrReference: []*openapi3.SchemaOrReference{buildOpenAPI3SchemaOrReferenceForSchema(schema.Items)},
}
}
if (schema.Properties != nil) && (len(schema.Properties.AdditionalProperties) > 0) {
s.Properties = &openapi3.Properties{}

View File

@@ -0,0 +1,5 @@
# report-messages tool
This directory contains a command-line tool that provides a text
report listing the messages in a gnostic messages file.

View File

@@ -0,0 +1,69 @@
// Copyright 2018 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.
// Filter and display messages produced by gnostic invocations.
package main
import (
"flag"
"fmt"
"io/ioutil"
"os"
"github.com/golang/protobuf/proto"
"github.com/googleapis/gnostic/printer"
plugins "github.com/googleapis/gnostic/plugins"
)
func readMessagesFromFileWithName(filename string) *plugins.Messages {
data, err := ioutil.ReadFile(filename)
if err != nil {
fmt.Printf("File error: %v\n", err)
os.Exit(1)
}
messages := &plugins.Messages{}
err = proto.Unmarshal(data, messages)
if err != nil {
panic(err)
}
return messages
}
func printMessages(code *printer.Code, messages *plugins.Messages) {
for _, message := range messages.Messages {
line := fmt.Sprintf("%-7s %-14s %s %+v",
message.Level,
message.Code,
message.Text,
message.Keys)
code.Print(line)
}
}
func main() {
flag.Parse()
args := flag.Args()
if len(args) != 1 {
fmt.Printf("Usage: report-messages <file.pb>\n")
return
}
messages := readMessagesFromFileWithName(args[0])
code := &printer.Code{}
printMessages(code, messages)
fmt.Printf("%s", code)
}

View File

@@ -110,7 +110,9 @@ func ReadInfoFromBytes(filename string, bytes []byte) (interface{}, error) {
if err != nil {
return nil, err
}
infoCache[filename] = info
if len(filename) > 0 {
infoCache[filename] = info
}
return info, nil
}

View File

@@ -2124,7 +2124,7 @@ func (m *StringArray) ResolveReferences(root string) (interface{}, error) {
func (m *Annotations) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if len(m.Required) != 0 {
info = append(info, yaml.MapItem{"required", m.Required})
info = append(info, yaml.MapItem{Key: "required", Value: m.Required})
}
return info
}
@@ -2154,7 +2154,7 @@ func (m *Any) ToRawInfo() interface{} {
func (m *Auth) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if m.Oauth2 != nil {
info = append(info, yaml.MapItem{"oauth2", m.Oauth2.ToRawInfo()})
info = append(info, yaml.MapItem{Key: "oauth2", Value: m.Oauth2.ToRawInfo()})
}
// &{Name:oauth2 Type:Oauth2 StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
return info
@@ -2164,100 +2164,100 @@ func (m *Auth) ToRawInfo() interface{} {
func (m *Document) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if m.Kind != "" {
info = append(info, yaml.MapItem{"kind", m.Kind})
info = append(info, yaml.MapItem{Key: "kind", Value: m.Kind})
}
if m.DiscoveryVersion != "" {
info = append(info, yaml.MapItem{"discoveryVersion", m.DiscoveryVersion})
info = append(info, yaml.MapItem{Key: "discoveryVersion", Value: m.DiscoveryVersion})
}
if m.Id != "" {
info = append(info, yaml.MapItem{"id", m.Id})
info = append(info, yaml.MapItem{Key: "id", Value: m.Id})
}
if m.Name != "" {
info = append(info, yaml.MapItem{"name", m.Name})
info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
}
if m.Version != "" {
info = append(info, yaml.MapItem{"version", m.Version})
info = append(info, yaml.MapItem{Key: "version", Value: m.Version})
}
if m.Revision != "" {
info = append(info, yaml.MapItem{"revision", m.Revision})
info = append(info, yaml.MapItem{Key: "revision", Value: m.Revision})
}
if m.Title != "" {
info = append(info, yaml.MapItem{"title", m.Title})
info = append(info, yaml.MapItem{Key: "title", Value: m.Title})
}
if m.Description != "" {
info = append(info, yaml.MapItem{"description", m.Description})
info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
}
if m.Icons != nil {
info = append(info, yaml.MapItem{"icons", m.Icons.ToRawInfo()})
info = append(info, yaml.MapItem{Key: "icons", Value: m.Icons.ToRawInfo()})
}
// &{Name:icons Type:Icons StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.DocumentationLink != "" {
info = append(info, yaml.MapItem{"documentationLink", m.DocumentationLink})
info = append(info, yaml.MapItem{Key: "documentationLink", Value: m.DocumentationLink})
}
if len(m.Labels) != 0 {
info = append(info, yaml.MapItem{"labels", m.Labels})
info = append(info, yaml.MapItem{Key: "labels", Value: m.Labels})
}
if m.Protocol != "" {
info = append(info, yaml.MapItem{"protocol", m.Protocol})
info = append(info, yaml.MapItem{Key: "protocol", Value: m.Protocol})
}
if m.BaseUrl != "" {
info = append(info, yaml.MapItem{"baseUrl", m.BaseUrl})
info = append(info, yaml.MapItem{Key: "baseUrl", Value: m.BaseUrl})
}
if m.BasePath != "" {
info = append(info, yaml.MapItem{"basePath", m.BasePath})
info = append(info, yaml.MapItem{Key: "basePath", Value: m.BasePath})
}
if m.RootUrl != "" {
info = append(info, yaml.MapItem{"rootUrl", m.RootUrl})
info = append(info, yaml.MapItem{Key: "rootUrl", Value: m.RootUrl})
}
if m.ServicePath != "" {
info = append(info, yaml.MapItem{"servicePath", m.ServicePath})
info = append(info, yaml.MapItem{Key: "servicePath", Value: m.ServicePath})
}
if m.BatchPath != "" {
info = append(info, yaml.MapItem{"batchPath", m.BatchPath})
info = append(info, yaml.MapItem{Key: "batchPath", Value: m.BatchPath})
}
if m.Parameters != nil {
info = append(info, yaml.MapItem{"parameters", m.Parameters.ToRawInfo()})
info = append(info, yaml.MapItem{Key: "parameters", Value: m.Parameters.ToRawInfo()})
}
// &{Name:parameters Type:Parameters StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.Auth != nil {
info = append(info, yaml.MapItem{"auth", m.Auth.ToRawInfo()})
info = append(info, yaml.MapItem{Key: "auth", Value: m.Auth.ToRawInfo()})
}
// &{Name:auth Type:Auth StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if len(m.Features) != 0 {
info = append(info, yaml.MapItem{"features", m.Features})
info = append(info, yaml.MapItem{Key: "features", Value: m.Features})
}
if m.Schemas != nil {
info = append(info, yaml.MapItem{"schemas", m.Schemas.ToRawInfo()})
info = append(info, yaml.MapItem{Key: "schemas", Value: m.Schemas.ToRawInfo()})
}
// &{Name:schemas Type:Schemas StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.Methods != nil {
info = append(info, yaml.MapItem{"methods", m.Methods.ToRawInfo()})
info = append(info, yaml.MapItem{Key: "methods", Value: m.Methods.ToRawInfo()})
}
// &{Name:methods Type:Methods StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.Resources != nil {
info = append(info, yaml.MapItem{"resources", m.Resources.ToRawInfo()})
info = append(info, yaml.MapItem{Key: "resources", Value: m.Resources.ToRawInfo()})
}
// &{Name:resources Type:Resources StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.Etag != "" {
info = append(info, yaml.MapItem{"etag", m.Etag})
info = append(info, yaml.MapItem{Key: "etag", Value: m.Etag})
}
if m.OwnerDomain != "" {
info = append(info, yaml.MapItem{"ownerDomain", m.OwnerDomain})
info = append(info, yaml.MapItem{Key: "ownerDomain", Value: m.OwnerDomain})
}
if m.OwnerName != "" {
info = append(info, yaml.MapItem{"ownerName", m.OwnerName})
info = append(info, yaml.MapItem{Key: "ownerName", Value: m.OwnerName})
}
if m.VersionModule != false {
info = append(info, yaml.MapItem{"version_module", m.VersionModule})
info = append(info, yaml.MapItem{Key: "version_module", Value: m.VersionModule})
}
if m.CanonicalName != "" {
info = append(info, yaml.MapItem{"canonicalName", m.CanonicalName})
info = append(info, yaml.MapItem{Key: "canonicalName", Value: m.CanonicalName})
}
if m.FullyEncodeReservedExpansion != false {
info = append(info, yaml.MapItem{"fullyEncodeReservedExpansion", m.FullyEncodeReservedExpansion})
info = append(info, yaml.MapItem{Key: "fullyEncodeReservedExpansion", Value: m.FullyEncodeReservedExpansion})
}
if m.PackagePath != "" {
info = append(info, yaml.MapItem{"packagePath", m.PackagePath})
info = append(info, yaml.MapItem{Key: "packagePath", Value: m.PackagePath})
}
return info
}
@@ -2266,10 +2266,10 @@ func (m *Document) ToRawInfo() interface{} {
func (m *Icons) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if m.X16 != "" {
info = append(info, yaml.MapItem{"x16", m.X16})
info = append(info, yaml.MapItem{Key: "x16", Value: m.X16})
}
if m.X32 != "" {
info = append(info, yaml.MapItem{"x32", m.X32})
info = append(info, yaml.MapItem{Key: "x32", Value: m.X32})
}
return info
}
@@ -2278,17 +2278,17 @@ func (m *Icons) ToRawInfo() interface{} {
func (m *MediaUpload) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if len(m.Accept) != 0 {
info = append(info, yaml.MapItem{"accept", m.Accept})
info = append(info, yaml.MapItem{Key: "accept", Value: m.Accept})
}
if m.MaxSize != "" {
info = append(info, yaml.MapItem{"maxSize", m.MaxSize})
info = append(info, yaml.MapItem{Key: "maxSize", Value: m.MaxSize})
}
if m.Protocols != nil {
info = append(info, yaml.MapItem{"protocols", m.Protocols.ToRawInfo()})
info = append(info, yaml.MapItem{Key: "protocols", Value: m.Protocols.ToRawInfo()})
}
// &{Name:protocols Type:Protocols StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.SupportsSubscription != false {
info = append(info, yaml.MapItem{"supportsSubscription", m.SupportsSubscription})
info = append(info, yaml.MapItem{Key: "supportsSubscription", Value: m.SupportsSubscription})
}
return info
}
@@ -2297,56 +2297,56 @@ func (m *MediaUpload) ToRawInfo() interface{} {
func (m *Method) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if m.Id != "" {
info = append(info, yaml.MapItem{"id", m.Id})
info = append(info, yaml.MapItem{Key: "id", Value: m.Id})
}
if m.Path != "" {
info = append(info, yaml.MapItem{"path", m.Path})
info = append(info, yaml.MapItem{Key: "path", Value: m.Path})
}
if m.HttpMethod != "" {
info = append(info, yaml.MapItem{"httpMethod", m.HttpMethod})
info = append(info, yaml.MapItem{Key: "httpMethod", Value: m.HttpMethod})
}
if m.Description != "" {
info = append(info, yaml.MapItem{"description", m.Description})
info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
}
if m.Parameters != nil {
info = append(info, yaml.MapItem{"parameters", m.Parameters.ToRawInfo()})
info = append(info, yaml.MapItem{Key: "parameters", Value: m.Parameters.ToRawInfo()})
}
// &{Name:parameters Type:Parameters StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if len(m.ParameterOrder) != 0 {
info = append(info, yaml.MapItem{"parameterOrder", m.ParameterOrder})
info = append(info, yaml.MapItem{Key: "parameterOrder", Value: m.ParameterOrder})
}
if m.Request != nil {
info = append(info, yaml.MapItem{"request", m.Request.ToRawInfo()})
info = append(info, yaml.MapItem{Key: "request", Value: m.Request.ToRawInfo()})
}
// &{Name:request Type:Request StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.Response != nil {
info = append(info, yaml.MapItem{"response", m.Response.ToRawInfo()})
info = append(info, yaml.MapItem{Key: "response", Value: m.Response.ToRawInfo()})
}
// &{Name:response Type:Response StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if len(m.Scopes) != 0 {
info = append(info, yaml.MapItem{"scopes", m.Scopes})
info = append(info, yaml.MapItem{Key: "scopes", Value: m.Scopes})
}
if m.SupportsMediaDownload != false {
info = append(info, yaml.MapItem{"supportsMediaDownload", m.SupportsMediaDownload})
info = append(info, yaml.MapItem{Key: "supportsMediaDownload", Value: m.SupportsMediaDownload})
}
if m.SupportsMediaUpload != false {
info = append(info, yaml.MapItem{"supportsMediaUpload", m.SupportsMediaUpload})
info = append(info, yaml.MapItem{Key: "supportsMediaUpload", Value: m.SupportsMediaUpload})
}
if m.UseMediaDownloadService != false {
info = append(info, yaml.MapItem{"useMediaDownloadService", m.UseMediaDownloadService})
info = append(info, yaml.MapItem{Key: "useMediaDownloadService", Value: m.UseMediaDownloadService})
}
if m.MediaUpload != nil {
info = append(info, yaml.MapItem{"mediaUpload", m.MediaUpload.ToRawInfo()})
info = append(info, yaml.MapItem{Key: "mediaUpload", Value: m.MediaUpload.ToRawInfo()})
}
// &{Name:mediaUpload Type:MediaUpload StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.SupportsSubscription != false {
info = append(info, yaml.MapItem{"supportsSubscription", m.SupportsSubscription})
info = append(info, yaml.MapItem{Key: "supportsSubscription", Value: m.SupportsSubscription})
}
if m.FlatPath != "" {
info = append(info, yaml.MapItem{"flatPath", m.FlatPath})
info = append(info, yaml.MapItem{Key: "flatPath", Value: m.FlatPath})
}
if m.EtagRequired != false {
info = append(info, yaml.MapItem{"etagRequired", m.EtagRequired})
info = append(info, yaml.MapItem{Key: "etagRequired", Value: m.EtagRequired})
}
return info
}
@@ -2356,7 +2356,7 @@ func (m *Methods) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if m.AdditionalProperties != nil {
for _, item := range m.AdditionalProperties {
info = append(info, yaml.MapItem{item.Name, item.Value.ToRawInfo()})
info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
}
}
// &{Name:additionalProperties Type:NamedMethod StringEnumValues:[] MapType:Method Repeated:true Pattern: Implicit:true Description:}
@@ -2367,7 +2367,7 @@ func (m *Methods) ToRawInfo() interface{} {
func (m *NamedMethod) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if m.Name != "" {
info = append(info, yaml.MapItem{"name", m.Name})
info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
}
// &{Name:value Type:Method StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
return info
@@ -2377,7 +2377,7 @@ func (m *NamedMethod) ToRawInfo() interface{} {
func (m *NamedParameter) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if m.Name != "" {
info = append(info, yaml.MapItem{"name", m.Name})
info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
}
// &{Name:value Type:Parameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
return info
@@ -2387,7 +2387,7 @@ func (m *NamedParameter) ToRawInfo() interface{} {
func (m *NamedResource) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if m.Name != "" {
info = append(info, yaml.MapItem{"name", m.Name})
info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
}
// &{Name:value Type:Resource StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
return info
@@ -2397,7 +2397,7 @@ func (m *NamedResource) ToRawInfo() interface{} {
func (m *NamedSchema) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if m.Name != "" {
info = append(info, yaml.MapItem{"name", m.Name})
info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
}
// &{Name:value Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
return info
@@ -2407,7 +2407,7 @@ func (m *NamedSchema) ToRawInfo() interface{} {
func (m *NamedScope) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if m.Name != "" {
info = append(info, yaml.MapItem{"name", m.Name})
info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
}
// &{Name:value Type:Scope StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
return info
@@ -2417,7 +2417,7 @@ func (m *NamedScope) ToRawInfo() interface{} {
func (m *Oauth2) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if m.Scopes != nil {
info = append(info, yaml.MapItem{"scopes", m.Scopes.ToRawInfo()})
info = append(info, yaml.MapItem{Key: "scopes", Value: m.Scopes.ToRawInfo()})
}
// &{Name:scopes Type:Scopes StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
return info
@@ -2427,61 +2427,61 @@ func (m *Oauth2) ToRawInfo() interface{} {
func (m *Parameter) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if m.Id != "" {
info = append(info, yaml.MapItem{"id", m.Id})
info = append(info, yaml.MapItem{Key: "id", Value: m.Id})
}
if m.Type != "" {
info = append(info, yaml.MapItem{"type", m.Type})
info = append(info, yaml.MapItem{Key: "type", Value: m.Type})
}
if m.XRef != "" {
info = append(info, yaml.MapItem{"$ref", m.XRef})
info = append(info, yaml.MapItem{Key: "$ref", Value: m.XRef})
}
if m.Description != "" {
info = append(info, yaml.MapItem{"description", m.Description})
info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
}
if m.Default != "" {
info = append(info, yaml.MapItem{"default", m.Default})
info = append(info, yaml.MapItem{Key: "default", Value: m.Default})
}
if m.Required != false {
info = append(info, yaml.MapItem{"required", m.Required})
info = append(info, yaml.MapItem{Key: "required", Value: m.Required})
}
if m.Format != "" {
info = append(info, yaml.MapItem{"format", m.Format})
info = append(info, yaml.MapItem{Key: "format", Value: m.Format})
}
if m.Pattern != "" {
info = append(info, yaml.MapItem{"pattern", m.Pattern})
info = append(info, yaml.MapItem{Key: "pattern", Value: m.Pattern})
}
if m.Minimum != "" {
info = append(info, yaml.MapItem{"minimum", m.Minimum})
info = append(info, yaml.MapItem{Key: "minimum", Value: m.Minimum})
}
if m.Maximum != "" {
info = append(info, yaml.MapItem{"maximum", m.Maximum})
info = append(info, yaml.MapItem{Key: "maximum", Value: m.Maximum})
}
if len(m.Enum) != 0 {
info = append(info, yaml.MapItem{"enum", m.Enum})
info = append(info, yaml.MapItem{Key: "enum", Value: m.Enum})
}
if len(m.EnumDescriptions) != 0 {
info = append(info, yaml.MapItem{"enumDescriptions", m.EnumDescriptions})
info = append(info, yaml.MapItem{Key: "enumDescriptions", Value: m.EnumDescriptions})
}
if m.Repeated != false {
info = append(info, yaml.MapItem{"repeated", m.Repeated})
info = append(info, yaml.MapItem{Key: "repeated", Value: m.Repeated})
}
if m.Location != "" {
info = append(info, yaml.MapItem{"location", m.Location})
info = append(info, yaml.MapItem{Key: "location", Value: m.Location})
}
if m.Properties != nil {
info = append(info, yaml.MapItem{"properties", m.Properties.ToRawInfo()})
info = append(info, yaml.MapItem{Key: "properties", Value: m.Properties.ToRawInfo()})
}
// &{Name:properties Type:Schemas StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.AdditionalProperties != nil {
info = append(info, yaml.MapItem{"additionalProperties", m.AdditionalProperties.ToRawInfo()})
info = append(info, yaml.MapItem{Key: "additionalProperties", Value: m.AdditionalProperties.ToRawInfo()})
}
// &{Name:additionalProperties Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.Items != nil {
info = append(info, yaml.MapItem{"items", m.Items.ToRawInfo()})
info = append(info, yaml.MapItem{Key: "items", Value: m.Items.ToRawInfo()})
}
// &{Name:items Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.Annotations != nil {
info = append(info, yaml.MapItem{"annotations", m.Annotations.ToRawInfo()})
info = append(info, yaml.MapItem{Key: "annotations", Value: m.Annotations.ToRawInfo()})
}
// &{Name:annotations Type:Annotations StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
return info
@@ -2492,7 +2492,7 @@ func (m *Parameters) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if m.AdditionalProperties != nil {
for _, item := range m.AdditionalProperties {
info = append(info, yaml.MapItem{item.Name, item.Value.ToRawInfo()})
info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
}
}
// &{Name:additionalProperties Type:NamedParameter StringEnumValues:[] MapType:Parameter Repeated:true Pattern: Implicit:true Description:}
@@ -2503,11 +2503,11 @@ func (m *Parameters) ToRawInfo() interface{} {
func (m *Protocols) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if m.Simple != nil {
info = append(info, yaml.MapItem{"simple", m.Simple.ToRawInfo()})
info = append(info, yaml.MapItem{Key: "simple", Value: m.Simple.ToRawInfo()})
}
// &{Name:simple Type:Simple StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.Resumable != nil {
info = append(info, yaml.MapItem{"resumable", m.Resumable.ToRawInfo()})
info = append(info, yaml.MapItem{Key: "resumable", Value: m.Resumable.ToRawInfo()})
}
// &{Name:resumable Type:Resumable StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
return info
@@ -2517,10 +2517,10 @@ func (m *Protocols) ToRawInfo() interface{} {
func (m *Request) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if m.XRef != "" {
info = append(info, yaml.MapItem{"$ref", m.XRef})
info = append(info, yaml.MapItem{Key: "$ref", Value: m.XRef})
}
if m.ParameterName != "" {
info = append(info, yaml.MapItem{"parameterName", m.ParameterName})
info = append(info, yaml.MapItem{Key: "parameterName", Value: m.ParameterName})
}
return info
}
@@ -2529,11 +2529,11 @@ func (m *Request) ToRawInfo() interface{} {
func (m *Resource) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if m.Methods != nil {
info = append(info, yaml.MapItem{"methods", m.Methods.ToRawInfo()})
info = append(info, yaml.MapItem{Key: "methods", Value: m.Methods.ToRawInfo()})
}
// &{Name:methods Type:Methods StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.Resources != nil {
info = append(info, yaml.MapItem{"resources", m.Resources.ToRawInfo()})
info = append(info, yaml.MapItem{Key: "resources", Value: m.Resources.ToRawInfo()})
}
// &{Name:resources Type:Resources StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
return info
@@ -2544,7 +2544,7 @@ func (m *Resources) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if m.AdditionalProperties != nil {
for _, item := range m.AdditionalProperties {
info = append(info, yaml.MapItem{item.Name, item.Value.ToRawInfo()})
info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
}
}
// &{Name:additionalProperties Type:NamedResource StringEnumValues:[] MapType:Resource Repeated:true Pattern: Implicit:true Description:}
@@ -2555,7 +2555,7 @@ func (m *Resources) ToRawInfo() interface{} {
func (m *Response) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if m.XRef != "" {
info = append(info, yaml.MapItem{"$ref", m.XRef})
info = append(info, yaml.MapItem{Key: "$ref", Value: m.XRef})
}
return info
}
@@ -2564,10 +2564,10 @@ func (m *Response) ToRawInfo() interface{} {
func (m *Resumable) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if m.Multipart != false {
info = append(info, yaml.MapItem{"multipart", m.Multipart})
info = append(info, yaml.MapItem{Key: "multipart", Value: m.Multipart})
}
if m.Path != "" {
info = append(info, yaml.MapItem{"path", m.Path})
info = append(info, yaml.MapItem{Key: "path", Value: m.Path})
}
return info
}
@@ -2576,65 +2576,65 @@ func (m *Resumable) ToRawInfo() interface{} {
func (m *Schema) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if m.Id != "" {
info = append(info, yaml.MapItem{"id", m.Id})
info = append(info, yaml.MapItem{Key: "id", Value: m.Id})
}
if m.Type != "" {
info = append(info, yaml.MapItem{"type", m.Type})
info = append(info, yaml.MapItem{Key: "type", Value: m.Type})
}
if m.Description != "" {
info = append(info, yaml.MapItem{"description", m.Description})
info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
}
if m.Default != "" {
info = append(info, yaml.MapItem{"default", m.Default})
info = append(info, yaml.MapItem{Key: "default", Value: m.Default})
}
if m.Required != false {
info = append(info, yaml.MapItem{"required", m.Required})
info = append(info, yaml.MapItem{Key: "required", Value: m.Required})
}
if m.Format != "" {
info = append(info, yaml.MapItem{"format", m.Format})
info = append(info, yaml.MapItem{Key: "format", Value: m.Format})
}
if m.Pattern != "" {
info = append(info, yaml.MapItem{"pattern", m.Pattern})
info = append(info, yaml.MapItem{Key: "pattern", Value: m.Pattern})
}
if m.Minimum != "" {
info = append(info, yaml.MapItem{"minimum", m.Minimum})
info = append(info, yaml.MapItem{Key: "minimum", Value: m.Minimum})
}
if m.Maximum != "" {
info = append(info, yaml.MapItem{"maximum", m.Maximum})
info = append(info, yaml.MapItem{Key: "maximum", Value: m.Maximum})
}
if len(m.Enum) != 0 {
info = append(info, yaml.MapItem{"enum", m.Enum})
info = append(info, yaml.MapItem{Key: "enum", Value: m.Enum})
}
if len(m.EnumDescriptions) != 0 {
info = append(info, yaml.MapItem{"enumDescriptions", m.EnumDescriptions})
info = append(info, yaml.MapItem{Key: "enumDescriptions", Value: m.EnumDescriptions})
}
if m.Repeated != false {
info = append(info, yaml.MapItem{"repeated", m.Repeated})
info = append(info, yaml.MapItem{Key: "repeated", Value: m.Repeated})
}
if m.Location != "" {
info = append(info, yaml.MapItem{"location", m.Location})
info = append(info, yaml.MapItem{Key: "location", Value: m.Location})
}
if m.Properties != nil {
info = append(info, yaml.MapItem{"properties", m.Properties.ToRawInfo()})
info = append(info, yaml.MapItem{Key: "properties", Value: m.Properties.ToRawInfo()})
}
// &{Name:properties Type:Schemas StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.AdditionalProperties != nil {
info = append(info, yaml.MapItem{"additionalProperties", m.AdditionalProperties.ToRawInfo()})
info = append(info, yaml.MapItem{Key: "additionalProperties", Value: m.AdditionalProperties.ToRawInfo()})
}
// &{Name:additionalProperties Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.Items != nil {
info = append(info, yaml.MapItem{"items", m.Items.ToRawInfo()})
info = append(info, yaml.MapItem{Key: "items", Value: m.Items.ToRawInfo()})
}
// &{Name:items Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.XRef != "" {
info = append(info, yaml.MapItem{"$ref", m.XRef})
info = append(info, yaml.MapItem{Key: "$ref", Value: m.XRef})
}
if m.Annotations != nil {
info = append(info, yaml.MapItem{"annotations", m.Annotations.ToRawInfo()})
info = append(info, yaml.MapItem{Key: "annotations", Value: m.Annotations.ToRawInfo()})
}
// &{Name:annotations Type:Annotations StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.ReadOnly != false {
info = append(info, yaml.MapItem{"readOnly", m.ReadOnly})
info = append(info, yaml.MapItem{Key: "readOnly", Value: m.ReadOnly})
}
return info
}
@@ -2644,7 +2644,7 @@ func (m *Schemas) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if m.AdditionalProperties != nil {
for _, item := range m.AdditionalProperties {
info = append(info, yaml.MapItem{item.Name, item.Value.ToRawInfo()})
info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
}
}
// &{Name:additionalProperties Type:NamedSchema StringEnumValues:[] MapType:Schema Repeated:true Pattern: Implicit:true Description:}
@@ -2655,7 +2655,7 @@ func (m *Schemas) ToRawInfo() interface{} {
func (m *Scope) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if m.Description != "" {
info = append(info, yaml.MapItem{"description", m.Description})
info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
}
return info
}
@@ -2665,7 +2665,7 @@ func (m *Scopes) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if m.AdditionalProperties != nil {
for _, item := range m.AdditionalProperties {
info = append(info, yaml.MapItem{item.Name, item.Value.ToRawInfo()})
info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
}
}
// &{Name:additionalProperties Type:NamedScope StringEnumValues:[] MapType:Scope Repeated:true Pattern: Implicit:true Description:}
@@ -2676,10 +2676,10 @@ func (m *Scopes) ToRawInfo() interface{} {
func (m *Simple) ToRawInfo() interface{} {
info := yaml.MapSlice{}
if m.Multipart != false {
info = append(info, yaml.MapItem{"multipart", m.Multipart})
info = append(info, yaml.MapItem{Key: "multipart", Value: m.Multipart})
}
if m.Path != "" {
info = append(info, yaml.MapItem{"path", m.Path})
info = append(info, yaml.MapItem{Key: "path", Value: m.Path})
}
return info
}

View File

@@ -1,6 +1,5 @@
// Code generated by protoc-gen-go.
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: discovery/discovery.proto
// DO NOT EDIT!
/*
Package discovery_v1 is a generated protocol buffer package.
@@ -1307,7 +1306,7 @@ func init() { proto.RegisterFile("discovery/discovery.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 1683 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x58, 0x5f, 0x53, 0xdc, 0xc8,
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x58, 0x5f, 0x53, 0xdc, 0xc8,
0x11, 0xaf, 0x85, 0xfd, 0xdb, 0xbb, 0x0b, 0xcb, 0xf0, 0x4f, 0x60, 0x9c, 0x23, 0xba, 0xba, 0x04,
0x72, 0x77, 0x50, 0xc6, 0x39, 0x57, 0x2a, 0x4e, 0x1e, 0x70, 0xe0, 0xc1, 0x95, 0x60, 0xb0, 0x28,
0x27, 0x95, 0x87, 0x94, 0x6a, 0x90, 0x66, 0x59, 0x15, 0x92, 0x46, 0x19, 0x8d, 0x30, 0xeb, 0x8f,

View File

@@ -1,6 +1,5 @@
// Code generated by protoc-gen-go.
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: extension.proto
// DO NOT EDIT!
/*
Package openapiextension_v1 is a generated protocol buffer package.
@@ -78,7 +77,7 @@ func (m *Version) GetSuffix() string {
// An encoded Request is written to the ExtensionHandler's stdin.
type ExtensionHandlerRequest struct {
// The OpenAPI descriptions that were explicitly listed on the command line.
// The specifications will appear in the order they are specified to openapic.
// The specifications will appear in the order they are specified to gnostic.
Wrapper *Wrapper `protobuf:"bytes,1,opt,name=wrapper" json:"wrapper,omitempty"`
// The version number of openapi compiler.
CompilerVersion *Version `protobuf:"bytes,3,opt,name=compiler_version,json=compilerVersion" json:"compiler_version,omitempty"`
@@ -192,28 +191,28 @@ func init() {
func init() { proto.RegisterFile("extension.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 355 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0x4d, 0x4b, 0xf3, 0x40,
0x1c, 0xc4, 0x49, 0xdf, 0xf2, 0x64, 0x1f, 0xb4, 0xb2, 0x16, 0x8d, 0xe2, 0xa1, 0x04, 0x84, 0x22,
0xb8, 0xa5, 0x0a, 0xde, 0x5b, 0x28, 0xea, 0xc5, 0x96, 0x3d, 0xd4, 0x9b, 0x65, 0x9b, 0xfe, 0xdb,
0x46, 0x92, 0xdd, 0x75, 0xf3, 0x62, 0xfb, 0x55, 0x3c, 0xfa, 0x49, 0x25, 0xbb, 0xd9, 0x7a, 0x50,
0x6f, 0x99, 0x1f, 0x93, 0xfc, 0x67, 0x26, 0xa8, 0x0d, 0xdb, 0x0c, 0x78, 0x1a, 0x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, 0x27, 0x76, 0x78, 0x32, 0xe4, 0x3b, 0x6a, 0x2c, 0xc1, 0x0b, 0x72, 0xab,
0x52, 0xe5, 0x19, 0x5b, 0xc1, 0xd1, 0xc3, 0x59, 0x89, 0x2f, 0xd1, 0xe1, 0xbe, 0xc5, 0x9c, 0xb3,
0x04, 0xf4, 0x6f, 0xf0, 0xe8, 0xc1, 0x9e, 0x3e, 0xb1, 0x04, 0x30, 0x46, 0x8d, 0x1d, 0x4b, 0x62,
0x7d, 0xd6, 0xa3, 0xfa, 0x79, 0x74, 0x8d, 0xda, 0x42, 0xad, 0xed, 0x16, 0x21, 0x29, 0x06, 0x23,
0x3c, 0x91, 0xc0, 0x87, 0xd3, 0xc7, 0x7d, 0xdf, 0xd9, 0x60, 0xea, 0x7c, 0xd6, 0xea, 0x93, 0xe1,
0x78, 0xd1, 0xd2, 0x19, 0x6f, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0xfc, 0x56, 0x40, 0x4d, 0x52,
0x02, 0x00, 0x00,
// 357 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0x4d, 0x4b, 0xc3, 0x40,
0x18, 0x84, 0x49, 0xbf, 0x62, 0x56, 0x6c, 0x65, 0x2d, 0x1a, 0xc5, 0x43, 0x09, 0x08, 0x45, 0x64,
0x4b, 0x15, 0xbc, 0xb7, 0x50, 0xd4, 0x8b, 0x2d, 0x7b, 0xa8, 0x37, 0xcb, 0x36, 0x7d, 0x9b, 0x46,
0x92, 0xdd, 0x75, 0xf3, 0x61, 0xfb, 0x57, 0x3c, 0xfa, 0x4b, 0x25, 0xbb, 0x49, 0x3d, 0xa8, 0xb7,
0xcc, 0xc3, 0x24, 0xef, 0xcc, 0x04, 0x75, 0x60, 0x9b, 0x02, 0x4f, 0x42, 0xc1, 0x89, 0x54, 0x22,
0x15, 0xf8, 0x44, 0x48, 0xe0, 0x4c, 0x86,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,
0x71, 0xa6, 0xaa, 0x60, 0xe9, 0xe1, 0x2a, 0x89, 0xaf, 0x50, 0x7b, 0xdf, 0x62, 0xc1, 0x59, 0x0c,
0xfa, 0x37, 0x38, 0xf4, 0x68, 0x4f, 0x9f, 0x59, 0x0c, 0x18, 0xa3, 0xc6, 0x8e, 0xc5, 0x91, 0x3e,
0xeb, 0x50, 0xfd, 0x3c, 0xbe, 0x41, 0x6d, 0xa1, 0x02, 0x12, 0x70, 0x91, 0xa4, 0xa1, 0x4f, 0xf2,
0xe1, 0x18, 0x4f, 0x25, 0xf0, 0xd1, 0xec, 0x69, 0x5f, 0x77, 0x3e, 0x9c, 0x59, 0x5f, 0xb5, 0xfa,
0x74, 0x34, 0x59, 0xb6, 0x74, 0xc4, 0xbb, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x84, 0x5c, 0x6b,
0x80, 0x51, 0x02, 0x00, 0x00,
}

View File

@@ -29,7 +29,7 @@ option java_multiple_files = true;
option java_outer_classname = "OpenAPIExtensionV1";
// The Java package name must be proto package name with proper prefix.
option java_package = "org.openapic.v1";
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
@@ -53,7 +53,7 @@ message Version {
message ExtensionHandlerRequest {
// The OpenAPI descriptions that were explicitly listed on the command line.
// The specifications will appear in the order they are specified to openapic.
// The specifications will appear in the order they are specified to gnostic.
Wrapper wrapper = 1;
// The version number of openapi compiler.

View File

@@ -804,44 +804,44 @@ func (domain *Domain) generateToRawInfoMethodForType(code *printer.Code, typeNam
propertyName := propertyModel.Name
if !propertyModel.Repeated {
code.Print("if m.%s != \"\" {", propertyModel.FieldName())
code.Print("info = append(info, yaml.MapItem{\"%s\", m.%s})", propertyName, propertyModel.FieldName())
code.Print("info = append(info, yaml.MapItem{Key:\"%s\", Value:m.%s})", propertyName, propertyModel.FieldName())
code.Print("}")
} else {
code.Print("if len(m.%s) != 0 {", propertyModel.FieldName())
code.Print("info = append(info, yaml.MapItem{\"%s\", m.%s})", propertyName, propertyModel.FieldName())
code.Print("info = append(info, yaml.MapItem{Key:\"%s\", Value:m.%s})", propertyName, propertyModel.FieldName())
code.Print("}")
}
case "bool":
propertyName := propertyModel.Name
if !propertyModel.Repeated {
code.Print("if m.%s != false {", propertyModel.FieldName())
code.Print("info = append(info, yaml.MapItem{\"%s\", m.%s})", propertyName, propertyModel.FieldName())
code.Print("info = append(info, yaml.MapItem{Key:\"%s\", Value:m.%s})", propertyName, propertyModel.FieldName())
code.Print("}")
} else {
code.Print("if len(m.%s) != 0 {", propertyModel.FieldName())
code.Print("info = append(info, yaml.MapItem{\"%s\", m.%s})", propertyName, propertyModel.FieldName())
code.Print("info = append(info, yaml.MapItem{Key:\"%s\", Value:m.%s})", propertyName, propertyModel.FieldName())
code.Print("}")
}
case "int":
propertyName := propertyModel.Name
if !propertyModel.Repeated {
code.Print("if m.%s != 0 {", propertyModel.FieldName())
code.Print("info = append(info, yaml.MapItem{\"%s\", m.%s})", propertyName, propertyModel.FieldName())
code.Print("info = append(info, yaml.MapItem{Key:\"%s\", Value:m.%s})", propertyName, propertyModel.FieldName())
code.Print("}")
} else {
code.Print("if len(m.%s) != 0 {", propertyModel.FieldName())
code.Print("info = append(info, yaml.MapItem{\"%s\", m.%s})", propertyName, propertyModel.FieldName())
code.Print("info = append(info, yaml.MapItem{Key:\"%s\", Value:m.%s})", propertyName, propertyModel.FieldName())
code.Print("}")
}
case "float":
propertyName := propertyModel.Name
if !propertyModel.Repeated {
code.Print("if m.%s != 0.0 {", propertyModel.FieldName())
code.Print("info = append(info, yaml.MapItem{\"%s\", m.%s})", propertyName, propertyModel.FieldName())
code.Print("info = append(info, yaml.MapItem{Key:\"%s\", Value:m.%s})", propertyName, propertyModel.FieldName())
code.Print("}")
} else {
code.Print("if len(m.%s) != 0 {", propertyModel.FieldName())
code.Print("info = append(info, yaml.MapItem{\"%s\", m.%s})", propertyName, propertyModel.FieldName())
code.Print("info = append(info, yaml.MapItem{Key:\"%s\", Value:m.%s})", propertyName, propertyModel.FieldName())
code.Print("}")
}
default:
@@ -852,9 +852,9 @@ func (domain *Domain) generateToRawInfoMethodForType(code *printer.Code, typeNam
code.Print("if m.%s != nil {", propertyModel.FieldName())
if propertyModel.Type == "TypeItem" {
code.Print("if len(m.Type.Value) == 1 {")
code.Print("info = append(info, yaml.MapItem{\"type\", m.Type.Value[0]})")
code.Print("info = append(info, yaml.MapItem{Key:\"type\", Value:m.Type.Value[0]})")
code.Print("} else {")
code.Print("info = append(info, yaml.MapItem{\"type\", m.Type.Value})")
code.Print("info = append(info, yaml.MapItem{Key:\"type\", Value:m.Type.Value})")
code.Print("}")
} else if propertyModel.Type == "ItemsItem" {
code.Print("items := make([]interface{}, 0)")
@@ -865,9 +865,9 @@ func (domain *Domain) generateToRawInfoMethodForType(code *printer.Code, typeNam
}
code.Print(" items = append(items, item.ToRawInfo())")
code.Print("}")
code.Print("info = append(info, yaml.MapItem{\"items\", items[0]})")
code.Print("info = append(info, yaml.MapItem{Key:\"items\", Value:items[0]})")
} else {
code.Print("info = append(info, yaml.MapItem{\"%s\", m.%s.ToRawInfo()})",
code.Print("info = append(info, yaml.MapItem{Key:\"%s\", Value:m.%s.ToRawInfo()})",
propertyName, propertyModel.FieldName())
}
code.Print("}")
@@ -877,7 +877,7 @@ func (domain *Domain) generateToRawInfoMethodForType(code *printer.Code, typeNam
} else if propertyModel.MapType != "" {
code.Print("if m.%s != nil {", propertyModel.FieldName())
code.Print("for _, item := range m.%s {", propertyModel.FieldName())
code.Print("info = append(info, yaml.MapItem{item.Name, item.Value.ToRawInfo()})")
code.Print("info = append(info, yaml.MapItem{Key:item.Name, Value:item.Value.ToRawInfo()})")
code.Print("}")
code.Print("}")
code.Print("// %+v", propertyModel)
@@ -887,7 +887,7 @@ func (domain *Domain) generateToRawInfoMethodForType(code *printer.Code, typeNam
code.Print("for _, item := range m.%s {", propertyModel.FieldName())
code.Print("items = append(items, item.ToRawInfo())")
code.Print("}")
code.Print("info = append(info, yaml.MapItem{\"%s\", items})", propertyName)
code.Print("info = append(info, yaml.MapItem{Key:\"%s\", Value:items})", propertyName)
code.Print("}")
code.Print("// %+v", propertyModel)
}

View File

@@ -41,6 +41,7 @@ import (
"path/filepath"
"regexp"
"strings"
"time"
"github.com/golang/protobuf/proto"
"github.com/googleapis/gnostic/OpenAPIv2"
@@ -92,7 +93,7 @@ type pluginCall struct {
}
// Invokes a plugin.
func (p *pluginCall) perform(document proto.Message, sourceFormat int, sourceName string) error {
func (p *pluginCall) perform(document proto.Message, sourceFormat int, sourceName string, timePlugins bool) ([]*plugins.Message, error) {
if p.Name != "" {
request := &plugins.Request{}
@@ -112,7 +113,7 @@ func (p *pluginCall) perform(document proto.Message, sourceFormat int, sourceNam
//
invocationRegex := regexp.MustCompile(`^([\w-_\/\.]+=[\w-_\/\.]+(,[\w-_\/\.]+=[\w-_\/\.]+)*:)?[^,:=]+$`)
if !invocationRegex.Match([]byte(p.Invocation)) {
return fmt.Errorf("Invalid invocation of %s: %s", executableName, invocation)
return nil, fmt.Errorf("Invalid invocation of %s: %s", executableName, invocation)
}
invocationParts := strings.Split(p.Invocation, ":")
@@ -145,11 +146,21 @@ func (p *pluginCall) perform(document proto.Message, sourceFormat int, sourceNam
request.SourceName = sourceName
switch sourceFormat {
case SourceFormatOpenAPI2:
request.Openapi2 = document.(*openapi_v2.Document)
request.Surface, _ = surface.NewModelFromOpenAPI2(request.Openapi2)
request.AddModel("openapi.v2.Document", document)
// include experimental API surface model
surfaceModel, err := surface.NewModelFromOpenAPI2(document.(*openapi_v2.Document))
if err == nil {
request.AddModel("surface.v1.Model", surfaceModel)
}
case SourceFormatOpenAPI3:
request.Openapi3 = document.(*openapi_v3.Document)
request.Surface, _ = surface.NewModelFromOpenAPI3(request.Openapi3)
request.AddModel("openapi.v3.Document", document)
// include experimental API surface model
surfaceModel, err := surface.NewModelFromOpenAPI3(document.(*openapi_v3.Document))
if err == nil {
request.AddModel("surface.v1.Model", surfaceModel)
}
case SourceFormatDiscovery:
request.AddModel("discovery.v1.Document", document)
default:
}
@@ -158,19 +169,27 @@ func (p *pluginCall) perform(document proto.Message, sourceFormat int, sourceNam
cmd := exec.Command(executableName, "-plugin")
cmd.Stdin = bytes.NewReader(requestBytes)
cmd.Stderr = os.Stderr
pluginStartTime := time.Now()
output, err := cmd.Output()
pluginElapsedTime := time.Since(pluginStartTime)
if timePlugins {
fmt.Printf("> %s (%s)\n", executableName, pluginElapsedTime)
}
if err != nil {
return err
return nil, err
}
response := &plugins.Response{}
err = proto.Unmarshal(output, response)
if err != nil {
return err
// Gnostic expects plugins to only write the
// response message to stdout. Be sure that
// any logging messages are written to stderr only.
return nil, errors.New("Invalid plugin response (plugins must write log messages to stderr, not stdout).")
}
plugins.HandleResponse(response, outputLocation)
return response.Messages, nil
}
return nil
return nil, nil
}
func isFile(path string) bool {
@@ -233,10 +252,12 @@ type Gnostic struct {
yamlOutputPath string
jsonOutputPath string
errorOutputPath string
messageOutputPath string
resolveReferences bool
pluginCalls []*pluginCall
extensionHandlers []compiler.ExtensionHandler
sourceFormat int
timePlugins bool
}
// Initialize a structure to store global application state.
@@ -244,20 +265,27 @@ func newGnostic() *Gnostic {
g := &Gnostic{}
// Option fields initialize to their default values.
g.usage = `
Usage: gnostic OPENAPI_SOURCE [OPTIONS]
OPENAPI_SOURCE is the filename or URL of an OpenAPI description to read.
Usage: gnostic SOURCE [OPTIONS]
SOURCE is the filename or URL of an API description.
Options:
--pb-out=PATH Write a binary proto to the specified location.
--text-out=PATH Write a text proto to the specified location.
--json-out=PATH Write a json API description to the specified location.
--yaml-out=PATH Write a yaml API description to the specified location.
--errors-out=PATH Write compilation errors to the specified location.
--PLUGIN-out=PATH Run the plugin named gnostic_PLUGIN and write results
--messages-out=PATH Write messages generated by plugins to the specified
location. Messages from all plugin invocations are
written to a single common file.
--PLUGIN-out=PATH Run the plugin named gnostic-PLUGIN and write results
to the specified location.
--PLUGIN Run the plugin named gnostic-PLUGIN but don't write any
results. Used for plugins that return messages only.
PLUGIN must not match any other gnostic option.
--x-EXTENSION Use the extension named gnostic-x-EXTENSION
to process OpenAPI specification extensions.
--resolve-refs Explicitly resolve $ref references.
This could have problems with recursive definitions.
--time-plugins Report plugin runtimes.
`
// Initialize internal structures.
g.pluginCalls = make([]*pluginCall, 0)
@@ -292,6 +320,8 @@ func (g *Gnostic) readOptions() {
g.yamlOutputPath = invocation
case "errors":
g.errorOutputPath = invocation
case "messages":
g.messageOutputPath = invocation
default:
p := &pluginCall{Name: pluginName, Invocation: invocation}
g.pluginCalls = append(g.pluginCalls, p)
@@ -302,6 +332,13 @@ func (g *Gnostic) readOptions() {
g.extensionHandlers = append(g.extensionHandlers, extensionHandler)
} else if arg == "--resolve-refs" {
g.resolveReferences = true
} else if arg == "--time-plugins" {
g.timePlugins = true
} else if arg[0] == '-' && arg[1] == '-' {
// try letting the option specify a plugin with no output files (or unwanted output files)
// this is useful for calling plugins like linters that only return messages
p := &pluginCall{Name: arg[2:len(arg)], Invocation: "!"}
g.pluginCalls = append(g.pluginCalls, p)
} else if arg[0] == '-' {
fmt.Fprintf(os.Stderr, "Unknown option: %s.\n%s\n", arg, g.usage)
os.Exit(-1)
@@ -467,6 +504,17 @@ func (g *Gnostic) writeJSONYAMLOutput(message proto.Message) {
}
}
// Write messages.
func (g *Gnostic) writeMessagesOutput(message proto.Message) {
protoBytes, err := proto.Marshal(message)
if err != nil {
writeFile(g.messageOutputPath, g.errorBytes(err), g.sourceName, "errors")
defer os.Exit(-1)
} else {
writeFile(g.messageOutputPath, protoBytes, g.sourceName, "messages.pb")
}
}
// Perform all actions specified in the command-line options.
func (g *Gnostic) performActions(message proto.Message) (err error) {
// Optionally resolve internal references.
@@ -490,17 +538,29 @@ func (g *Gnostic) performActions(message proto.Message) (err error) {
if g.textOutputPath != "" {
g.writeTextOutput(message)
}
// Optionaly write document in yaml and/or json formats.
// Optionally write document in yaml and/or json formats.
if g.yamlOutputPath != "" || g.jsonOutputPath != "" {
g.writeJSONYAMLOutput(message)
}
// Call all specified plugins.
messages := make([]*plugins.Message, 0)
for _, p := range g.pluginCalls {
err := p.perform(message, g.sourceFormat, g.sourceName)
pluginMessages, err := p.perform(message, g.sourceFormat, g.sourceName, g.timePlugins)
if err != nil {
writeFile(g.errorOutputPath, g.errorBytes(err), g.sourceName, "errors")
defer os.Exit(-1) // run all plugins, even when some have errors
}
messages = append(messages, pluginMessages...)
}
if g.messageOutputPath != "" {
g.writeMessagesOutput(&plugins.Messages{Messages: messages})
} else {
// Print any messages from the plugins
if len(messages) > 0 {
for _, message := range messages {
fmt.Printf("%+v\n", message)
}
}
}
return nil
}

View File

@@ -50,7 +50,7 @@ func renderMap(info interface{}, indent string) (result string) {
case []string:
result += renderStringArray(value, innerIndent)
default:
result += fmt.Sprintf("???MapItem(%+v, %T)", value, value)
result += fmt.Sprintf("???MapItem(Key:%+v, Value:%T)", value, value)
}
if i < len(pairs)-1 {
result += ","
@@ -106,7 +106,7 @@ func renderStringArray(array []string, indent string) (result string) {
return result
}
func render(info yaml.MapSlice) string {
func Render(info yaml.MapSlice) string {
return renderMap(info, "") + "\n"
}
@@ -223,106 +223,106 @@ func schemaArrayValue(array *[]*Schema) []interface{} {
func (schema *Schema) jsonValue() yaml.MapSlice {
m := yaml.MapSlice{}
if schema.Title != nil {
m = append(m, yaml.MapItem{"title", *schema.Title})
m = append(m, yaml.MapItem{Key: "title", Value: *schema.Title})
}
if schema.ID != nil {
m = append(m, yaml.MapItem{"id", *schema.ID})
m = append(m, yaml.MapItem{Key: "id", Value: *schema.ID})
}
if schema.Schema != nil {
m = append(m, yaml.MapItem{"$schema", *schema.Schema})
m = append(m, yaml.MapItem{Key: "$schema", Value: *schema.Schema})
}
if schema.Type != nil {
m = append(m, yaml.MapItem{"type", schema.Type.jsonValue()})
m = append(m, yaml.MapItem{Key: "type", Value: schema.Type.jsonValue()})
}
if schema.Items != nil {
m = append(m, yaml.MapItem{"items", schema.Items.jsonValue()})
m = append(m, yaml.MapItem{Key: "items", Value: schema.Items.jsonValue()})
}
if schema.Description != nil {
m = append(m, yaml.MapItem{"description", *schema.Description})
m = append(m, yaml.MapItem{Key: "description", Value: *schema.Description})
}
if schema.Required != nil {
m = append(m, yaml.MapItem{"required", *schema.Required})
m = append(m, yaml.MapItem{Key: "required", Value: *schema.Required})
}
if schema.AdditionalProperties != nil {
m = append(m, yaml.MapItem{"additionalProperties", schema.AdditionalProperties.jsonValue()})
m = append(m, yaml.MapItem{Key: "additionalProperties", Value: schema.AdditionalProperties.jsonValue()})
}
if schema.PatternProperties != nil {
m = append(m, yaml.MapItem{"patternProperties", namedSchemaArrayValue(schema.PatternProperties)})
m = append(m, yaml.MapItem{Key: "patternProperties", Value: namedSchemaArrayValue(schema.PatternProperties)})
}
if schema.Properties != nil {
m = append(m, yaml.MapItem{"properties", namedSchemaArrayValue(schema.Properties)})
m = append(m, yaml.MapItem{Key: "properties", Value: namedSchemaArrayValue(schema.Properties)})
}
if schema.Dependencies != nil {
m = append(m, yaml.MapItem{"dependencies", namedSchemaOrStringArrayValue(schema.Dependencies)})
m = append(m, yaml.MapItem{Key: "dependencies", Value: namedSchemaOrStringArrayValue(schema.Dependencies)})
}
if schema.Ref != nil {
m = append(m, yaml.MapItem{"$ref", *schema.Ref})
m = append(m, yaml.MapItem{Key: "$ref", Value: *schema.Ref})
}
if schema.MultipleOf != nil {
m = append(m, yaml.MapItem{"multipleOf", schema.MultipleOf.jsonValue()})
m = append(m, yaml.MapItem{Key: "multipleOf", Value: schema.MultipleOf.jsonValue()})
}
if schema.Maximum != nil {
m = append(m, yaml.MapItem{"maximum", schema.Maximum.jsonValue()})
m = append(m, yaml.MapItem{Key: "maximum", Value: schema.Maximum.jsonValue()})
}
if schema.ExclusiveMaximum != nil {
m = append(m, yaml.MapItem{"exclusiveMaximum", *schema.ExclusiveMaximum})
m = append(m, yaml.MapItem{Key: "exclusiveMaximum", Value: schema.ExclusiveMaximum})
}
if schema.Minimum != nil {
m = append(m, yaml.MapItem{"minimum", schema.Minimum.jsonValue()})
m = append(m, yaml.MapItem{Key: "minimum", Value: schema.Minimum.jsonValue()})
}
if schema.ExclusiveMinimum != nil {
m = append(m, yaml.MapItem{"exclusiveMinimum", *schema.ExclusiveMinimum})
m = append(m, yaml.MapItem{Key: "exclusiveMinimum", Value: schema.ExclusiveMinimum})
}
if schema.MaxLength != nil {
m = append(m, yaml.MapItem{"maxLength", *schema.MaxLength})
m = append(m, yaml.MapItem{Key: "maxLength", Value: *schema.MaxLength})
}
if schema.MinLength != nil {
m = append(m, yaml.MapItem{"minLength", *schema.MinLength})
m = append(m, yaml.MapItem{Key: "minLength", Value: *schema.MinLength})
}
if schema.Pattern != nil {
m = append(m, yaml.MapItem{"pattern", *schema.Pattern})
m = append(m, yaml.MapItem{Key: "pattern", Value: *schema.Pattern})
}
if schema.AdditionalItems != nil {
m = append(m, yaml.MapItem{"additionalItems", schema.AdditionalItems.jsonValue()})
m = append(m, yaml.MapItem{Key: "additionalItems", Value: schema.AdditionalItems.jsonValue()})
}
if schema.MaxItems != nil {
m = append(m, yaml.MapItem{"maxItems", *schema.MaxItems})
m = append(m, yaml.MapItem{Key: "maxItems", Value: *schema.MaxItems})
}
if schema.MinItems != nil {
m = append(m, yaml.MapItem{"minItems", *schema.MinItems})
m = append(m, yaml.MapItem{Key: "minItems", Value: *schema.MinItems})
}
if schema.UniqueItems != nil {
m = append(m, yaml.MapItem{"uniqueItems", *schema.UniqueItems})
m = append(m, yaml.MapItem{Key: "uniqueItems", Value: *schema.UniqueItems})
}
if schema.MaxProperties != nil {
m = append(m, yaml.MapItem{"maxProperties", *schema.MaxProperties})
m = append(m, yaml.MapItem{Key: "maxProperties", Value: *schema.MaxProperties})
}
if schema.MinProperties != nil {
m = append(m, yaml.MapItem{"minProperties", *schema.MinProperties})
m = append(m, yaml.MapItem{Key: "minProperties", Value: *schema.MinProperties})
}
if schema.Enumeration != nil {
m = append(m, yaml.MapItem{"enum", schemaEnumArrayValue(schema.Enumeration)})
m = append(m, yaml.MapItem{Key: "enum", Value: schemaEnumArrayValue(schema.Enumeration)})
}
if schema.AllOf != nil {
m = append(m, yaml.MapItem{"allOf", schemaArrayValue(schema.AllOf)})
m = append(m, yaml.MapItem{Key: "allOf", Value: schemaArrayValue(schema.AllOf)})
}
if schema.AnyOf != nil {
m = append(m, yaml.MapItem{"anyOf", schemaArrayValue(schema.AnyOf)})
m = append(m, yaml.MapItem{Key: "anyOf", Value: schemaArrayValue(schema.AnyOf)})
}
if schema.OneOf != nil {
m = append(m, yaml.MapItem{"oneOf", schemaArrayValue(schema.OneOf)})
m = append(m, yaml.MapItem{Key: "oneOf", Value: schemaArrayValue(schema.OneOf)})
}
if schema.Not != nil {
m = append(m, yaml.MapItem{"not", schema.Not.jsonValue()})
m = append(m, yaml.MapItem{Key: "not", Value: schema.Not.jsonValue()})
}
if schema.Definitions != nil {
m = append(m, yaml.MapItem{"definitions", namedSchemaArrayValue(schema.Definitions)})
m = append(m, yaml.MapItem{Key: "definitions", Value: namedSchemaArrayValue(schema.Definitions)})
}
if schema.Default != nil {
m = append(m, yaml.MapItem{"default", *schema.Default})
m = append(m, yaml.MapItem{Key: "default", Value: *schema.Default})
}
if schema.Format != nil {
m = append(m, yaml.MapItem{"format", *schema.Format})
m = append(m, yaml.MapItem{Key: "format", Value: *schema.Format})
}
return m
}
@@ -330,5 +330,5 @@ func (schema *Schema) jsonValue() yaml.MapSlice {
// JSONString returns a json representation of a schema.
func (schema *Schema) JSONString() string {
info := schema.jsonValue()
return render(info)
return Render(info)
}

20
vendor/github.com/googleapis/gnostic/linters/README.md generated vendored Normal file
View File

@@ -0,0 +1,20 @@
# Linters
This directory contains linters that can be used to check Gnostic models.
Linters are plugins that generate no files but instead return messages
in their responses. Each message can include a level, an identifier, text,
and a key path in an API description associated with that message.
Messages are collected by gnostic and written to a common output file,
allowing multiple linter plugins to be invoked in a single gnostic
run.
The following invocation runs the `gnostic-lint-paths` and
`gnostic-lint-descriptions` plugins and writes their messages
to a file named `lint.pb`.
```
% gnostic examples/v2.0/yaml/petstore.yaml --lint-paths --lint-descriptions --messages-out=lint.pb
```
Message files can be displayed using the `report-messages` tool in the `apps` directory.

View File

@@ -0,0 +1,9 @@
# gnostic-lint-descriptions
This directory contains a `gnostic` plugin that analyzes an OpenAPI
description for factors that might influence code generation and other
API automation.
The plugin can be invoked like this:
gnostic bookstore.json --lint-descriptions

View File

@@ -0,0 +1,180 @@
//
// 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 main
import (
openapi "github.com/googleapis/gnostic/OpenAPIv2"
plugins "github.com/googleapis/gnostic/plugins"
)
// DocumentLinter contains information collected about an API description.
type DocumentLinterV2 struct {
document *openapi.Document `json:"-"`
}
func (d *DocumentLinterV2) Run() []*plugins.Message {
return d.analyzeDocument(d.document)
}
// NewDocumentLinter builds a new DocumentLinter object.
func NewDocumentLinterV2(document *openapi.Document) *DocumentLinterV2 {
return &DocumentLinterV2{document: document}
}
// Analyze an OpenAPI description.
func (s *DocumentLinterV2) analyzeDocument(document *openapi.Document) []*plugins.Message {
messages := make([]*plugins.Message, 0, 0)
for _, pair := range document.Paths.Path {
path := pair.Value
if path.Get != nil {
messages = append(messages, s.analyzeOperation([]string{"paths", pair.Name, "get"}, path.Get)...)
}
if path.Post != nil {
messages = append(messages, s.analyzeOperation([]string{"paths", pair.Name, "post"}, path.Post)...)
}
if path.Put != nil {
messages = append(messages, s.analyzeOperation([]string{"paths", pair.Name, "put"}, path.Put)...)
}
if path.Delete != nil {
messages = append(messages, s.analyzeOperation([]string{"paths", pair.Name, "delete"}, path.Delete)...)
}
}
if document.Definitions != nil {
for _, pair := range document.Definitions.AdditionalProperties {
definition := pair.Value
messages = append(messages, s.analyzeDefinition([]string{"definitions", pair.Name}, definition)...)
}
}
return messages
}
func (s *DocumentLinterV2) analyzeOperation(keys []string, operation *openapi.Operation) []*plugins.Message {
messages := make([]*plugins.Message, 0)
if operation.Description == "" {
messages = append(messages,
&plugins.Message{
Level: plugins.Message_WARNING,
Code: "NODESCRIPTION",
Text: "Operation has no description.",
Keys: keys})
}
for _, parameter := range operation.Parameters {
p := parameter.GetParameter()
if p != nil {
b := p.GetBodyParameter()
if b != nil && b.Description == "" {
messages = append(messages,
&plugins.Message{
Level: plugins.Message_WARNING,
Code: "NODESCRIPTION",
Text: "Parameter has no description.",
Keys: append(keys, []string{"responses", b.Name}...)})
}
n := p.GetNonBodyParameter()
if n != nil {
hp := n.GetHeaderParameterSubSchema()
if hp != nil && hp.Description == "" {
messages = append(messages,
&plugins.Message{
Level: plugins.Message_WARNING,
Code: "NODESCRIPTION",
Text: "Parameter has no description.",
Keys: append(keys, []string{"responses", hp.Name}...)})
}
fp := n.GetFormDataParameterSubSchema()
if fp != nil && fp.Description == "" {
messages = append(messages,
&plugins.Message{
Level: plugins.Message_WARNING,
Code: "NODESCRIPTION",
Text: "Parameter has no description.",
Keys: append(keys, []string{"responses", fp.Name}...)})
}
qp := n.GetQueryParameterSubSchema()
if qp != nil && qp.Description == "" {
messages = append(messages,
&plugins.Message{
Level: plugins.Message_WARNING,
Code: "NODESCRIPTION",
Text: "Parameter has no description.",
Keys: append(keys, []string{"responses", qp.Name}...)})
}
pp := n.GetPathParameterSubSchema()
if pp != nil && pp.Description == "" {
messages = append(messages,
&plugins.Message{
Level: plugins.Message_WARNING,
Code: "NODESCRIPTION",
Text: "Parameter has no description.",
Keys: append(keys, []string{"responses", pp.Name}...)})
}
}
}
}
for _, pair := range operation.Responses.ResponseCode {
value := pair.Value
response := value.GetResponse()
if response != nil {
responseSchema := response.Schema
responseSchemaSchema := responseSchema.GetSchema()
if responseSchemaSchema != nil && responseSchemaSchema.Description == "" {
messages = append(messages,
&plugins.Message{
Level: plugins.Message_WARNING,
Code: "NODESCRIPTION",
Text: "Response has no description.",
Keys: append(keys, []string{"responses", pair.Name}...)})
}
responseFileSchema := responseSchema.GetFileSchema()
if responseFileSchema != nil && responseFileSchema.Description == "" {
messages = append(messages,
&plugins.Message{
Level: plugins.Message_WARNING,
Code: "NODESCRIPTION",
Text: "Response has no description.",
Keys: append(keys, []string{"responses", pair.Name}...)})
}
}
}
return messages
}
// Analyze a definition in an OpenAPI description.
func (s *DocumentLinterV2) analyzeDefinition(keys []string, definition *openapi.Schema) []*plugins.Message {
messages := make([]*plugins.Message, 0)
if definition.Description == "" {
messages = append(messages,
&plugins.Message{
Level: plugins.Message_WARNING,
Code: "NODESCRIPTION",
Text: "Definition has no description.",
Keys: keys})
}
if definition.Properties != nil {
for _, pair := range definition.Properties.AdditionalProperties {
propertySchema := pair.Value
if propertySchema.Description == "" {
messages = append(messages,
&plugins.Message{
Level: plugins.Message_WARNING,
Code: "NODESCRIPTION",
Text: "Property has no description.",
Keys: append(keys, []string{"properties", pair.Name}...)})
}
}
}
return messages
}

View File

@@ -0,0 +1,33 @@
// Copyright 2017 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 main
import (
openapi "github.com/googleapis/gnostic/OpenAPIv3"
plugins "github.com/googleapis/gnostic/plugins"
)
// DocumentLinter contains information collected about an API description.
type DocumentLinterV3 struct {
}
func (d *DocumentLinterV3) Run() []*plugins.Message {
return nil
}
// NewDocumentLinter builds a new DocumentLinter object.
func NewDocumentLinterV3(document *openapi.Document) *DocumentLinterV3 {
return &DocumentLinterV3{}
}

View File

@@ -0,0 +1,61 @@
// Copyright 2017 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.
// gnostic_lint is a tool for analyzing OpenAPI descriptions.
//
// It scans an API description and checks it against a set of
// coding style guidelines.
//
// Results are returned in a JSON structure.
package main
import (
"github.com/golang/protobuf/proto"
openapiv2 "github.com/googleapis/gnostic/OpenAPIv2"
openapiv3 "github.com/googleapis/gnostic/OpenAPIv3"
plugins "github.com/googleapis/gnostic/plugins"
)
type DocumentLinter interface {
Run() []*plugins.Message
}
// This is the main function for the plugin.
func main() {
env, err := plugins.NewEnvironment()
env.RespondAndExitIfError(err)
var linter DocumentLinter
for _, model := range env.Request.Models {
switch model.TypeUrl {
case "openapi.v2.Document":
documentv2 := &openapiv2.Document{}
err = proto.Unmarshal(model.Value, documentv2)
if err == nil {
linter = NewDocumentLinterV2(documentv2)
env.Response.Messages = linter.Run()
}
case "openapi.v3.Document":
documentv3 := &openapiv3.Document{}
err = proto.Unmarshal(model.Value, documentv3)
if err == nil {
linter = NewDocumentLinterV3(documentv3)
env.Response.Messages = linter.Run()
}
}
}
env.RespondAndExit()
}

View File

@@ -0,0 +1,9 @@
# gnostic-lint-paths
This directory contains a `gnostic` plugin that analyzes an OpenAPI
description for factors that might influence code generation and other
API automation.
The plugin can be invoked like this:
gnostic bookstore.json --lint-paths

View File

@@ -0,0 +1,77 @@
// Copyright 2018 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.
// gnostic-lint-paths is a tool for analyzing paths in OpenAPI descriptions.
//
// It scans an API description and checks it against a set of coding style guidelines.
package main
import (
"github.com/golang/protobuf/proto"
openapiv2 "github.com/googleapis/gnostic/OpenAPIv2"
openapiv3 "github.com/googleapis/gnostic/OpenAPIv3"
plugins "github.com/googleapis/gnostic/plugins"
)
func checkPathsV2(document *openapiv2.Document, messages []*plugins.Message) []*plugins.Message {
for _, pair := range document.Paths.Path {
messages = append(messages,
&plugins.Message{
Level: plugins.Message_INFO,
Code: "PATH",
Text: pair.Name,
Keys: []string{"paths", pair.Name}})
}
return messages
}
func checkPathsV3(document *openapiv3.Document, messages []*plugins.Message) []*plugins.Message {
for _, pair := range document.Paths.Path {
messages = append(messages,
&plugins.Message{
Level: plugins.Message_INFO,
Code: "PATH",
Text: pair.Name,
Keys: []string{"paths", pair.Name}})
}
return messages
}
func main() {
env, err := plugins.NewEnvironment()
env.RespondAndExitIfError(err)
messages := make([]*plugins.Message, 0, 0)
for _, model := range env.Request.Models {
switch model.TypeUrl {
case "openapi.v2.Document":
documentv2 := &openapiv2.Document{}
err = proto.Unmarshal(model.Value, documentv2)
if err == nil {
messages = checkPathsV2(documentv2, messages)
}
case "openapi.v3.Document":
documentv3 := &openapiv3.Document{}
err = proto.Unmarshal(model.Value, documentv3)
if err == nil {
messages = checkPathsV3(documentv3, messages)
}
}
}
env.RespondAndExitIfError(err)
env.Response.Messages = messages
env.RespondAndExit()
}

View File

@@ -0,0 +1,20 @@
GNOSTIC = $(GOPATH)/src/github.com/googleapis/gnostic
plugin:
node_modules/.bin/pbjs -t json \
$(GNOSTIC)/OpenAPIv2/OpenAPIv2.proto \
$(GNOSTIC)/OpenAPIv3/OpenAPIv3.proto \
$(GNOSTIC)/discovery/discovery.proto \
$(GNOSTIC)/surface/surface.proto \
$(GNOSTIC)/plugins/plugin.proto \
> bundle.json
node_modules/.bin/nexe gnostic-lint-operations.js
run: plugin
gnostic $(GNOSTIC)/examples/v2.0/yaml/petstore.yaml --lint-operations
setup:
npm install protobufjs
npm install get-stdin
npm install nexe

View File

@@ -0,0 +1,15 @@
This directory contains a gnostic linter written with node.
It is built using [dcodeIO/Protobuf.js](https://github.com/dcodeIO/ProtoBuf.js).
### SETUP
- Install node.
- Run `make setup` to install node dependencies.
### TRY IT
- Run `make run` to test-run the plugin.

View File

@@ -0,0 +1,47 @@
// import libraries
const protobuf = require("protobufjs")
const getStdin = require('get-stdin')
// import messages
const root = protobuf.Root.fromJSON(require("./bundle.json"))
const Request = root.lookupType("gnostic.plugin.v1.Request")
const Response = root.lookupType("gnostic.plugin.v1.Response")
const Document = root.lookupType("openapi.v2.Document")
getStdin.buffer().then(buffer => {
const request = Request.decode(buffer)
messages = []
for (var j in request.models) {
const m = request.models[j]
if (m.type_url == "openapi.v2.Document") {
const openapi2 = Document.decode(m.value)
const paths = openapi2.paths.path
for (var i in paths) {
const path = paths[i]
//console.error('path %s\n\n', path.name)
const getOperation = path.value.get
if (getOperation && getOperation.operationId == "") {
messages.push({level:3, code:"NOOPERATIONID", text:"No operation id.", keys:["paths", path.name, "get"]})
}
const postOperation = path.value.post
if (postOperation && postOperation.operationId == "") {
messages.push({level:3, code:"NOOPERATIONID", text:"No operation id.", keys:["paths", path.name, "post"]})
}
//console.error('get %s\n\n', JSON.stringify(getOperation))
}
}
}
const payload = {
messages: messages
}
// Verify the payload if necessary (i.e. when possibly incomplete or invalid)
const errMsg = Response.verify(payload)
if (errMsg)
throw Error(errMsg)
const message = Response.create(payload)
process.stdout.write(Response.encode(message).finish())
}).catch(err => console.error(err))

View File

@@ -0,0 +1,19 @@
GNOSTIC = $(GOPATH)/src/github.com/googleapis/gnostic
plugin:
node_modules/.bin/pbjs -t json \
$(GNOSTIC)/OpenAPIv2/OpenAPIv2.proto \
$(GNOSTIC)/OpenAPIv3/OpenAPIv3.proto \
$(GNOSTIC)/discovery/discovery.proto \
$(GNOSTIC)/surface/surface.proto \
$(GNOSTIC)/plugins/plugin.proto \
> bundle.json
node_modules/.bin/nexe gnostic-lint-responses.js
mv gnostic-lint-responses $(GOPATH)/bin
run: plugin
gnostic $(GNOSTIC)/examples/v2.0/yaml/petstore.yaml --lint-responses
setup:
npm install

View File

@@ -0,0 +1,15 @@
This directory contains a gnostic linter written with node.
It is built using [dcodeIO/Protobuf.js](https://github.com/dcodeIO/ProtoBuf.js).
### SETUP
- Install node.
- Run `make setup` to install node dependencies.
### TRY IT
- Run `make run` to test-run the plugin.

View File

@@ -0,0 +1,83 @@
// import libraries
const protobuf = require("protobufjs");
const getStdin = require("get-stdin");
const find = require("lodash/find");
const forEach = require("lodash/forEach");
const pick = require("lodash/pick");
// import messages
const root = protobuf.Root.fromJSON(require("./bundle.json"));
const Request = root.lookupType("gnostic.plugin.v1.Request");
const Response = root.lookupType("gnostic.plugin.v1.Response");
const Document = root.lookupType("openapi.v2.Document");
getStdin.buffer().then(buffer => {
const request = Request.decode(buffer);
var messages = [];
for (var j in request.models) {
const m = request.models[j];
if (m.type_url == "openapi.v2.Document") {
const openapi2 = Document.decode(m.value);
const paths = openapi2.paths.path;
for (var i in paths) {
const path = paths[i];
// console.error('path %s\n\n', path.name)
// Arrays MUST NOT be returned as the top-level structure in a response body.
let pathOps = pick(path.value, ["get","head","post", "put", "patch", "delete", "options"]);
forEach(pathOps, (op, opKey) => {
if (op != null) {
forEach(op.responses.responseCode, responseObj => {
// console.error('responseObj is %j', responseObj)
name = responseObj.name;
response = responseObj.value.response;
if (response.schema && response.schema.schema) {
if (!response.schema.schema._ref) {
if (
response.schema.schema.type != null &&
response.schema.schema.type.value == "array"
) {
messages.push({
level: 3,
code: "NO_ARRAY_RESPONSES",
text: "Arrays MUST NOT be returned as the top-level structure in a response body.",
keys: ["paths", path.name, opKey, "responses", name, "schema"]
});
}
} else {
let schemaName = response.schema.schema._ref.match(/#\/definitions\/(\w+)/);
if (schemaName) {
const definitions = openapi2.definitions.additionalProperties;
const schemaKvp = find(definitions, {name: schemaName[1]
});
//console.error('schemaKvp.value.type = %s', schemaKvp.value.type.value)
if (schemaKvp && schemaKvp.value.type && schemaKvp.value.type.value.indexOf("array") >= 0) {
messages.push({
level: 3,
code: "NO_ARRAY_RESPONSES",
text: "Arrays MUST NOT be returned as the top-level structure in a response body.",
keys: ["paths", path.name, opKey, "responses", name, "schema" ]
});
}
}
}
}
});
}
});
}
}
}
const payload = {
messages: messages
};
// Verify the payload if necessary (i.e. when possibly incomplete or invalid)
const errMsg = Response.verify(payload);
if (errMsg) throw Error(errMsg);
const message = Response.create(payload);
process.stdout.write(Response.encode(message).finish());
})
.catch(err => console.error(err));

View File

@@ -0,0 +1,19 @@
{
"name": "gnostic-lint-responses",
"version": "1.0.0",
"description": "Gnostic linter plugin to check responses",
"main": "gnostic-lint-responses.js",
"repository": "git@github.com:googleapis/gnostic.git",
"author": "Mike Kistler",
"license": "Apache-2.0",
"dependencies": {
"get-stdin": "^5.0.1",
"lodash": "^4.17.5",
"nexe": "^2.0.0-rc.24",
"protobufjs": "^6.8.4"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
}
}

View File

@@ -0,0 +1,18 @@
TGT=gnostic-lint-responses-swift
BINDIR=.build/debug
all:
swift build
install: all
cp $(BINDIR)/$(TGT) $(GOPATH)/bin/$(TGT)
clean :
rm -rf Packages
rm -rf .build
rm -f Package.pins Package.resolved
run:
gnostic ../../../examples/v2.0/yaml/petstore.yaml --lint-responses-swift

View File

@@ -0,0 +1,26 @@
// Copyright 2018 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.
import PackageDescription
let package = Package(
name: "gnostic-lint-responses-swift",
targets: [
Target(name: "gnostic-lint-responses-swift", dependencies: [ "Gnostic" ]),
Target(name: "Gnostic")
],
dependencies: [
.Package(url: "https://github.com/apple/swift-protobuf.git", Version(1,0,2))
]
)

View File

@@ -0,0 +1,12 @@
This directory contains a gnostic linter written with Swift.
### SETUP
- Install protoc (https://github.com/google/protobuf)
- Install the Swift Protocol Buffer plugin (https://github.com/apple/swift-protobuf)
- Run `sh compile-protos` to generate Protocol Buffer support code.
- Run `make install` to build and install the plugin.
### TRY IT
- Run `make run` to test-run the plugin.

View File

@@ -0,0 +1,77 @@
// Copyright 2018 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.
import Foundation
// The I/O code below is derived from Apple's swift-protobuf project.
// https://github.com/apple/swift-protobuf
// BEGIN swift-protobuf derivation
#if os(Linux)
import Glibc
#else
import Darwin.C
#endif
enum PluginError: Error {
/// Raised for any errors reading the input
case readFailure
}
// Alias clib's write() so Stdout.write(bytes:) can call it.
private let _write = write
class Stdin {
static func readall() throws -> Data {
let fd: Int32 = 0
let buffSize = 32
var buff = [UInt8]()
while true {
var fragment = [UInt8](repeating: 0, count: buffSize)
let count = read(fd, &fragment, buffSize)
if count < 0 {
throw PluginError.readFailure
}
if count < buffSize {
buff += fragment[0..<count]
return Data(bytes: buff)
}
buff += fragment
}
}
}
class Stdout {
static func write(bytes: Data) {
bytes.withUnsafeBytes { (p: UnsafePointer<UInt8>) -> () in
_ = _write(1, p, bytes.count)
}
}
static func write(_ string: String) {
self.write(bytes:string.data(using:.utf8)!)
}
}
class Stderr {
static func write(bytes: Data) {
bytes.withUnsafeBytes { (p: UnsafePointer<UInt8>) -> () in
_ = _write(2, p, bytes.count)
}
}
static func write(_ string: String) {
self.write(bytes:string.data(using:.utf8)!)
}
}
// END swift-protobuf derivation

View File

@@ -0,0 +1,116 @@
// Copyright 2018 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.
import Foundation
import Gnostic
extension Gnostic_Plugin_V1_Response {
mutating func message(level:Gnostic_Plugin_V1_Message.Level,
code:String,
text:String,
path:[String]=[]) {
var message = Gnostic_Plugin_V1_Message()
message.level = level
message.code = code
message.text = text
message.keys = path
messages.append(message)
}
}
class ResponseLinter {
var document : Openapi_V2_Document = Openapi_V2_Document()
func run(_ request : Gnostic_Plugin_V1_Request,
_ response : inout Gnostic_Plugin_V1_Response) throws {
for model in request.models {
if model.typeURL == "openapi.v2.Document" {
let document = try Openapi_V2_Document(serializedData: model.value)
self.document = document
for pair in document.paths.path {
let path = ["paths", pair.name]
let v = pair.value
if v.hasGet {
checkOperation(v.get, path:path + ["get"], response:&response)
}
if v.hasPost {
checkOperation(v.post, path:path + ["post"], response:&response)
}
if v.hasPut {
checkOperation(v.put, path:path + ["put"], response:&response)
}
if v.hasDelete {
checkOperation(v.delete, path:path + ["delete"], response:&response)
}
}
}
}
}
func checkOperation(_ operation:Openapi_V2_Operation,
path:[String],
response:inout Gnostic_Plugin_V1_Response) {
for responseCode in operation.responses.responseCode {
let code = responseCode.name
if responseCode.value.response.hasSchema {
var schema = responseCode.value.response.schema.schema
if schema.ref != "" {
if let resolvedSchema = resolveReference(schema.ref) {
schema = resolvedSchema
}
}
checkSchemaType(schema, path: path + ["responses", code, "schema"], response: &response)
}
}
}
func checkSchemaType(_ schema:Openapi_V2_Schema,
path:[String],
response:inout Gnostic_Plugin_V1_Response) {
if schema.hasType {
for type in schema.type.value {
if type == "array" {
response.message(
level: .error,
code: "NO_ARRAY_RESPONSES",
text: "Arrays MUST NOT be returned as the top-level structure in a response body.",
path: path)
}
}
}
}
func resolveReference(_ reference:String) -> Openapi_V2_Schema? {
let prefix = "#/definitions/"
if reference.hasPrefix(prefix) {
let schemaName = reference.dropFirst(prefix.count)
for pair in document.definitions.additionalProperties {
if pair.name == schemaName {
return pair.value
}
}
}
return nil
}
}
func main() throws {
let request = try Gnostic_Plugin_V1_Request(serializedData: Stdin.readall())
var response = Gnostic_Plugin_V1_Response()
try ResponseLinter().run(request, &response)
let serializedResponse = try response.serializedData()
Stdout.write(bytes: serializedResponse)
}
try main()

View File

@@ -0,0 +1,54 @@
#!/bin/sh
#
# Copyright 2018 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.
# Use this script to run protoc and swift-proto to generate
# support code for gnostic protos.
GNOSTIC=$GOPATH/src/github.com/googleapis/gnostic
PROTOS=(
plugins/plugin.proto
OpenAPIv2/OpenAPIv2.proto
OpenAPIv3/OpenAPIv3.proto
surface/surface.proto
discovery/discovery.proto
)
mkdir -p Sources/Gnostic
# remove old compiled pb files
rm -rf Sources/Gnostic/*.pb.swift
# remove any prior compilations
rm -rf Sources/Gnostic/github.com
# compile protos
for proto in "${PROTOS[@]}"
do
echo "COMPILING $proto"
protoc $GNOSTIC/$proto \
--swift_opt=Visibility=Public \
--swift_out=Sources/Gnostic \
--proto_path=$GOPATH/src
# relocate compiled protos
find Sources/Gnostic/github.com -name "*.pb.swift" -exec mv {} Sources/Gnostic \;
# remove scaffolding of compilation
rm -rf Sources/Gnostic/github.com
done

View File

@@ -1,6 +1,7 @@
package gnostic_plugin_v1
import (
"errors"
"flag"
"fmt"
"io"
@@ -10,9 +11,12 @@ import (
"path"
"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes/any"
openapiv2 "github.com/googleapis/gnostic/OpenAPIv2"
openapiv3 "github.com/googleapis/gnostic/OpenAPIv3"
discovery "github.com/googleapis/gnostic/discovery"
surface "github.com/googleapis/gnostic/surface"
)
// Environment contains the environment of a plugin call.
@@ -77,7 +81,7 @@ When the -plugin option is specified, these flags are ignored.`)
}
// Log the invocation.
log.Printf("Running plugin %s", env.Invocation)
//log.Printf("Running plugin %s", env.Invocation)
env.Request = request
@@ -98,20 +102,36 @@ When the -plugin option is specified, these flags are ignored.`)
documentv2 := &openapiv2.Document{}
err = proto.Unmarshal(apiData, documentv2)
if err == nil {
env.Request.Openapi2 = documentv2
} else {
// ignore deserialization errors
env.Request.AddModel("openapi.v2.Document", documentv2)
// include experimental API surface model
surfaceModel, err := surface.NewModelFromOpenAPI2(documentv2)
if err != nil {
env.Request.AddModel("surface.v1.Model", surfaceModel)
}
return env, err
}
// Then try to unmarshal OpenAPI v3.
// If that failed, ignore deserialization errors and try to unmarshal OpenAPI v3.
documentv3 := &openapiv3.Document{}
err = proto.Unmarshal(apiData, documentv3)
if err == nil {
env.Request.Openapi3 = documentv3
} else {
// ignore deserialization errors
env.Request.AddModel("openapi.v3.Document", documentv3)
// include experimental API surface model
surfaceModel, err := surface.NewModelFromOpenAPI3(documentv3)
if err != nil {
env.Request.AddModel("surface.v1.Model", surfaceModel)
}
return env, err
}
// If that failed, ignore deserialization errors and try to unmarshal a Discovery document.
discoveryDocument := &discovery.Document{}
err = proto.Unmarshal(apiData, discoveryDocument)
if err == nil {
env.Request.AddModel("discovery.v1.Document", discoveryDocument)
return env, err
}
// If we get here, we don't know what we got
err = errors.New("Unrecognized format for input")
return env, err
}
return env, err
}
@@ -172,6 +192,12 @@ func HandleResponse(response *Response, outputLocation string) error {
return nil
}
func (request *Request) AddModel(modelType string, model proto.Message) error {
modelBytes, err := proto.Marshal(model)
request.Models = append(request.Models, &any.Any{TypeUrl: modelType, Value: modelBytes})
return err
}
func isFile(path string) bool {
fileInfo, err := os.Stat(path)
if err != nil {

View File

@@ -30,9 +30,12 @@ import (
"path"
"strings"
"github.com/golang/protobuf/proto"
plugins "github.com/googleapis/gnostic/plugins"
"github.com/googleapis/gnostic/plugins/gnostic-analyze/statistics"
"github.com/golang/protobuf/proto"
openapiv2 "github.com/googleapis/gnostic/OpenAPIv2"
openapiv3 "github.com/googleapis/gnostic/OpenAPIv3"
plugins "github.com/googleapis/gnostic/plugins"
)
// Record an error, then serialize and return a response.
@@ -56,14 +59,24 @@ func main() {
env.RespondAndExitIfError(err)
var stats *statistics.DocumentStatistics
if env.Request.Openapi2 != nil {
// Analyze the API document.
stats = statistics.NewDocumentStatistics(env.Request.SourceName, env.Request.Openapi2)
}
if env.Request.Openapi3 != nil {
// Analyze the API document.
stats = statistics.NewDocumentStatisticsV3(env.Request.SourceName, env.Request.Openapi3)
for _, model := range env.Request.Models {
switch model.TypeUrl {
case "openapi.v2.Document":
documentv2 := &openapiv2.Document{}
err = proto.Unmarshal(model.Value, documentv2)
if err == nil {
// Analyze the API document.
stats = statistics.NewDocumentStatistics(env.Request.SourceName, documentv2)
}
case "openapi.v3.Document":
documentv3 := &openapiv3.Document{}
err = proto.Unmarshal(model.Value, documentv3)
if err == nil {
// Analyze the API document.
stats = statistics.NewDocumentStatisticsV3(env.Request.SourceName, documentv3)
}
}
}
if stats != nil {

View File

@@ -1,9 +1,13 @@
// +build ignore
// This file is omitted when getting with `go get github.com/googleapis/gnostic/...`
package main
import (
"fmt"
"github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/apis_guru/apis_guru"
"sort"
"github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/apis_guru/apis_guru"
)
func main() {

View File

@@ -0,0 +1,19 @@
/*
Copyright 2017 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 bookstore exists to allow this repo to work with recursive go get.
// It will be filled in with auto generated code.
package bookstore

View File

@@ -0,0 +1,20 @@
build:
go get golang.org/x/tools/cmd/goimports
go install github.com/googleapis/gnostic
go install github.com/googleapis/gnostic/plugins/gnostic-go-generator
rm -f $(GOPATH)/bin/gnostic-go-client $(GOPATH)/bin/gnostic-go-server
ln -s $(GOPATH)/bin/gnostic-go-generator $(GOPATH)/bin/gnostic-go-client
ln -s $(GOPATH)/bin/gnostic-go-generator $(GOPATH)/bin/gnostic-go-server
all: build
gnostic sample.yaml --go-generator-out=sample
clean:
rm -rf sample service/service
test: all
killall service; true # ignore errors due to no matching processes
cd service; go get .; go build; ./service &
go test
killall service

View File

@@ -0,0 +1,24 @@
# API Sample
This directory contains an OpenAPI description of a sample API
that exercises various OpenAPI features.
Use this example to try the `gnostic-go-generator` plugin, which implements
`gnostic-go-client` and `gnostic-go-server` for generating API client and
server code, respectively.
Run "make all" to build and install `gnostic` and the Go plugins.
It will generate both client and server code. The API client and
server code will be in the `sample` package.
The `service` directory contains additional code that completes the server.
To build and run the service, `cd service` and do the following:
go get .
go build
./service &
To test the service with the generated client, go back up to the top-level
directory and run `go test`. The test in `sample_test.go` uses client
code generated in `sample` to verify the service.

View File

@@ -0,0 +1,67 @@
swagger: '2.0'
schemes:
- https
host: sample.io
basePath: /
info:
title: sample.io
version: '1.0'
consumes:
- application/json
produces:
- application/json;charset=UTF-8
securityDefinitions:
api_key:
in: query
name: key
type: apiKey
paths:
/sample/{id}:
get:
operationId: "GetSample"
parameters:
- description: identifier
in: path
name: id
required: true
type: string
responses:
'200':
description: sample response
schema:
$ref: '#/definitions/Sample'
'401':
description: User doesn't have a valid session.
schema:
$ref: '#/definitions/APIError'
'404':
description: Unable to find supplied extractor ID.
schema:
$ref: '#/definitions/APIError'
security:
- api_key: []
summary: Get a sample response
tags:
- sample
- demo
definitions:
APIError:
properties:
code:
description: Internal error code
format: int
type: integer
message:
description: A message containing a brief description of the error
type: string
type: object
Sample:
properties:
id:
type: string
thing:
type: object
count:
format: int32
type: integer
type: object

View File

@@ -0,0 +1,19 @@
/*
Copyright 2017 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 sample exists to allow this repo to work with recursive go get.
// It will be filled in with auto generated code.
package sample

View File

@@ -0,0 +1,68 @@
/*
Copyright 2018 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 test
import (
"fmt"
"net/http"
"strings"
"testing"
"github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/sample"
)
const service = "http://localhost:8080"
func TestSample(t *testing.T) {
// create a client
s := sample.NewClient(service, nil)
// verify a sample request
{
message := "hello world"
response, err := s.GetSample(message)
if err != nil {
t.Log("get sample failed")
t.Fail()
}
if response.OK.Id != message || response.OK.Count != int32(len(message)) {
t.Log(fmt.Sprintf("get sample received %+v", response.OK))
t.Fail()
}
if (response == nil) || (response.OK == nil) {
t.Log(fmt.Sprintf("get sample failed %+v", response.OK))
t.Fail()
}
}
// verify the handling of an invalid request
{
req, err := http.NewRequest("GET", service+"/unsupported", strings.NewReader(""))
if err != nil {
t.Log("bad request failed")
return
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
return
}
// we expect a 404 (Not Found) code
if resp.StatusCode != 404 {
t.Log("bad request failed")
t.Fail()
}
return
}
}

View File

@@ -0,0 +1,9 @@
application: sample
version: 1
runtime: go
api_version: go1
handlers:
- url: /.*
script: _go_app
- url: /
static_dir: static

View File

@@ -0,0 +1,27 @@
/*
Copyright 2018 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 main
import (
"github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/sample"
)
// init() is called when the package is loaded
// this allows this app to be trivially deployed to Google App Engine, which does not call main()
func init() {
sample.Initialize(NewService())
}

View File

@@ -0,0 +1,34 @@
// +build !appengine
// This file is omitted when the app is built for Google App Engine
/*
Copyright 2018 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 main
import (
"log"
"github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/sample"
)
func main() {
err := sample.ServeHTTP(":8080")
if err != nil {
log.Printf("%v", err)
}
}

View File

@@ -0,0 +1,38 @@
/*
Copyright 2018 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 main
import (
"github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/sample"
)
//
// The Service type implements a sample service.
//
type Service struct{}
func NewService() *Service {
return &Service{}
}
func (service *Service) GetSample(parameters *sample.GetSampleParameters, responses *sample.GetSampleResponses) (err error) {
(*responses).OK = &sample.Sample{
Id: parameters.Id,
Thing: map[string]interface{}{"thing": 123},
Count: int32(len(parameters.Id))}
return err
}

View File

@@ -2,6 +2,7 @@ package main
import (
"fmt"
"github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/xkcd/xkcd"
)

View File

@@ -0,0 +1,19 @@
/*
Copyright 2017 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 xkcd exists to allow this repo to work with recursive go get.
// It will be filled in with auto generated code.
package xkcd

View File

@@ -0,0 +1,19 @@
/*
Copyright 2017 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 bookstore exists to allow this repo to work with recursive go get.
// It will be filled in with auto generated code.
package bookstore

View File

@@ -0,0 +1,19 @@
/*
Copyright 2017 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 urlshortener exists to allow this repo to work with recursive go get.
// It will be filled in with auto generated code.
package urlshortener

View File

@@ -16,8 +16,8 @@ package main
import (
surface "github.com/googleapis/gnostic/surface"
"unicode"
"strings"
"unicode"
)
type GoLanguageModel struct{}
@@ -49,7 +49,7 @@ func (language *GoLanguageModel) Prepare(model *surface.Model) {
f.NativeType = "int64"
}
case "object":
f.NativeType = "{}interface"
f.NativeType = "interface{}"
case "string":
f.NativeType = "string"
default:
@@ -88,6 +88,8 @@ func goFieldName(name string) string {
// avoid integers
if name == "200" {
return "OK"
} else if unicode.IsDigit(rune(name[0])) {
return "Code" + name
}
return name
}

View File

@@ -21,7 +21,9 @@ import (
"errors"
"strings"
"github.com/golang/protobuf/proto"
plugins "github.com/googleapis/gnostic/plugins"
surface "github.com/googleapis/gnostic/surface"
)
// This is the main function for the code generation plugin.
@@ -42,30 +44,33 @@ func main() {
files = []string{"client.go", "server.go", "provider.go", "types.go", "constants.go"}
}
// Get the code surface model.
model := env.Request.Surface
for _, model := range env.Request.Models {
switch model.TypeUrl {
case "surface.v1.Model":
surfaceModel := &surface.Model{}
err = proto.Unmarshal(model.Value, surfaceModel)
if err == nil {
// Customize the code surface model for Go
NewGoLanguageModel().Prepare(surfaceModel)
if model == nil {
err = errors.New("No generated code surface model is available.")
env.RespondAndExitIfError(err)
modelJSON, _ := json.MarshalIndent(surfaceModel, "", " ")
modelFile := &plugins.File{Name: "model.json", Data: modelJSON}
env.Response.Files = append(env.Response.Files, modelFile)
// Create the renderer.
renderer, err := NewServiceRenderer(surfaceModel)
renderer.Package = packageName
env.RespondAndExitIfError(err)
// Run the renderer to generate files and add them to the response object.
err = renderer.Render(env.Response, files)
env.RespondAndExitIfError(err)
// Return with success.
env.RespondAndExit()
}
}
}
// Customize the code surface model for Go
NewGoLanguageModel().Prepare(model)
modelJSON, _ := json.MarshalIndent(model, "", " ")
modelFile := &plugins.File{Name: "model.json", Data: modelJSON}
env.Response.Files = append(env.Response.Files, modelFile)
// Create the renderer.
renderer, err := NewServiceRenderer(model)
renderer.Package = packageName
err = errors.New("No generated code surface model is available.")
env.RespondAndExitIfError(err)
// Run the renderer to generate files and add them to the response object.
err = renderer.Render(env.Response, files)
env.RespondAndExitIfError(err)
// Return with success.
env.RespondAndExit()
}

View File

@@ -109,7 +109,9 @@ func (renderer *Renderer) RenderClient() ([]byte, error) {
if method.Method == "POST" {
f.WriteLine(`body := new(bytes.Buffer)`)
f.WriteLine(`json.NewEncoder(body).Encode(` + parametersType.FieldWithPosition(surface.Position_BODY).Name + `)`)
if parametersType != nil {
f.WriteLine(`json.NewEncoder(body).Encode(` + parametersType.FieldWithPosition(surface.Position_BODY).Name + `)`)
}
f.WriteLine(`req, err := http.NewRequest("` + method.Method + `", path, body)`)
f.WriteLine(`reqHeaders := make(http.Header)`)
f.WriteLine(`reqHeaders.Set("Content-Type", "application/json")`)

View File

@@ -43,7 +43,7 @@ func (renderer *Renderer) RenderTypes() ([]byte, error) {
} else if modelType.Kind == surface.TypeKind_OBJECT {
f.WriteLine(`type ` + modelType.TypeName + ` map[string]` + modelType.ContentType)
} else {
f.WriteLine(`type ` + modelType.TypeName + ` struct {}`)
f.WriteLine(`type ` + modelType.TypeName + ` interface {}`)
}
}
return f.Bytes(), nil

View File

@@ -17,14 +17,17 @@
package main
import (
openapi2 "github.com/googleapis/gnostic/OpenAPIv2"
openapi3 "github.com/googleapis/gnostic/OpenAPIv3"
"log"
"github.com/golang/protobuf/proto"
openapiv2 "github.com/googleapis/gnostic/OpenAPIv2"
openapiv3 "github.com/googleapis/gnostic/OpenAPIv3"
plugins "github.com/googleapis/gnostic/plugins"
"github.com/googleapis/gnostic/printer"
)
// generate a simple report of an OpenAPI document's contents
func printDocumentV2(code *printer.Code, document *openapi2.Document) {
func printDocumentV2(code *printer.Code, document *openapiv2.Document) {
code.Print("Swagger: %+v", document.Swagger)
code.Print("Host: %+v", document.Host)
code.Print("BasePath: %+v", document.BasePath)
@@ -57,7 +60,7 @@ func printDocumentV2(code *printer.Code, document *openapi2.Document) {
}
// generate a simple report of an OpenAPI document's contents
func printDocumentV3(code *printer.Code, document *openapi3.Document) {
func printDocumentV3(code *printer.Code, document *openapiv3.Document) {
code.Print("OpenAPI: %+v", document.Openapi)
code.Print("Servers: %+v", document.Servers)
if document.Info != nil {
@@ -92,20 +95,28 @@ func printDocumentV3(code *printer.Code, document *openapi3.Document) {
func main() {
env, err := plugins.NewEnvironment()
env.RespondAndExitIfError(err)
code := &printer.Code{}
switch {
case env.Request.Openapi2 != nil:
printDocumentV2(code, env.Request.Openapi2)
case env.Request.Openapi3 != nil:
printDocumentV3(code, env.Request.Openapi3)
default:
for _, model := range env.Request.Models {
log.Printf("model %s", model.TypeUrl)
switch model.TypeUrl {
case "openapi.v2.Document":
documentv2 := &openapiv2.Document{}
err = proto.Unmarshal(model.Value, documentv2)
if err == nil {
printDocumentV2(code, documentv2)
}
case "openapi.v3.Document":
documentv3 := &openapiv3.Document{}
err = proto.Unmarshal(model.Value, documentv3)
if err == nil {
printDocumentV3(code, documentv3)
}
}
}
file := &plugins.File{
Name: "summary.txt",
Data: []byte(code.String()),
}
env.Response.Files = append(env.Response.Files, file)
env.RespondAndExit()
}

View File

@@ -1,11 +1,13 @@
BINDIR=.build/debug
all:
swift build
cp .build/debug/gnostic-swift-generator gnostic-swift-generator
rm -f gnostic-swift-client gnostic-swift-server
ln -s gnostic-swift-generator gnostic-swift-client
ln -s gnostic-swift-generator gnostic-swift-server
install: all
cp $(BINDIR)/gnostic-swift-generator $(GOPATH)/bin/gnostic-swift-generator
cp $(BINDIR)/gnostic-swift-generator $(GOPATH)/bin/gnostic-swift-client
cp $(BINDIR)/gnostic-swift-generator $(GOPATH)/bin/gnostic-swift-server
clean:
rm -rf .build Packages
rm -rf gnostic-swift-client gnostic-swift-server gnostic-swift-generator

View File

@@ -1,10 +1,10 @@
# OpenAPI Swift Generator Plugin
This directory contains an `openapic` plugin that can be used to generate a Swift client library and scaffolding for a Swift server for an API with an OpenAPI description.
This directory contains a `gnostic` plugin that can be used to generate a Swift client library and scaffolding for a Swift server for an API with an OpenAPI description.
The plugin can be invoked like this:
openapic bookstore.json --swift_generator_out=Bookstore
gnostic bookstore.json --swift-generator-out=Bookstore
Where `Bookstore` is the name of a directory where the generated code will be written.

View File

@@ -171,45 +171,11 @@ public struct Gnostic_Plugin_V1_Request: SwiftProtobuf.Message {
/// Clears the value of `compilerVersion`. Subsequent reads from it will return its default value.
public mutating func clearCompilerVersion() {_storage._compilerVersion = nil}
/// OpenAPI v2 API representation
public var openapi2: Openapi_V2_Document {
get {return _storage._openapi2 ?? Openapi_V2_Document()}
set {_uniqueStorage()._openapi2 = newValue}
/// API models
public var models: [SwiftProtobuf.Google_Protobuf_Any] {
get {return _storage._models}
set {_uniqueStorage()._models = newValue}
}
/// Returns true if `openapi2` has been explicitly set.
public var hasOpenapi2: Bool {return _storage._openapi2 != nil}
/// Clears the value of `openapi2`. Subsequent reads from it will return its default value.
public mutating func clearOpenapi2() {_storage._openapi2 = nil}
/// OpenAPI v3 API representation
public var openapi3: Openapi_V3_Document {
get {return _storage._openapi3 ?? Openapi_V3_Document()}
set {_uniqueStorage()._openapi3 = newValue}
}
/// Returns true if `openapi3` has been explicitly set.
public var hasOpenapi3: Bool {return _storage._openapi3 != nil}
/// Clears the value of `openapi3`. Subsequent reads from it will return its default value.
public mutating func clearOpenapi3() {_storage._openapi3 = nil}
/// Discovery API representation
public var discovery: Discovery_V1_Document {
get {return _storage._discovery ?? Discovery_V1_Document()}
set {_uniqueStorage()._discovery = newValue}
}
/// Returns true if `discovery` has been explicitly set.
public var hasDiscovery: Bool {return _storage._discovery != nil}
/// Clears the value of `discovery`. Subsequent reads from it will return its default value.
public mutating func clearDiscovery() {_storage._discovery = nil}
/// generated code surface representation
public var surface: Surface_V1_Model {
get {return _storage._surface ?? Surface_V1_Model()}
set {_uniqueStorage()._surface = newValue}
}
/// Returns true if `surface` has been explicitly set.
public var hasSurface: Bool {return _storage._surface != nil}
/// Clears the value of `surface`. Subsequent reads from it will return its default value.
public mutating func clearSurface() {_storage._surface = nil}
public var unknownFields = SwiftProtobuf.UnknownStorage()
@@ -228,10 +194,7 @@ public struct Gnostic_Plugin_V1_Request: SwiftProtobuf.Message {
case 2: try decoder.decodeSingularStringField(value: &_storage._outputPath)
case 3: try decoder.decodeRepeatedMessageField(value: &_storage._parameters)
case 4: try decoder.decodeSingularMessageField(value: &_storage._compilerVersion)
case 5: try decoder.decodeSingularMessageField(value: &_storage._openapi2)
case 6: try decoder.decodeSingularMessageField(value: &_storage._openapi3)
case 7: try decoder.decodeSingularMessageField(value: &_storage._discovery)
case 8: try decoder.decodeSingularMessageField(value: &_storage._surface)
case 5: try decoder.decodeRepeatedMessageField(value: &_storage._models)
default: break
}
}
@@ -256,17 +219,8 @@ public struct Gnostic_Plugin_V1_Request: SwiftProtobuf.Message {
if let v = _storage._compilerVersion {
try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
}
if let v = _storage._openapi2 {
try visitor.visitSingularMessageField(value: v, fieldNumber: 5)
}
if let v = _storage._openapi3 {
try visitor.visitSingularMessageField(value: v, fieldNumber: 6)
}
if let v = _storage._discovery {
try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
}
if let v = _storage._surface {
try visitor.visitSingularMessageField(value: v, fieldNumber: 8)
if !_storage._models.isEmpty {
try visitor.visitRepeatedMessageField(value: _storage._models, fieldNumber: 5)
}
}
try unknownFields.traverse(visitor: &visitor)
@@ -284,13 +238,13 @@ public struct Gnostic_Plugin_V1_Response: SwiftProtobuf.Message {
/// even if it reports an error in this way.
///
/// This should be used to indicate errors which prevent the plugin from
/// operating as intended. Errors which indicate a problem in openapic
/// 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.
public var errors: [String] = []
/// file output, each file will be written by openapic to an appropriate location.
/// file output, each file will be written by gnostic to an appropriate location.
public var files: [Gnostic_Plugin_V1_File] = []
public var unknownFields = SwiftProtobuf.UnknownStorage()
@@ -411,10 +365,7 @@ extension Gnostic_Plugin_V1_Request: SwiftProtobuf._MessageImplementationBase, S
2: .standard(proto: "output_path"),
3: .same(proto: "parameters"),
4: .standard(proto: "compiler_version"),
5: .same(proto: "openapi2"),
6: .same(proto: "openapi3"),
7: .same(proto: "discovery"),
8: .same(proto: "surface"),
5: .same(proto: "models"),
]
fileprivate class _StorageClass {
@@ -422,10 +373,7 @@ extension Gnostic_Plugin_V1_Request: SwiftProtobuf._MessageImplementationBase, S
var _outputPath: String = String()
var _parameters: [Gnostic_Plugin_V1_Parameter] = []
var _compilerVersion: Gnostic_Plugin_V1_Version? = nil
var _openapi2: Openapi_V2_Document? = nil
var _openapi3: Openapi_V3_Document? = nil
var _discovery: Discovery_V1_Document? = nil
var _surface: Surface_V1_Model? = nil
var _models: [SwiftProtobuf.Google_Protobuf_Any] = []
static let defaultInstance = _StorageClass()
@@ -436,10 +384,7 @@ extension Gnostic_Plugin_V1_Request: SwiftProtobuf._MessageImplementationBase, S
_outputPath = source._outputPath
_parameters = source._parameters
_compilerVersion = source._compilerVersion
_openapi2 = source._openapi2
_openapi3 = source._openapi3
_discovery = source._discovery
_surface = source._surface
_models = source._models
}
}
@@ -457,10 +402,7 @@ extension Gnostic_Plugin_V1_Request: SwiftProtobuf._MessageImplementationBase, S
if _storage._outputPath != other_storage._outputPath {return false}
if _storage._parameters != other_storage._parameters {return false}
if _storage._compilerVersion != other_storage._compilerVersion {return false}
if _storage._openapi2 != other_storage._openapi2 {return false}
if _storage._openapi3 != other_storage._openapi3 {return false}
if _storage._discovery != other_storage._discovery {return false}
if _storage._surface != other_storage._surface {return false}
if _storage._models != other_storage._models {return false}
return true
}
if !storagesAreEqual {return false}

View File

@@ -26,15 +26,24 @@ func main() throws {
let request = try Gnostic_Plugin_V1_Request(serializedData:rawRequest)
var response = Gnostic_Plugin_V1_Response()
var openapiv2 : Openapi_V2_Document?
var surface : Surface_V1_Model?
for model in request.models {
if model.typeURL == "openapi.v2.Document" {
openapiv2 = try Openapi_V2_Document(serializedData: model.value)
} else if model.typeURL == "surface.v1.Model" {
surface = try Surface_V1_Model(serializedData: model.value)
}
}
if request.hasOpenapi2 && request.hasSurface {
let document = request.openapi2
let surface = request.surface
Log("\(request.surface)")
if let openapiv2 = openapiv2,
let surface = surface {
// build the service renderer
let renderer = ServiceRenderer(surface:surface, document:document)
let renderer = ServiceRenderer(surface:surface, document:openapiv2)
// generate the desired files
var filenames : [String]

View File

@@ -1,7 +1,5 @@
all:
rm -f gnostic-swift-generator
ln -s ../../gnostic-swift-generator
gnostic bookstore.json --swift-generator-out=Sources/Bookstore
swift build

View File

@@ -2,11 +2,11 @@
This directory contains an OpenAPI description of a simple bookstore API.
Use this example to try the `openapi_swift_generator` plugin, which
Use this example to try the `gnostic-swift-generator` plugin, which
generates Swift code that implements an API client and server for
an OpenAPI description.
Run `make all` to build and install `openapic` and the Swift plugin.
Run `make all` to build and install `gnostic` and the Swift plugin.
It will generate both client and server code. The API client and
server code will be in the `Sources/Bookstore` package.

View File

@@ -1,7 +1,14 @@
TGT=gnostic-swift-sample
BINDIR=.build/debug
all:
swift build
install: all
cp $(BINDIR)/$(TGT) $(GOPATH)/bin/$(TGT)
clean :
rm -rf Packages
rm -rf .build

View File

@@ -171,45 +171,11 @@ public struct Gnostic_Plugin_V1_Request: SwiftProtobuf.Message {
/// Clears the value of `compilerVersion`. Subsequent reads from it will return its default value.
public mutating func clearCompilerVersion() {_storage._compilerVersion = nil}
/// OpenAPI v2 API representation
public var openapi2: Openapi_V2_Document {
get {return _storage._openapi2 ?? Openapi_V2_Document()}
set {_uniqueStorage()._openapi2 = newValue}
/// API models
public var models: [SwiftProtobuf.Google_Protobuf_Any] {
get {return _storage._models}
set {_uniqueStorage()._models = newValue}
}
/// Returns true if `openapi2` has been explicitly set.
public var hasOpenapi2: Bool {return _storage._openapi2 != nil}
/// Clears the value of `openapi2`. Subsequent reads from it will return its default value.
public mutating func clearOpenapi2() {_storage._openapi2 = nil}
/// OpenAPI v3 API representation
public var openapi3: Openapi_V3_Document {
get {return _storage._openapi3 ?? Openapi_V3_Document()}
set {_uniqueStorage()._openapi3 = newValue}
}
/// Returns true if `openapi3` has been explicitly set.
public var hasOpenapi3: Bool {return _storage._openapi3 != nil}
/// Clears the value of `openapi3`. Subsequent reads from it will return its default value.
public mutating func clearOpenapi3() {_storage._openapi3 = nil}
/// Discovery API representation
public var discovery: Discovery_V1_Document {
get {return _storage._discovery ?? Discovery_V1_Document()}
set {_uniqueStorage()._discovery = newValue}
}
/// Returns true if `discovery` has been explicitly set.
public var hasDiscovery: Bool {return _storage._discovery != nil}
/// Clears the value of `discovery`. Subsequent reads from it will return its default value.
public mutating func clearDiscovery() {_storage._discovery = nil}
/// generated code surface representation
public var surface: Surface_V1_Model {
get {return _storage._surface ?? Surface_V1_Model()}
set {_uniqueStorage()._surface = newValue}
}
/// Returns true if `surface` has been explicitly set.
public var hasSurface: Bool {return _storage._surface != nil}
/// Clears the value of `surface`. Subsequent reads from it will return its default value.
public mutating func clearSurface() {_storage._surface = nil}
public var unknownFields = SwiftProtobuf.UnknownStorage()
@@ -228,10 +194,7 @@ public struct Gnostic_Plugin_V1_Request: SwiftProtobuf.Message {
case 2: try decoder.decodeSingularStringField(value: &_storage._outputPath)
case 3: try decoder.decodeRepeatedMessageField(value: &_storage._parameters)
case 4: try decoder.decodeSingularMessageField(value: &_storage._compilerVersion)
case 5: try decoder.decodeSingularMessageField(value: &_storage._openapi2)
case 6: try decoder.decodeSingularMessageField(value: &_storage._openapi3)
case 7: try decoder.decodeSingularMessageField(value: &_storage._discovery)
case 8: try decoder.decodeSingularMessageField(value: &_storage._surface)
case 5: try decoder.decodeRepeatedMessageField(value: &_storage._models)
default: break
}
}
@@ -256,17 +219,8 @@ public struct Gnostic_Plugin_V1_Request: SwiftProtobuf.Message {
if let v = _storage._compilerVersion {
try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
}
if let v = _storage._openapi2 {
try visitor.visitSingularMessageField(value: v, fieldNumber: 5)
}
if let v = _storage._openapi3 {
try visitor.visitSingularMessageField(value: v, fieldNumber: 6)
}
if let v = _storage._discovery {
try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
}
if let v = _storage._surface {
try visitor.visitSingularMessageField(value: v, fieldNumber: 8)
if !_storage._models.isEmpty {
try visitor.visitRepeatedMessageField(value: _storage._models, fieldNumber: 5)
}
}
try unknownFields.traverse(visitor: &visitor)
@@ -284,13 +238,13 @@ public struct Gnostic_Plugin_V1_Response: SwiftProtobuf.Message {
/// even if it reports an error in this way.
///
/// This should be used to indicate errors which prevent the plugin from
/// operating as intended. Errors which indicate a problem in openapic
/// 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.
public var errors: [String] = []
/// file output, each file will be written by openapic to an appropriate location.
/// file output, each file will be written by gnostic to an appropriate location.
public var files: [Gnostic_Plugin_V1_File] = []
public var unknownFields = SwiftProtobuf.UnknownStorage()
@@ -411,10 +365,7 @@ extension Gnostic_Plugin_V1_Request: SwiftProtobuf._MessageImplementationBase, S
2: .standard(proto: "output_path"),
3: .same(proto: "parameters"),
4: .standard(proto: "compiler_version"),
5: .same(proto: "openapi2"),
6: .same(proto: "openapi3"),
7: .same(proto: "discovery"),
8: .same(proto: "surface"),
5: .same(proto: "models"),
]
fileprivate class _StorageClass {
@@ -422,10 +373,7 @@ extension Gnostic_Plugin_V1_Request: SwiftProtobuf._MessageImplementationBase, S
var _outputPath: String = String()
var _parameters: [Gnostic_Plugin_V1_Parameter] = []
var _compilerVersion: Gnostic_Plugin_V1_Version? = nil
var _openapi2: Openapi_V2_Document? = nil
var _openapi3: Openapi_V3_Document? = nil
var _discovery: Discovery_V1_Document? = nil
var _surface: Surface_V1_Model? = nil
var _models: [SwiftProtobuf.Google_Protobuf_Any] = []
static let defaultInstance = _StorageClass()
@@ -436,10 +384,7 @@ extension Gnostic_Plugin_V1_Request: SwiftProtobuf._MessageImplementationBase, S
_outputPath = source._outputPath
_parameters = source._parameters
_compilerVersion = source._compilerVersion
_openapi2 = source._openapi2
_openapi3 = source._openapi3
_discovery = source._discovery
_surface = source._surface
_models = source._models
}
}
@@ -457,10 +402,7 @@ extension Gnostic_Plugin_V1_Request: SwiftProtobuf._MessageImplementationBase, S
if _storage._outputPath != other_storage._outputPath {return false}
if _storage._parameters != other_storage._parameters {return false}
if _storage._compilerVersion != other_storage._compilerVersion {return false}
if _storage._openapi2 != other_storage._openapi2 {return false}
if _storage._openapi3 != other_storage._openapi3 {return false}
if _storage._discovery != other_storage._discovery {return false}
if _storage._surface != other_storage._surface {return false}
if _storage._models != other_storage._models {return false}
return true
}
if !storagesAreEqual {return false}

View File

@@ -55,16 +55,19 @@ func main() throws {
var response = Gnostic_Plugin_V1_Response()
let rawRequest = try Stdin.readall()
let request = try Gnostic_Plugin_V1_Request(serializedData: rawRequest)
if request.hasOpenapi2 {
let document = request.openapi2
let report = printDocument(document:document, name:request.sourceName)
if let reportData = report.data(using:.utf8) {
var file = Gnostic_Plugin_V1_File()
file.name = "report.txt"
file.data = reportData
response.files.append(file)
for model in request.models {
if model.typeURL == "openapi.v2.Document" {
let document = try Openapi_V2_Document(serializedData: model.value)
let report = printDocument(document:document, name:request.sourceName)
if let reportData = report.data(using:.utf8) {
var file = Gnostic_Plugin_V1_File()
file.name = "report.txt"
file.data = reportData
response.files.append(file)
}
}
}
}
let serializedResponse = try response.serializedData()
Stdout.write(bytes: serializedResponse)
}

View File

@@ -1,17 +1,18 @@
// Code generated by protoc-gen-go.
// source: plugin.proto
// DO NOT EDIT!
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: plugins/plugin.proto
/*
Package gnostic_plugin_v1 is a generated protocol buffer package.
It is generated from these files:
plugin.proto
plugins/plugin.proto
It has these top-level messages:
Version
Parameter
Request
Message
Messages
Response
File
*/
@@ -20,10 +21,7 @@ package gnostic_plugin_v1
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import openapi_v2 "github.com/googleapis/gnostic/OpenAPIv2"
import openapi_v3 "github.com/googleapis/gnostic/OpenAPIv3"
import discovery_v1 "github.com/googleapis/gnostic/discovery"
import surface_v1 "github.com/googleapis/gnostic/surface"
import google_protobuf "github.com/golang/protobuf/ptypes/any"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
@@ -36,6 +34,36 @@ var _ = math.Inf
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type Message_Level int32
const (
Message_UNKNOWN Message_Level = 0
Message_INFO Message_Level = 1
Message_WARNING Message_Level = 2
Message_ERROR Message_Level = 3
Message_FATAL Message_Level = 4
)
var Message_Level_name = map[int32]string{
0: "UNKNOWN",
1: "INFO",
2: "WARNING",
3: "ERROR",
4: "FATAL",
}
var Message_Level_value = map[string]int32{
"UNKNOWN": 0,
"INFO": 1,
"WARNING": 2,
"ERROR": 3,
"FATAL": 4,
}
func (x Message_Level) String() string {
return proto.EnumName(Message_Level_name, int32(x))
}
func (Message_Level) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{3, 0} }
// The version number of gnostic.
type Version struct {
Major int32 `protobuf:"varint,1,opt,name=major" json:"major,omitempty"`
@@ -116,14 +144,8 @@ type Request struct {
Parameters []*Parameter `protobuf:"bytes,3,rep,name=parameters" json:"parameters,omitempty"`
// The version number of gnostic.
CompilerVersion *Version `protobuf:"bytes,4,opt,name=compiler_version,json=compilerVersion" json:"compiler_version,omitempty"`
// OpenAPI v2 API representation
Openapi2 *openapi_v2.Document `protobuf:"bytes,5,opt,name=openapi2" json:"openapi2,omitempty"`
// OpenAPI v3 API representation
Openapi3 *openapi_v3.Document `protobuf:"bytes,6,opt,name=openapi3" json:"openapi3,omitempty"`
// Discovery API representation
Discovery *discovery_v1.Document `protobuf:"bytes,7,opt,name=discovery" json:"discovery,omitempty"`
// generated code surface representation
Surface *surface_v1.Model `protobuf:"bytes,8,opt,name=surface" json:"surface,omitempty"`
// API models
Models []*google_protobuf.Any `protobuf:"bytes,5,rep,name=models" json:"models,omitempty"`
}
func (m *Request) Reset() { *m = Request{} }
@@ -159,30 +181,70 @@ func (m *Request) GetCompilerVersion() *Version {
return nil
}
func (m *Request) GetOpenapi2() *openapi_v2.Document {
func (m *Request) GetModels() []*google_protobuf.Any {
if m != nil {
return m.Openapi2
return m.Models
}
return nil
}
func (m *Request) GetOpenapi3() *openapi_v3.Document {
// Plugins can return messages to be collated and reported by gnostic.
type Message struct {
// message severity
Level Message_Level `protobuf:"varint,1,opt,name=level,enum=gnostic.plugin.v1.Message_Level" json:"level,omitempty"`
// a unique message identifier
Code string `protobuf:"bytes,2,opt,name=code" json:"code,omitempty"`
// message text
Text string `protobuf:"bytes,3,opt,name=text" json:"text,omitempty"`
// an associated key path in an API description
Keys []string `protobuf:"bytes,4,rep,name=keys" json:"keys,omitempty"`
}
func (m *Message) Reset() { *m = Message{} }
func (m *Message) String() string { return proto.CompactTextString(m) }
func (*Message) ProtoMessage() {}
func (*Message) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
func (m *Message) GetLevel() Message_Level {
if m != nil {
return m.Openapi3
return m.Level
}
return Message_UNKNOWN
}
func (m *Message) GetCode() string {
if m != nil {
return m.Code
}
return ""
}
func (m *Message) GetText() string {
if m != nil {
return m.Text
}
return ""
}
func (m *Message) GetKeys() []string {
if m != nil {
return m.Keys
}
return nil
}
func (m *Request) GetDiscovery() *discovery_v1.Document {
if m != nil {
return m.Discovery
}
return nil
type Messages struct {
Messages []*Message `protobuf:"bytes,1,rep,name=messages" json:"messages,omitempty"`
}
func (m *Request) GetSurface() *surface_v1.Model {
func (m *Messages) Reset() { *m = Messages{} }
func (m *Messages) String() string { return proto.CompactTextString(m) }
func (*Messages) ProtoMessage() {}
func (*Messages) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
func (m *Messages) GetMessages() []*Message {
if m != nil {
return m.Surface
return m.Messages
}
return nil
}
@@ -194,19 +256,21 @@ type Response struct {
// even if it reports an error in this way.
//
// This should be used to indicate errors which prevent the plugin from
// operating as intended. Errors which indicate a problem in openapic
// 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,1,rep,name=errors" json:"errors,omitempty"`
// file output, each file will be written by openapic to an appropriate location.
// file output, each file will be written by gnostic to an appropriate location.
Files []*File `protobuf:"bytes,2,rep,name=files" json:"files,omitempty"`
// informational messages to be collected and reported by gnostic.
Messages []*Message `protobuf:"bytes,3,rep,name=messages" json:"messages,omitempty"`
}
func (m *Response) Reset() { *m = Response{} }
func (m *Response) String() string { return proto.CompactTextString(m) }
func (*Response) ProtoMessage() {}
func (*Response) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
func (*Response) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
func (m *Response) GetErrors() []string {
if m != nil {
@@ -222,6 +286,13 @@ func (m *Response) GetFiles() []*File {
return nil
}
func (m *Response) GetMessages() []*Message {
if m != nil {
return m.Messages
}
return nil
}
// File describes a file generated by a plugin.
type File struct {
// name of the file
@@ -233,7 +304,7 @@ type File struct {
func (m *File) Reset() { *m = File{} }
func (m *File) String() string { return proto.CompactTextString(m) }
func (*File) ProtoMessage() {}
func (*File) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
func (*File) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
func (m *File) GetName() string {
if m != nil {
@@ -253,44 +324,49 @@ func init() {
proto.RegisterType((*Version)(nil), "gnostic.plugin.v1.Version")
proto.RegisterType((*Parameter)(nil), "gnostic.plugin.v1.Parameter")
proto.RegisterType((*Request)(nil), "gnostic.plugin.v1.Request")
proto.RegisterType((*Message)(nil), "gnostic.plugin.v1.Message")
proto.RegisterType((*Messages)(nil), "gnostic.plugin.v1.Messages")
proto.RegisterType((*Response)(nil), "gnostic.plugin.v1.Response")
proto.RegisterType((*File)(nil), "gnostic.plugin.v1.File")
proto.RegisterEnum("gnostic.plugin.v1.Message_Level", Message_Level_name, Message_Level_value)
}
func init() { proto.RegisterFile("plugin.proto", fileDescriptor0) }
func init() { proto.RegisterFile("plugins/plugin.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 499 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x4f, 0x8f, 0xd3, 0x3c,
0x10, 0xc6, 0xd5, 0xa6, 0x7f, 0xa7, 0xfb, 0xbe, 0xb0, 0xd6, 0x6a, 0xb1, 0x56, 0x48, 0x5b, 0xf5,
0x42, 0x25, 0x84, 0x4b, 0x1b, 0x10, 0x17, 0x2e, 0xac, 0x80, 0x15, 0x07, 0x76, 0x83, 0x0f, 0x5c,
0x2b, 0x6f, 0xea, 0xa6, 0x46, 0x49, 0x6c, 0x6c, 0x27, 0x82, 0x4f, 0xc2, 0x9d, 0x4f, 0x8a, 0x62,
0x27, 0x4d, 0xc5, 0x56, 0x68, 0x4f, 0x9d, 0xe7, 0xd1, 0xfc, 0x9e, 0xb8, 0x33, 0x03, 0x27, 0x2a,
0x2d, 0x12, 0x91, 0x13, 0xa5, 0xa5, 0x95, 0xe8, 0x34, 0xc9, 0xa5, 0xb1, 0x22, 0x26, 0xb5, 0x5b,
0x2e, 0x2f, 0xde, 0x24, 0xc2, 0xee, 0x8a, 0x3b, 0x12,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xfc, 0xee, 0x06, 0xd7, 0x37, 0xb7,
0x77, 0x03, 0x77, 0xe8, 0xe1, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x40, 0x96, 0xff, 0x27, 0xeb,
0x03, 0x00, 0x00,
// 539 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0xc1, 0x6e, 0xd3, 0x40,
0x10, 0xc5, 0xb1, 0xdd, 0xc4, 0x13, 0x28, 0x66, 0x55, 0x81, 0xa9, 0x90, 0x1a, 0xf9, 0x42, 0x0e,
0xe0, 0xa8, 0x41, 0xf4, 0xc4, 0x25, 0x91, 0x9a, 0xa8, 0xa2, 0x38, 0xd1, 0x0a, 0xe8, 0x31, 0xda,
0x3a, 0x1b, 0xc7, 0x60, 0x7b, 0xcd, 0xee, 0x3a, 0x6a, 0x3e, 0x81, 0xdf, 0xe0, 0x4b, 0xf8, 0x32,
0x84, 0x76, 0xd7, 0x89, 0x8a, 0x08, 0x07, 0x4e, 0x7e, 0xf3, 0xf4, 0xfc, 0x66, 0xe6, 0xed, 0xc0,
0x49, 0x95, 0xd7, 0x69, 0x56, 0x8a, 0x81, 0xf9, 0x46, 0x15, 0x67, 0x92, 0xa1, 0x27, 0x69, 0xc9,
0x84, 0xcc, 0x92, 0xa8, 0x61, 0x37, 0xe7, 0xa7, 0xcf, 0x53, 0xc6, 0xd2, 0x9c, 0x0e, 0xb4, 0xe0,
0xb6, 0x5e, 0x0d, 0x48, 0xb9, 0x35, 0xea, 0x30, 0x81, 0xf6, 0x67, 0xca, 0x45, 0xc6, 0x4a, 0x74,
0x02, 0x6e, 0x41, 0xbe, 0x30, 0x1e, 0x58, 0x3d, 0xab, 0xef, 0x62, 0x53, 0x68, 0x36, 0x2b, 0x19,
0x0f, 0x5a, 0x0d, 0xab, 0x0a, 0xc5, 0x56, 0x44, 0x26, 0xeb, 0xc0, 0x36, 0xac, 0x2e, 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 0x00,
0x00, 0xff, 0xff, 0x97, 0xa0, 0x65, 0xe7, 0xd5, 0x03, 0x00, 0x00,
}

View File

@@ -22,10 +22,7 @@
syntax = "proto3";
import "github.com/googleapis/gnostic/OpenAPIv2/OpenAPIv2.proto";
import "github.com/googleapis/gnostic/OpenAPIv3/OpenAPIv3.proto";
import "github.com/googleapis/gnostic/discovery/discovery.proto";
import "github.com/googleapis/gnostic/surface/surface.proto";
import "google/protobuf/any.proto";
package gnostic.plugin.v1;
@@ -85,17 +82,36 @@ message Request {
// The version number of gnostic.
Version compiler_version = 4;
// OpenAPI v2 API representation
openapi.v2.Document openapi2 = 5;
// API models
repeated google.protobuf.Any models = 5;
}
// OpenAPI v3 API representation
openapi.v3.Document openapi3 = 6;
// Plugins can return messages to be collated and reported by gnostic.
message Message {
// Discovery API representation
discovery.v1.Document discovery = 7;
// generated code surface representation
surface.v1.Model surface = 8;
enum Level {
UNKNOWN = 0;
INFO = 1;
WARNING = 2;
ERROR = 3;
FATAL = 4;
}
// message severity
Level level = 1;
// a unique message identifier
string code = 2;
// message text
string text = 3;
// an associated key path in an API description
repeated string keys = 4;
}
message Messages {
repeated Message messages = 1;
}
// The plugin writes an encoded Response to stdout.
@@ -106,14 +122,17 @@ message Response {
// even if it reports an error in this way.
//
// This should be used to indicate errors which prevent the plugin from
// operating as intended. Errors which indicate a problem in openapic
// 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 = 1;
// file output, each file will be written by openapic to an appropriate location.
// file output, each file will be written by gnostic to an appropriate location.
repeated File files = 2;
// informational messages to be collected and reported by gnostic.
repeated Message messages = 3;
}
// File describes a file generated by a plugin.

View File

@@ -99,7 +99,9 @@ func (b *OpenAPI2Builder) buildTypeFromDefinition(name string, schema *openapiv2
// If the schema has no fixed properties and additional properties of a specified type,
// generate a map pointing to objects of that type.
t.Kind = TypeKind_OBJECT
t.ContentType = typeForRef(schema.AdditionalProperties.GetSchema().XRef)
if schema.AdditionalProperties.GetSchema() != nil {
t.ContentType = typeForRef(schema.AdditionalProperties.GetSchema().XRef)
}
}
}
return t, err

View File

@@ -19,8 +19,9 @@ import (
"fmt"
"log"
openapiv3 "github.com/googleapis/gnostic/OpenAPIv3"
"strings"
openapiv3 "github.com/googleapis/gnostic/OpenAPIv3"
)
// NewModelFromOpenAPIv3 builds a model of an API service for use in code generation.
@@ -270,13 +271,14 @@ func (b *OpenAPI3Builder) typeForSchema(schema *openapiv3.Schema) (kind FieldKin
case "array":
if schema.Items != nil {
// we have an array.., but of what?
items := schema.Items.SchemaOrReference
if len(items) == 1 {
if items[0].GetReference().GetXRef() != "" {
return FieldKind_ARRAY, typeForRef(items[0].GetReference().GetXRef()), format
} else if items[0].GetSchema().Type == "string" {
items := schema.Items
if items != nil {
a := items.GetSchemaOrReference()
if a[0].GetReference().GetXRef() != "" {
return FieldKind_ARRAY, typeForRef(a[0].GetReference().GetXRef()), format
} else if a[0].GetSchema().Type == "string" {
return FieldKind_ARRAY, "string", format
} else if items[0].GetSchema().Type == "object" {
} else if a[0].GetSchema().Type == "object" {
return FieldKind_ARRAY, "interface{}", format
}
}