CreateAPI / CreateAPI/CreateAPI

Sort Parameters/Refactor

オープン
#149 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Swift
スター
447
フォーク
42
PR マージ指標
30日以内にマージされた PR はありません

説明

Allow sorting of the parameters from generated Parameter structs for requests.

```yaml
paths:
sortQueryParameters: true || false
```

However, the above title poses an ambiguous problem for whether it sorts the inlined, Parameter object properties, or both. So, ignore this and refactor this entire behavior.

Taking a look at the mixture of config options `paths.inlineSimpleRequests`, `paths.inlineSimpleQueryParameters`, `paths.simpleQueryParametersThreshold` I think that these can be expanded and become a lot more clear with the following, mirroring the way that we do object type overrides (and soon enums).

```yaml
paths:
# default inline, which inlines all properties
parameterType: inline || object
# sorts all parameters
sortParameters: true || false
# options for defining an object parameter, but can also have some inlined parameters as well
objectParameter:
# default false?
inlineRequiredParameters: true || false
# inlines the first n parameters, *after* sorting if true, and the rest are part of the parameter object
inlineThreshold: 2
parameterTypeOverrides:
# use the operationID or eventually the JSON pointers for individual customization
myOperation: inline
myOtherOperation: object
```

I don't know how `inlineRequiredParameters` and `inlineThreshold` would work together exactly, I just thought that these options separately worked well. We can probably remove `inlineThreshold` and simplify to just `inlineRequiredParameters`, also removing the `objectParameter` object.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。