Skip to content

Commit 724363b

Browse files
authored
Rename isbn field for openapi-generator-server guide (#1440)
All caps generation with Gradle had an issue micronaut-projects/micronaut-openapi#1472 Whilst that should fix it, this PR renames the guide again works for both build tools and 4.3.5-SNAPSHOT
1 parent ed7c2b6 commit 724363b

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

guides/micronaut-openapi-generator-server/java/src/main/java/example/micronaut/controller/BooksController.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void addBook(BookInfo bookInfo) {
5050
bookRepository.save(bookInfo.getName(), // <3>
5151
bookInfo.getAvailability(),
5252
bookInfo.getAuthor(),
53-
bookInfo.getISBN());
53+
bookInfo.getIsbn());
5454
}
5555
//end::addBook[]
5656

@@ -68,7 +68,7 @@ public List<BookInfo> search(
6868

6969
private BookInfo map(BookEntity entity) {
7070
var book = new BookInfo(entity.name(), entity.availability());
71-
book.setISBN(entity.isbn());
71+
book.setIsbn(entity.isbn());
7272
book.setAuthor(entity.author());
7373
return book;
7474
}

guides/micronaut-openapi-generator-server/java/src/main/resources/library-definition.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ components:
7272
name: {type: string}
7373
availability: {$ref: "#/components/schemas/BookAvailability"} # <3>
7474
author: {type: string, minLength: 3}
75-
ISBN: {type: string, pattern: "[0-9]{13}"}
75+
isbn: {type: string, pattern: "[0-9]{13}"}
7676
required: ["name", "availability"]
7777
BookAvailability: # <4>
7878
type: string

guides/micronaut-openapi-generator-server/java/src/test/java/example/micronaut/controller/BooksControllerTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class BooksControllerTest {
4040
void addBookClientApiTest() {
4141
var body = new BookInfo("Building Microservices", BookAvailability.AVAILABLE);
4242
body.setAuthor("Sam Newman");
43-
body.setISBN("9781492034025");
43+
body.setIsbn("9781492034025");
4444
var response = client.toBlocking()
4545
.exchange(HttpRequest.POST("/add", body)); // <3>
4646
assertEquals(HttpStatus.OK, response.status()); // <4>

guides/micronaut-openapi-generator-server/java/src/test/java/example/micronaut/model/BookInfoTest.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,15 @@ public void authorTest() {
8484
@Test
8585
public void ISBNTest() {
8686
BookInfo bookInfo = new BookInfo("Alice's Adventures in Wonderland", BookAvailability.AVAILABLE)
87-
.ISBN(null);
87+
.isbn(null);
8888
assertTrue(validator.validate(bookInfo).isEmpty());
8989

9090
bookInfo = new BookInfo("Alice's Adventures in Wonderland", BookAvailability.AVAILABLE)
91-
.ISBN("9783161484100");
91+
.isbn("9783161484100");
9292
assertTrue(validator.validate(bookInfo).isEmpty()); // <3>
9393

9494
bookInfo = new BookInfo("Alice's Adventures in Wonderland", BookAvailability.AVAILABLE)
95-
.ISBN("9783161 84100");
95+
.isbn("9783161 84100");
9696
assertFalse(validator.validate(bookInfo).isEmpty()); // <4>
9797
}
9898
//end::otherProperties[]
@@ -106,7 +106,7 @@ public void ISBNTest() {
106106
public void bookInfoJsonSerialization() {
107107
BookInfo requiredBookInfo = new BookInfo("Alice's Adventures in Wonderland", BookAvailability.AVAILABLE)
108108
.author("Lewis Carroll")
109-
.ISBN("9783161484100");
109+
.isbn("9783161484100");
110110

111111
BookInfo bookInfo = httpClient.toBlocking().retrieve(HttpRequest.GET("/bookinfo"), BookInfo.class); // <5>
112112
assertEquals(requiredBookInfo, bookInfo);
@@ -120,7 +120,7 @@ static class BookInfoSerdeController {
120120
BookInfo index() { // <4>
121121
return new BookInfo("Alice's Adventures in Wonderland", BookAvailability.AVAILABLE)
122122
.author("Lewis Carroll")
123-
.ISBN("9783161484100");
123+
.isbn("9783161484100");
124124
}
125125
}
126126
//end::jsonSerialization[]

0 commit comments

Comments
 (0)