Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: migrate to lutaml-model from shale #18

Merged
merged 2 commits into from
Dec 27, 2024
Merged

wip: migrate to lutaml-model from shale #18

merged 2 commits into from
Dec 27, 2024

Conversation

ronaldtse
Copy link
Contributor

@ronaldtse ronaldtse commented Dec 21, 2024

@kwkwan can you please help us migrate to lutaml-model? The specs are failing right now with:

 bundle exec rake
~/.asdf/installs/ruby/3.3.2/bin/ruby -I~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib:~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-support-3.13.2/lib ~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb

Suma
[suma] Current directory: /private/var/folders/2t/xmdrn2sd2lv2w49dv0zw9_q00000gp/T/d20241221-47153-apohj8, writing schemas.yml...
[relaton-bib] WARN: Type `collection` is invalid.
[suma] [ERROR] Error occurred during processing. See details below.
[suma] undefined method `default' for nil
[suma] #<NoMethodError: undefined method `default' for nil>
[suma] ~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/lutaml-model-0.3.30/lib/lutaml/model/serialize.rb:385:in `block in apply_hash_mapping'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/lutaml-model-0.3.30/lib/lutaml/model/serialize.rb:377:in `each'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/lutaml-model-0.3.30/lib/lutaml/model/serialize.rb:377:in `apply_hash_mapping'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/lutaml-model-0.3.30/lib/lutaml/model/serialize.rb:314:in `apply_mappings'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/lutaml-model-0.3.30/lib/lutaml/model/attribute.rb:227:in `cast'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/lutaml-model-0.3.30/lib/lutaml/model/serialize.rb:397:in `block in apply_hash_mapping'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/lutaml-model-0.3.30/lib/lutaml/model/serialize.rb:377:in `each'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/lutaml-model-0.3.30/lib/lutaml/model/serialize.rb:377:in `apply_hash_mapping'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/lutaml-model-0.3.30/lib/lutaml/model/serialize.rb:314:in `apply_mappings'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/lutaml-model-0.3.30/lib/lutaml/model/serialize.rb:122:in `block (2 levels) in <module:ClassMethods>'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/lutaml-model-0.3.30/lib/lutaml/model/serialize.rb:109:in `public_send'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/lutaml-model-0.3.30/lib/lutaml/model/serialize.rb:109:in `block (2 levels) in <module:ClassMethods>'
~/src/mn/suma/lib/suma/collection_config.rb:15:in `from_file'
~/src/mn/suma/lib/suma/processor.rb:39:in `export_schema_config'
~/src/mn/suma/lib/suma/processor.rb:17:in `run'
~/src/mn/suma/lib/suma/cli.rb:39:in `run'
~/src/mn/suma/lib/suma/cli.rb:26:in `build'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/thor-1.3.2/lib/thor/command.rb:28:in `run'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/thor-hollaback-0.2.1/lib/thor/hollaback.rb:68:in `run'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/thor-1.3.2/lib/thor/invocation.rb:127:in `invoke_command'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/thor-1.3.2/lib/thor.rb:538:in `dispatch'
~/src/mn/suma/lib/suma/thor_ext.rb:36:in `block in start'
~/src/mn/suma/lib/suma/thor_ext.rb:45:in `handle_help_switches'
~/src/mn/suma/lib/suma/thor_ext.rb:35:in `start'
~/src/mn/suma/spec/suma/cli_spec.rb:24:in `block (2 levels) in <top (required)>'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example.rb:263:in `instance_exec'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example.rb:263:in `block in run'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example.rb:511:in `block in with_around_and_singleton_context_hooks'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example.rb:468:in `block in with_around_example_hooks'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/hooks.rb:486:in `block in run'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/hooks.rb:626:in `block in run_around_example_hooks_for'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example.rb:352:in `call'
~/src/mn/suma/spec/suma/cli_spec.rb:18:in `block (4 levels) in <top (required)>'
~/src/mn/suma/spec/suma/cli_spec.rb:17:in `chdir'
~/src/mn/suma/spec/suma/cli_spec.rb:17:in `block (3 levels) in <top (required)>'
~/.asdf/installs/ruby/3.3.2/lib/ruby/3.3.0/tmpdir.rb:99:in `mktmpdir'
~/src/mn/suma/spec/suma/cli_spec.rb:8:in `block (2 levels) in <top (required)>'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example.rb:457:in `instance_exec'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example.rb:457:in `instance_exec'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/hooks.rb:390:in `execute_with'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example.rb:352:in `call'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/hooks.rb:629:in `run_around_example_hooks_for'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/hooks.rb:486:in `run'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example.rb:468:in `with_around_example_hooks'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example.rb:511:in `with_around_and_singleton_context_hooks'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example.rb:259:in `run'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example_group.rb:646:in `block in run_examples'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example_group.rb:642:in `map'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example_group.rb:642:in `run_examples'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/example_group.rb:607:in `run'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/runner.rb:121:in `block (3 levels) in run_specs'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/runner.rb:121:in `map'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/runner.rb:121:in `block (2 levels) in run_specs'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/configuration.rb:2097:in `with_suite_hooks'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/runner.rb:116:in `block in run_specs'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/reporter.rb:74:in `report'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/runner.rb:115:in `run_specs'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/runner.rb:89:in `run'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/runner.rb:71:in `run'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/runner.rb:45:in `invoke'
~/.asdf/installs/ruby/3.3.2/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.2/exe/rspec:4:in `<main>'
  Build simple metanorma.yml manifest (FAILED - 1)
  raise ENOENT for missing manifest
[Errno::ENOENT] No such file or directory - Specified Metanorma site manifest file `not-found.yml` not found.
  non-zero exit code for missing manifest

Suma
  has a version number

Failures:

  1) Suma Build simple metanorma.yml manifest
     Failure/Error: expect(File.exist?("schemas.yml")).to be true
     
       expected true
            got false
     # ./spec/suma/cli_spec.rb:26:in `block (2 levels) in <top (required)>'
     # ./spec/suma/cli_spec.rb:18:in `block (4 levels) in <top (required)>'
     # ./spec/suma/cli_spec.rb:17:in `chdir'
     # ./spec/suma/cli_spec.rb:17:in `block (3 levels) in <top (required)>'
     # ./spec/suma/cli_spec.rb:8:in `block (2 levels) in <top (required)>'

Finished in 0.10002 seconds (files took 2.28 seconds to load)
4 examples, 1 failure

Failed examples:

rspec ./spec/suma/cli_spec.rb:23 # Suma Build simple metanorma.yml manifest

Basically, you can follow the errors using this command at the iso-10303 repo:

# Make sure Gemfile uses this branch of `suma`, then:
bundle exec suma build metanorma-smol.yml

Fixes #17
Fixes #19

@ronaldtse ronaldtse added the enhancement New feature or request label Dec 21, 2024
@kwkwan
Copy link
Contributor

kwkwan commented Dec 23, 2024

Hi @ronaldtse, the specs has been failed because there is a bug in apply_mappings when using custom method. It was fixed by @HassanAkbar at (https://github.com/lutaml/lutaml-model/pull/213/files) in branch feature/adding_enum_methods_to_serializeable in lutaml-model.

@kwkwan
Copy link
Contributor

kwkwan commented Dec 23, 2024

You may either merge the branch or cherry-pick that commit to fix it.

@ronaldtse
Copy link
Contributor Author

@kwkwan that PR still contains failing tests, I’ve pinged @HassanAkbar to mark it ready and to merge it. Thanks!

@kwkwan
Copy link
Contributor

kwkwan commented Dec 27, 2024

Hi @ronaldtse, @HassanAkbar has merged the branch and all the specs are now successful.

@ronaldtse
Copy link
Contributor Author

Thanks @kwkwan , please help merge this.

@kwkwan kwkwan merged commit d73cc7e into main Dec 27, 2024
13 of 14 checks passed
@kwkwan kwkwan deleted the rt-upgrade-lutaml branch December 27, 2024 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate to lutaml-model from Shale Failure to run due to new lutaml-model behavior with “using”
2 participants