Below is the json file
{
“openapi”: “3.0.1”,
“info”: {
“title”: “Feedback.Api”,
“version”: “1.12.0”
},
“servers”: [
{
“url”: “https://feedback”
}
],
“paths”: {
“/v1/Surveys/{surveyId}”: {
“get”: {
“tags”: [
“Surveys”
],
“summary”: “Get survey by id”,
“operationId”: “GetSurveyById”,
“parameters”: [
{
“name”: “surveyId”,
“in”: “path”,
“required”: true,
“schema”: {
“type”: “string”,
“format”: “uuid”
}
}
],
},
“/v1/Surveys/{surveyId}/summary”: {
“get”: {
“tags”: [
“Surveys”
],
“summary”: “Get survey summary by survey id”,
“operationId”: “GetSurveySummaryById”,
“parameters”: [
{
“name”: “surveyId”,
“in”: “path”,
“required”: true,
“schema”: {
“type”: “string”,
“format”: “uuid”
}
}
],
“/v1/Surveys”: {
“post”: {
“tags”: [
“Surveys”
],
“summary”: “Create user survey”,
“operationId”: “UpdateUserSurvey”,
“requestBody”: {
“content”: {
“application/json”: {
“schema”: {
“$ref”: “#/components/schemas/UserSurveyViewModel”
}
}
}
}
}
}
Questions:
- I want to get all the paths ( url ) if they are matching get (excluding the post )
- Create new json variable as key value pair with key as path url which are matching get and summary with description as another attribute
Gettiing all the paths
locals {
api-url-paths = [for url in keys(local.swagger-apis.servers) : url]
}
I am able to get all paths but not paths( /v1/Surveys/{surveyId}/summary )which are matching get ( “get”: ) since paths values is dynamic and also the summary value ( “summary”: “Get survey summary by survey id”, )