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

From version 3.2
edited by Ashterix
on 2024/07/11 09:57
Change comment: Updated the relative links.
To version 2.1
edited by Ashterix
on 2024/05/10 15:48
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -53,6 +53,9 @@
53 53  - RFC Standards: Header requirements are regulated by RFC documents that define standards for Internet protocols. For example, common headers and their use are described in RFC 7231.
54 54  {{/spoiler}}
55 55  
56 +
57 +
58 +
56 56  == Parameter {{code language="none"}}clients_tokens{{/code}} ==
57 57  
58 58  Now you need to specify an array of client tokens that will have access to the API.
... ... @@ -159,24 +159,6 @@
159 159   class: App\Services\RpcSecurity\UserTokenValidator
160 160  {{/code}}
161 161  
162 -= Block {{code language="none"}}async{{/code}} =
163 -
164 -This block is for configuring [[asynchronous transport>>doc:docs.JsonRpcBundle.functionality.async.WebHome]].
165 -
166 -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]].
167 -
168 -{{code language="yaml" layout="LINENUMBERS" title="config/packages/ufo_json_rpc.yaml"}}
169 -ufo_json_rpc:
170 - async:
171 - rpc_async: '%env(resolve:RPC_TRANSPORT_DSN)%'
172 -
173 -{{/code}}
174 -
175 -(% class="box warningmessage" %)
176 -(((
177 -This configuration implies that you have an environment variable RPC_TRANSPORT_DSN set, which contains the DSN string.
178 -)))
179 -
180 180  = The {{code language="none"}}docs{{/code}} block =
181 181  
182 182  This block configures the generation of documentation when you make a GET request on the RPC Server
... ... @@ -209,65 +209,6 @@
209 209   key_for_methods: some_custom_key
210 210  {{/code}}
211 211  
212 -=== Parameter {{code language="none"}}async_dsn_info{{/code}} ===
213 -
214 -Responsible for displaying information about asynchronous transport in the documentation.
215 -
216 -{{code language="yaml" layout="LINENUMBERS" title="config/packages/ufo_json_rpc.yaml"}}
217 -ufo_json_rpc:
218 - async_dsn_info: true # or false
219 -{{/code}}
220 -
221 -==== **Documentation Example** ====
222 -
223 -{{code language="json" layout="LINENUMBERS" title="GET: /api"}}
224 -{
225 - "envelope": "JSON-RPC-2.0/UFO-RPC-6",
226 - "contentType": "application/json",
227 - "description": "",
228 - "transport": {
229 - "sync": {
230 - "scheme": "http",
231 - "host": "example.com",
232 - "path": "/api",
233 - "method": "POST"
234 - },
235 - "async": {
236 - "scheme": "amqp",
237 - "user": "{user}",
238 - "pass": "{pass}",
239 - "host": "async_rabbit",
240 - "port": 5672,
241 - "path": "/%2f/json-rpc"
242 - }
243 - },
244 - "methods": {
245 - ...
246 - }
247 -}
248 -{{/code}}
249 -
250 -{{info}}
251 -Do not worry about the security of your authorization data contained in the DSN.
252 -
253 -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.
254 -
255 -The template for protecting data is {{code language="none"}}/([\w\d_]*(?:secret|access|token|key)[_\w]*)=((?:\w|\d)+(?=&?))/{{/code}}.
256 -
257 -Example:
258 -
259 -{{code language="json" layout="LINENUMBERS" title="RPC_TRANSPORT_DSN=https://sqs.eu-west-3.amazonaws.com/123456789012/messages?access_key=AKIAIOSFODNN7EXAMPLE&secret_key=j17M97ffSVoKI0briFoo9a"}}
260 -{
261 - "async": {
262 - "scheme": "https",
263 - "host": "sqs.eu-west-3.amazonaws.com",
264 - "path": "/123456789012/messages",
265 - "query": "access_key={access_key}&secret_key={secret_key}"
266 - }
267 -}
268 -{{/code}}
269 -{{/info}}
270 -
271 271  === Parameter {{code language="none"}}validations{{/code}} ===
272 272  
273 273  Responsible for displaying in the documentation methods additional blocks that indicate data validation requirements.
... ... @@ -292,7 +292,7 @@
292 292  (% class="box infomessage" %)
293 293  (((
294 294  In this example, I removed the content of the objects symfony_assertions to simplify the example.
295 -For more information on method validation, see the page **[[Validate procedures>>doc:docs.JsonRpcBundle.add_rpc_service.assertions.WebHome]]**
221 +For more information on method validation, see the page **[[Validate procedures>>doc:.add_rpc_service.assertions.WebHome]]**
296 296  )))
297 297  
298 298  {{code language="json" layout="LINENUMBERS" title="GET: /api"}}