Last modified by Ashterix on 2024/07/11 10:08

From version 2.1
edited by Ashterix
on 2024/05/10 15:48
Change comment: There is no comment for this version
To version 5.1
edited by Ashterix
on 2024/07/11 10:08
Change comment: There is no comment for this version

Summary

Details

Page properties
Title
... ... @@ -1,1 +1,1 @@
1 -2. Bundle config
1 +Version 6. Bundle config
Content
... ... @@ -2,6 +2,11 @@
2 2  {{toc/}}
3 3  {{/box}}
4 4  
5 +{{error}}
6 +**WARNING!!! **This version of the documentation is out of date.
7 +In JsonRpcBundle version 7, the configuration has undergone significant changes and is not backwards compatible with version 6.
8 +{{/error}}
9 +
5 5  (% class="wikigeneratedid" %)
6 6  All bundle settings are located in the file {{code language="none"}}config/packages/ufo_json_rpc.yaml{{/code}}.
7 7  
... ... @@ -162,6 +162,24 @@
162 162   class: App\Services\RpcSecurity\UserTokenValidator
163 163  {{/code}}
164 164  
170 += Block {{code language="none"}}async{{/code}} =
171 +
172 +This block is for configuring [[asynchronous transport>>doc:docs.JsonRpcBundle.functionality.async.WebHome]].
173 +
174 +Add the parameter {{code language="none"}}rpc_async{{/code}} which contains a string in DSN format. This string is the configuration for [[Symfony Messenger>>https://symfony.com/doc/current/messenger.html]], and it points to the asynchronous transport where the RPC Server will be waiting for incoming requests if you have a consumer running ({{code language="none"}}php bin/console messenger:consume rpc_async{{/code}}). For a more detailed understanding of this process, read the [[Symfony Messenger documentation>>https://symfony.com/doc/current/messenger.html]].
175 +
176 +{{code language="yaml" layout="LINENUMBERS" title="config/packages/ufo_json_rpc.yaml"}}
177 +ufo_json_rpc:
178 + async:
179 + rpc_async: '%env(resolve:RPC_TRANSPORT_DSN)%'
180 +
181 +{{/code}}
182 +
183 +(% class="box warningmessage" %)
184 +(((
185 +This configuration implies that you have an environment variable RPC_TRANSPORT_DSN set, which contains the DSN string.
186 +)))
187 +
165 165  = The {{code language="none"}}docs{{/code}} block =
166 166  
167 167  This block configures the generation of documentation when you make a GET request on the RPC Server
... ... @@ -194,6 +194,65 @@
194 194   key_for_methods: some_custom_key
195 195  {{/code}}
196 196  
220 +=== Parameter {{code language="none"}}async_dsn_info{{/code}} ===
221 +
222 +Responsible for displaying information about asynchronous transport in the documentation.
223 +
224 +{{code language="yaml" layout="LINENUMBERS" title="config/packages/ufo_json_rpc.yaml"}}
225 +ufo_json_rpc:
226 + async_dsn_info: true # or false
227 +{{/code}}
228 +
229 +==== **Documentation Example** ====
230 +
231 +{{code language="json" layout="LINENUMBERS" title="GET: /api"}}
232 +{
233 + "envelope": "JSON-RPC-2.0/UFO-RPC-6",
234 + "contentType": "application/json",
235 + "description": "",
236 + "transport": {
237 + "sync": {
238 + "scheme": "http",
239 + "host": "example.com",
240 + "path": "/api",
241 + "method": "POST"
242 + },
243 + "async": {
244 + "scheme": "amqp",
245 + "user": "{user}",
246 + "pass": "{pass}",
247 + "host": "async_rabbit",
248 + "port": 5672,
249 + "path": "/%2f/json-rpc"
250 + }
251 + },
252 + "methods": {
253 + ...
254 + }
255 +}
256 +{{/code}}
257 +
258 +{{info}}
259 +Do not worry about the security of your authorization data contained in the DSN.
260 +
261 +The documenter is designed in such a way that before displaying DSN information, it removes user data and passwords, as well as other sensitive information, such as tokens, secret keys, etc.
262 +
263 +The template for protecting data is {{code language="none"}}/([\w\d_]*(?:secret|access|token|key)[_\w]*)=((?:\w|\d)+(?=&?))/{{/code}}.
264 +
265 +Example:
266 +
267 +{{code language="json" layout="LINENUMBERS" title="RPC_TRANSPORT_DSN=https://sqs.eu-west-3.amazonaws.com/123456789012/messages?access_key=AKIAIOSFODNN7EXAMPLE&secret_key=j17M97ffSVoKI0briFoo9a"}}
268 +{
269 + "async": {
270 + "scheme": "https",
271 + "host": "sqs.eu-west-3.amazonaws.com",
272 + "path": "/123456789012/messages",
273 + "query": "access_key={access_key}&secret_key={secret_key}"
274 + }
275 +}
276 +{{/code}}
277 +{{/info}}
278 +
197 197  === Parameter {{code language="none"}}validations{{/code}} ===
198 198  
199 199  Responsible for displaying in the documentation methods additional blocks that indicate data validation requirements.
... ... @@ -218,7 +218,7 @@
218 218  (% class="box infomessage" %)
219 219  (((
220 220  In this example, I removed the content of the objects symfony_assertions to simplify the example.
221 -For more information on method validation, see the page **[[Validate procedures>>doc:.add_rpc_service.assertions.WebHome]]**
303 +For more information on method validation, see the page **[[Validate procedures>>doc:docs.JsonRpcBundle.add_rpc_service.assertions.WebHome]]**
222 222  )))
223 223  
224 224  {{code language="json" layout="LINENUMBERS" title="GET: /api"}}