Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Links can be strings #16

Merged
merged 2 commits into from
Jun 13, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
105 changes: 65 additions & 40 deletions openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,45 +124,6 @@
},
"components": {
"schemas": {
"StructureResourceAttributes": {
"title": "StructureResourceAttributes",
"required": [
"local_id",
"last_modified"
],
"type": "object",
"properties": {
"local_id": {
"title": "Local_Id",
"type": "string"
},
"last_modified": {
"title": "Last_Modified",
"type": "string",
"format": "date-time"
},
"immutable_id": {
"title": "Immutable_Id",
"type": "string"
},
"elements": {
"title": "Elements",
"type": "string"
},
"nelements": {
"title": "Nelements",
"type": "integer"
},
"chemical_formula": {
"title": "Chemical_Formula",
"type": "string"
},
"formula_prototype": {
"title": "Formula_Prototype",
"type": "string"
}
}
},
"Link": {
"title": "Link",
"required": [
Expand All @@ -188,7 +149,32 @@
"type": "object",
"properties": {
"next": {
"$ref": "#/components/schemas/Link"
"title": "Next",
"anyOf": [
{
"minLength": 1,
"maxLength": 65536,
"type": "string",
"format": "uri"
},
{
"$ref": "#/components/schemas/Link"
}
]
},
"base_url": {
"title": "Base_Url",
"anyOf": [
{
"minLength": 1,
"maxLength": 65536,
"type": "string",
"format": "uri"
},
{
"$ref": "#/components/schemas/Link"
}
]
}
}
},
Expand Down Expand Up @@ -241,6 +227,45 @@
},
"description": "A JSON API meta member that contains JSON API meta objects of non-standard meta-information.\n\nIn addition to the required fields, it MAY contain\n\n- `data_available`: an integer containing the total number of data objects available in the database.\n- `last_id`: a string containing the last ID returned.\n- `response_message`: response string from the server.\n\nOther OPTIONAL additional information global to the query that is not specified in this document, MUST start with\na database-provider-specific prefix"
},
"StructureResourceAttributes": {
"title": "StructureResourceAttributes",
"required": [
"local_id",
"last_modified"
],
"type": "object",
"properties": {
"local_id": {
"title": "Local_Id",
"type": "string"
},
"last_modified": {
"title": "Last_Modified",
"type": "string",
"format": "date-time"
},
"immutable_id": {
"title": "Immutable_Id",
"type": "string"
},
"elements": {
"title": "Elements",
"type": "string"
},
"nelements": {
"title": "Nelements",
"type": "integer"
},
"chemical_formula": {
"title": "Chemical_Formula",
"type": "string"
},
"formula_prototype": {
"title": "Formula_Prototype",
"type": "string"
}
}
},
"StructureResource": {
"title": "StructureResource",
"required": [
Expand Down
5 changes: 3 additions & 2 deletions optimade/server/models/jsonapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
from typing import Optional

from pydantic import BaseModel, UrlStr
from pydantic import BaseModel, UrlStr, Union


class Link(BaseModel):
Expand All @@ -12,7 +12,8 @@ class Link(BaseModel):


class Links(BaseModel):
next: Optional[Link]
next: Optional[Union[UrlStr,Link]]
base_url: Optional[Union[UrlStr,Link]]


class Resource(BaseModel):
Expand Down