IGNF / road2

NodeJS routing server aggregating several popular routing engines (video presentation (french) : https://peertube.fr/w/75fwFoW2GP8tQSGLUXUpPP)
https://ignf.github.io/road2/
GNU General Public License v3.0
11 stars 3 forks source link

[feature] Get `/services/:service` implementation #49

Closed benoitblanc closed 1 year ago

benoitblanc commented 1 year ago

Create GET /services/:service like it is specified inside https://github.com/IGNF/road2/blob/develop/documentation/apis/administration/1.0.0/api.yaml.

Code

lgrd commented 1 year ago

You will have to update the api.yaml because there is no id in the response of this route. But it could be interesting to have the same object for this route and the /services route. What do you think ?

benoitblanc commented 1 year ago

@lgrd There is no id in serviceConfiguration response in api.yml for now, I have to add it to have the correct response for /services route. Also, I started to implement this new route with the same object so /services/:service will also have an id.

Does it look good for you ?

lgrd commented 1 year ago

Oh ! I got the point...

Now, you have this in the yaml :

        200:
          description: "successful operation"
          content:
            application/json:
              schema:
                type: "array"
                items:
                  type: "object"
                  allOf:
                    - type: "object"
                      properties:
                        id:
                          type: "string"
                    - $ref: "#/components/schemas/serviceConfiguration"

This is because, when you POST or PATCH a service, you will not give the id inside the body. It is only inside the URL parameter.

That's why I add it only in the response of /services. So, to be in line with the other /service/{serviceId}, let us keep the api.yaml like it is.

So, in your code section, you can only read the content of service.json and return it. You don't have to add the id.

Is that ok for you ?

benoitblanc commented 1 year ago

Sorry I did not see that id was added outside serviceConfiguration in /services. So yes I will update my branch to only return serviceConfiguration without id.

lgrd commented 1 year ago

thanks ! I will test your code tomorrow but it looks good ! ;)