Skip to content

Commit

Permalink
Configuration: OpenAPI improve (#30)
Browse files Browse the repository at this point in the history
* fix: add openapi base

* Add OpenAPI base
  • Loading branch information
mosoriob authored Feb 17, 2020
1 parent ec2d8aa commit 0107986
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 45 deletions.
7 changes: 0 additions & 7 deletions config-provenance.yaml

This file was deleted.

19 changes: 14 additions & 5 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,21 @@ ontologies:
prefixUri: https://w3id.org/okn/o/sd#
name: modelcatalog
output_dir: outputs
openapi_base: modelcatalog_info.yaml

endpoint:
url: https://endpoint.mint.isi.edu/modelCatalog-1.2.0
prefix: https://w3id.org/okn/i/mint/
graph_base: http://ontosoft.isi.edu:3030/modelCatalog-1.2.0/data/
openapi:
openapi: 3.0.1
info:
description: This is the API of the Software Description Ontology
at [https://mintproject.github.io/Mint-ModelCatalog-Ontology/release/1.3.0/index-en.html](https://w3id.org/okn/o/sdm)
title: Model Catalog
version: v1.3.0
externalDocs:
description: Model Catalog
url: https://w3id.org/okn/o/sdm
servers:
- url: https://api.models.mint.isi.edu/v1.3.0
- url: https://dev.api.models.mint.isi.edu/v1.3.0
- url: http://localhost:8080/v1.3.0

firebase:
key:
Expand Down
15 changes: 15 additions & 0 deletions config.yaml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,18 @@ endpoint:
url: https://endpoint.mint.isi.edu/modelCatalog-1.2.0
prefix: https://w3id.org/okn/i/mint/
graph_base: http://ontosoft.isi.edu:3030/modelCatalog-1.2.0/data/

openapi:
openapi: 3.0.1
info:
description: This is the API of the Software Description Ontology
at [https://mintproject.github.io/Mint-ModelCatalog-Ontology/release/1.3.0/index-en.html](https://w3id.org/okn/o/sdm)
title: Model Catalog
version: v1.3.0
externalDocs:
description: Model Catalog
url: https://w3id.org/okn/o/sdm
servers:
- url: https://api.models.mint.isi.edu/v1.3.0
- url: https://dev.api.models.mint.isi.edu/v1.3.0
- url: http://localhost:8080/v1.3.0
37 changes: 32 additions & 5 deletions docs/configuration_file.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,21 @@ ontologies:
prefixUri: https://w3id.org/okn/o/sd#
name: modelcatalog
output_dir: outputs
openapi_base: modelcatalog_info.yaml

openapi:
openapi: 3.0.1
info:
description: This is the API of the Software Description Ontology
at [https://mintproject.github.io/Mint-ModelCatalog-Ontology/release/1.3.0/index-en.html](https://w3id.org/okn/o/sdm)
title: Model Catalog
version: v1.3.0
externalDocs:
description: Model Catalog
url: https://w3id.org/okn/o/sdm
servers:
- url: https://api.models.mint.isi.edu/v1.3.0
- url: https://dev.api.models.mint.isi.edu/v1.3.0
- url: http://localhost:8080/v1.3.0

endpoint:
url: https://endpoint.mint.isi.edu/modelCatalog-1.2.0
Expand Down Expand Up @@ -62,21 +76,34 @@ output_dir: outputs
```
### openapi_base
### openapi
The path of the [OpenAPI Base file](https://swagger.io/docs/specification/basic-structure/)
| Field | Value |
|---|---|
| **Required:** | ``true`` |
| **Type:** | ``path`` |
| **Type:** | ``OpenAPI`` |
Example:
```yaml
openapi_base: modelcatalog_info.yaml
```
openapi:
openapi: 3.0.1
info:
description: This is the API of the Software Description Ontology
at [https://mintproject.github.io/Mint-ModelCatalog-Ontology/release/1.3.0/index-en.html](https://w3id.org/okn/o/sdm)
title: Model Catalog
version: v1.3.0
externalDocs:
description: Model Catalog
url: https://w3id.org/okn/o/sdm
servers:
- url: https://api.models.mint.isi.edu/v1.3.0
- url: https://dev.api.models.mint.isi.edu/v1.3.0
- url: http://localhost:8080/v1.3.0
```
### endpoint
Expand Down
13 changes: 0 additions & 13 deletions modelcatalog_info.yaml

This file was deleted.

6 changes: 3 additions & 3 deletions src/main/java/edu/isi/oba/MapperDataProperty.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ public MapperDataProperty(String name, List<String> type, Boolean array, Boolean

public Schema getSchemaByDataProperty(){
//TODO: Assumption: only one type
if (this.name.equalsIgnoreCase("hasMaximumAcceptedValue")){
System.out.println("a");
}
//if (this.name.equalsIgnoreCase("hasMaximumAcceptedValue")){
// System.out.println("a");
////}

if (this.type.size() == 0) {
return (array) ? arraySchema(new StringSchema(), nullable) : new StringSchema().nullable(nullable);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/edu/isi/oba/Oba.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static void main(String[] args) throws Exception {
LinkedHashMap<String, PathItem> custom_paths = config_data.getCustom_paths();

//get base of openapi
OpenAPI openapi_base = new OpenAPIV3Parser().read(config_data.getOpenapi_base());
OpenAPI openapi_base = config_data.getOpenapi();
//obtain the output directory to write the openapi specification
//write the openapi specification
generate_openapi_spec(openapi_base, mappers, destination_dir, custom_paths);
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/edu/isi/oba/config/YamlConfig.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package edu.isi.oba.config;


import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.PathItem;
import io.swagger.v3.oas.models.Paths;

import java.util.LinkedHashMap;
import java.util.List;
Expand All @@ -13,9 +12,18 @@ public class YamlConfig {
String DEFAULT_OUTPUT_DIRECTORY = "outputs";
String DEFAULT_PROJECT_NAME = "default_project";

public OpenAPI getOpenapi() {
return openapi;
}

public void setOpenapi(OpenAPI openapi) {
this.openapi = openapi;
}

public OpenAPI openapi;

public String output_dir = DEFAULT_OUTPUT_DIRECTORY;
public String name = DEFAULT_PROJECT_NAME;
public String openapi_base;
public List<String> paths;
public Map<String, OntologyConfig> ontologies;
public EndpointConfig endpoint;
Expand All @@ -40,14 +48,6 @@ public void setName(String name) {
this.name = name;
}

public String getOpenapi_base() {
return openapi_base;
}

public void setOpenapi_base(String openapi_base) {
this.openapi_base = openapi_base;
}

public List<String> getPaths() {
return paths;
}
Expand Down

0 comments on commit 0107986

Please sign in to comment.