Henrik Lindberg this is documented but still unexpected behavior for users (inability to load definitions of different kinds of puppet objects from the same file). Is this considered a bug and on the roadmap to be addressed?
Justin Stoller I consider this to be a bug, the issue is that the endpoint is not instrumented with access to the loaders (required to resolve data types). Ping Thomas Hallgren. Targeting the next .z release for this.
In Puppet 6 there is validation checking if a loaded definition is in the right place, I think that also catches extra definitions in loaded files (since they would be in the "wrong location"). This means that users would see a more actionable error.
Still, not sure if the endpoint in question will run into other valid situations where loaders are needed.
This issue was reported against an EOL version of puppet, and the resource_type API was removed in Puppet 5, so I'm going to close this. Anyone wanting this information should be using the new environment_classes REST API instead.