loopbackio / loopbackio/loopback-next
Define a required parameter using a sugar API
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 5.1k
- Forks
- 1.1k
- Ø Merge
- 2 T. 21 Std.
- Gemergte PRs (30 T.)
- 27
Beschreibung
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:
```ts
@param({name: 'format', in: 'query', required: true}) format?: string
```
Ideally, I would like LB4 to provide the following syntax for annotating parameters as required:
```ts
@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 type `Partial` 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 :wave: 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](https://loopback.io/doc/en/lb4/submitting_a_pr.html).
- If this is your first contribution to LoopBack, then please take a look at our [Developer guide](https://loopback.io/doc/en/lb4/code-contrib-lb4.html)
- Feel free to ask for help in `#loopback-contributors` channel, you can join our Slack workspace [here](https://join.slack.com/t/loopbackio/shared_invite/zt-8lbow73r-SKAKz61Vdao~_rGf91pcsw).
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, die TypeScript-Implementierungen der Shortcuts @param.SOURCE.TYPE(), @param.array() und @param.query.object() zu finden, und untersuche anschließend, wie deren generierte ParameterObject-Spezifikationen für die API-Dokumentation bereitgestellt werden. Aktualisiere die Shortcuts so, dass sie die genannten optionalen Eigenschaften akzeptieren, und überprüfe, dass die Dokumentation sie einschließlich erforderlicher Parameter widerspiegelt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- openapi, typescript
- Bereich
- api, documentation
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 35/100