Custom mime types ignored in `produces`
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 45/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- openapi, ruby
- Área
- api, documentation
Línea de trabajo
Start in grape-swagger/endpoint.rb at Grape::Endpoint#produces_object and follow the lookup into doc_methods/produces_consumes.rb. Compare that lookup with the custom :content_types settings described in the issue, then check the corresponding consumes path. Done means custom symbols produce their configured MIME values in the generated Swagger output for both produces and consumes.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
The default content types can be overridden using the DSL content_type, which adds to a :content_types Hash in the settings, which takes precedence over the default CONTENT_TYPES.
However, when generating documentation Grape::Endpoint#produces_object employs GrapeSwagger::DocMethods::ProducesConsumes to lookup mime types by symbol, and that goes directly to CONTENT_TYPES, bypassing any customisation.
class MyApi < Grape::API
content_type :jsonapi, 'application/vnd.api+json'
resource :foo do
desc '/fooey', { produces: [:jsonapi] }
get do
{
# My JSON API response...
}
end
end
end
The generated Swagger will say
...
"paths": {
"/fooey": {
"get": {
"produces": ["jsonapi"]
}
}
}
...
rather than the expected "produces": ["application/vnd.api+json"]. You have to explicitly specify the mime type rather than the symbol to workaround.
I assume that consumes is similarly affected.
... Or is this as intended?
- Lenguaje dominante
- Ruby
- Estrellas
- 1.1k
- Forks
- 477
- Merge medio
- 5 h 25 min
- PR fusionados (30 d)
- 3
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de ruby-grape/grape-swagger
-
Support default_response and default in 2.3; stop reading route.descPosiblemente ocupada @numbata la tomó hace 53 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
ruby-grape/grape-swagger#989 ·
Los mantenedores suelen responder en 1 día
-
Length limits (minLength/maxLength, minItems/maxItems) are dropped from body params moved into a definitionPosiblemente ocupada @numbata la tomó hace 3 días. Abierto
ruby-grape/grape-swagger#1010 · 1 comentario · 1 reacción · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
ruby-grape/grape-swagger#987 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Bug report: omitted array parameters with `array_use_braces: true`Posiblemente ocupada @olivier-thatch la tomó hace 526 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
ruby-grape/grape-swagger#952 · 2 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Bug Report: `default` for array params (`type: [String]`) is incorrectly placed inside `items`Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
ruby-grape/grape-swagger#950 · 2 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
Todos los issues de ruby-grape/grape-swagger
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
matteocrippa/awesome-swift#2028 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
fractaledmind/litestream-ruby#89 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 78/100
resque/resque-scheduler#848 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
voxpupuli/puppet-patroni#126 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
voxpupuli/puppet-elasticsearch#1290 ·