Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/models/graphiti/open_api/endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ def paths
{
path => {
parameters: parameters,
}.merge(collection_actions.map(&:operation).inject(&:merge)),
}.merge(collection_actions.map(&:operation).inject({}, &:merge)),
resource_path => {
parameters: [{'$ref': "#/components/parameters/#{resource.type}_id"}] + parameters,
}.merge(resource_actions.map(&:operation).inject(&:merge)),
}.merge(resource_actions.map(&:operation).inject({}, &:merge)),
}
end

Expand All @@ -52,7 +52,7 @@ def parameters
end

def resource
resource_actions.first.resource
actions.first.resource
end

def_instance_delegators :resource, :type
Expand Down
132 changes: 132 additions & 0 deletions spec/fixtures/files/schema_basic.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,124 @@
"count"
]
}
},
{
"name": "CreateOnlyResource",
"type": "create_only_entities",
"graphql_entrypoint": "createOnlyEntities",
"description": "Resource supporting only the create action.",
"attributes": {
"id": {
"type": "integer_id",
"readable": true,
"writable": true,
"description": null
},
"label": {
"type": "string",
"readable": true,
"writable": true,
"description": null
}
},
"extra_attributes": {},
"sorts": {
"id": {},
"label": {}
},
"filters": {
"id": {
"type": "integer_id",
"operators": [
"eq",
"not_eq",
"gt",
"gte",
"lt",
"lte"
]
},
"label": {
"type": "string",
"operators": [
"eq",
"not_eq",
"eql",
"not_eql",
"prefix",
"not_prefix",
"suffix",
"not_suffix",
"match",
"not_match"
]
}
},
"relationships": {},
"stats": {
"total": [
"count"
]
}
},
{
"name": "ShowOnlyResource",
"type": "show_only_entities",
"graphql_entrypoint": "showOnlyEntities",
"description": "Resource supporting only the show action.",
"attributes": {
"id": {
"type": "integer_id",
"readable": true,
"writable": true,
"description": null
},
"label": {
"type": "string",
"readable": true,
"writable": true,
"description": null
}
},
"extra_attributes": {},
"sorts": {
"id": {},
"label": {}
},
"filters": {
"id": {
"type": "integer_id",
"operators": [
"eq",
"not_eq",
"gt",
"gte",
"lt",
"lte"
]
},
"label": {
"type": "string",
"operators": [
"eq",
"not_eq",
"eql",
"not_eql",
"prefix",
"not_prefix",
"suffix",
"not_suffix",
"match",
"not_match"
]
}
},
"relationships": {},
"stats": {
"total": [
"count"
]
}
}
],
"endpoints": {
Expand All @@ -79,6 +197,20 @@
"resource": "EntityResource"
}
}
},
"/api/v1/create_only_entities": {
"actions": {
"create": {
"resource": "CreateOnlyResource"
}
}
},
"/api/v1/show_only_entities": {
"actions": {
"show": {
"resource": "ShowOnlyResource"
}
}
}
},
"types": {
Expand Down