Skip to content
Snippets Groups Projects
Unverified Commit fe7c940e authored by Andrea Franchini's avatar Andrea Franchini
Browse files

Add ?version query param to /modelcheck endpoint

parent ae577f8d
No related branches found
No related tags found
No related merge requests found
import copy
import importlib.resources as ilres
import sys
from typing import Optional, Tuple
from lxml import etree
......@@ -90,7 +91,10 @@ def parse_doml_model(raw_model: bytes, doml_version: Optional[DOMLVersion]) -> T
model, doml_version = get_model(raw_model, doml_version)
else: # if user specifies DOML version, respect that choice!
try:
model = parse_xmi_model(raw_model, doml_version)
except:
raise Exception("Parsing of DOML failed. Perhaps you are using the wrong DOML version or IDE?")
print(f"Using DOML {doml_version.value}")
......
......@@ -15,17 +15,20 @@ def make_error(user_msg, debug_msg=None):
print(f"ERROR [{datetime.datetime.now()}]: {debug_msg}")
return result
def post(body):
def post(body, version=None):
doml_xmi = body
try:
doml_version = None
try:
doml_version: str = os.environ["DOML_VERSION"]
doml_version = DOMLVersion.get(doml_version)
print("Setting DOML version from DOML_VERSION")
except:
pass
if version:
doml_version: str = version
if doml_version:
doml_version = DOMLVersion.get(doml_version)
print(f"Forcing DOML {doml_version.value}")
dmc = ModelChecker(doml_xmi, doml_version)
user_req_store = None
......
......@@ -3,12 +3,13 @@ info:
license:
name: Apache-2.0
title: PIACERE Model Checker
version: "1.0"
version: "2.2.0"
paths:
/modelcheck:
post:
summary: Verify a DOML model
description: Send a DOML model in XMI format and a requirement to check.
The response says whether the requirement is satisfied by the model,
The response says whether the requirements are satisfied by the model,
with a description of the issue if it is not.
operationId: mc_openapi.handlers.post
requestBody:
......@@ -17,6 +18,16 @@ paths:
schema:
type: string
required: true
parameters:
- in: query
name: version
schema:
type: string
description: >
The DOML version you're currently using, written as e.g. `2.0` or `V2_0`.
If not specified, it will try to infer it by trying to parse it for each supported
DOML version, starting with the most recent.
required: false
responses:
"200":
content:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment