diff --git a/kernel-d-openapi/README.md b/kernel-d-openapi/README.md deleted file mode 100644 index d3670146d..000000000 --- a/kernel-d-openapi/README.md +++ /dev/null @@ -1 +0,0 @@ -openapi接口文档适配 diff --git a/kernel-d-openapi/openapi-api/pom.xml b/kernel-d-openapi/openapi-api/pom.xml deleted file mode 100644 index 76380bae4..000000000 --- a/kernel-d-openapi/openapi-api/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - 4.0.0 - - - cn.stylefeng.roses - kernel-d-openapi - 7.6.0 - ../pom.xml - - - openapi-api - - jar - - - - - - cn.stylefeng.roses - kernel-a-rule - ${roses.version} - - - - - cn.stylefeng.roses - scanner-api - ${roses.version} - - - - - \ No newline at end of file diff --git a/kernel-d-openapi/openapi-api/src/main/java/cn/stylefeng/roses/kernel/openapi/api/constants/OpenApiConstants.java b/kernel-d-openapi/openapi-api/src/main/java/cn/stylefeng/roses/kernel/openapi/api/constants/OpenApiConstants.java deleted file mode 100644 index e6347792c..000000000 --- a/kernel-d-openapi/openapi-api/src/main/java/cn/stylefeng/roses/kernel/openapi/api/constants/OpenApiConstants.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright [2020-2030] [https://www.stylefeng.cn] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: - * - * 1.请不要删除和修改根目录下的LICENSE文件。 - * 2.请不要删除和修改Guns源码头部的版权声明。 - * 3.请保留源码和相关描述文件的项目出处,作者声明等。 - * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns - * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns - * 6.若您的项目无法满足以上几点,可申请商业授权 - */ -package cn.stylefeng.roses.kernel.openapi.api.constants; - -/** - * OpenApi模块的常量 - * - * @author caiti - * @since 2022-11-11 - */ -public interface OpenApiConstants { - - /** - * OpenApi模块的名称 - */ - String OPENAPI_MODULE_NAME = "kernel-d-openapi"; - -} diff --git a/kernel-d-openapi/openapi-api/src/main/java/cn/stylefeng/roses/kernel/openapi/api/exception/OpenApiException.java b/kernel-d-openapi/openapi-api/src/main/java/cn/stylefeng/roses/kernel/openapi/api/exception/OpenApiException.java deleted file mode 100644 index e9fb7acb0..000000000 --- a/kernel-d-openapi/openapi-api/src/main/java/cn/stylefeng/roses/kernel/openapi/api/exception/OpenApiException.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright [2020-2030] [https://www.stylefeng.cn] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: - * - * 1.请不要删除和修改根目录下的LICENSE文件。 - * 2.请不要删除和修改Guns源码头部的版权声明。 - * 3.请保留源码和相关描述文件的项目出处,作者声明等。 - * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns - * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns - * 6.若您的项目无法满足以上几点,可申请商业授权 - */ -package cn.stylefeng.roses.kernel.openapi.api.exception; - -import cn.stylefeng.roses.kernel.openapi.api.constants.OpenApiConstants; -import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum; -import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException; - -/** - * OpenApi模块的异常 - * - * @author caiti - * @since 2022-11-11 - */ -public class OpenApiException extends ServiceException { - - public OpenApiException(AbstractExceptionEnum exceptionEnum) { - super(OpenApiConstants.OPENAPI_MODULE_NAME, exceptionEnum); - } - -} diff --git a/kernel-d-openapi/openapi-sdk-springdoc/pom.xml b/kernel-d-openapi/openapi-sdk-springdoc/pom.xml deleted file mode 100644 index 890ec04db..000000000 --- a/kernel-d-openapi/openapi-sdk-springdoc/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - 4.0.0 - - - cn.stylefeng.roses - kernel-d-openapi - 7.6.0 - ../pom.xml - - - openapi-sdk-springdoc - - jar - - - - - - cn.stylefeng.roses - openapi-api - ${roses.version} - - - - org.springdoc - springdoc-openapi-webmvc-core - - - - - - \ No newline at end of file diff --git a/kernel-d-openapi/openapi-sdk-springdoc/src/main/java/cn/stylefeng/roses/kernel/springdoc/converter/GunsModelConverterImpl.java b/kernel-d-openapi/openapi-sdk-springdoc/src/main/java/cn/stylefeng/roses/kernel/springdoc/converter/GunsModelConverterImpl.java deleted file mode 100644 index 83c34fbca..000000000 --- a/kernel-d-openapi/openapi-sdk-springdoc/src/main/java/cn/stylefeng/roses/kernel/springdoc/converter/GunsModelConverterImpl.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright [2020-2030] [https://www.stylefeng.cn] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: - * - * 1.请不要删除和修改根目录下的LICENSE文件。 - * 2.请不要删除和修改Guns源码头部的版权声明。 - * 3.请保留源码和相关描述文件的项目出处,作者声明等。 - * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns - * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns - * 6.若您的项目无法满足以上几点,可申请商业授权 - */ -package cn.stylefeng.roses.kernel.springdoc.converter; - -import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription; -import io.swagger.v3.core.converter.AnnotatedType; -import io.swagger.v3.core.converter.ModelConverter; -import io.swagger.v3.core.converter.ModelConverterContext; -import io.swagger.v3.oas.models.media.Schema; - -import java.lang.annotation.Annotation; -import java.util.Iterator; -import java.util.Objects; - -/** - * 文档转换 - * - * @author caiti - * @since 2022-11-11 - */ -public class GunsModelConverterImpl implements ModelConverter { - - @Override - public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context, Iterator chain) { - Schema schema = next(annotatedType, context, chain); - Annotation[] ctxAnnotations = annotatedType.getCtxAnnotations(); - if (Objects.isNull(ctxAnnotations)) { - return schema; - } - ChineseDescription chineseDescription = null; - for (Annotation ctxAnnotation : ctxAnnotations) { - if (ctxAnnotation instanceof ChineseDescription) { - chineseDescription = (ChineseDescription) ctxAnnotation; - break; - } - } - if (chineseDescription == null) { - return schema; - } - - if (schema != null) { - schema.setDescription(chineseDescription.value()); - } - return schema; - } - - private Schema next(AnnotatedType annotatedType, ModelConverterContext context, Iterator chain) { - if (chain.hasNext()) { - return chain.next().resolve(annotatedType, context, chain); - } else { - return null; - } - } - -} diff --git a/kernel-d-openapi/openapi-sdk-springdoc/src/main/java/cn/stylefeng/roses/kernel/springdoc/providers/GunsJavadocProviderImpl.java b/kernel-d-openapi/openapi-sdk-springdoc/src/main/java/cn/stylefeng/roses/kernel/springdoc/providers/GunsJavadocProviderImpl.java deleted file mode 100644 index 51b9ad1f8..000000000 --- a/kernel-d-openapi/openapi-sdk-springdoc/src/main/java/cn/stylefeng/roses/kernel/springdoc/providers/GunsJavadocProviderImpl.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright [2020-2030] [https://www.stylefeng.cn] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: - * - * 1.请不要删除和修改根目录下的LICENSE文件。 - * 2.请不要删除和修改Guns源码头部的版权声明。 - * 3.请保留源码和相关描述文件的项目出处,作者声明等。 - * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns - * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns - * 6.若您的项目无法满足以上几点,可申请商业授权 - */ -package cn.stylefeng.roses.kernel.springdoc.providers; - -import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription; -import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource; -import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource; -import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource; -import org.springdoc.core.providers.JavadocProvider; -import org.springframework.core.annotation.AnnotatedElementUtils; -import org.springframework.lang.Nullable; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.Map; - -/** - * 文档转换 - * - * @author caiti - * @since 2022-11-11 - */ -public class GunsJavadocProviderImpl implements JavadocProvider { - - @Override - public String getClassJavadoc(Class cl) { - ApiResource annotation = AnnotatedElementUtils.getMergedAnnotation(cl, ApiResource.class); - if (annotation != null) { - return annotation.name(); - } - return null; - } - - @Override - public String getMethodJavadocDescription(Method method) { - return getResourceName(method); - } - - @Override - public String getMethodJavadocReturn(Method method) { - return getResourceName(method); - } - - @Nullable - private String getResourceName(Method method) { - GetResource getAnnotation = AnnotatedElementUtils.getMergedAnnotation(method, GetResource.class); - if (getAnnotation != null) { - return getAnnotation.name(); - } - PostResource postAnnotation = AnnotatedElementUtils.getMergedAnnotation(method, PostResource.class); - if (postAnnotation != null) { - return postAnnotation.name(); - } - ApiResource apiAnnotation = AnnotatedElementUtils.getMergedAnnotation(method, ApiResource.class); - if (apiAnnotation != null) { - return apiAnnotation.name(); - } - return null; - } - - @Override - public Map getMethodJavadocThrows(Method method) { - - return null; - } - - @Override - public String getParamJavadoc(Method method, String name) { - return null; - } - - @Override - public String getFieldJavadoc(Field field) { - ChineseDescription annotation = AnnotatedElementUtils.getMergedAnnotation(field, ChineseDescription.class); - if (annotation != null) { - return annotation.value(); - } - return null; - } - - @Override - public String getFirstSentence(String text) { - return text; - } - -} diff --git a/kernel-d-openapi/openapi-spring-boot-starter/pom.xml b/kernel-d-openapi/openapi-spring-boot-starter/pom.xml deleted file mode 100644 index 67babb8b9..000000000 --- a/kernel-d-openapi/openapi-spring-boot-starter/pom.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - 4.0.0 - - - cn.stylefeng.roses - kernel-d-openapi - 7.6.0 - ../pom.xml - - - openapi-spring-boot-starter - - jar - - - - - - cn.stylefeng.roses - openapi-sdk-springdoc - ${roses.version} - - - - - \ No newline at end of file diff --git a/kernel-d-openapi/openapi-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/springdoc/starter/SpringdocOpenApiAutoConfiguration.java b/kernel-d-openapi/openapi-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/springdoc/starter/SpringdocOpenApiAutoConfiguration.java deleted file mode 100644 index c006465f4..000000000 --- a/kernel-d-openapi/openapi-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/springdoc/starter/SpringdocOpenApiAutoConfiguration.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright [2020-2030] [https://www.stylefeng.cn] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: - * - * 1.请不要删除和修改根目录下的LICENSE文件。 - * 2.请不要删除和修改Guns源码头部的版权声明。 - * 3.请保留源码和相关描述文件的项目出处,作者声明等。 - * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns - * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns - * 6.若您的项目无法满足以上几点,可申请商业授权 - */ -package cn.stylefeng.roses.kernel.springdoc.starter; - -import cn.stylefeng.roses.kernel.springdoc.converter.GunsModelConverterImpl; -import cn.stylefeng.roses.kernel.springdoc.providers.GunsJavadocProviderImpl; -import io.swagger.v3.core.converter.ModelConverter; -import org.springdoc.core.providers.JavadocProvider; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.Ordered; -import org.springframework.core.annotation.Order; - -/** - * openapi的自动装配 - * - * @author caiti - * @since 2022-11-11 - */ -@Configuration -public class SpringdocOpenApiAutoConfiguration { - - @Bean - @Order(Ordered.HIGHEST_PRECEDENCE) - public ModelConverter gunsSpringdocModelConverter() { - return new GunsModelConverterImpl(); - } - - @Bean - public JavadocProvider gunsSpringdocJavadocProvider() { - return new GunsJavadocProviderImpl(); - } - -} diff --git a/kernel-d-openapi/openapi-spring-boot-starter/src/main/resources/META-INF/spring.factories b/kernel-d-openapi/openapi-spring-boot-starter/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 0f4a72fe5..000000000 --- a/kernel-d-openapi/openapi-spring-boot-starter/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,2 +0,0 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ - cn.stylefeng.roses.kernel.springdoc.starter.SpringdocOpenApiAutoConfiguration diff --git a/kernel-d-openapi/pom.xml b/kernel-d-openapi/pom.xml deleted file mode 100644 index 589888bc9..000000000 --- a/kernel-d-openapi/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - 4.0.0 - - - cn.stylefeng.roses - roses-kernel - 7.6.0 - ../pom.xml - - - kernel-d-openapi - - pom - - - openapi-api - openapi-spring-boot-starter - openapi-sdk-springdoc - - - \ No newline at end of file diff --git a/pom.xml b/pom.xml index 29c0a028e..0fbf5712f 100644 --- a/pom.xml +++ b/pom.xml @@ -58,9 +58,6 @@ kernel-d-office - - kernel-d-openapi - kernel-d-pinyin @@ -147,7 +144,6 @@ 2.5.0 2.2.6.RELEASE 1.68 - 1.6.12 7.1.1 @@ -315,13 +311,6 @@ ${getty.version} - - - org.springdoc - springdoc-openapi-webmvc-core - ${springdoc.version} - -