@@ -290,3 +290,194 @@ select postgrest_openapi_spec('{test}')->'components'->'responses' ? 'mayBeEmpty
290290 f
291291(1 row)
292292
293+ -- Functions
294+ -- Returning composite types
295+ -- defines an application/json response
296+ select jsonb_pretty(postgrest_openapi_spec('{test}')->'components'->'responses'->'rpc.get_attribute'->'content'->'application/json');
297+ jsonb_pretty
298+ ------------------------------------------------------------
299+ { +
300+ "schema": { +
301+ "$ref": "#/components/schemas/types.attribute_ret"+
302+ } +
303+ }
304+ (1 row)
305+
306+ -- defines an application/vnd.pgrst.object+json response
307+ select jsonb_pretty(postgrest_openapi_spec('{test}')->'components'->'responses'->'rpc.get_attribute'->'content'->'application/vnd.pgrst.object+json');
308+ jsonb_pretty
309+ ------------------------------------------------------------
310+ { +
311+ "schema": { +
312+ "$ref": "#/components/schemas/types.attribute_ret"+
313+ } +
314+ }
315+ (1 row)
316+
317+ -- defines an application/vnd.pgrst.object+json;nulls=stripped response
318+ select jsonb_pretty(postgrest_openapi_spec('{test}')->'components'->'responses'->'rpc.get_attribute'->'content'->'application/vnd.pgrst.object+json;nulls=stripped');
319+ jsonb_pretty
320+ ------------------------------------------------------------
321+ { +
322+ "schema": { +
323+ "$ref": "#/components/schemas/types.attribute_ret"+
324+ } +
325+ }
326+ (1 row)
327+
328+ -- defines a text/csv response
329+ select jsonb_pretty(postgrest_openapi_spec('{test}')->'components'->'responses'->'rpc.get_attribute'->'content'->'text/csv');
330+ jsonb_pretty
331+ ---------------------------
332+ { +
333+ "schema": { +
334+ "type": "string",+
335+ "format": "csv" +
336+ } +
337+ }
338+ (1 row)
339+
340+ -- Returning SET OF composite types
341+ -- defines an application/json response
342+ select jsonb_pretty(postgrest_openapi_spec('{test}')->'components'->'responses'->'rpc.get_products_by_size'->'content'->'application/json');
343+ jsonb_pretty
344+ -----------------------------------------------------
345+ { +
346+ "schema": { +
347+ "type": "array", +
348+ "items": { +
349+ "$ref": "#/components/schemas/products"+
350+ } +
351+ } +
352+ }
353+ (1 row)
354+
355+ -- defines an application/vnd.pgrst.object+json response
356+ select jsonb_pretty(postgrest_openapi_spec('{test}')->'components'->'responses'->'rpc.get_products_by_size'->'content'->'application/vnd.pgrst.object+json');
357+ jsonb_pretty
358+ -------------------------------------------------
359+ { +
360+ "schema": { +
361+ "$ref": "#/components/schemas/products"+
362+ } +
363+ }
364+ (1 row)
365+
366+ -- defines an application/vnd.pgrst.object+json;nulls=stripped response
367+ select jsonb_pretty(postgrest_openapi_spec('{test}')->'components'->'responses'->'rpc.get_products_by_size'->'content'->'application/vnd.pgrst.object+json;nulls=stripped');
368+ jsonb_pretty
369+ -------------------------------------------------
370+ { +
371+ "schema": { +
372+ "$ref": "#/components/schemas/products"+
373+ } +
374+ }
375+ (1 row)
376+
377+ -- defines a text/csv response
378+ select jsonb_pretty(postgrest_openapi_spec('{test}')->'components'->'responses'->'rpc.get_products_by_size'->'content'->'text/csv');
379+ jsonb_pretty
380+ ---------------------------
381+ { +
382+ "schema": { +
383+ "type": "string",+
384+ "format": "csv" +
385+ } +
386+ }
387+ (1 row)
388+
389+ -- Returning non-composite types
390+ -- defines an application/json response
391+ select jsonb_pretty(postgrest_openapi_spec('{test}')->'components'->'responses'->'rpc.returns_inout_out'->'content'->'application/json');
392+ jsonb_pretty
393+ --------------------------------------------------------------
394+ { +
395+ "schema": { +
396+ "$ref": "#/components/schemas/rpc.returns_inout_out"+
397+ } +
398+ }
399+ (1 row)
400+
401+ -- defines an application/vnd.pgrst.object+json response
402+ select jsonb_pretty(postgrest_openapi_spec('{test}')->'components'->'responses'->'rpc.returns_inout_out'->'content'->'application/vnd.pgrst.object+json');
403+ jsonb_pretty
404+ --------------------------------------------------------------
405+ { +
406+ "schema": { +
407+ "$ref": "#/components/schemas/rpc.returns_inout_out"+
408+ } +
409+ }
410+ (1 row)
411+
412+ -- defines an application/vnd.pgrst.object+json;nulls=stripped response
413+ select jsonb_pretty(postgrest_openapi_spec('{test}')->'components'->'responses'->'rpc.returns_inout_out'->'content'->'application/vnd.pgrst.object+json;nulls=stripped');
414+ jsonb_pretty
415+ --------------------------------------------------------------
416+ { +
417+ "schema": { +
418+ "$ref": "#/components/schemas/rpc.returns_inout_out"+
419+ } +
420+ }
421+ (1 row)
422+
423+ -- defines a text/csv response
424+ select jsonb_pretty(postgrest_openapi_spec('{test}')->'components'->'responses'->'rpc.returns_inout_out'->'content'->'text/csv');
425+ jsonb_pretty
426+ ---------------------------
427+ { +
428+ "schema": { +
429+ "type": "string",+
430+ "format": "csv" +
431+ } +
432+ }
433+ (1 row)
434+
435+ -- Returning SET OF non-composite types
436+ -- defines an application/json response
437+ select jsonb_pretty(postgrest_openapi_spec('{test}')->'components'->'responses'->'rpc.returns_table'->'content'->'application/json');
438+ jsonb_pretty
439+ --------------------------------------------------------------
440+ { +
441+ "schema": { +
442+ "type": "array", +
443+ "items": { +
444+ "$ref": "#/components/schemas/rpc.returns_table"+
445+ } +
446+ } +
447+ }
448+ (1 row)
449+
450+ -- defines an application/vnd.pgrst.object+json response
451+ select jsonb_pretty(postgrest_openapi_spec('{test}')->'components'->'responses'->'rpc.returns_table'->'content'->'application/vnd.pgrst.object+json');
452+ jsonb_pretty
453+ ----------------------------------------------------------
454+ { +
455+ "schema": { +
456+ "$ref": "#/components/schemas/rpc.returns_table"+
457+ } +
458+ }
459+ (1 row)
460+
461+ -- defines an application/vnd.pgrst.object+json;nulls=stripped response
462+ select jsonb_pretty(postgrest_openapi_spec('{test}')->'components'->'responses'->'rpc.returns_table'->'content'->'application/vnd.pgrst.object+json;nulls=stripped');
463+ jsonb_pretty
464+ ----------------------------------------------------------
465+ { +
466+ "schema": { +
467+ "$ref": "#/components/schemas/rpc.returns_table"+
468+ } +
469+ }
470+ (1 row)
471+
472+ -- defines a text/csv response
473+ select jsonb_pretty(postgrest_openapi_spec('{test}')->'components'->'responses'->'rpc.returns_table'->'content'->'text/csv');
474+ jsonb_pretty
475+ ---------------------------
476+ { +
477+ "schema": { +
478+ "type": "string",+
479+ "format": "csv" +
480+ } +
481+ }
482+ (1 row)
483+
0 commit comments