简体   繁体   English

Swagger软件包javax.validation.constraints不存在

[英]Swagger package javax.validation.constraints does not exist

I'm having trouble building swagger Java clients using swagger-codegen and Maven. 我在使用swagger-codegen和Maven构建swagger Java客户端时遇到了麻烦。 It's building on my CI using Java 1.8 and Maven 3.6. 它基于Java 1.8和Maven 3.6在CI上构建。 I'm seeing this: 我看到了这个:

... package javax.validation.constraints does not exist
... package javax.validation does not exist

The relevant part of my config is: 我的配置的相关部分是:

{
  "library": "resttemplate",
  "configOptions": {
    "dateLibrary": "java8"
  },
  "useBeanValidation": true
}

And the command I use to generate the api is: 我用来生成api的命令是:

java -jar swagger-codegen-cli.jar generate -i swagger.json -l java -o ./generated/ -c swagger-java-config.json

I would expect this error to occur with Java 11. Also, I don't see the required imports in the official resttemplate library pom.xml template for the Java client . 我希望Java 11会发生此错误。此外,我在Java客户端官方resttemplatepom.xml模板resttemplate不到所需的导入。

The problem comes from "useBeanValidation": true in the configuration. 问题来自"useBeanValidation": true在配置中为"useBeanValidation": true This option is only available for generated servers, not clients. 此选项仅适用于生成的服务器,而不适用于客户端。 The java -jar swagger-codegen.jar config-help -L java will show this option as it does not discriminate on the library chosen (in your case resttemplate ). java -jar swagger-codegen.jar config-help -L java将显示此选项,因为它与所选择的library没有区别(在您的情况下为resttemplate )。 The templates specific to resttemplate do not alter the code outputted by the java language templates. 专用于resttemplate的模板不会更改java语言模板输出的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Spring: java: package javax.validation.constraints 不存在 - Spring: java: package javax.validation.constraints does not exist javax.validation.constraints 不适用于 Spring web - javax.validation.constraints does not work with Spring web javax.validation.constraints中的转义序列无效 - Invalid escape sequencein javax.validation.constraints 原始布尔值的 javax.validation.constraints? - javax.validation.constraints for primitive boolean? 来自 javax.validation.constraints 的注释不起作用 - Annotations from javax.validation.constraints not working @PathVariable 上的多个 javax.validation.constraints 验证 - Multiple javax.validation.constraints validations on @PathVariable 关注点重复javax.validation.constraints和javax.persistence.Column - Duplication of concerns javax.validation.constraints and javax.persistence.Column 以编程方式“关闭”bean验证(javax.validation.constraints) - “Turn off” bean validation programmatically (javax.validation.constraints) 结合自定义 ConstraintValidator 的 javax.validation.constraints 注释 - Annotations from javax.validation.constraints in combination with custom ConstraintValidator 来自javax.validation.constraints的注释不起作用(忽略) - Annotations from javax.validation.constraints not working (ignored)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM