Skip to content

Commit

Permalink
feature: Add license
Browse files Browse the repository at this point in the history
  • Loading branch information
Fioooooooo committed Nov 13, 2023
1 parent 2b64c0b commit 816d407
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/main/java/com/ly/doc/helper/DocBuildHelper.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/*
* Copyright (C) 2018-2023 smart-doc
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
package com.ly.doc.helper;

import com.ly.doc.builder.ProjectDocConfigBuilder;
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/com/ly/doc/helper/GitHelper.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/*
* Copyright (C) 2018-2023 smart-doc
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
package com.ly.doc.helper;

import com.power.common.util.StringUtil;
Expand Down
87 changes: 87 additions & 0 deletions src/test/java/com/ly/doc/util/ParamUtilTest.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,99 @@
package com.ly.doc.util;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.ly.doc.model.ApiParam;
import com.ly.doc.utils.JsonUtil;
import com.ly.doc.utils.ParamUtil;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.List;

public class ParamUtilTest {

@Test
public void testFormatMockValue() {
System.out.printf(ParamUtil.formatMockValue("*\\/5 * * *"));
}

@Test
public void testExtractQualifiedName() {
String paramJson = "[\n" +
" {\n" +
" \"className\": \"org.example.springboot.dto.PetDTO\",\n" +
" \"id\": 1,\n" +
" \"field\": \"name\",\n" +
" \"type\": \"string\",\n" +
" \"desc\": \"name\",\n" +
" \"required\": false,\n" +
" \"version\": \"-\",\n" +
" \"pid\": 0,\n" +
" \"pathParam\": false,\n" +
" \"queryParam\": false,\n" +
" \"value\": \"\",\n" +
" \"hasItems\": false,\n" +
" \"maxLength\": \"\",\n" +
" \"configParam\": false,\n" +
" \"selfReferenceLoop\": false\n" +
" },\n" +
" {\n" +
" \"className\": \"org.example.springboot.dto.PetDTO\",\n" +
" \"id\": 2,\n" +
" \"field\": \"age\",\n" +
" \"type\": \"int32\",\n" +
" \"desc\": \"age\",\n" +
" \"required\": false,\n" +
" \"version\": \"-\",\n" +
" \"pid\": 0,\n" +
" \"pathParam\": false,\n" +
" \"queryParam\": false,\n" +
" \"value\": \"0\",\n" +
" \"hasItems\": false,\n" +
" \"maxLength\": \"\",\n" +
" \"configParam\": false,\n" +
" \"selfReferenceLoop\": false\n" +
" },\n" +
" {\n" +
" \"className\": \"org.example.springboot.dto.PetDTO\",\n" +
" \"id\": 3,\n" +
" \"field\": \"master\",\n" +
" \"type\": \"object\",\n" +
" \"desc\": \"master\",\n" +
" \"required\": false,\n" +
" \"version\": \"-\",\n" +
" \"pid\": 0,\n" +
" \"pathParam\": false,\n" +
" \"queryParam\": false,\n" +
" \"value\": \"\",\n" +
" \"hasItems\": false,\n" +
" \"maxLength\": \"\",\n" +
" \"configParam\": false,\n" +
" \"selfReferenceLoop\": false\n" +
" },\n" +
" {\n" +
" \"className\": \"org.example.springboot.dto.UserDTO\",\n" +
" \"id\": 4,\n" +
" \"field\": \"└─username\",\n" +
" \"type\": \"string\",\n" +
" \"desc\": \"No comments found.\",\n" +
" \"required\": false,\n" +
" \"version\": \"-\",\n" +
" \"pid\": 3,\n" +
" \"pathParam\": false,\n" +
" \"queryParam\": false,\n" +
" \"value\": \"\",\n" +
" \"hasItems\": false,\n" +
" \"maxLength\": \"\",\n" +
" \"configParam\": false,\n" +
" \"selfReferenceLoop\": false\n" +
" }\n" +
"]";
List<ApiParam> paramList = new Gson().fromJson(paramJson, new TypeToken<List<ApiParam>>() {
});
List<String> qualifiedList = ParamUtil.extractQualifiedName(paramList);
qualifiedList.forEach(System.out::println);
}

}

0 comments on commit 816d407

Please sign in to comment.