My question is similar to this one, however in my case, my Apex classes are Dynamic, auto-generated by an External Service that I created.
I started off by creating a Salesforce DX project. Next I created a scratch org based on the project's definition file. Then I opened up the scratch org and created an External Service and 2 companion Flows utilizing the External Service. After testing the Flows locally in my scratch org, I force:source:pull'ed what I assumed were all of the changes back into my project.
I then subsequently created another scratch org and attempted to force:source:push the code into the 2nd scratch org, with the intention of validating my changes. However, the force:source:push resulted in the following error:
"MY_FLOW_NAME (Variable) - "apexClass" is invalid. Provide the API name of an Apex class that includes an Apex data type supported in flows."
When looking at the source files that the sfdx CLI pulled into my project, I can see the External Service definition, however nowhere do I see the name of the Dynamic Apex classes created, so I'm not really sure how/where I would provide the API name.
There was a comment in the other question that I referenced that asked if the poster's package included permissions for the Apex class. In my case, I'm not seeing any specific permission settings related to those Dynamic Apex classes, so I'm wondering if that's the problem. In which case, I'm not sure what I would need to do to fix it.
I'm really scratching my head trying to figure out how to get past this blocker. Any help would be greatly appreciated.