Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,14 @@ define generate_client
./scripts/generate_client.sh gooddata-$(1)-client -f "/local/schemas/gooddata-$(1)-client.json"
endef

# The OpenAPI generator aborts on a request body that declares no schema, so such bodies are
# dropped from the merged spec; the per-API specs stay exactly as the backend serves them.
STRIP_SCHEMALESS_BODIES = .paths |= map_values(map_values(if type == "object" and has("requestBody") and ([.requestBody.content[]?.schema] | all(. == null)) then del(.requestBody) else . end))

.PHONY: _api-client-generate
_api-client-generate:
rm -f schemas/gooddata-api-client.json
cat schemas/gooddata-*.json | jq -S -s 'reduce .[] as $$item ({}; . * $$item) + { tags : ( reduce .[].tags as $$item (null; . + $$item) | unique_by(.name) ) }' > "schemas/gooddata-api-client.json"
cat schemas/gooddata-*.json | jq -S -s 'reduce .[] as $$item ({}; . * $$item) + { tags : ( reduce .[].tags as $$item (null; . + $$item) | unique_by(.name) ) }' | jq -S '$(STRIP_SCHEMALESS_BODIES)' > "schemas/gooddata-api-client.json"
$(call generate_client,api)

.PHONY: api-client
Expand Down
Loading
Loading