Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,37 @@ service Messaging1 {
]
};
}

rpc StreamMessages(Message) returns(stream Message) {
option(google.api.http) = {
get: "/v1/stream/{message_id}"
body: "*"
};
option (openapi.v3.operation) = {
responses: {
response_or_reference: {
name: "200"
value: {
response : {
description: "OK"
content: {
additional_properties: {
name: "text/event-stream"
value: {
schema: {
reference: {
_ref: "Message"
}
}
}
}
}
}
}
}
}
};
}
}

service Messaging2 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,36 @@ paths:
$ref: '#/components/schemas/Status'
security:
- BasicAuth: []
/v1/stream/{message_id}:
get:
tags:
- Messaging1
operationId: Messaging1_StreamMessages
parameters:
- name: message_id
in: path
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
required: true
responses:
default:
description: Default error response
content:
application/json:
schema:
$ref: '#/components/schemas/Status'
"200":
description: OK
content:
text/event-stream:
schema:
$ref: '#/components/schemas/Message'
components:
schemas:
GoogleProtobufAny:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,36 @@ paths:
$ref: '#/components/schemas/Status'
security:
- BasicAuth: []
/v1/stream/{message_id}:
get:
tags:
- Messaging1
operationId: Messaging1_StreamMessages
parameters:
- name: message_id
in: path
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
required: true
responses:
default:
description: Default error response
content:
application/json:
schema:
$ref: '#/components/schemas/Status'
"200":
description: OK
content:
text/event-stream:
schema:
$ref: '#/components/schemas/Message'
components:
schemas:
GoogleProtobufAny:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,36 @@ paths:
$ref: '#/components/schemas/google.rpc.Status'
security:
- BasicAuth: []
/v1/stream/{message_id}:
get:
tags:
- Messaging1
operationId: Messaging1_StreamMessages
parameters:
- name: message_id
in: path
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/tests.openapiv3annotations.message.v1.Message'
required: true
responses:
default:
description: Default error response
content:
application/json:
schema:
$ref: '#/components/schemas/google.rpc.Status'
"200":
description: OK
content:
text/event-stream:
schema:
$ref: '#/components/schemas/tests.openapiv3annotations.message.v1.Message'
components:
schemas:
google.protobuf.Any:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,36 @@ paths:
$ref: '#/components/schemas/Status'
security:
- BasicAuth: []
/v1/stream/{message_id}:
get:
tags:
- Messaging1
operationId: Messaging1_StreamMessages
parameters:
- name: message_id
in: path
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
required: true
responses:
default:
description: Default error response
content:
application/json:
schema:
$ref: '#/components/schemas/Status'
"200":
description: OK
content:
text/event-stream:
schema:
$ref: '#/components/schemas/Message'
components:
schemas:
GoogleProtobufAny:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,36 @@ paths:
$ref: '#/components/schemas/Status'
security:
- BasicAuth: []
/v1/stream/{message_id}:
get:
tags:
- Messaging1
operationId: Messaging1_StreamMessages
parameters:
- name: message_id
in: path
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
required: true
responses:
default:
description: Default error response
content:
application/json:
schema:
$ref: '#/components/schemas/Status'
"200":
description: OK
content:
text/event-stream:
schema:
$ref: '#/components/schemas/Message'
components:
schemas:
GoogleProtobufAny:
Expand Down
20 changes: 10 additions & 10 deletions cmd/protoc-gen-openapi/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ func TestOpenAPIProtobufNaming(t *testing.T) {
}
} else {
// Verify that the generated spec matches our expected version.
err = exec.Command("diff", TEMP_FILE, fixture).Run()
output, err := exec.Command("diff", TEMP_FILE, fixture).CombinedOutput()
if err != nil {
t.Fatalf("Diff failed: %+v", err)
t.Fatalf("Diff failed: %s", output)
}
}
// if the test succeeded, clean up
Expand Down Expand Up @@ -163,9 +163,9 @@ func TestOpenAPIFQSchemaNaming(t *testing.T) {
}
} else {
// Verify that the generated spec matches our expected version.
err = exec.Command("diff", TEMP_FILE, fixture).Run()
output, err := exec.Command("diff", TEMP_FILE, fixture).CombinedOutput()
if err != nil {
t.Fatalf("Diff failed: %+v", err)
t.Fatalf("Diff failed: %s", output)
}
// Verify that the generated spec matches the source_relative version
sourceRelativeFile := strings.TrimSuffix(tt.protofile, filepath.Ext(tt.protofile)) + ".openapi.yaml"
Expand Down Expand Up @@ -207,9 +207,9 @@ func TestOpenAPIJSONNaming(t *testing.T) {
}
} else {
// Verify that the generated spec matches our expected version.
err = exec.Command("diff", TEMP_FILE, fixture).Run()
output, err := exec.Command("diff", TEMP_FILE, fixture).CombinedOutput()
if err != nil {
t.Fatalf("Diff failed: %+v", err)
t.Fatalf("Diff failed: %s", output)
}
}
// if the test succeeded, clean up
Expand Down Expand Up @@ -244,9 +244,9 @@ func TestOpenAPIStringEnums(t *testing.T) {
}
} else {
// Verify that the generated spec matches our expected version.
err = exec.Command("diff", TEMP_FILE, fixture).Run()
output, err := exec.Command("diff", TEMP_FILE, fixture).CombinedOutput()
if err != nil {
t.Fatalf("diff failed: %+v", err)
t.Fatalf("diff failed: %s", output)
}
}
// if the test succeeded, clean up
Expand Down Expand Up @@ -281,9 +281,9 @@ func TestOpenAPIDefaultResponse(t *testing.T) {
}
} else {
// Verify that the generated spec matches our expected version.
err = exec.Command("diff", TEMP_FILE, fixture).Run()
output, err := exec.Command("diff", TEMP_FILE, fixture).CombinedOutput()
if err != nil {
t.Fatalf("diff failed: %+v", err)
t.Fatalf("diff failed: %s", output)
}
}
// if the test succeeded, clean up
Expand Down