Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-40426

Unable to add validators for fields of type `array`

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.1.11
    • Component/s: Internal Code
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Sprint:
      Dev Tools 2019-04-22

      Description

      Adding a validator to this type leads to the following error from the IDL compiler:

      E:\workspace\mongo>ninja build\ninja\mongo\db\s\transaction_coordinator_test.exe
      [1/12] C:\Python27\python.exe buildscripts/idl/idlc.py --include src --base_dir build/ninja --target_arch x86_64 --header build\ninja\mongo...d\ninja\mongo\db\commands\txn_two_phase_commit_cmds_gen.cpp src\mongo\db\commands\txn_two_phase_commit_cmds.idl --write-dependencies-inline
      FAILED: build/ninja/mongo/db/commands/txn_two_phase_commit_cmds_gen.h
      C:\Python27\python.exe buildscripts/idl/idlc.py --include src --base_dir build/ninja --target_arch x86_64 --header build\ninja\mongo\db\commands\txn_two_phase_commit_cmds_gen.h --output build\ninja\mongo\db\commands\txn_two_phase_commit_cmds_gen.cpp src\mongo\db\commands\txn_two_phase_commit_cmds.idl --write-dependencies-inline
      Traceback (most recent call last):
        File "buildscripts/idl/idlc.py", line 99, in <module>
          main()
        File "buildscripts/idl/idlc.py", line 92, in main
          success = idl.compiler.compile_idl(compiler_args)
        File "E:\workspace\mongo\buildscripts\idl\idl\compiler.py", line 221, in compile_idl
          header_file_name, source_file_name)
        File "E:\workspace\mongo\buildscripts\idl\idl\generator.py", line 2368, in generate_code
          _generate_header(spec, header_file_name)
        File "E:\workspace\mongo\buildscripts\idl\idl\generator.py", line 2334, in _generate_header
          str_value = generate_header_str(spec)
        File "E:\workspace\mongo\buildscripts\idl\idl\generator.py", line 2325, in generate_header_str
          header.generate(spec)
        File "E:\workspace\mongo\buildscripts\idl\idl\generator.py", line 1009, in generate
          self.gen_validators(field)
        File "E:\workspace\mongo\buildscripts\idl\idl\generator.py", line 633, in gen_validators
          if not cpp_types.is_primitive_type(param_type):
        File "E:\workspace\mongo\buildscripts\idl\idl\cpp_types.py", line 75, in is_primitive_type
          cpp_type = cpp_type.replace(' ', '')
      AttributeError: 'NoneType' object has no attribute 'replace'
      [2/12] Checking error codes and waiting for next compile to finish
      ninja: build stopped: subcommand failed.
      

        Attachments

          Activity

            People

            Assignee:
            mark.benvenuto Mark Benvenuto
            Reporter:
            kaloian.manassiev Kaloian Manassiev
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: