· 6 years ago · Apr 07, 2020, 11:18 PM
1def create_doc(doc: Dict[str, Any], HYDRUS_SERVER_URL: str = None,
2 API_NAME: str = None) -> HydraDoc:
3 """Create the HydraDoc object from the API Documentation.
4
5 Raises:
6 SyntaxError: If the `doc` doesn't have an entry for `@id` key.
7 SyntaxError: If the `@id` key of the `doc` is not of
8 the form : '[protocol] :// [base url] / [entrypoint] / vocab'
9
10 """
11 # Check @id
12 try:
13 id_ = doc["@id"]
14 except KeyError:
15 raise SyntaxError("The API Documentation must have [@id]")