Aconex / drakov

Mock Server that implements the API Blueprint specification
MIT License
481 stars 115 forks source link

Missing URI parameters on mock advanced API Blueprint resources #178

Closed kamihouse closed 6 years ago

kamihouse commented 6 years ago

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.

LKaemmerling commented 6 years ago

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

LKaemmerling commented 6 years ago

@kamihouse

I fixed it currently hardcoded: For my use case this now work. I'll try to find a more generic solution. https://github.com/LKDevelopment/drakov/commit/a3e359071fd89b35551cd9ab6d06d2c7fa335df2

kamihouse commented 6 years ago

Hi @LKDevelopment, In my case I stopped using action along with resources. But I really enjoyed your proposed solution at https://github.com/LKDevelopment/drakov/commit/a3e359071fd89b35551cd9ab6d06d2c7fa335df2 \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] ...

LKaemmerling commented 6 years ago

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!