CE-1887 Migrate openAPI model classes out of qqq-middleware-api, into new qqq-openapi module (for re-use within qqq-midleware-javalin)

This commit is contained in:
2024-10-17 11:46:29 -05:00
parent 27dbc72db4
commit fc23718c4f
49 changed files with 4808 additions and 96 deletions

View File

@ -36,6 +36,7 @@
<module>qqq-backend-module-rdbms</module>
<module>qqq-backend-module-mongodb</module>
<module>qqq-language-support-javascript</module>
<module>qqq-openapi</module>
<module>qqq-middleware-picocli</module>
<module>qqq-middleware-javalin</module>
<module>qqq-middleware-lambda</module>

View File

@ -74,6 +74,11 @@
<artifactId>qqq-middleware-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.kingsrook.qqq</groupId>
<artifactId>qqq-openapi</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.kingsrook.qqq</groupId>
<artifactId>qqq-middleware-picocli</artifactId>

View File

@ -48,13 +48,13 @@
<artifactId>qqq-middleware-javalin</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.kingsrook.qqq</groupId>
<artifactId>qqq-openapi</artifactId>
<version>${revision}</version>
</dependency>
<!-- 3rd party deps specifically for this module -->
<dependency>
<groupId>io.javalin</groupId>
<artifactId>javalin</artifactId>
<version>5.1.4</version>
</dependency>
<dependency>
<groupId>com.konghq</groupId>
<artifactId>unirest-java</artifactId>

View File

@ -51,22 +51,6 @@ import com.kingsrook.qqq.api.model.metadata.processes.ApiProcessUtils;
import com.kingsrook.qqq.api.model.metadata.tables.ApiAssociationMetaData;
import com.kingsrook.qqq.api.model.metadata.tables.ApiTableMetaData;
import com.kingsrook.qqq.api.model.metadata.tables.ApiTableMetaDataContainer;
import com.kingsrook.qqq.api.model.openapi.Components;
import com.kingsrook.qqq.api.model.openapi.Contact;
import com.kingsrook.qqq.api.model.openapi.Content;
import com.kingsrook.qqq.api.model.openapi.Example;
import com.kingsrook.qqq.api.model.openapi.ExampleWithListValue;
import com.kingsrook.qqq.api.model.openapi.ExampleWithSingleValue;
import com.kingsrook.qqq.api.model.openapi.Info;
import com.kingsrook.qqq.api.model.openapi.Method;
import com.kingsrook.qqq.api.model.openapi.OpenAPI;
import com.kingsrook.qqq.api.model.openapi.Parameter;
import com.kingsrook.qqq.api.model.openapi.Path;
import com.kingsrook.qqq.api.model.openapi.RequestBody;
import com.kingsrook.qqq.api.model.openapi.Response;
import com.kingsrook.qqq.api.model.openapi.Schema;
import com.kingsrook.qqq.api.model.openapi.SecurityScheme;
import com.kingsrook.qqq.api.model.openapi.Tag;
import com.kingsrook.qqq.backend.core.actions.AbstractQActionFunction;
import com.kingsrook.qqq.backend.core.actions.permissions.PermissionsHelper;
import com.kingsrook.qqq.backend.core.actions.permissions.TablePermissionSubType;
@ -93,6 +77,22 @@ import com.kingsrook.qqq.backend.core.utils.StringUtils;
import com.kingsrook.qqq.backend.core.utils.YamlUtils;
import com.kingsrook.qqq.backend.core.utils.collections.ListBuilder;
import com.kingsrook.qqq.backend.core.utils.collections.MapBuilder;
import com.kingsrook.qqq.openapi.model.Components;
import com.kingsrook.qqq.openapi.model.Contact;
import com.kingsrook.qqq.openapi.model.Content;
import com.kingsrook.qqq.openapi.model.Example;
import com.kingsrook.qqq.openapi.model.ExampleWithListValue;
import com.kingsrook.qqq.openapi.model.ExampleWithSingleValue;
import com.kingsrook.qqq.openapi.model.Info;
import com.kingsrook.qqq.openapi.model.Method;
import com.kingsrook.qqq.openapi.model.OpenAPI;
import com.kingsrook.qqq.openapi.model.Parameter;
import com.kingsrook.qqq.openapi.model.Path;
import com.kingsrook.qqq.openapi.model.RequestBody;
import com.kingsrook.qqq.openapi.model.Response;
import com.kingsrook.qqq.openapi.model.Schema;
import com.kingsrook.qqq.openapi.model.SecurityScheme;
import com.kingsrook.qqq.openapi.model.Tag;
import io.javalin.http.ContentType;
import io.javalin.http.HttpStatus;
import org.apache.commons.lang.BooleanUtils;

View File

@ -31,14 +31,14 @@ import com.kingsrook.qqq.api.model.metadata.processes.ApiProcessInput;
import com.kingsrook.qqq.api.model.metadata.processes.ApiProcessInputFieldsContainer;
import com.kingsrook.qqq.api.model.metadata.processes.ApiProcessMetaData;
import com.kingsrook.qqq.api.model.metadata.processes.ApiProcessMetaDataContainer;
import com.kingsrook.qqq.api.model.openapi.ExampleWithListValue;
import com.kingsrook.qqq.api.model.openapi.ExampleWithSingleValue;
import com.kingsrook.qqq.api.model.openapi.HttpMethod;
import com.kingsrook.qqq.backend.core.model.actions.reporting.ReportFormatPossibleValueEnum;
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldType;
import com.kingsrook.qqq.backend.core.model.metadata.processes.QProcessMetaData;
import com.kingsrook.qqq.openapi.model.ExampleWithListValue;
import com.kingsrook.qqq.openapi.model.ExampleWithSingleValue;
import com.kingsrook.qqq.openapi.model.HttpMethod;
/*******************************************************************************

View File

@ -27,15 +27,15 @@ import java.util.LinkedHashMap;
import java.util.Map;
import com.kingsrook.qqq.api.model.actions.HttpApiResponse;
import com.kingsrook.qqq.api.model.metadata.processes.ApiProcessOutputInterface;
import com.kingsrook.qqq.api.model.openapi.Content;
import com.kingsrook.qqq.api.model.openapi.Response;
import com.kingsrook.qqq.api.model.openapi.Schema;
import com.kingsrook.qqq.backend.core.actions.tables.StorageAction;
import com.kingsrook.qqq.backend.core.exceptions.QException;
import com.kingsrook.qqq.backend.core.model.actions.processes.RunProcessInput;
import com.kingsrook.qqq.backend.core.model.actions.processes.RunProcessOutput;
import com.kingsrook.qqq.backend.core.model.actions.reporting.ReportFormat;
import com.kingsrook.qqq.backend.core.model.actions.tables.storage.StorageInput;
import com.kingsrook.qqq.openapi.model.Content;
import com.kingsrook.qqq.openapi.model.Response;
import com.kingsrook.qqq.openapi.model.Schema;
import org.eclipse.jetty.http.HttpStatus;

View File

@ -53,7 +53,6 @@ import com.kingsrook.qqq.api.model.metadata.processes.ApiProcessMetaDataContaine
import com.kingsrook.qqq.api.model.metadata.processes.ApiProcessUtils;
import com.kingsrook.qqq.api.model.metadata.tables.ApiTableMetaData;
import com.kingsrook.qqq.api.model.metadata.tables.ApiTableMetaDataContainer;
import com.kingsrook.qqq.api.model.openapi.HttpMethod;
import com.kingsrook.qqq.backend.core.actions.tables.GetAction;
import com.kingsrook.qqq.backend.core.actions.tables.InsertAction;
import com.kingsrook.qqq.backend.core.context.QContext;
@ -87,6 +86,7 @@ import com.kingsrook.qqq.backend.core.utils.StringUtils;
import com.kingsrook.qqq.backend.core.utils.collections.MapBuilder;
import com.kingsrook.qqq.backend.javalin.QJavalinAccessLogger;
import com.kingsrook.qqq.backend.javalin.QJavalinImplementation;
import com.kingsrook.qqq.openapi.model.HttpMethod;
import io.javalin.apibuilder.ApiBuilder;
import io.javalin.apibuilder.EndpointGroup;
import io.javalin.http.ContentType;
@ -135,8 +135,17 @@ public class QJavalinApiHandler
///////////////////////////////////////////////
// static endpoints to support rapidoc pages //
///////////////////////////////////////////////
ApiBuilder.get("/api/docs/js/rapidoc.min.js", (context) -> QJavalinApiHandler.serveResource(context, "rapidoc/rapidoc-9.3.4.min.js", MapBuilder.of("Content-Type", ContentType.JAVASCRIPT)));
ApiBuilder.get("/api/docs/css/qqq-api-styles.css", (context) -> QJavalinApiHandler.serveResource(context, "rapidoc/rapidoc-overrides.css", MapBuilder.of("Content-Type", ContentType.CSS)));
try
{
ApiBuilder.get("/api/docs/js/rapidoc.min.js", (context) -> QJavalinApiHandler.serveResource(context, "rapidoc/rapidoc-9.3.8.min.js", MapBuilder.of("Content-Type", ContentType.JAVASCRIPT)));
ApiBuilder.get("/api/docs/css/qqq-api-styles.css", (context) -> QJavalinApiHandler.serveResource(context, "rapidoc/rapidoc-overrides.css", MapBuilder.of("Content-Type", ContentType.CSS)));
}
catch(IllegalArgumentException iae)
{
//////////////////////////////////////////////////////////////
// assume a different module already registered these paths //
//////////////////////////////////////////////////////////////
}
ApiBuilder.get("/apis.json", QJavalinApiHandler::doGetApisJson);

View File

@ -22,8 +22,8 @@
package com.kingsrook.qqq.api.model.actions;
import com.kingsrook.qqq.api.model.openapi.OpenAPI;
import com.kingsrook.qqq.backend.core.model.actions.AbstractActionOutput;
import com.kingsrook.qqq.openapi.model.OpenAPI;
/*******************************************************************************

View File

@ -32,13 +32,13 @@ import java.util.Set;
import com.kingsrook.qqq.api.model.APIVersion;
import com.kingsrook.qqq.api.model.metadata.tables.ApiTableMetaData;
import com.kingsrook.qqq.api.model.metadata.tables.ApiTableMetaDataContainer;
import com.kingsrook.qqq.api.model.openapi.SecurityScheme;
import com.kingsrook.qqq.api.model.openapi.Server;
import com.kingsrook.qqq.backend.core.instances.QInstanceValidator;
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
import com.kingsrook.qqq.backend.core.model.metadata.tables.QTableMetaData;
import com.kingsrook.qqq.backend.core.utils.CollectionUtils;
import com.kingsrook.qqq.backend.core.utils.StringUtils;
import com.kingsrook.qqq.openapi.model.SecurityScheme;
import com.kingsrook.qqq.openapi.model.Server;
import org.apache.commons.lang.BooleanUtils;

View File

@ -23,10 +23,10 @@ package com.kingsrook.qqq.api.model.metadata.fields;
import java.util.Map;
import com.kingsrook.qqq.api.model.openapi.Example;
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
import com.kingsrook.qqq.backend.core.utils.StringUtils;
import com.kingsrook.qqq.openapi.model.Example;
/*******************************************************************************

View File

@ -29,7 +29,6 @@ import com.kingsrook.qqq.api.ApiSupplementType;
import com.kingsrook.qqq.api.model.APIVersionRange;
import com.kingsrook.qqq.api.model.metadata.fields.ApiFieldMetaData;
import com.kingsrook.qqq.api.model.metadata.fields.ApiFieldMetaDataContainer;
import com.kingsrook.qqq.api.model.openapi.HttpMethod;
import com.kingsrook.qqq.backend.core.instances.QInstanceEnricher;
import com.kingsrook.qqq.backend.core.instances.QInstanceValidator;
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
@ -39,6 +38,7 @@ import com.kingsrook.qqq.backend.core.model.metadata.processes.QProcessMetaData;
import com.kingsrook.qqq.backend.core.utils.CollectionUtils;
import com.kingsrook.qqq.backend.core.utils.StringUtils;
import com.kingsrook.qqq.backend.core.utils.collections.ListBuilder;
import com.kingsrook.qqq.openapi.model.HttpMethod;
import org.apache.commons.lang.BooleanUtils;

View File

@ -31,11 +31,6 @@ import java.util.Objects;
import com.kingsrook.qqq.api.actions.GenerateOpenApiSpecAction;
import com.kingsrook.qqq.api.model.metadata.fields.ApiFieldMetaData;
import com.kingsrook.qqq.api.model.metadata.fields.ApiFieldMetaDataContainer;
import com.kingsrook.qqq.api.model.openapi.Content;
import com.kingsrook.qqq.api.model.openapi.ExampleWithListValue;
import com.kingsrook.qqq.api.model.openapi.ExampleWithSingleValue;
import com.kingsrook.qqq.api.model.openapi.Response;
import com.kingsrook.qqq.api.model.openapi.Schema;
import com.kingsrook.qqq.backend.core.model.actions.processes.RunProcessInput;
import com.kingsrook.qqq.backend.core.model.actions.processes.RunProcessOutput;
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
@ -43,6 +38,11 @@ import com.kingsrook.qqq.backend.core.utils.CollectionUtils;
import com.kingsrook.qqq.backend.core.utils.ObjectUtils;
import com.kingsrook.qqq.backend.core.utils.StringUtils;
import com.kingsrook.qqq.backend.core.utils.collections.MapBuilder;
import com.kingsrook.qqq.openapi.model.Content;
import com.kingsrook.qqq.openapi.model.ExampleWithListValue;
import com.kingsrook.qqq.openapi.model.ExampleWithSingleValue;
import com.kingsrook.qqq.openapi.model.Response;
import com.kingsrook.qqq.openapi.model.Schema;
import io.javalin.http.ContentType;
import org.eclipse.jetty.http.HttpStatus;

View File

@ -25,11 +25,11 @@ package com.kingsrook.qqq.api.model.metadata.processes;
import java.io.Serializable;
import java.util.Map;
import com.kingsrook.qqq.api.model.actions.HttpApiResponse;
import com.kingsrook.qqq.api.model.openapi.Response;
import com.kingsrook.qqq.backend.core.exceptions.QException;
import com.kingsrook.qqq.backend.core.model.actions.processes.RunProcessInput;
import com.kingsrook.qqq.backend.core.model.actions.processes.RunProcessOutput;
import com.kingsrook.qqq.backend.core.utils.collections.MapBuilder;
import com.kingsrook.qqq.openapi.model.Response;
import org.eclipse.jetty.http.HttpStatus;

View File

@ -28,9 +28,6 @@ import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import com.kingsrook.qqq.api.model.openapi.Content;
import com.kingsrook.qqq.api.model.openapi.Response;
import com.kingsrook.qqq.api.model.openapi.Schema;
import com.kingsrook.qqq.backend.core.exceptions.QException;
import com.kingsrook.qqq.backend.core.logging.QLogger;
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryFilterLink;
@ -42,6 +39,9 @@ import com.kingsrook.qqq.backend.core.model.actions.processes.RunProcessOutput;
import com.kingsrook.qqq.backend.core.utils.CollectionUtils;
import com.kingsrook.qqq.backend.core.utils.collections.ListBuilder;
import com.kingsrook.qqq.backend.core.utils.collections.MapBuilder;
import com.kingsrook.qqq.openapi.model.Content;
import com.kingsrook.qqq.openapi.model.Response;
import com.kingsrook.qqq.openapi.model.Schema;
import io.javalin.http.ContentType;
import org.apache.commons.lang.NotImplementedException;
import org.eclipse.jetty.http.HttpStatus;

View File

@ -38,7 +38,6 @@ import com.kingsrook.qqq.api.model.metadata.processes.ApiProcessObjectOutput;
import com.kingsrook.qqq.api.model.metadata.processes.ApiProcessSummaryListOutput;
import com.kingsrook.qqq.api.model.metadata.tables.ApiTableMetaData;
import com.kingsrook.qqq.api.model.metadata.tables.ApiTableMetaDataContainer;
import com.kingsrook.qqq.api.model.openapi.HttpMethod;
import com.kingsrook.qqq.backend.core.actions.customizers.AbstractPreDeleteCustomizer;
import com.kingsrook.qqq.backend.core.actions.customizers.AbstractPreInsertCustomizer;
import com.kingsrook.qqq.backend.core.actions.customizers.AbstractPreUpdateCustomizer;
@ -86,6 +85,7 @@ import com.kingsrook.qqq.backend.core.processes.implementations.etl.streamedwith
import com.kingsrook.qqq.backend.core.processes.implementations.etl.streamedwithfrontend.StreamedETLWithFrontendProcess;
import com.kingsrook.qqq.backend.core.processes.implementations.savedreports.RenderSavedReportMetaDataProducer;
import com.kingsrook.qqq.backend.core.utils.CollectionUtils;
import com.kingsrook.qqq.openapi.model.HttpMethod;
/*******************************************************************************

View File

@ -78,9 +78,9 @@ class QJavalinApiHandlerPermissionsTest extends BaseTest
}
qJavalinImplementation = new QJavalinImplementation(qInstance);
qJavalinImplementation.startJavalinServer(PORT);
EndpointGroup routes = new QJavalinApiHandler(qInstance).getRoutes();
qJavalinImplementation.getJavalinService().routes(routes);
qJavalinImplementation.addJavalinRoutes(routes);
qJavalinImplementation.startJavalinServer(PORT);
}

View File

@ -112,9 +112,9 @@ class QJavalinApiHandlerTest extends BaseTest
.withInitialVersion(TestUtils.V2022_Q4))));
qJavalinImplementation = new QJavalinImplementation(qInstance);
qJavalinImplementation.startJavalinServer(PORT);
EndpointGroup routes = new QJavalinApiHandler(qInstance).getRoutes();
qJavalinImplementation.getJavalinService().routes(routes);
qJavalinImplementation.addJavalinRoutes(routes);
qJavalinImplementation.startJavalinServer(PORT);
}

81
qqq-openapi/pom.xml Normal file
View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ QQQ - Low-code Application Framework for Engineers.
~ Copyright (C) 2021-2022. Kingsrook, LLC
~ 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
~ contact@kingsrook.com
~ https://github.com/Kingsrook/
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU Affero General Public License as
~ published by the Free Software Foundation, either version 3 of the
~ License, or (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU Affero General Public License for more details.
~
~ You should have received a copy of the GNU Affero General Public License
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>qqq-openapi</artifactId>
<parent>
<groupId>com.kingsrook.qqq</groupId>
<artifactId>qqq-parent-project</artifactId>
<version>${revision}</version>
</parent>
<properties>
<!-- props specifically to this module -->
<!-- none at this time -->
</properties>
<dependencies>
<!-- other qqq modules deps -->
<dependency>
<groupId>com.kingsrook.qqq</groupId>
<artifactId>qqq-backend-core</artifactId>
<version>${revision}</version>
</dependency>
<!-- Common deps for all qqq modules -->
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- plugins specifically for this module -->
<!-- none at this time -->
</plugins>
</build>
</project>

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.api.model.openapi;
package com.kingsrook.qqq.openapi.model;
import java.util.Map;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.api.model.openapi;
package com.kingsrook.qqq.openapi.model;
/*******************************************************************************

View File

@ -19,7 +19,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.api.model.openapi;
package com.kingsrook.qqq.openapi.model;
import java.util.Map;
/*******************************************************************************
@ -27,7 +30,8 @@ package com.kingsrook.qqq.api.model.openapi;
*******************************************************************************/
public class Content
{
private Schema schema;
private Schema schema;
private Map<String, Example> examples;
@ -60,4 +64,35 @@ public class Content
return (this);
}
/*******************************************************************************
** Getter for examples
*******************************************************************************/
public Map<String, Example> getExamples()
{
return (this.examples);
}
/*******************************************************************************
** Setter for examples
*******************************************************************************/
public void setExamples(Map<String, Example> examples)
{
this.examples = examples;
}
/*******************************************************************************
** Fluent setter for examples
*******************************************************************************/
public Content withExamples(Map<String, Example> examples)
{
this.examples = examples;
return (this);
}
}

View File

@ -0,0 +1,77 @@
package com.kingsrook.qqq.openapi.model;
import java.util.Map;
/*******************************************************************************
**
*******************************************************************************/
public class Discriminator
{
private String propertyName;
private Map<String, String> mapping;
/*******************************************************************************
** Getter for propertyName
*******************************************************************************/
public String getPropertyName()
{
return (this.propertyName);
}
/*******************************************************************************
** Setter for propertyName
*******************************************************************************/
public void setPropertyName(String propertyName)
{
this.propertyName = propertyName;
}
/*******************************************************************************
** Fluent setter for propertyName
*******************************************************************************/
public Discriminator withPropertyName(String propertyName)
{
this.propertyName = propertyName;
return (this);
}
/*******************************************************************************
** Getter for mapping
*******************************************************************************/
public Map<String, String> getMapping()
{
return (this.mapping);
}
/*******************************************************************************
** Setter for mapping
*******************************************************************************/
public void setMapping(Map<String, String> mapping)
{
this.mapping = mapping;
}
/*******************************************************************************
** Fluent setter for mapping
*******************************************************************************/
public Discriminator withMapping(Map<String, String> mapping)
{
this.mapping = mapping;
return (this);
}
}

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.api.model.openapi;
package com.kingsrook.qqq.openapi.model;
import com.fasterxml.jackson.annotation.JsonGetter;
@ -32,6 +32,7 @@ public class Example
{
private String summary;
private String ref;
private Object value;
@ -96,4 +97,35 @@ public class Example
return (this);
}
/*******************************************************************************
** Getter for value
*******************************************************************************/
public Object getValue()
{
return (this.value);
}
/*******************************************************************************
** Setter for value
*******************************************************************************/
public void setValue(Object value)
{
this.value = value;
}
/*******************************************************************************
** Fluent setter for value
*******************************************************************************/
public Example withValue(Object value)
{
this.value = value;
return (this);
}
}

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.api.model.openapi;
package com.kingsrook.qqq.openapi.model;
import java.util.List;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.api.model.openapi;
package com.kingsrook.qqq.openapi.model;
import java.io.Serializable;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.api.model.openapi;
package com.kingsrook.qqq.openapi.model;
/*******************************************************************************

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.api.model.openapi;
package com.kingsrook.qqq.openapi.model;
/*******************************************************************************

View File

@ -0,0 +1,34 @@
/*
* QQQ - Low-code Application Framework for Engineers.
* Copyright (C) 2021-2024. Kingsrook, LLC
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
* contact@kingsrook.com
* https://github.com/Kingsrook/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.openapi.model;
/*******************************************************************************
**
*******************************************************************************/
public enum In
{
PATH,
QUERY,
HEADER,
COOKIE
}

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.api.model.openapi;
package com.kingsrook.qqq.openapi.model;
/*******************************************************************************

View File

@ -19,9 +19,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.api.model.openapi;
package com.kingsrook.qqq.openapi.model;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -200,6 +201,21 @@ public class Method
/*******************************************************************************
** Fluent setter for tags
*******************************************************************************/
public Method withTag(String tag)
{
if(this.tags == null)
{
this.tags = new ArrayList<>();
}
this.tags.add(tag);
return (this);
}
/*******************************************************************************
** Getter for requestBody
*******************************************************************************/

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.api.model.openapi;
package com.kingsrook.qqq.openapi.model;
import java.util.Map;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.api.model.openapi;
package com.kingsrook.qqq.openapi.model;
import java.util.Map;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.api.model.openapi;
package com.kingsrook.qqq.openapi.model;
import java.util.List;
@ -32,7 +32,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
*******************************************************************************/
public class OpenAPI
{
private String openapi = "3.0.3"; // todo not version
private String openapi = "3.0.3";
private Info info;
private ExternalDocs externalDocs;
private List<Server> servers;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.api.model.openapi;
package com.kingsrook.qqq.openapi.model;
import java.util.Map;
@ -37,7 +37,7 @@ public class Parameter
private Schema schema;
private Boolean explode;
private Map<String, Example> examples;
private Example example;
private Object example;
@ -116,9 +116,10 @@ public class Parameter
/*******************************************************************************
** Setter for in
*******************************************************************************/
@Deprecated(since = "Use version that takes enum")
public void setIn(String in)
{
this.in = in;
this.in = In.valueOf(in.toUpperCase()).toString().toLowerCase();
}
@ -126,9 +127,31 @@ public class Parameter
/*******************************************************************************
** Fluent setter for in
*******************************************************************************/
@Deprecated(since = "Use version that takes enum")
public Parameter withIn(String in)
{
this.in = in;
setIn(in);
return (this);
}
/*******************************************************************************
** Setter for in
*******************************************************************************/
public void setIn(In in)
{
this.in = in.toString().toLowerCase();
}
/*******************************************************************************
** Fluent setter for in
*******************************************************************************/
public Parameter withIn(In in)
{
setIn(in);
return (this);
}
@ -261,7 +284,7 @@ public class Parameter
/*******************************************************************************
** Getter for example
*******************************************************************************/
public Example getExample()
public Object getExample()
{
return (this.example);
}
@ -269,7 +292,7 @@ public class Parameter
/*******************************************************************************
** Setter for examplee
** Setter for example
*******************************************************************************/
public void setExample(Example example)
{
@ -279,7 +302,7 @@ public class Parameter
/*******************************************************************************
** Fluent setter for examplee
** Fluent setter for example
*******************************************************************************/
public Parameter withExample(Example example)
{
@ -287,4 +310,24 @@ public class Parameter
return (this);
}
/*******************************************************************************
** Setter for example
*******************************************************************************/
public void setExample(String example)
{
this.example = example;
}
/*******************************************************************************
** Fluent setter for example
*******************************************************************************/
public Parameter withExample(String example)
{
this.example = example;
return (this);
}
}

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.api.model.openapi;
package com.kingsrook.qqq.openapi.model;
/*******************************************************************************

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.api.model.openapi;
package com.kingsrook.qqq.openapi.model;
/*******************************************************************************

View File

@ -19,9 +19,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.api.model.openapi;
package com.kingsrook.qqq.openapi.model;
import java.util.LinkedHashMap;
import java.util.Map;
@ -127,4 +128,19 @@ public class RequestBody
return (this);
}
/*******************************************************************************
** Fluent setter for content
*******************************************************************************/
public RequestBody withContent(String key, Content content)
{
if(this.content == null)
{
this.content = new LinkedHashMap<>();
}
this.content.put(key, content);
return (this);
}
}

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.api.model.openapi;
package com.kingsrook.qqq.openapi.model;
import java.util.Map;

View File

@ -19,10 +19,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.api.model.openapi;
package com.kingsrook.qqq.openapi.model;
import java.math.BigDecimal;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonGetter;
@ -33,18 +34,23 @@ import com.fasterxml.jackson.annotation.JsonGetter;
*******************************************************************************/
public class Schema
{
private String type;
private String format;
private String description;
private List<String> enumValues;
private Schema items;
private Map<String, Schema> properties;
private Object example;
private String ref;
private List<Schema> allOf;
private Boolean readOnly;
private Boolean nullable;
private Integer maxLength;
private String type;
private String format;
private String description;
private List<String> enumValues;
private Schema items;
private Map<String, Schema> properties;
private Object example;
private Map<String, Example> examples;
private String ref;
private List<Schema> allOf;
private List<Schema> anyOf;
private List<Schema> oneOf;
private Boolean readOnly;
private Boolean nullable;
private Integer maxLength;
private Discriminator discriminator;
private Object additionalProperties;
@ -61,9 +67,10 @@ public class Schema
/*******************************************************************************
** Setter for type
*******************************************************************************/
@Deprecated(since = "Use version that takes enum")
public void setType(String type)
{
this.type = type;
this.type = Type.valueOf(type.toUpperCase()).toString().toLowerCase();
}
@ -71,9 +78,31 @@ public class Schema
/*******************************************************************************
** Fluent setter for type
*******************************************************************************/
@Deprecated(since = "Use version that takes enum")
public Schema withType(String type)
{
this.type = type;
setType(type);
return (this);
}
/*******************************************************************************
** Setter for type
*******************************************************************************/
public void setType(Type type)
{
this.type = type.toString().toLowerCase();
}
/*******************************************************************************
** Fluent setter for type
*******************************************************************************/
public Schema withType(Type type)
{
setType(type);
return (this);
}
@ -172,6 +201,21 @@ public class Schema
/*******************************************************************************
** Fluent setter for properties
*******************************************************************************/
public Schema withProperty(String key, Schema schema)
{
if(this.properties == null)
{
this.properties = new LinkedHashMap<>();
}
this.properties.put(key, schema);
return (this);
}
/*******************************************************************************
** Getter for example
*******************************************************************************/
@ -462,4 +506,195 @@ public class Schema
return (this);
}
/*******************************************************************************
** Getter for discriminator
*******************************************************************************/
public Discriminator getDiscriminator()
{
return (this.discriminator);
}
/*******************************************************************************
** Setter for discriminator
*******************************************************************************/
public void setDiscriminator(Discriminator discriminator)
{
this.discriminator = discriminator;
}
/*******************************************************************************
** Fluent setter for discriminator
*******************************************************************************/
public Schema withDiscriminator(Discriminator discriminator)
{
this.discriminator = discriminator;
return (this);
}
/*******************************************************************************
** Getter for anyOf
*******************************************************************************/
public List<Schema> getAnyOf()
{
return (this.anyOf);
}
/*******************************************************************************
** Setter for anyOf
*******************************************************************************/
public void setAnyOf(List<Schema> anyOf)
{
this.anyOf = anyOf;
}
/*******************************************************************************
** Fluent setter for anyOf
*******************************************************************************/
public Schema withAnyOf(List<Schema> anyOf)
{
this.anyOf = anyOf;
return (this);
}
/*******************************************************************************
** Getter for oneOf
*******************************************************************************/
public List<Schema> getOneOf()
{
return (this.oneOf);
}
/*******************************************************************************
** Setter for oneOf
*******************************************************************************/
public void setOneOf(List<Schema> oneOf)
{
this.oneOf = oneOf;
}
/*******************************************************************************
** Fluent setter for oneOf
*******************************************************************************/
public Schema withOneOf(List<Schema> oneOf)
{
this.oneOf = oneOf;
return (this);
}
/*******************************************************************************
** Getter for examples
*******************************************************************************/
public Map<String, Example> getExamples()
{
return (this.examples);
}
/*******************************************************************************
** Setter for examples
*******************************************************************************/
public void setExamples(Map<String, Example> examples)
{
this.examples = examples;
}
/*******************************************************************************
** Fluent setter for examples
*******************************************************************************/
public Schema withExamples(Map<String, Example> examples)
{
this.examples = examples;
return (this);
}
/*******************************************************************************
** Fluent setter for examples
*******************************************************************************/
public Schema withExample(String name, Example example)
{
if(this.examples == null)
{
this.examples = new LinkedHashMap<>();
}
this.examples.put(name, example);
return (this);
}
/*******************************************************************************
** Getter for additionalProperties
*******************************************************************************/
public Object getAdditionalProperties()
{
return (this.additionalProperties);
}
/*******************************************************************************
** Setter for additionalProperties
*******************************************************************************/
public void setAdditionalProperties(Schema additionalProperties)
{
this.additionalProperties = additionalProperties;
}
/*******************************************************************************
** Fluent setter for additionalProperties
*******************************************************************************/
public Schema withAdditionalProperties(Schema additionalProperties)
{
this.additionalProperties = additionalProperties;
return (this);
}
/*******************************************************************************
** Setter for additionalProperties
*******************************************************************************/
public void setAdditionalProperties(Boolean additionalProperties)
{
this.additionalProperties = additionalProperties;
}
/*******************************************************************************
** Fluent setter for additionalProperties
*******************************************************************************/
public Schema withAdditionalProperties(Boolean additionalProperties)
{
this.additionalProperties = additionalProperties;
return (this);
}
}

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.api.model.openapi;
package com.kingsrook.qqq.openapi.model;
import com.fasterxml.jackson.annotation.JsonIgnore;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.api.model.openapi;
package com.kingsrook.qqq.openapi.model;
/*******************************************************************************

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.api.model.openapi;
package com.kingsrook.qqq.openapi.model;
/*******************************************************************************

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.api.model.openapi;
package com.kingsrook.qqq.openapi.model;
/*******************************************************************************

View File

@ -0,0 +1,36 @@
/*
* QQQ - Low-code Application Framework for Engineers.
* Copyright (C) 2021-2024. Kingsrook, LLC
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
* contact@kingsrook.com
* https://github.com/Kingsrook/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.openapi.model;
/*******************************************************************************
**
*******************************************************************************/
public enum Type
{
ARRAY,
BOOLEAN,
INTEGER,
NUMBER,
OBJECT,
STRING;
}

View File

@ -22,4 +22,4 @@
/*******************************************************************************
** The POJOs in this package represent a model of an OpenAPI spec file.
*******************************************************************************/
package com.kingsrook.qqq.api.model.openapi;
package com.kingsrook.qqq.openapi.model;

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,101 @@
<!--
~ QQQ - Low-code Application Framework for Engineers.
~ Copyright (C) 2021-2023. Kingsrook, LLC
~ 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
~ contact@kingsrook.com
~ https://github.com/Kingsrook/
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU Affero General Public License as
~ published by the Free Software Foundation, either version 3 of the
~ License, or (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU Affero General Public License for more details.
~
~ You should have received a copy of the GNU Affero General Public License
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<!doctype html>
<html lang="en-US">
<head>
<title>{title}</title>
<meta charset="utf-8">
<!-- <script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"></script> -->
<script type="module" src="/api/docs/js/rapidoc.min.js"></script>
<link rel="stylesheet" href="/api/docs/css/qqq-api-styles.css">
</head>
<body>
<rapi-doc
id="the-rapi-doc"
spec-url="{spec-url}"
regular-font="SF Pro Display,Roboto,Helvetica,Arial,sans-serif"
mono-font="Monaco, Menlo, Consolas, source-code-pro, monospace"
font-size="large"
show-header="false"
allow-spec-file-download="true"
primary-color="{primaryColor}"
sort-endpoints-by="none"
allow-authentication="false"
persist-auth="false"
render-style="focused"
show-method-in-nav-bar="as-colored-block"
nav-item-spacing="relaxed"
css-file="qqq-api-styles.css"
css-classes="qqqApi"
info-description-headings-in-navbar="true"
show-curl-before-try="true"
show-components="true"
sort-schemas="true"
schema-expand-level="1"
>
{navLogoImg}
<div slot="overview" id="otherVersions">
<label for="otherVersionsSelect">Other Versions of this API:</label>
<select id="otherVersionsSelect" onchange=changeVersion()>
<option value="/api/">--</option>
{otherVersionOptions}
</select>
</div>
</rapi-doc>
<script>
window.addEventListener('DOMContentLoaded', (event) => {
const rapidocEl = document.getElementById('the-rapi-doc');
rapidocEl.addEventListener('spec-loaded', (e) => {
const shadowRoot = rapidocEl.shadowRoot;
const collapseButton = shadowRoot.querySelector(".nav-bar-collapse-all");
if(collapseButton)
{
collapseButton.click();
}
const otherVersions = document.querySelector("#otherVersions");
if(otherVersions)
{
otherVersions.style.visibility = "visible";
}
const navLogo = document.querySelector("#navLogo");
if(navLogo)
{
navLogo.style.visibility = "visible";
}
});
});
function changeApi()
{
document.location.href = document.getElementById("otherApisSelect").value;
}
function changeVersion()
{
document.location.href = document.getElementById("otherVersionsSelect").value;
}
</script>
</body>
</html>

View File

@ -0,0 +1,76 @@
/*
* QQQ - Low-code Application Framework for Engineers.
* Copyright (C) 2021-2023. Kingsrook, LLC
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
* contact@kingsrook.com
* https://github.com/Kingsrook/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#api-info
{
margin-left: 0 !important;
}
#api-info button
{
width: auto !important;
}
#api-title span
{
font-size: 24px !important;
margin-left: 8px;
}
.nav-scroll
{
padding-left: 16px;
}
.tag-description.expanded
{
max-height: initial !important;
}
.tag-description .m-markdown p
{
margin-block-end: 0.5em !important;
}
api-response
{
margin-bottom: 50vh;
display: inline-block;
}
#otherVersions
{
margin-bottom: 2em;
}
#navLogo
{
width: fit-content;
max-width: 280px;
margin-left: auto;
margin-right: auto;
visibility: hidden;
}
#otherVersions
{
visibility: hidden;
}