Closed netsensei closed 1 year ago
@netsensei this ticket is already described within #19 so I see no need to split this
@nicolasfranck #19 is the initial setup and wiring the OpenAPI / Ogen generated code into the router whilst testing with a single, simple API call. Only once that's tackled can we move on completing the implementation of the actual API calls as described in this issue.
To restructure to OAI service way of working
So I conclude:
/api/v1/GetPerson
instead of /api/v1/people/:id
@nicolasfranck That's correct. Please create a table of all the calls you plan to implement with these fields:
gRPC | HTTP URI | HTTP METHOD | Request body | Response body |
---|---|---|---|---|
getPerson | api/v1/get-person | POST | json object with attribute id (string) |
json object of person |
getPeople | api/v1/get-people | POST | json object with attribute cursor (string) |
json object with cursor and data containing array of Person objects |
suggestPeople | api/v1/suggest-people | POST | json object with attribute query (string) |
json object with data containing array of people |
getOrganization | api/v1/get-organization | POST | json object with attribute id (string) |
json object of organization |
getOrganizations | api/v1/get-organizations | POST | json object with attribute cursor (string) |
json object with cursor and data containing array of organization objects |
suggestOrganizations | api/v1/suggest-organizations | POST | json object with attribute query (string) |
object with data containing array of organization objects |
setPersonOrcid | api/v1/set-person-orcid | POST | json object with attributes orcid (string) and id (string) |
json object of person |
setPersonOrcidToken | api/v1/set-person-orcid-token | POST | json body with attributes orcid_token (string) and id (string) |
json object of person |
setPersonRole | api/v1/set-person-role | POST | json body with attributes role (string) and id (string) |
json object of person |
setPersonSettings | api/v1/set-person-settings | POST | json body with attributes settings (object) and id (string) |
json object of person |
@nicolasfranck Can you also replace the "parameters" and " response" columns with "request" and "response" columns?
Request and Response should list per row:
The last three can be merged into one of course, in which case it should only accept parameters id, orcid, orcid_token and settings.
Let's keep this explicit: separate calls are okay.
Feel free to say anything about the paths (e.g. get-person
vs person-update-settings
feels a bit off)
Story
I should be able to communicate with all the calls which are currently implemented as gRPC in the new OpenAPI based REST API
Success criteria
Port all the gRPC calls currently defined in the
proto/api/v1/person.proto
are described as OpenAPI calls:cursor
anddata
containing array of peopledata
containing array of peoplecursor
anddata
containing array of organizationsdata
containing array of organizationsorcid_token
role
settings
Implementation suggestion
In order to implement a call:
api/v1/openapi.yaml
go generate ./...
Service
struct inapi/v1/service.go
to match theHandler
interfaceAutomatic testing scenario
n/a
Additional information
You may try and check if the call works with Postman
Related issues
18