Aconex / drakov

Mock Server that implements the API Blueprint specification

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing URI parameters on mock advanced API Blueprint resources

kamihouse opened this issue · comments

Hi guys.
I'm having some troubles while trying to mock some resources using the Blueprint API.

This resource is defined by a resource name (identifier) followed by an HTTP request method and an URI template enclosed in square brackets []:

# <identifier> [<HTTP request method> <URI template>]
Source: https://apiblueprint.org/documentation/specification.html#def-resource-section

For example:

## Group Veículos
Descrição dos recursos de veículos.


### Avisos [/veiculos/{id}/avisos]

+ Parameters
    + id: `wqv57dm` (required, string) - ID do veículo.

#### Lista os avisos [GET]
Esse endpoint projeta uma lista de avisos especificado pelo veículo.

+ Response 200 (application/json; charset=utf-8)
    + Attributes
        + data (array[dsAvisoVeiculoResponse], fixed-type)

### Deleta um aviso [DELETE /veiculos/{id}/avisos/{id_aviso}]
Esse endpoint deleta um aviso especificado.

+ Parameters
    + id: `wqv57dm` (required, string) - ID do veículo.
    + id_aviso: `wqv57dm` (required, string) - ID do aviso.

+ Response 204

This generates the doc:
recursos

However, drakov generates the following endpoints:
drakov
Path variables are not being interpreted.

Now I'm having some troubles to mock the features and I do not know if it's a drakov or Blueprint API problem. Thanks.

Did you find any solution for this? I have the same problem as you.

@kamihouse

I fixed it currently hardcoded:
For my use case this now work. I'll try to find a more generic solution.
LKaemmerling@a3e3590

Hi @LKDevelopment, In my case I stopped using action along with resources.
But I really enjoyed your proposed solution at LKaemmerling@a3e3590 \o/

For example:
### Deleta um aviso [DELETE /veiculos/{id}/avisos/{id_aviso}]

I solved by separating the resource (HTTP request method) from the action (GET, POST, PUT, DELETE...):

### Aviso [/veiculos/{id}/avisos/{id_aviso}]
...

#### Deleta um aviso [DELETE]
...

i ve found out that there is already a better generic pr here in the repo :) #169 I've use now this code and it works perfectly!