loopbackio / loopbackio/loopback-next
Define a required parameter using a sugar API
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- TypeScript
- Estrellas
- 5.1k
- Forks
- 1.1k
- Merge medio
- 2 d 21 h
- PR fusionados (30 d)
- 27
Descripción
At the moment, it is not possible to use @param shortcuts like @param.query.string to define a required parameter.
One has to use @param directly (but don't have to specify the type since LB4 can infer the type from TypeScript metadata). For example:
@param({name: 'format', in: 'query', required: true}) format?: string
Ideally, I would like LB4 to provide the following syntax for annotating parameters as required:
@param.query.string('format', {required: true}) format?: string
Acceptance criteria
- Modify all
@param.SOURCE.TYPE()shortcuts (and possibly other similar shortucts) to accept a new optional argument of typePartial<ParameterObject>and use the provided properties to enhance (or amend) the spec generated by the decorator. - Modify
@param.array()in a similar way, the new optional argument will be the fourth arg. - Modify
@param.query.object()similarly, the new optional argument will be the third arg. - Verify that the API documentation is able to pick up the changes
🎆 Hacktoberfest 2020
Greetings 👋 to all Hacktoberfest 2020 participants!
Here are few tips 👀 to make your start easier, see also #6456:
- Before you start working on this issue, please leave a comment to let others know.
- If you are new to GitHub pull requests, then you can learn about the process in Submitting a pull request to LoopBack 4.
- If this is your first contribution to LoopBack, then please take a look at our Developer guide
- Feel free to ask for help in
#loopback-contributorschannel, you can join our Slack workspace here.
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.
Línea de trabajo
Comienza localizando las implementaciones en TypeScript de los atajos @param.SOURCE.TYPE(), @param.array() y @param.query.object(), y después inspecciona cómo se exponen sus especificaciones ParameterObject generadas para la documentación de API. Actualiza los atajos para que acepten las propiedades opcionales indicadas y verifica que la documentación las refleje, incluidos los parámetros obligatorios.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- openapi, typescript
- Área
- api, documentation
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bien especificado
- Aptitud para principiantes
- 35/100