tangcent / easy-yapi

Generate API document to yapi
https://easyyapi.com
GNU Affero General Public License v3.0
433 stars 143 forks source link

Vo 里边套一个Vo的情况,好像出现stackOverflow了 #468

Closed chenshun00 closed 3 years ago

chenshun00 commented 3 years ago
public class TestVo {
 private Long total;
 private List<First> datas;
}
public static class First {
 private String name;
 private String xx;
 private First sourceFirset;
}

类试于这种情况导出,会有套娃的情况. :( 不知道是不是我使用有问题

tangcent commented 3 years ago

未能重现 image


chenshun00 commented 3 years ago

嗯,我去试试

chenshun00 commented 3 years ago

效果变成这样了 image

不过这样也能满足我的需求.

package com.itangcent.springboot.demo.controller;

import jdk.nashorn.internal.objects.annotations.Getter;
import jdk.nashorn.internal.objects.annotations.Setter;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

/**
 * @author luobo.cs@raycloud.com
 * @since 2021/5/18 10:46 上午
 */
@RestController
@RequestMapping(value = "/test/nested")
public class NestdController {

    @RequestMapping("/first")
    public NestedResponse nestedTest(@RequestParam Integer id) {
        return new NestedResponse();
    }

    public static class NestedResponse {

        /**
         * 总计
         */
        private Long total;
        /**
         * 数据
         */
        private List<First> datas;

        public Long getTotal() {
            return total;
        }

        public void setTotal(Long total) {
            this.total = total;
        }

        public List<First> getDatas() {
            return datas;
        }

        public void setDatas(List<First> datas) {
            this.datas = datas;
        }

        /**
         * 第一个
         *
         * @author luobo.cs@raycloud.com
         * @since 2021/05/18
         */
        public static class First {
            /**
             * 的名字
             */
            private String name;
            /**
             * 年龄
             */
            private Integer age;
            /**
             * 生日
             */
            private Date birthday;

            /**
             * 第一个来源
             */
            private First sourceFirst;

            public String getName() {
                return name;
            }

            public void setName(String name) {
                this.name = name;
            }

            public Integer getAge() {
                return age;
            }

            public void setAge(Integer age) {
                this.age = age;
            }

            public Date getBirthday() {
                return birthday;
            }

            public void setBirthday(Date birthday) {
                this.birthday = birthday;
            }

            public First getSourceFirst() {
                return sourceFirst;
            }

            public void setSourceFirst(First sourceFirst) {
                this.sourceFirst = sourceFirst;
            }
        }
    }

}
chenshun00 commented 3 years ago

看了下代码变更的地方

      val paramType = param.getType() ?: continue
      val unboxType = paramType.unbox()

以前的版本用的 unboxType ,新的版本用的 paramType