use of com.devonfw.cobigen.openapiplugin.model.InfoDef in project cobigen by devonfw.
the class OpenAPIInputReader method extractInfo.
/**
* @param openApi document root
* @return an object of {@link InfoDef}
*/
private InfoDef extractInfo(OpenApi3 openApi) {
InfoDef info = new InfoDef();
Info inf = openApi.getInfo();
info.setDescription(inf.getDescription());
info.setTitle(inf.getTitle());
return info;
}
use of com.devonfw.cobigen.openapiplugin.model.InfoDef in project cobigen by devonfw.
the class OpenAPIInputReaderTest method testRetrieveHeaderInfo.
@Test
public void testRetrieveHeaderInfo() throws Exception {
List<Object> inputObjects = getInputs("two-components.yaml");
for (Object o : inputObjects) {
if (isEntityDef(o)) {
EntityDef entityDef = (EntityDef) o;
HeaderDef header = entityDef.getHeader();
InfoDef info = header.getInfo();
assertThat(info.getDescription()).isEqualTo("Example of a API definition");
assertThat(info.getTitle()).isEqualTo("Devon Example");
List<ServerDef> servers = header.getServers();
assertThat(servers).hasSize(1);
ServerDef server = servers.get(0);
assertThat(server.getDescription()).isEqualTo("Just some data");
assertThat(server.getURI()).isEqualTo("https://localhost:8081/server/services/rest");
}
}
}
Aggregations