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