frozen api reference types: fix typo, add section about this in README.md

This commit is contained in:
shuang 2019-08-07 20:14:43 +08:00
parent c078086190
commit f2176713eb
2 changed files with 17 additions and 3 deletions

View File

@ -560,7 +560,21 @@ allow_oauth2_login=true
oauth2.jwk_set.url=https://www.googleapis.com/oauth2/v3/certs
```
---
## Frozen APIs
API versions may be marked as "STABLE", if changes are made to an API which has been marked as "STABLE", then unit test `FrozenClassTest` will fail.
### Changes to "STABLE" api cause the tests fail:
* modify request or response body structure of apis
* add or delete apis
* change the apis versionStatus from or to "STABLE"
If is is required for a "STABLE" api to be changed, then the class metadata must be regenerated using the FrozenClassUtil (see how to freeze an api)
### Steps to freeze an api
* Run the FrozenClassUtil to regenerate persist file of frozen apis information, the file is `PROJECT_ROOT_PATH/obp-api/src/test/resources/frozen_type_meta_data`
* push the file `frozen_type_meta_data` to github
There is a video about the detail: [demonstrate the detail of the feature](https://www.youtube.com/watch?v=m9iYCSM0bKA)
## Scala / Lift
* We use scala and liftweb http://www.liftweb.net/

View File

@ -64,13 +64,13 @@ class FrozenClassTest extends ServerSetup {
(typeName, fields) <- typeNameToTypeValFields.toList
if(pTypeName == typeName && pFields != fields)
} yield {
val expectStructure = pFields.map(pair => s"${pair._1}:${pair._2}").mkString("(", ", ", ")")
val expectedStructure = pFields.map(pair => s"${pair._1}:${pair._2}").mkString("(", ", ", ")")
val actualStructure = fields.map(pair => s"${pair._1}:${pair._2}").mkString("(", ", ", ")")
s"""
|{
| typeName: $typeName
| expectStructure: $expectStructure
| expectedStructure: $expectedStructure
| actualStructure: $actualStructure
|}
|""".stripMargin