Skip to content

Commit cbe9e87

Browse files
authored
fix: remove '_' from the class_name (#135)
* fix: wrong opeanpi spec fix: #132 * fix: remove '_' from the class_name mustache (the template manager used by the openapi generator) is removing the underscore symbol from the class name The serializer python creates a variable file with the URI and name of the class. However, it wasn't removing the symbol. The commit fixes #134
1 parent d7292ec commit cbe9e87

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

.ci/business.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
set -xe
2+
3+
container_name="business"
4+
java -jar target/oba-*-jar-with-dependencies.jar -c examples/business/config.yaml
5+
pushd outputs/BusinessOntology/servers/python
6+
bash generate-server.sh
7+
pushd server
8+
docker build -t openapi_server .
9+
docker run --name ${container_name} -d -p 8081:8080 openapi_server
10+
popd
11+
sleep 10s
12+
curl -X GET "http://0.0.0.0:8081/v1.3.0/bands/Pink_Floyd" -H "accept: application/json"
13+
docker logs ${container_name}
14+
docker rm -f ${container_name}

examples/business/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ openapi:
1515
url: https://www.semanticarts.com/gist/previous-versions/
1616
servers:
1717
- url: http://localhost:8080/v1
18-
- description: localhost server
18+
description: localhost server
1919

2020
## Ontologies
2121
### List of ontologies

src/main/java/edu/isi/oba/SerializerPython.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ private void add_variable_python(FileWriter myWriter, Iterator it) {
7171
clsIRI = (IRI) pair.getKey();
7272
name = (String) pair.getValue();
7373
try {
74-
String variable_name = name.toUpperCase().replace("-", "");
74+
String variable_name = name.toUpperCase().replace("-", "").replace("_", "");
7575
//TODO: Catch class name empty
7676
String catch_temp = name.replace("<", "").replace(">", "");
7777
if (!catch_temp.equals(clsIRI.toString())) {

0 commit comments

Comments
 (0)