Skip to content

Commit ea32146

Browse files
heatherlpmbwhite
authored andcommitted
[FAB-15883] Removed swagger annotations
- added contact, info and license annotation files - added .vscode folder to .gitignore - fixed some typos Signed-off-by: heatherlp <[email protected]> Change-Id: I45bcff4a3b8cd98b65a3f3766cfbb9d4712e7902
1 parent 605bebe commit ea32146

File tree

13 files changed

+143
-30
lines changed

13 files changed

+143
-30
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ nbdist/
3636
.nb-gradle/
3737

3838
local-config.yaml
39-
gradle.properties
39+
gradle.properties
40+
.vscode/

fabric-chaincode-shim/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ tasks.withType(org.gradle.api.tasks.testing.Test) {
1919
dependencies {
2020
compile project(':fabric-chaincode-protos')
2121
compile 'io.netty:netty-tcnative-boringssl-static:2.0.7.Final'
22-
compile 'org.bouncycastle:bcpkix-jdk15on:1.59'
23-
compile 'org.bouncycastle:bcprov-jdk15on:1.59'
22+
compile 'org.bouncycastle:bcpkix-jdk15on:1.60'
23+
compile 'org.bouncycastle:bcprov-jdk15on:1.60'
2424
compile 'org.reflections:reflections:0.9.11'
2525
implementation 'com.github.everit-org.json-schema:org.everit.json.schema:1.11.1'
2626
compile 'io.swagger.core.v3:swagger-annotations:2.0.0'
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
Copyright IBM Corp. All Rights Reserved.
3+
4+
SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
package org.hyperledger.fabric.contract.annotation;
8+
9+
import static java.lang.annotation.RetentionPolicy.RUNTIME;
10+
11+
import java.lang.annotation.ElementType;
12+
import java.lang.annotation.Retention;
13+
import java.lang.annotation.Target;
14+
15+
/**
16+
* Class level annotation that identifies this class as being a contact. Can
17+
* be populated with email, name and url fields.
18+
*
19+
*/
20+
@Retention(RUNTIME)
21+
@Target(ElementType.TYPE)
22+
public @interface Contact {
23+
24+
String email() default "";
25+
26+
String name() default "";
27+
28+
String url() default "";
29+
30+
}

fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/contract/annotation/Contract.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,24 @@
1212
import java.lang.annotation.Retention;
1313
import java.lang.annotation.Target;
1414

15-
import io.swagger.v3.oas.annotations.info.Info;
15+
import org.hyperledger.fabric.contract.annotation.Info;
1616

1717
/**
1818
* Class level annotation that identifies this class as being a contract. Can
1919
* supply information and an alternative name for the contract rather than the
2020
* classname
21-
* <p>
22-
* The Info object can be supplied to provide additional information about the
23-
* contract; the format of this uses the OpenAPI v3 specification of info
24-
* {@link io.swagger.v3.oas.annotations.info.Info}
25-
*
2621
*/
2722
@Retention(RUNTIME)
2823
@Target(ElementType.TYPE)
2924
public @interface Contract {
3025

3126
/**
3227
* The Info object can be supplied to provide additional information about the
33-
* contract; the format of this uses the OpenAPI v3 Info format
28+
* contract, including title, description, version and license
3429
*
35-
*
36-
* @return OpenAPI v3 specification of info
37-
* {@link io.swagger.v3.oas.annotations.info.Info}
30+
* @return Info object
3831
*/
39-
Info info();
32+
Info info() default @Info();
4033

4134
/**
4235
* Normally the name of the class is used to refer to the contract (name without package).
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
Copyright IBM Corp. All Rights Reserved.
3+
4+
SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
package org.hyperledger.fabric.contract.annotation;
8+
9+
import static java.lang.annotation.RetentionPolicy.RUNTIME;
10+
11+
import java.lang.annotation.ElementType;
12+
import java.lang.annotation.Retention;
13+
import java.lang.annotation.Target;
14+
import org.hyperledger.fabric.contract.annotation.License;
15+
import org.hyperledger.fabric.contract.annotation.Contact;
16+
17+
/**
18+
* Class level annotation that identifies this class as being an info object. Can
19+
* supply additional information about the contract, including title, description,
20+
* version, license and contact information.
21+
*
22+
*/
23+
@Retention(RUNTIME)
24+
@Target(ElementType.TYPE)
25+
public @interface Info {
26+
27+
String title() default "";
28+
29+
String description() default "";
30+
31+
String version() default "";
32+
33+
String termsOfService() default "";
34+
35+
/**
36+
* License object that can be populated to include name and url.
37+
*
38+
* @return License object
39+
*
40+
*/
41+
License license() default @License();
42+
43+
/**
44+
* Contact object that can be populated with email, name and url fields.
45+
*
46+
* @return Contact object
47+
*
48+
*/
49+
Contact contact() default @Contact();
50+
51+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
Copyright IBM Corp. All Rights Reserved.
3+
4+
SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
package org.hyperledger.fabric.contract.annotation;
8+
9+
import static java.lang.annotation.RetentionPolicy.RUNTIME;
10+
11+
import java.lang.annotation.ElementType;
12+
import java.lang.annotation.Retention;
13+
import java.lang.annotation.Target;
14+
15+
/**
16+
* Class level annotation that identifies this class as being a license object. Can
17+
* be populated to include name and url.
18+
*
19+
*/
20+
@Retention(RUNTIME)
21+
@Target(ElementType.TYPE)
22+
public @interface License {
23+
24+
String name() default "";
25+
26+
String url() default "";
27+
28+
}

fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/contract/annotation/Property.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
/**
1515
* Field and parameter level annotation defining a property of the class
16-
* (identified by {@link DataType}) Can also be used on the paratemers of
16+
* (identified by {@link DataType}) Can also be used on the parameters of
1717
* transaction functions
1818
* <p>
1919
* Example of using this annotation
@@ -26,7 +26,7 @@
2626
*
2727
* // How friendly is this on a scale of 1-5, 1 being formal, 5 being familar
2828
* &#64;Property(schema = { "minimum", "1", "maximum", "5" })
29-
* private int friendlyness = 1;
29+
* private int friendliness = 1;
3030
*
3131
* </pre>
3232
*/

fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/contract/annotation/Transaction.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@
1616
* Method level annotation indicating the method to be a callable transaction
1717
* function.
1818
* <p>
19-
* These funcitons are called in client SDKs by the combination of <pre> [contractname]:[transactioname] </pre>
20-
* Unless specified other wise, the contract name is the class name (without package) and the transactio
19+
* These functions are called in client SDKs by the combination of <pre> [contractname]:[transactioname] </pre>
20+
* Unless specified otherwise, the contract name is the class name (without package) and the transaction
2121
* name is the method name.
2222
*/
2323
@Retention(RUNTIME)
2424
@Target(METHOD)
2525
public @interface Transaction {
2626
/**
2727
* TRUE indicates that this function is intended to be called with the 'submit'
28-
* semantics.
28+
* semantics
2929
*
3030
* FALSE indicates that this is intended to be called with the evaluate
3131
* semantics

fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/contract/metadata/MetadataBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import org.json.JSONObject;
3232
import org.json.JSONTokener;
3333

34-
import io.swagger.v3.oas.annotations.info.Info;
34+
import org.hyperledger.fabric.contract.annotation.Info;
3535

3636
/**
3737
* Builder to assist in production of the metadata

fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/contract/routing/impl/ContractDefinitionImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class ContractDefinitionImpl implements ContractDefinition {
3939
public ContractDefinitionImpl(Class<? extends ContractInterface> cl) {
4040

4141
Contract annotation = cl.getAnnotation(Contract.class);
42-
logger.debug(() -> "Class Contract Annodation: " + annotation);
42+
logger.debug(() -> "Class Contract Annotation: " + annotation);
4343

4444
String annotationName = annotation.name();
4545

@@ -58,7 +58,7 @@ public ContractDefinitionImpl(Class<? extends ContractInterface> cl) {
5858
unknownTx = new TxFunctionImpl(m, this);
5959
unknownTx.setUnknownTx(true);
6060
} catch (NoSuchMethodException | SecurityException e) {
61-
ContractRuntimeException cre = new ContractRuntimeException("Failure to find unknownTranction method", e);
61+
ContractRuntimeException cre = new ContractRuntimeException("Failure to find unknownTransaction method", e);
6262
logger.severe(() -> logger.formatError(cre));
6363
throw cre;
6464
}

0 commit comments

Comments
 (0)