@union tag in request or response

Hi!

Perhaps I have misunderstood the DSDL spec, but are the below DSDL examples correct?

Example1. Request contains code and a union of type1_value/type2_value

# Service SetMyTypeValue
# Request
uint8 code
@union
MyType1 type1_value
MyType2 type2_value
 
---
 
#Response
MyResponseCode code

Or

Example2. Response contains code and a union of type1_value/type2_value

# Service GetMyTypeValue
# Request
uint8 code

---
 
#Response
MyResponseCode code
@union
MyType1 type1_value
MyType2 type2_value

When compiled, I noticed that all members in request (example 1) and response (example 2) becomes part of the union. Am I correct?

Do I have to put the unions in its own type?

When compiled, I noticed that all members in request (example 1) and response (example 2) becomes part of the union. Am I correct?

Yes.

Do I have to put the unions in its own type?

Yes.

As I thought =) Thanks.