Generated CWL file fails validation

I have the following code which uses the python module to generate CWL files but the generated file fails the validation test

import pprint
from ruamel.yaml import YAML
import sys
import cwl_utils.parser_v1_2 as cwl

clt = cwl.CommandLineTool(
    # eg: keys from https://github.com/common-workflow-language/cwl-utils/blob/c7308efbbbd4d64f5d479f27bf46ca6041cfb7b2/cwl_utils/parser_v1_2.py#L7000-L7021
    id="mytoolid",
    inputs=[
        cwl.CommandInputParameter("myParamId", label=None, secondaryFiles=None, format=None,
                                    streamable=None, doc=None, inputBinding=None, default=None)
    ],
    outputs=[]
)

dict_representation = clt.save()
yaml = YAML()
# yaml.dump(dict_representation, sys.stdout)
with open('nicholas.cwl', 'w') as outfile:
    yaml.dump(dict_representation, outfile)
class: CommandLineTool
id: mytoolid
inputs:
- type: myParamId
outputs: []
$ cwltool --validate nicholas.cwl 
INFO /data1/nyue/projects/workflow-languages_git/CWL/dev_venv/bin/cwltool 3.0.20210124104916
INFO Resolved 'nicholas.cwl' to 'file:///data1/nyue/projects/workflow-languages_git/CWL/vfx/nicholas.cwl'
ERROR Tool definition failed validation:
No cwlVersion found. Use the following syntax in your CWL document to declare the version: cwlVersion: <version>.
Note: if this is a CWL draft-2 (pre v1.0) document then it will need to be upgraded first.

Hello @Nicholas_Yue

At this time, you need to add a cwlVersion="v1.2" to your cwl.CommandLineTool invocation.