Skip to content

Commit

Permalink
fix: remove '_' from the class_name (#135)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
mosoriob committed Oct 12, 2020
1 parent d7292ec commit cbe9e87
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions .ci/business.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
set -xe

container_name="business"
java -jar target/oba-*-jar-with-dependencies.jar -c examples/business/config.yaml
pushd outputs/BusinessOntology/servers/python
bash generate-server.sh
pushd server
docker build -t openapi_server .
docker run --name ${container_name} -d -p 8081:8080 openapi_server
popd
sleep 10s
curl -X GET "http://0.0.0.0:8081/v1.3.0/bands/Pink_Floyd" -H "accept: application/json"
docker logs ${container_name}
docker rm -f ${container_name}
2 changes: 1 addition & 1 deletion examples/business/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ openapi:
url: https://www.semanticarts.com/gist/previous-versions/
servers:
- url: http://localhost:8080/v1
- description: localhost server
description: localhost server

## Ontologies
### List of ontologies
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/edu/isi/oba/SerializerPython.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private void add_variable_python(FileWriter myWriter, Iterator it) {
clsIRI = (IRI) pair.getKey();
name = (String) pair.getValue();
try {
String variable_name = name.toUpperCase().replace("-", "");
String variable_name = name.toUpperCase().replace("-", "").replace("_", "");
//TODO: Catch class name empty
String catch_temp = name.replace("<", "").replace(">", "");
if (!catch_temp.equals(clsIRI.toString())) {
Expand Down

0 comments on commit cbe9e87

Please sign in to comment.