-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from tangcent/release/stable
release v1.1.1.183.0.4
- Loading branch information
Showing
11 changed files
with
227 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
group 'com.itangcent' | ||
version '1.1.0.183.0.2' | ||
version '1.1.1.183.0.4' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
1. How to add custom config? | ||
|
||
* add .easy.api.config in the root of project or module | ||
|
||
* see [Supported-custom-rules.md](https://github.com/tangcent/easy-api/blob/master/docs/2.%20Supported-custom-rules.md) | ||
|
||
2. How to group apis to special directory? | ||
|
||
* add config: | ||
|
||
```properties | ||
#find module for comment tag | ||
module=#module | ||
``` | ||
|
||
* add comment tag at class | ||
```java | ||
/** | ||
* Mock Apis | ||
* | ||
* @module mock | ||
*/ | ||
@RestController | ||
@RequestMapping(value = "mock") | ||
public class MockCtrl { | ||
} | ||
``` | ||
|
||
3. How to ignore apis? | ||
|
||
* add config: | ||
```properties | ||
#ignore class or method which has comment tag 'ignore' | ||
ignore=#ignore | ||
``` | ||
|
||
* add comment tag at controller class for ignore all apis in controller | ||
```java | ||
/** | ||
* Mock Apis | ||
* | ||
* @ignore | ||
*/ | ||
@RestController | ||
@RequestMapping(value = "mock") | ||
public class MockCtrl { | ||
} | ||
``` | ||
|
||
* add comment tag at api for ignore special api in controller | ||
```java | ||
/** | ||
* Mock Apis | ||
*/ | ||
@RestController | ||
@RequestMapping(value = "mock") | ||
public class MockCtrl { | ||
|
||
/** | ||
* Mock String | ||
* @ignore | ||
*/ | ||
@GetMapping("/string") | ||
public String mockString() { | ||
return Result.success("mock string"); | ||
} | ||
|
||
} | ||
``` | ||
|
||
4. How to set name&description of api/directory? | ||
* in general: | ||
```java | ||
/** | ||
* The head line will be the name of api directory | ||
* The rest lines will be the description of api directory | ||
*/ | ||
@RestController | ||
@RequestMapping(value = "mock") | ||
public class MockCtrl { | ||
|
||
/** | ||
* The head line will be the name of api | ||
* The rest lines will be the description of api | ||
*/ | ||
@GetMapping("/string") | ||
public String mockString() { | ||
return Result.success("mock string"); | ||
} | ||
} | ||
``` | ||
|
||
5. How to mark api as deprecated in description | ||
* you can add additional config: | ||
```properties | ||
doc.method[#deprecated]=groovy:"\n「deprecated」" + it.doc("deprecated") | ||
doc.method[@java.lang.Deprecated]=「deprecated」 | ||
doc.method[@kotlin.Deprecated]=groovy:"\n「deprecated」" + it.ann("kotlin.Deprecated","message") | ||
|
||
doc.method[groovy:it.containingClass().hasDoc("deprecated")]=groovy:"\n「deprecated」" + it.containingClass().doc("deprecated") | ||
doc.method[groovy:it.containingClass().hasAnn("java.lang.Deprecated")]=「deprecated」 | ||
doc.method[groovy:it.containingClass().hasAnn("kotlin.Deprecated")]=groovy:"\n「deprecated」 " + it.containingClass().ann("kotlin.Deprecated","message") | ||
|
||
``` | ||
|
||
6. How to declare a api requires some special permission in a description with javax.annotation.security? | ||
|
||
|
||
* add config for spring security: | ||
```properties | ||
# security description | ||
doc.method[@javax.annotation.security.RolesAllowed]=groovy:"\require role:"+it.ann("javax.annotation.security.RolesAllowed") | ||
``` | ||
* code: | ||
```java | ||
/** | ||
* The head line will be the name of api directory | ||
* The rest lines will be the description of api directory | ||
*/ | ||
@RestController | ||
@RequestMapping(value = "mock") | ||
public class MockCtrl { | ||
|
||
/** | ||
* The head line will be the name of api | ||
* The rest lines will be the description of api | ||
*/ | ||
@GetMapping("/string") | ||
@RolesAllowed("admin") | ||
public String mockString() { | ||
return Result.success("mock string"); | ||
} | ||
} | ||
|
||
``` | ||
7. How to config for spring security | ||
|
||
* add config for spring security: | ||
```properties | ||
# security description | ||
find_role_in_PreAuthorize=(function(exp){var str="";if(exp.indexOf("hasRole")!=-1){var roles=exp.match(/hasRole\\((.*?)\\)/);if(roles&&roles.length>1){str+="require role:"+roles[1];}};return str}) | ||
doc.method[@org.springframework.security.access.prepost.PreAuthorize]=js:${find_role_in_PreAuthorize}(it.ann("org.springframework.security.access.prepost.PreAuthorize")) | ||
``` | ||
* code: | ||
```java | ||
/** | ||
* The head line will be the name of api directory | ||
* The rest lines will be the description of api directory | ||
*/ | ||
@RestController | ||
@RequestMapping(value = "mock") | ||
public class MockCtrl { | ||
|
||
/** | ||
* The head line will be the name of api | ||
* The rest lines will be the description of api | ||
*/ | ||
@GetMapping("/string") | ||
@PreAuthorize("hasRole('admin')") | ||
public String mockString() { | ||
return Result.success("mock string"); | ||
} | ||
} | ||
|
||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,13 @@ | ||
<a href="https://github.com/tangcent/easy-yapi/releases/tag/v1.1.0.2">v1.1.0.183.0.2(2019-10-23)</a> | ||
<a href="https://github.com/tangcent/easy-yapi/releases/tag/v1.1.1.4">v1.1.1.183.0.4(2019-10-28)</a> | ||
<br/> | ||
<a href="https://github.com/tangcent/easy-yapi/blob/master/IDEA_CHANGELOG.md">Full Changelog</a> | ||
<ul>enhancement: | ||
<li>support rule: name[filter]=value<a | ||
href="https://github.com/tangcent/easy-api/pull/138">(#138)</a> | ||
</li> | ||
<li>parse kotlin files in ApiDashboard<a | ||
href="https://github.com/tangcent/easy-api/pull/141">(#141)</a> | ||
<li>provide 'hasModifier(modifier)' for class/method/field<a | ||
href="https://github.com/tangcent/easy-api/issues/157">(#157)</a> | ||
</li> | ||
</ul> | ||
<ul>fix: | ||
<li>support Serializer for Enum<a | ||
href="https://github.com/tangcent/easy-api/issues/134">(#134)</a> | ||
</li> | ||
<li>fix error base path for APIs in super class<a | ||
href="https://github.com/tangcent/easy-api/issues/137">(#137)</a> | ||
</li> | ||
<li>fix: ApiDashboard not show kotlin module&apis<a | ||
href="https://github.com/tangcent/easy-api/issues/140">(#140)</a> | ||
<li>script config: class.name()<a | ||
href="https://github.com/tangcent/easy-api/issues/155">(#155)</a> | ||
</li> | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,6 +79,9 @@ class RecommendConfigReader : ConfigReader { | |
[email protected]#value | ||
[email protected]#serialize | ||
#ignore transient field | ||
json.rule.field.ignore=groovy:it.hasModifier("transient") | ||
#The ObjectId and Date are parsed as strings | ||
json.rule.convert[org.bson.types.ObjectId]=java.lang.String | ||
json.rule.convert[java.util.Date]=java.lang.String | ||
|
Oops, something went wrong.