Skip to content

Commit

Permalink
Fix a cloud GQL api change for repoTopicsByNamespaceAndRepository (…
Browse files Browse the repository at this point in the history
…now returns a list of `topic` rather than a single `topics` list).
  • Loading branch information
mildbyte committed Aug 18, 2021
1 parent 6eb8c92 commit 8dfa862
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion splitgraph/cloud/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def get_headers():
repository
repoTopicsByNamespaceAndRepository {
nodes {
topics
topic
}
}
repoProfileByNamespaceAndRepository {
Expand Down
6 changes: 2 additions & 4 deletions splitgraph/cloud/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class RepositoriesYAML(BaseModel):
class MetadataResponse(BaseModel):
class RepoTopicsResponse(BaseModel):
class RepositoryTopics(BaseModel):
topics: List[str]
topic: str

nodes: List[RepositoryTopics]

Expand Down Expand Up @@ -116,9 +116,7 @@ def to_metadata(self) -> Metadata:
return Metadata(
readme=Metadata.Readme(text=profile.readme),
description=profile.description,
topics=[
t for node in self.repoTopicsByNamespaceAndRepository.nodes for t in node.topics
],
topics=[node.topic for node in self.repoTopicsByNamespaceAndRepository.nodes],
sources=profile.sources,
license=profile.license,
extra_metadata=profile.metadata.upstream_metadata if profile.metadata else None,
Expand Down
4 changes: 3 additions & 1 deletion test/splitgraph/commandline/http_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ def _gql_callback(request, uri, response_headers):
_somerepo_2 = {
"namespace": "otheruser",
"repository": "somerepo_2",
"repoTopicsByNamespaceAndRepository": {"nodes": [{"topics": ["topic_1", "topic_2"]}]},
"repoTopicsByNamespaceAndRepository": {
"nodes": [{"topic": "topic_1"}, {"topic": "topic_2"}]
},
"repoProfileByNamespaceAndRepository": {
"description": "Repository Description 2",
"license": None,
Expand Down

0 comments on commit 8dfa862

Please sign in to comment.