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

From version 1.1
edited by Ashterix
on 2024/07/11 11:46
Change comment: There is no comment for this version
To version 4.1
edited by Ashterix
on 2024/07/11 11:48
Change comment: There is no comment for this version

Summary

Details

Page properties
Title
... ... @@ -1,1 +1,1 @@
1 -2. Bundle settings
1 +2. Bundle config
Content
... ... @@ -48,6 +48,8 @@
48 48  - RFC Norms: Header requirements are regulated by RFC documents that define Internet protocol standards. For example, common headers and their use are described in RFC 7231.
49 49  {{/spoiler}}
50 50  
51 +
52 +
51 51  Parameter {{code language="none"}}clients_tokens{{/code}}
52 52  
53 53  Next, specify an array of client tokens that will have access to the API.
... ... @@ -182,5 +182,118 @@
182 182  * {{code language="none"}}project_description{{/code}}: The project description
183 183  * {{code language="none"}}project_version{{/code}}: The current version of your API
184 184  * {{code language="none"}}async_dsn_info{{/code}}: Indicates whether to display information about asynchronous transport in the documentation
185 -* (% id="cke_bm_826282S" style="display:none" %){{code language="none"}}validations.symfony_asserts{{/code}}{{code language="none"}}validations.symfony_asserts{{/code}}(%%
187 +* (% id="cke_bm_826282S" style="display:none" %){{code language="none"}}validations.symfony_asserts{{/code}}{{code language="none"}}validations.symfony_asserts{{/code}}{{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]])
186 186  
189 +{{code language="yaml" layout="LINENUMBERS" title="config/packages/ufo_json_rpc.yaml"}}
190 +ufo_json_rpc:
191 + docs:
192 + project_name: 'My Project'
193 + project_description: 'My project description'
194 + project_version: '1.0'
195 + # Optional response details
196 + async_dsn_info: false # Provide information about API that work asynchronously
197 + validations:
198 + symfony_asserts: false # Indicates if an array of Symfony validation constraints is used
199 +
200 +{{/code}}
201 +
202 +{{info}}
203 +Do not worry about the security of your authorization data contained in the DSN.
204 +
205 +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.
206 +
207 +The template for protection is {{code language="none"}}/([\w\d_]*(?:secret|access|token|key)[_\w]*)=((?:\w|\d)+(?=&?))/{{/code}}.
208 +
209 +Example:
210 +
211 +{{code language="json" layout="LINENUMBERS" title="RPC_TRANSPORT_DSN=https://sqs.eu-west-3.amazonaws.com/123456789012/messages?access_key=AKIAIOSFODNN7EXAMPLE&secret_key=j17M97ffSVoKI0briFoo9a"}}
212 +{
213 + "async": {
214 + "scheme": "https",
215 + "host": "sqs.eu-west-3.amazonaws.com",
216 + "path": "/123456789012/messages",
217 + "query": "access_key={access_key}&secret_key={secret_key}"
218 + }
219 +}
220 +{{/code}}
221 +{{/info}}
222 +
223 +=== Documentation Example ===
224 +
225 +{{code language="json" layout="LINENUMBERS" title="GET: /api"}}
226 +{
227 + "openrpc":"1.2.6",
228 + "info":{
229 + "title":"My Project",
230 + "description":"My project description",
231 + "contact":{
232 + "name":"ufo-tech/json-rpc-bundle",
233 + "url":"https://docs.ufo-tech.space/bin/view/docs/JsonRpcBundle/?language=en"
234 + },
235 + "license":{
236 + "name":"MIT"
237 + },
238 + "version":"1.0"
239 + },
240 + "servers":[
241 + {
242 + "url":"https://mysite.com/api",
243 + "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.",
244 + "name":"UFO Json-RPC Server v.7.0.0",
245 + "x-method":"POST",
246 + "x-ufo":{
247 + "envelop":"JSON-RPC-2.0/UFO-RPC-7.0.0",
248 + "transport":{
249 + "sync":{
250 + "scheme":"https",
251 + "host":"mysite.com",
252 + "path":"/api",
253 + "method":"POST"
254 + },
255 + "async":{
256 + "scheme":"amqp",
257 + "user":"{user}",
258 + "pass":"{pass}",
259 + "host":"mysite.com",
260 + "port":5672,
261 + "path":"/%2f/json-rpc"
262 + }
263 + },
264 + "documentation":{
265 + "json-rpc":"https://www.jsonrpc.org/specification",
266 + "ufo-tech/json-rpc-bundle":"https://docs.ufo-tech.space/bin/view/docs/JsonRpcBundle/?language=en"
267 + }
268 + }
269 + }
270 + ],
271 + "methods":[
272 + {
273 + "name":"getUserNameByUuid",
274 + "tags":[
275 + {
276 + "name":"App\\Api\\UserApiService"
277 + }
278 + ],
279 + "summary":"Get username by id",
280 + "params":[
281 + {
282 + "name":"userId",
283 + "description":"User Id format uuid",
284 + "required":true,
285 + "schema":{
286 + "type":"string"
287 + },
288 + "x-ufo-assertions": "new Assert\\Uuid()"
289 + }
290 + ],
291 + "result":{
292 + "name":"string",
293 + "description":"User Name",
294 + "schema":{
295 + "type":"string"
296 + }
297 + }
298 + }
299 + ]
300 +}
301 +{{/code}}