Last modified by Ashterix on 2024/07/11 11:49

From version 2.1
edited by Ashterix
on 2024/07/11 11:46
Change comment: There is no comment for this version
To version 5.1
edited by Ashterix
on 2024/07/11 11:49
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -49,6 +49,9 @@
49 49  {{/spoiler}}
50 50  
51 51  
52 +
53 +
54 +
52 52  Parameter {{code language="none"}}clients_tokens{{/code}}
53 53  
54 54  Next, specify an array of client tokens that will have access to the API.
... ... @@ -183,4 +183,118 @@
183 183  * {{code language="none"}}project_description{{/code}}: The project description
184 184  * {{code language="none"}}project_version{{/code}}: The current version of your API
185 185  * {{code language="none"}}async_dsn_info{{/code}}: Indicates whether to display information about asynchronous transport in the documentation
186 -* (% id="cke_bm_826282S" style="display:none" %){{code language="none"}}validations.symfony_asserts{{/code}}{{code language="none"}}validations.symfony_asserts{{/code}}~(%%
189 +* {{code language="none"}}validations.symfony_asserts{{/code}}: <bool> Indicates whether to display the validation constraint string for the parameter (if you use [[validation>>doc:docs.JsonRpcBundle.add_rpc_service.assertions.WebHome]])
190 +
191 +{{code language="yaml" layout="LINENUMBERS" title="config/packages/ufo_json_rpc.yaml"}}
192 +ufo_json_rpc:
193 + docs:
194 + project_name: 'My Project'
195 + project_description: 'My project description'
196 + project_version: '1.0'
197 + # Optional response details
198 + async_dsn_info: false # Provide information about API that work asynchronously
199 + validations:
200 + symfony_asserts: false # Indicates if an array of Symfony validation constraints is used
201 +
202 +{{/code}}
203 +
204 +{{info}}
205 +Do not worry about the security of your authorization data contained in the DSN.
206 +
207 +The documenter is designed in such a way that before displaying DSN information, it removes user and password data, as well as other secret data such as tokens, secret keys, etc.
208 +
209 +The template for protection is {{code language="none"}}/([\w\d_]*(?:secret|access|token|key)[_\w]*)=((?:\w|\d)+(?=&?))/{{/code}}.
210 +
211 +Example:
212 +
213 +{{code language="json" layout="LINENUMBERS" title="RPC_TRANSPORT_DSN=https://sqs.eu-west-3.amazonaws.com/123456789012/messages?access_key=AKIAIOSFODNN7EXAMPLE&secret_key=j17M97ffSVoKI0briFoo9a"}}
214 +{
215 + "async": {
216 + "scheme": "https",
217 + "host": "sqs.eu-west-3.amazonaws.com",
218 + "path": "/123456789012/messages",
219 + "query": "access_key={access_key}&secret_key={secret_key}"
220 + }
221 +}
222 +{{/code}}
223 +{{/info}}
224 +
225 +=== Documentation Example ===
226 +
227 +{{code language="json" layout="LINENUMBERS" title="GET: /api"}}
228 +{
229 + "openrpc":"1.2.6",
230 + "info":{
231 + "title":"My Project",
232 + "description":"My project description",
233 + "contact":{
234 + "name":"ufo-tech/json-rpc-bundle",
235 + "url":"https://docs.ufo-tech.space/bin/view/docs/JsonRpcBundle/?language=en"
236 + },
237 + "license":{
238 + "name":"MIT"
239 + },
240 + "version":"1.0"
241 + },
242 + "servers":[
243 + {
244 + "url":"https://mysite.com/api",
245 + "description":"Json-RPC api server from UFO Tec\n\nUFO Tech, or Universal Flexible Open Technologies, is an initiative aimed at providing PHP developers with tools to create complex yet user-friendly solutions for modern web applications and service-oriented architectures.",
246 + "name":"UFO Json-RPC Server v.7.0.0",
247 + "x-method":"POST",
248 + "x-ufo":{
249 + "envelop":"JSON-RPC-2.0/UFO-RPC-7.0.0",
250 + "transport":{
251 + "sync":{
252 + "scheme":"https",
253 + "host":"mysite.com",
254 + "path":"/api",
255 + "method":"POST"
256 + },
257 + "async":{
258 + "scheme":"amqp",
259 + "user":"{user}",
260 + "pass":"{pass}",
261 + "host":"mysite.com",
262 + "port":5672,
263 + "path":"/%2f/json-rpc"
264 + }
265 + },
266 + "documentation":{
267 + "json-rpc":"https://www.jsonrpc.org/specification",
268 + "ufo-tech/json-rpc-bundle":"https://docs.ufo-tech.space/bin/view/docs/JsonRpcBundle/?language=en"
269 + }
270 + }
271 + }
272 + ],
273 + "methods":[
274 + {
275 + "name":"getUserNameByUuid",
276 + "tags":[
277 + {
278 + "name":"App\\Api\\UserApiService"
279 + }
280 + ],
281 + "summary":"Get username by id",
282 + "params":[
283 + {
284 + "name":"userId",
285 + "description":"User Id format uuid",
286 + "required":true,
287 + "schema":{
288 + "type":"string"
289 + },
290 + "x-ufo-assertions": "new Assert\\Uuid()"
291 + }
292 + ],
293 + "result":{
294 + "name":"string",
295 + "description":"User Name",
296 + "schema":{
297 + "type":"string"
298 + }
299 + }
300 + }
301 + ]
302 +}
303 +{{/code}}