Closed mmccarthy67 closed 1 year ago
It looks like you're trying to use JHipster 8 beta for this. This repository's JDL expects you to use JHipster 7. If you want to use JHipster 8, this JDL should work:
/*
* This is a microservice e-commerce store sample with Gateway and three microservice applications.
* This uses eureka for service discovery and OIDC authentication.
* This also creates the required Kubernetes deployment manifests.
*/
application {
config {
baseName store
applicationType gateway
packageName com.okta.demo.store
serviceDiscoveryType eureka
authenticationType oauth2
prodDatabaseType postgresql
cacheProvider hazelcast
buildTool gradle
clientFramework react
}
entities *
}
application {
config {
baseName product
applicationType microservice
packageName com.okta.demo.product
serviceDiscoveryType eureka
authenticationType oauth2
prodDatabaseType postgresql
cacheProvider hazelcast
buildTool gradle
serverPort 8081
}
entities Product, ProductCategory, ProductOrder, OrderItem
}
application {
config {
baseName invoice
applicationType microservice
packageName com.okta.demo.invoice
serviceDiscoveryType eureka
authenticationType oauth2
prodDatabaseType postgresql
buildTool gradle
serverPort 8082
}
entities Invoice, Shipment
}
/**
* Entities for Store Gateway
*/
// Customer for the store
entity Customer {
firstName String required
lastName String required
gender Gender required
email String required pattern(/^[^@\s]+@[^@\s]+\.[^@\s]+$/)
phone String required
addressLine1 String required
addressLine2 String
city String required
country String required
}
enum Gender {
MALE, FEMALE, OTHER
}
relationship OneToOne {
Customer{user(login) required} to User with builtInEntity
}
service Customer with serviceClass
paginate Customer with pagination
/**
* Entities for product microservice
*/
// Product sold by the Online store
entity Product {
name String required
description String
price BigDecimal required min(0)
itemSize Size required
image ImageBlob
}
enum Size {
S, M, L, XL, XXL
}
entity ProductCategory {
name String required
description String
}
entity ProductOrder {
placedDate Instant required
status OrderStatus required
code String required
invoiceId Long
customer String required
}
enum OrderStatus {
COMPLETED, PENDING, CANCELLED
}
entity OrderItem {
quantity Integer required min(0)
totalPrice BigDecimal required min(0)
status OrderItemStatus required
}
enum OrderItemStatus {
AVAILABLE, OUT_OF_STOCK, BACK_ORDER
}
relationship ManyToOne {
OrderItem{product(name) required} to Product
}
relationship OneToMany {
ProductOrder{orderItem} to OrderItem{order(code) required} ,
ProductCategory{product} to Product{productCategory(name)}
}
service Product, ProductCategory, ProductOrder, OrderItem with serviceClass
paginate Product, ProductOrder, OrderItem with pagination
microservice Product, ProductOrder, ProductCategory, OrderItem with product
/**
* Entities for Invoice microservice
*/
// Invoice for sales
entity Invoice {
code String required
date Instant required
details String
status InvoiceStatus required
paymentMethod PaymentMethod required
paymentDate Instant required
paymentAmount BigDecimal required
}
enum InvoiceStatus {
PAID, ISSUED, CANCELLED
}
entity Shipment {
trackingCode String
date Instant required
details String
}
enum PaymentMethod {
CREDIT_CARD, CASH_ON_DELIVERY, PAYPAL
}
relationship OneToMany {
Invoice{shipment} to Shipment{invoice(code) required}
}
service Invoice, Shipment with serviceClass
paginate Invoice, Shipment with pagination
microservice Invoice, Shipment with invoice
/**
* Deployments
*/
deployment {
deploymentType kubernetes
appsFolders [store, invoice, product]
dockerRepositoryName "deepu105" // @Replace With Your Docker repo name@
serviceDiscoveryType eureka
kubernetesServiceType LoadBalancer
kubernetesNamespace jhipster
}
Ok cool. Thanks! I will give this a try. 😊
From: Matt Raible @.> Sent: Friday, June 23, 2023 9:16 AM To: oktadev/okta-jhipster-k8s-eks-microservices-example @.> Cc: Michael McCarthy @.>; Author @.> Subject: Re: [oktadev/okta-jhipster-k8s-eks-microservices-example] ERROR! In the relationship between Customer and User, User is not declared. (Issue #2)
It looks like you're trying to use JHipster 8 beta for this. This repository's JDL expects you to use JHipster 7. If you want to use JHipster 8, this JDL should work:
/*
application { config { baseName store applicationType gateway packageName com.okta.demo.store serviceDiscoveryType eureka authenticationType oauth2 prodDatabaseType postgresql cacheProvider hazelcast buildTool gradle clientFramework react } entities * }
application { config { baseName product applicationType microservice packageName com.okta.demo.product serviceDiscoveryType eureka authenticationType oauth2 prodDatabaseType postgresql cacheProvider hazelcast buildTool gradle serverPort 8081 } entities Product, ProductCategory, ProductOrder, OrderItem }
application { config { baseName invoice applicationType microservice packageName com.okta.demo.invoice serviceDiscoveryType eureka authenticationType oauth2 prodDatabaseType postgresql buildTool gradle serverPort 8082 } entities Invoice, Shipment }
/**
// Customer for the store entity Customer { firstName String required lastName String required gender Gender required email String required pattern(/^[^@\s]+@[^@\s]+.[^@\s]+$/ mailto:+@[%5e@\s%5d+\.%5b%5e@\s%5d+$/ ) phone String required addressLine1 String required addressLine2 String city String required country String required }
enum Gender { MALE, FEMALE, OTHER }
relationship OneToOne { Customer{user(login) required} to User with builtInEntity }
service Customer with serviceClass paginate Customer with pagination
/**
// Product sold by the Online store entity Product { name String required description String price BigDecimal required min(0) itemSize Size required image ImageBlob }
enum Size { S, M, L, XL, XXL }
entity ProductCategory { name String required description String }
entity ProductOrder { placedDate Instant required status OrderStatus required code String required invoiceId Long customer String required }
enum OrderStatus { COMPLETED, PENDING, CANCELLED }
entity OrderItem { quantity Integer required min(0) totalPrice BigDecimal required min(0) status OrderItemStatus required }
enum OrderItemStatus { AVAILABLE, OUT_OF_STOCK, BACK_ORDER }
relationship ManyToOne { OrderItem{product(name) required} to Product }
relationship OneToMany { ProductOrder{orderItem} to OrderItem{order(code) required} , ProductCategory{product} to Product{productCategory(name)} }
service Product, ProductCategory, ProductOrder, OrderItem with serviceClass paginate Product, ProductOrder, OrderItem with pagination microservice Product, ProductOrder, ProductCategory, OrderItem with product
/**
// Invoice for sales entity Invoice { code String required date Instant required details String status InvoiceStatus required paymentMethod PaymentMethod required paymentDate Instant required paymentAmount BigDecimal required }
enum InvoiceStatus { PAID, ISSUED, CANCELLED }
entity Shipment { trackingCode String date Instant required details String }
enum PaymentMethod { CREDIT_CARD, CASH_ON_DELIVERY, PAYPAL }
relationship OneToMany { Invoice{shipment} to Shipment{invoice(code) required} }
service Invoice, Shipment with serviceClass paginate Invoice, Shipment with pagination microservice Invoice, Shipment with invoice
/**
deployment { deploymentType kubernetes appsFolders [store, invoice, product] dockerRepositoryName "deepu105" // @Replace With Your Docker repo name@ serviceDiscoveryType eureka kubernetesServiceType LoadBalancer kubernetesNamespace jhipster }
— Reply to this email directly, view it on GitHub https://github.com/oktadev/okta-jhipster-k8s-eks-microservices-example/issues/2#issuecomment-1604272018 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZUGP54SC5QG5ZWH6RRYGDXMWJIVANCNFSM6AAAAAAZDRUOL4 . You are receiving this because you authored the thread. https://github.com/notifications/beacon/AAZUGP2KIHPHZ2BL65CSOELXMWJIVA5CNFSM6AAAAAAZDRUOL6WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTS7T47ZE.gif Message ID: @. @.> >
INFO! Generating jdls .\apps.jdl ERROR! An error occured while running jhipster:jdl#parseJDL ERROR! ERROR! In the relationship between Customer and User, User is not declared. If 'User' is a built-in entity declare like 'Customer to User with builtInEntity'. Error: In the relationship between Customer and User, User is not declared. If 'User' is a built-in entity declare like 'Customer to User with builtInEntity'. at checkForAbsentEntities (file:///C:/Users/micha/AppData/Roaming/npm/node_modules/generator-jhipster/dist/jdl/validators/jdl-with-application-validator.js:155:15) at file:///C:/Users/micha/AppData/Roaming/npm/node_modules/generator-jhipster/dist/jdl/validators/jdl-with-application-validator.js:97:13 at file:///C:/Users/micha/AppData/Roaming/npm/node_modules/generator-jhipster/dist/jdl/models/jdl-object.js:183:13 at file:///C:/Users/micha/AppData/Roaming/npm/node_modules/generator-jhipster/dist/jdl/models/jdl-relationships.js:78:13 at Array.forEach ()
at JDLRelationships.forEach (file:///C:/Users/micha/AppData/Roaming/npm/node_modules/generator-jhipster/dist/jdl/models/jdl-relationships.js:77:24)
at JDLObject.forEachRelationship (file:///C:/Users/micha/AppData/Roaming/npm/node_modules/generator-jhipster/dist/jdl/models/jdl-object.js:182:28)
at checkForRelationshipErrors (file:///C:/Users/micha/AppData/Roaming/npm/node_modules/generator-jhipster/dist/jdl/validators/jdl-with-application-validator.js:95:19)
at file:///C:/Users/micha/AppData/Roaming/npm/node_modules/generator-jhipster/dist/jdl/validators/jdl-with-application-validator.js:50:17
at file:///C:/Users/micha/AppData/Roaming/npm/node_modules/generator-jhipster/dist/jdl/models/jdl-object.js:73:13
ERROR! An error occured while running jhipster:jdl#customizeApplication
ERROR! An error occured while running jhipster:jdl#configure
ERROR! An error occured while running jhipster:jdl#generateJson
ERROR! An error occured while running jhipster:jdl#generate
force .yo-rc.json