Comments (9)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
from goa.
Poke
from goa.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
from goa.
Poke
from goa.
There are two issues:
- Unneeded package name prefix for a qualified identifier (e.g.
payloads.Associations
) (resolved by #3469) - Missing imports (e.g.
data
)
The second issue is unclear whether it is a specification or a bug. The Meta DSL's godoc says:
Note: If that meta tag is used more that once in the same design, but with different values in the meta statement (ex. one type has Meta("struct:pkg:path", "types1") and another has Meta("struct:pkg:path", "types2")) then those two types cannot both contain a field of the same user type. For the same reason, you may not set a different custom package in a user type than the one set on a containing user type.
This specification can be reproduced by changing design as follows.
-Field(1, "resources", ArrayOf(Resource))
+Field(1, "resources", Resource)
goa gen
outputs the following error:
attribute: type "Resource" has conflicting packages common/data and common/payloads
Should Goa print the same error for Array types?
Or can we improve the specification by resolving the missing imports?
from goa.
Thank you for looking into this! This limitation was to help keep the implementation simple.
The main use case for struct:pkg:path
is to make it possible for the code generated from two different services in the same design to share the same type definitions (by using the same package path in types defined in both). This makes it convenient for user code as the same type can be reused across as opposed to having to instantiate service specific structs. The intent (at least initially) was not to make it possible to define a complex set of packages. At the end of the day the code is generated so creating a modular set of packages has limited benefits.
For example making it possible to define multiple packages for types that are related would mean having to write code that detect circular dependencies. In general the code that deals with external packages is already pretty complex so my vote would be to make sure that the ArrayOf
case generates the proper error message.
That being said if there is a strong case for making it possible to create multiple packages with types that have fields defined across the packages and if we can find an easy way to support it then that's great.
from goa.
That's nice, but it will take some time to design, so I'll add an error message for now.
Thank you.
from goa.
Great, thank you for the PR!
from goa.
Closing this issue, the TL;DR is that there was a bug and a missing validation. The decision is to not allow defining complex package types so as to keep the code simple.
from goa.
Related Issues (20)
- setting the accept header doesn't seem to work HOT 5
- Cannot access help forum HOT 3
- Does Goa create client code as well as CLI code? HOT 10
- Support OpenAPI V3 YAML/JSON oneof HOT 4
- can't set cookie 'SameSite' attribute HOT 2
- How to get the native *http.Request from the payload? HOT 2
- Missing schemas in OpenAPI spec when using union types HOT 3
- Declare POST request contain an array of object HOT 2
- Bumping goa.design/plugins/v3 from 3.14.0 to 3.14.1 is causing my client generation to fail HOT 3
- Generated code for nested inline attributes doesn't compile HOT 2
- Deprecated Code in Generated http.go using goa example
- meta for externalDocs and deprecated? HOT 4
- Map as Query Param not working? HOT 2
- Using Param() to map path parameters to attributes results in a runtime error HOT 5
- Panic in main HOT 2
- Goa panics when query params have unclosed square brackets HOT 2
- Goa panics when a user provides an explicit `null` where a `Map` is expected, if it's a nested structure HOT 2
- Middleware in design? HOT 6
- Goa generating uncompilable code while using views on types that contain OneOf union type
- Goa generating invalid code when OneOf types is a user defined type
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goa.