I have a table where I have a filed (string) with a full Swagger text on it. From this swagger I need to retrieve the elements under the scope object.
Example of the field
swagger: '2.0'
info:
title: "Values"
version: 2.4.0
description: "Lorem iosum."
license:
name: Copyright
url: 'https://lorem.com/'
x-catalogation:
ba: "Execution"
bd: "Loans"
bdd: "Account"
schemes:
- "https"
basePath: "/v2/values"
consumes:
- "application/json"
produces:
- "application/json"
securityDefinitions:
JWTProfile:
type: "oauth"
description: 'OGT'
flow: "implicit"
scopes:
valueid.read: "lorem"
valuelist.read: "lorem"
valuetran.read: "lorem"
value: "lorem"
vlimit: "lorem"
valuestat.read: "lorem"
authorizationUrl: "$(authorization-url)"
x-tokenIntrospect:
url: "$(sca-security-url)"
paths:...
The desire result of the query must be
valueid.read valuelist.read valuetran.read value vlimit valuestat.read
I tried with this query
select unnest (regexp_matches(api_spec, E'\"([a-z]+\\.[a-z]+)\"', 'g')) as scopes from apis
but I retrieve only this scopes
valueid.read valuelist.read valuetran.read valuestat.read
I'm in a corner, someone can help me?