if (version == Constants.EdmxVersion4)
{
await GenerateCodeForV4Clients(options, console).ConfigureAwait(false);
}
else if (version == Constants.EdmxVersion3)
{
await GenerateCodeForV3Clients(options, console).ConfigureAwait(false);
}
We check whether the version is V4 or V3 only. The GenerateCodeForV3Clients method actually supports V1, V2 and V3. So we should check for those as well.
And we should have an else block to emit an error for unsupported versions.
if (version == Constants.EdmxVersion4)
{
await GenerateCodeForV4Clients(options, console).ConfigureAwait(false);
}
else if (version == Constants.EdmxVersion3 || version == Constants.EdmxVersion2 || version == Constants.EdmxVersion1)
{
await GenerateCodeForV3Clients(options, consol, version).ConfigureAwait(false);
}
else
{
ReportUnsupportedVersionError();
}
Describe the bug
The
generate
command completes without generating code when you pass a V1 (or V2) schema.Version of the Project affected
OData CLI 0.3.0
To Reproduce
odata-cli generate -m my-v1-schema.xml -o output-dir
The command completes without emitting any errors, but no file is generated in the output directory.
Expected behavior
The output directory should contain generated code.
If there are any errors, they should be logged.
Actual behavior
No code is generated. No error is emitted.
Additional context
The offending code comes from the following snippet in
GenerateCommand.cs
: https://github.com/OData/ODataConnectedService/blob/master/src/Microsoft.OData.Cli/GenerateCommand.cs#L228We check whether the version is V4 or V3 only. The
GenerateCodeForV3Clients
method actually supports V1, V2 and V3. So we should check for those as well.And we should have an
else
block to emit an error for unsupported versions.