Include missing swagger info to the accounts service

This commit is contained in:
Juan Pablo Villafáñez
2021-12-17 12:52:23 +01:00
parent 652bc1657c
commit eb78b80f18
7 changed files with 89 additions and 24 deletions

View File

@@ -202,9 +202,9 @@ https://cloud.google.com/apis/design/naming_convention?hl=de
| Method Name | Request Type | Response Type | Description |
| ----------- | ------------ | ------------- | ------------|
| ListAccounts | [ListAccountsRequest](#listaccountsrequest) | [ListAccountsResponse](#listaccountsresponse) | Lists accounts |
| GetAccount | [GetAccountRequest](#getaccountrequest) | [.ocis.messages.accounts.v1.Account](../../../messages/accounts/v1/grpc.md#account) | Gets an account rpc GetAccount(GetAccountRequest) returns (Account) { |
| CreateAccount | [CreateAccountRequest](#createaccountrequest) | [.ocis.messages.accounts.v1.Account](../../../messages/accounts/v1/grpc.md#account) | Creates an account rpc CreateAccount(CreateAccountRequest) returns (Account) { |
| UpdateAccount | [UpdateAccountRequest](#updateaccountrequest) | [.ocis.messages.accounts.v1.Account](../../../messages/accounts/v1/grpc.md#account) | Updates an account rpc UpdateAccount(UpdateAccountRequest) returns (Account) { |
| GetAccount | [GetAccountRequest](#getaccountrequest) | [.ocis.messages.accounts.v1.Account](../../../messages/accounts/v1/grpc.md#account) | Gets an account |
| CreateAccount | [CreateAccountRequest](#createaccountrequest) | [.ocis.messages.accounts.v1.Account](../../../messages/accounts/v1/grpc.md#account) | Creates an account |
| UpdateAccount | [UpdateAccountRequest](#updateaccountrequest) | [.ocis.messages.accounts.v1.Account](../../../messages/accounts/v1/grpc.md#account) | Updates an account |
| DeleteAccount | [DeleteAccountRequest](#deleteaccountrequest) | [.google.protobuf.Empty](#googleprotobufempty) | Deletes an account |
### GroupsService

View File

@@ -7,6 +7,7 @@
package v1
import (
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"
v1 "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v1"
_ "google.golang.org/genproto/googleapis/api/annotations"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
@@ -1103,7 +1104,10 @@ var file_ocis_services_accounts_v1_accounts_proto_rawDesc = []byte{
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f,
0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f,
0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65,
0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x15, 0x0a,
0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f,
0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x15, 0x0a,
0x13, 0x52, 0x65, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x22, 0x16, 0x0a, 0x14, 0x52, 0x65, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x49,
0x6e, 0x64, 0x65, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xb4, 0x01, 0x0a,
@@ -1343,12 +1347,30 @@ var file_ocis_services_accounts_v1_accounts_proto_rawDesc = []byte{
0x65, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x22, 0x15, 0x2f, 0x61, 0x70,
0x69, 0x2f, 0x76, 0x31, 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2f, 0x72, 0x65, 0x62, 0x75, 0x69,
0x6c, 0x64, 0x3a, 0x01, 0x2a, 0x42, 0x43, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
0x63, 0x6f, 0x6d, 0x2f, 0x6a, 0x76, 0x69, 0x6c, 0x6c, 0x61, 0x66, 0x61, 0x6e, 0x65, 0x7a, 0x2f,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x74, 0x65, 0x73, 0x74, 0x30, 0x30, 0x31, 0x2f, 0x67, 0x65, 0x6e,
0x2f, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x61,
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
0x6c, 0x64, 0x3a, 0x01, 0x2a, 0x42, 0xe7, 0x02, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6a, 0x76, 0x69, 0x6c, 0x6c, 0x61, 0x66, 0x61, 0x6e, 0x65, 0x7a,
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x74, 0x65, 0x73, 0x74, 0x30, 0x30, 0x31, 0x2f, 0x67, 0x65,
0x6e, 0x2f, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f,
0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x92, 0x41, 0xa0, 0x02, 0x12,
0xb6, 0x01, 0x0a, 0x20, 0x6f, 0x77, 0x6e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x20, 0x49, 0x6e, 0x66,
0x69, 0x6e, 0x69, 0x74, 0x65, 0x20, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x20, 0x61, 0x63, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x73, 0x22, 0x47, 0x0a, 0x0d, 0x6f, 0x77, 0x6e, 0x43, 0x6c, 0x6f, 0x75, 0x64,
0x20, 0x47, 0x6d, 0x62, 0x48, 0x12, 0x20, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67,
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x77, 0x6e, 0x63, 0x6c, 0x6f,
0x75, 0x64, 0x2f, 0x6f, 0x63, 0x69, 0x73, 0x1a, 0x14, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74,
0x40, 0x6f, 0x77, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x63, 0x6f, 0x6d, 0x2a, 0x42, 0x0a,
0x0a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2d, 0x32, 0x2e, 0x30, 0x12, 0x34, 0x68, 0x74, 0x74,
0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
0x6f, 0x77, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x62, 0x6c,
0x6f, 0x62, 0x2f, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x2f, 0x4c, 0x49, 0x43, 0x45, 0x4e, 0x53,
0x45, 0x32, 0x05, 0x31, 0x2e, 0x30, 0x2e, 0x30, 0x2a, 0x02, 0x01, 0x02, 0x32, 0x10, 0x61, 0x70,
0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x10,
0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e,
0x72, 0x3d, 0x0a, 0x10, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x20, 0x4d, 0x61,
0x6e, 0x75, 0x61, 0x6c, 0x12, 0x29, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x6f, 0x77,
0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x64, 0x65, 0x76, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e,
0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@@ -5,6 +5,7 @@ package v1
import (
fmt "fmt"
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"
v1 "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v1"
_ "google.golang.org/genproto/googleapis/api/annotations"
proto "google.golang.org/protobuf/proto"
@@ -79,13 +80,10 @@ type AccountsService interface {
// Lists accounts
ListAccounts(ctx context.Context, in *ListAccountsRequest, opts ...client.CallOption) (*ListAccountsResponse, error)
// Gets an account
//rpc GetAccount(GetAccountRequest) returns (Account) {
GetAccount(ctx context.Context, in *GetAccountRequest, opts ...client.CallOption) (*v1.Account, error)
// Creates an account
//rpc CreateAccount(CreateAccountRequest) returns (Account) {
CreateAccount(ctx context.Context, in *CreateAccountRequest, opts ...client.CallOption) (*v1.Account, error)
// Updates an account
//rpc UpdateAccount(UpdateAccountRequest) returns (Account) {
UpdateAccount(ctx context.Context, in *UpdateAccountRequest, opts ...client.CallOption) (*v1.Account, error)
// Deletes an account
DeleteAccount(ctx context.Context, in *DeleteAccountRequest, opts ...client.CallOption) (*emptypb.Empty, error)
@@ -159,13 +157,10 @@ type AccountsServiceHandler interface {
// Lists accounts
ListAccounts(context.Context, *ListAccountsRequest, *ListAccountsResponse) error
// Gets an account
//rpc GetAccount(GetAccountRequest) returns (Account) {
GetAccount(context.Context, *GetAccountRequest, *v1.Account) error
// Creates an account
//rpc CreateAccount(CreateAccountRequest) returns (Account) {
CreateAccount(context.Context, *CreateAccountRequest, *v1.Account) error
// Updates an account
//rpc UpdateAccount(UpdateAccountRequest) returns (Account) {
UpdateAccount(context.Context, *UpdateAccountRequest, *v1.Account) error
// Deletes an account
DeleteAccount(context.Context, *DeleteAccountRequest, *emptypb.Empty) error

View File

@@ -1,8 +1,17 @@
{
"swagger": "2.0",
"info": {
"title": "ocis/services/accounts/v1/accounts.proto",
"version": "version not set"
"title": "ownCloud Infinite Scale accounts",
"version": "1.0.0",
"contact": {
"name": "ownCloud GmbH",
"url": "https://github.com/owncloud/ocis",
"email": "support@owncloud.com"
},
"license": {
"name": "Apache-2.0",
"url": "https://github.com/owncloud/ocis/blob/master/LICENSE"
}
},
"tags": [
{
@@ -15,6 +24,10 @@
"name": "IndexService"
}
],
"schemes": [
"http",
"https"
],
"consumes": [
"application/json"
],
@@ -24,7 +37,7 @@
"paths": {
"/api/v1/accounts/accounts-create": {
"post": {
"summary": "Creates an account\nrpc CreateAccount(CreateAccountRequest) returns (Account) {",
"summary": "Creates an account",
"operationId": "AccountsService_CreateAccount",
"responses": {
"200": {
@@ -90,7 +103,7 @@
},
"/api/v1/accounts/accounts-get": {
"post": {
"summary": "Gets an account\nrpc GetAccount(GetAccountRequest) returns (Account) {",
"summary": "Gets an account",
"operationId": "AccountsService_GetAccount",
"responses": {
"200": {
@@ -156,7 +169,7 @@
},
"/api/v1/accounts/accounts-update": {
"post": {
"summary": "Updates an account\nrpc UpdateAccount(UpdateAccountRequest) returns (Account) {",
"summary": "Updates an account",
"operationId": "AccountsService_UpdateAccount",
"responses": {
"200": {
@@ -1043,5 +1056,9 @@
}
}
}
},
"externalDocs": {
"description": "Developer Manual",
"url": "https://owncloud.dev/extensions/accounts/"
}
}

View File

@@ -8,3 +8,10 @@ deps:
commit: 5860854adf6a48c39b19d54342b68385
digest: b1-WayFxGJKhSLbpMCQ-VZ5-3R5Gj9iRFYsMG7o57lgqog=
create_time: 2021-12-14T15:10:38.563007Z
- remote: buf.build
owner: grpc-ecosystem
repository: grpc-gateway
branch: main
commit: ff83506eb9cc4cf8972f49ce87e6ed3e
digest: b1-iLPHgLaoeWWinMiXXqPnxqE4BThtY3eSbswVGh9GOGI=
create_time: 2021-10-23T16:26:52.283938Z

View File

@@ -4,6 +4,7 @@ lint:
- DEFAULT
deps:
- buf.build/googleapis/googleapis
- buf.build/grpc-ecosystem/grpc-gateway
breaking:
use:
- FILE

View File

@@ -9,6 +9,32 @@ import "google/api/field_behavior.proto";
import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
info: {
title: "ownCloud Infinite Scale accounts";
version: "1.0.0";
contact: {
name: "ownCloud GmbH";
url: "https://github.com/owncloud/ocis";
email: "support@owncloud.com";
};
license: {
name: "Apache-2.0";
url: "https://github.com/owncloud/ocis/blob/master/LICENSE";
};
};
schemes: HTTP;
schemes: HTTPS;
consumes: "application/json";
produces: "application/json";
external_docs: {
description: "Developer Manual";
url: "https://owncloud.dev/extensions/accounts/";
};
};
// Follow recommended Methods for rpc APIs https://cloud.google.com/apis/design/resources?hl=de#methods
// https://cloud.google.com/apis/design/standard_methods?hl=de#list
// https://cloud.google.com/apis/design/naming_convention?hl=de
@@ -22,7 +48,6 @@ service AccountsService {
};
}
// Gets an account
//rpc GetAccount(GetAccountRequest) returns (Account) {
rpc GetAccount(GetAccountRequest) returns (ocis.messages.accounts.v1.Account) {
option (google.api.http) = {
post: "/api/v1/accounts/accounts-get",
@@ -30,7 +55,6 @@ service AccountsService {
};
}
// Creates an account
//rpc CreateAccount(CreateAccountRequest) returns (Account) {
rpc CreateAccount(CreateAccountRequest) returns (ocis.messages.accounts.v1.Account) {
// Create maps to HTTP POST. URL path as the collection name.
// HTTP request body contains the resource
@@ -40,7 +64,6 @@ service AccountsService {
};
}
// Updates an account
//rpc UpdateAccount(UpdateAccountRequest) returns (Account) {
rpc UpdateAccount(UpdateAccountRequest) returns (ocis.messages.accounts.v1.Account) {
// Update maps to HTTP PATCH. Resource name is mapped to a URL path.
// Resource is contained in the HTTP request body