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

Libninja panics while processing the commercetools OpenAPI spec #19

Open
mseele opened this issue Dec 21, 2023 · 1 comment
Open

Libninja panics while processing the commercetools OpenAPI spec #19

mseele opened this issue Dec 21, 2023 · 1 comment

Comments

@mseele
Copy link

mseele commented Dec 21, 2023

I want to generate a commercetools OpenAPI client and tried to process the OpenAPI spec from commercetools:

https://github.com/commercetools/commercetools-api-reference/blob/main/oas/api/openapi.yaml

Unfortunalty then generation failed with a panic:

libninja gen -l rust ct -o ct openapi.yaml
ct/Cargo.toml: Wrote file.
ct/src/model.rs: Wrote file.
ct/src/model/address.rs: Wrote file.
ct/src/model/address_draft.rs: Wrote file.
ct/src/model/api_client.rs: Wrote file.
ct/src/model/api_client_paged_query_response.rs: Wrote file.
ct/src/model/approval_flow.rs: Wrote file.
ct/src/model/approval_flow_approval.rs: Wrote file.
ct/src/model/approval_flow_paged_query_response.rs: Wrote file.
ct/src/model/approval_flow_rejection.rs: Wrote file.
ct/src/model/approval_flow_update_action.rs: Wrote file.
ct/src/model/approval_rule.rs: Wrote file.
ct/src/model/approval_rule_paged_query_response.rs: Wrote file.
ct/src/model/approval_rule_update_action.rs: Wrote file.
ct/src/model/approver_conjunction.rs: Wrote file.
ct/src/model/approver_conjunction_draft.rs: Wrote file.
ct/src/model/approver_disjunction.rs: Wrote file.
ct/src/model/approver_disjunction_draft.rs: Wrote file.
ct/src/model/approver_hierarchy.rs: Wrote file.
ct/src/model/approver_hierarchy_draft.rs: Wrote file.
ct/src/model/asset.rs: Wrote file.
ct/src/model/asset_dimensions.rs: Wrote file.
ct/src/model/asset_draft.rs: Wrote file.
ct/src/model/asset_source.rs: Wrote file.
ct/src/model/assigned_product_reference.rs: Wrote file.
ct/src/model/assigned_product_selection.rs: Wrote file.
ct/src/model/assigned_product_selection_paged_query_response.rs: Wrote file.
ct/src/model/associate.rs: Wrote file.
ct/src/model/associate_draft.rs: Wrote file.
ct/src/model/associate_role.rs: Wrote file.
ct/src/model/associate_role_assignment.rs: Wrote file.
ct/src/model/associate_role_assignment_draft.rs: Wrote file.
ct/src/model/associate_role_key_reference.rs: Wrote file.
ct/src/model/associate_role_paged_query_response.rs: Wrote file.
ct/src/model/associate_role_resource_identifier.rs: Wrote file.
ct/src/model/associate_role_update_action.rs: Wrote file.
ct/src/model/attribute.rs: Wrote file.
ct/src/model/attribute_definition.rs: Wrote file.
ct/src/model/attribute_definition_draft.rs: Wrote file.
ct/src/model/attribute_group.rs: Wrote file.
ct/src/model/attribute_group_paged_query_response.rs: Wrote file.
ct/src/model/attribute_group_update_action.rs: Wrote file.
ct/src/model/attribute_reference.rs: Wrote file.
ct/src/model/attribute_type.rs: Wrote file.
ct/src/model/base_address.rs: Wrote file.
ct/src/model/base_resource.rs: Wrote file.
ct/src/model/business_unit.rs: Wrote file.
ct/src/model/business_unit_configuration.rs: Wrote file.
ct/src/model/business_unit_key_reference.rs: Wrote file.
ct/src/model/business_unit_paged_query_response.rs: Wrote file.
ct/src/model/business_unit_resource_identifier.rs: Wrote file.
ct/src/model/business_unit_update_action.rs: Wrote file.
ct/src/model/cart.rs: Wrote file.
ct/src/model/cart_discount.rs: Wrote file.
ct/src/model/cart_discount_paged_query_response.rs: Wrote file.
ct/src/model/cart_discount_reference.rs: Wrote file.
ct/src/model/cart_discount_resource_identifier.rs: Wrote file.
ct/src/model/cart_discount_target.rs: Wrote file.
ct/src/model/cart_discount_update_action.rs: Wrote file.
ct/src/model/cart_discount_value.rs: Wrote file.
ct/src/model/cart_discount_value_draft.rs: Wrote file.
ct/src/model/cart_paged_query_response.rs: Wrote file.
ct/src/model/cart_reference.rs: Wrote file.
ct/src/model/cart_resource_identifier.rs: Wrote file.
ct/src/model/cart_update_action.rs: Wrote file.
ct/src/model/carts_configuration.rs: Wrote file.
ct/src/model/category.rs: Wrote file.
ct/src/model/category_order_hints.rs: Wrote file.
ct/src/model/category_paged_query_response.rs: Wrote file.
ct/src/model/category_reference.rs: Wrote file.
ct/src/model/category_resource_identifier.rs: Wrote file.
ct/src/model/category_update_action.rs: Wrote file.
ct/src/model/cent_precision_money.rs: Wrote file.
ct/src/model/change_subscription.rs: Wrote file.
ct/src/model/channel.rs: Wrote file.
ct/src/model/channel_paged_query_response.rs: Wrote file.
ct/src/model/channel_reference.rs: Wrote file.
ct/src/model/channel_resource_identifier.rs: Wrote file.
ct/src/model/channel_update_action.rs: Wrote file.
ct/src/model/client_logging.rs: Wrote file.
ct/src/model/container_and_key.rs: Wrote file.
ct/src/model/created_by.rs: Wrote file.
ct/src/model/custom_fields.rs: Wrote file.
ct/src/model/custom_fields_draft.rs: Wrote file.
ct/src/model/custom_line_item.rs: Wrote file.
ct/src/model/custom_line_item_draft.rs: Wrote file.
ct/src/model/custom_line_item_import_draft.rs: Wrote file.
ct/src/model/custom_object.rs: Wrote file.
ct/src/model/custom_object_paged_query_response.rs: Wrote file.
ct/src/model/custom_shipping_draft.rs: Wrote file.
ct/src/model/customer.rs: Wrote file.
ct/src/model/customer_group.rs: Wrote file.
ct/src/model/customer_group_paged_query_response.rs: Wrote file.
ct/src/model/customer_group_reference.rs: Wrote file.
ct/src/model/customer_group_resource_identifier.rs: Wrote file.
ct/src/model/customer_group_update_action.rs: Wrote file.
ct/src/model/customer_paged_query_response.rs: Wrote file.
ct/src/model/customer_reference.rs: Wrote file.
ct/src/model/customer_resource_identifier.rs: Wrote file.
ct/src/model/customer_sign_in_result.rs: Wrote file.
ct/src/model/customer_token.rs: Wrote file.
ct/src/model/customer_update_action.rs: Wrote file.
ct/src/model/delivery.rs: Wrote file.
ct/src/model/delivery_draft.rs: Wrote file.
ct/src/model/delivery_format.rs: Wrote file.
ct/src/model/delivery_item.rs: Wrote file.
ct/src/model/destination.rs: Wrote file.
ct/src/model/direct_discount.rs: Wrote file.
ct/src/model/discount_code.rs: Wrote file.
ct/src/model/discount_code_info.rs: Wrote file.
ct/src/model/discount_code_paged_query_response.rs: Wrote file.
ct/src/model/discount_code_reference.rs: Wrote file.
ct/src/model/discount_code_update_action.rs: Wrote file.
ct/src/model/discount_on_total_price.rs: Wrote file.
ct/src/model/discounted_line_item_portion.rs: Wrote file.
ct/src/model/discounted_line_item_price.rs: Wrote file.
ct/src/model/discounted_line_item_price_draft.rs: Wrote file.
ct/src/model/discounted_line_item_price_for_quantity.rs: Wrote file.
ct/src/model/discounted_price.rs: Wrote file.
ct/src/model/discounted_price_draft.rs: Wrote file.
ct/src/model/discounted_total_price_portion.rs: Wrote file.
ct/src/model/error_object.rs: Wrote file.
ct/src/model/extension.rs: Wrote file.
ct/src/model/extension_destination.rs: Wrote file.
ct/src/model/extension_paged_query_response.rs: Wrote file.
ct/src/model/extension_trigger.rs: Wrote file.
ct/src/model/extension_update_action.rs: Wrote file.
ct/src/model/external_line_item_total_price.rs: Wrote file.
ct/src/model/external_o_auth.rs: Wrote file.
ct/src/model/external_tax_rate_draft.rs: Wrote file.
ct/src/model/facet_results.rs: Wrote file.
ct/src/model/field_container.rs: Wrote file.
ct/src/model/field_definition.rs: Wrote file.
ct/src/model/field_type.rs: Wrote file.
ct/src/model/geo_json.rs: Wrote file.
ct/src/model/graph_ql_error.rs: Wrote file.
ct/src/model/graph_ql_error_location.rs: Wrote file.
ct/src/model/graph_ql_error_object.rs: Wrote file.
ct/src/model/graph_ql_response.rs: Wrote file.
ct/src/model/hit.rs: Wrote file.
ct/src/model/image.rs: Wrote file.
ct/src/model/image_dimensions.rs: Wrote file.
ct/src/model/inherited_associate.rs: Wrote file.
ct/src/model/inherited_associate_role_assignment.rs: Wrote file.
ct/src/model/inventory_entry.rs: Wrote file.
ct/src/model/inventory_entry_update_action.rs: Wrote file.
ct/src/model/inventory_paged_query_response.rs: Wrote file.
ct/src/model/item_shipping_details.rs: Wrote file.
ct/src/model/item_shipping_details_draft.rs: Wrote file.
ct/src/model/item_shipping_target.rs: Wrote file.
ct/src/model/item_state.rs: Wrote file.
ct/src/model/key_reference.rs: Wrote file.
ct/src/model/last_modified_by.rs: Wrote file.
ct/src/model/line_item.rs: Wrote file.
ct/src/model/line_item_draft.rs: Wrote file.
ct/src/model/line_item_import_draft.rs: Wrote file.
ct/src/model/localized_string.rs: Wrote file.
ct/src/model/location.rs: Wrote file.
ct/src/model/message.rs: Wrote file.
ct/src/model/message_paged_query_response.rs: Wrote file.
ct/src/model/message_payload.rs: Wrote file.
ct/src/model/message_subscription.rs: Wrote file.
ct/src/model/messages_configuration.rs: Wrote file.
ct/src/model/method_external_tax_rate_draft.rs: Wrote file.
ct/src/model/method_tax_rate.rs: Wrote file.
ct/src/model/method_taxed_price.rs: Wrote file.
ct/src/model/money.rs: Wrote file.
ct/src/model/my_cart_update_action.rs: Wrote file.
ct/src/model/my_customer_draft.rs: Wrote file.
ct/src/model/my_customer_update_action.rs: Wrote file.
ct/src/model/my_line_item_draft.rs: Wrote file.
ct/src/model/my_payment.rs: Wrote file.
ct/src/model/my_payment_paged_query_response.rs: Wrote file.
ct/src/model/my_payment_update_action.rs: Wrote file.
ct/src/model/my_quote_request_update_action.rs: Wrote file.
ct/src/model/my_quote_update_action.rs: Wrote file.
ct/src/model/my_shopping_list_update_action.rs: Wrote file.
ct/src/model/my_transaction_draft.rs: Wrote file.
ct/src/model/order.rs: Wrote file.
ct/src/model/order_edit.rs: Wrote file.
ct/src/model/order_edit_paged_query_response.rs: Wrote file.
ct/src/model/order_edit_result.rs: Wrote file.
ct/src/model/order_edit_update_action.rs: Wrote file.
ct/src/model/order_excerpt.rs: Wrote file.
ct/src/model/order_paged_query_response.rs: Wrote file.
ct/src/model/order_paged_search_response.rs: Wrote file.
ct/src/model/order_reference.rs: Wrote file.
ct/src/model/order_search_query.rs: Wrote file.
ct/src/model/order_search_query_expression.rs: Wrote file.
ct/src/model/order_search_query_expression_value.rs: Wrote file.
ct/src/model/order_search_sorting.rs: Wrote file.
ct/src/model/order_update_action.rs: Wrote file.
ct/src/model/parcel.rs: Wrote file.
ct/src/model/parcel_draft.rs: Wrote file.
ct/src/model/parcel_measurements.rs: Wrote file.
ct/src/model/payment.rs: Wrote file.
ct/src/model/payment_info.rs: Wrote file.
ct/src/model/payment_method_info.rs: Wrote file.
ct/src/model/payment_paged_query_response.rs: Wrote file.
ct/src/model/payment_reference.rs: Wrote file.
ct/src/model/payment_status.rs: Wrote file.
ct/src/model/payment_status_draft.rs: Wrote file.
ct/src/model/payment_update_action.rs: Wrote file.
ct/src/model/price.rs: Wrote file.
ct/src/model/price_draft.rs: Wrote file.
ct/src/model/price_tier.rs: Wrote file.
ct/src/model/price_tier_draft.rs: Wrote file.
ct/src/model/product.rs: Wrote file.
ct/src/model/product_catalog_data.rs: Wrote file.
ct/src/model/product_data.rs: Wrote file.
ct/src/model/product_discount.rs: Wrote file.
ct/src/model/product_discount_paged_query_response.rs: Wrote file.
ct/src/model/product_discount_reference.rs: Wrote file.
ct/src/model/product_discount_update_action.rs: Wrote file.
ct/src/model/product_discount_value.rs: Wrote file.
ct/src/model/product_discount_value_draft.rs: Wrote file.
ct/src/model/product_paged_query_response.rs: Wrote file.
ct/src/model/product_projection.rs: Wrote file.
ct/src/model/product_projection_paged_query_response.rs: Wrote file.
ct/src/model/product_projection_paged_search_response.rs: Wrote file.
ct/src/model/product_reference.rs: Wrote file.
ct/src/model/product_selection.rs: Wrote file.
ct/src/model/product_selection_assignment.rs: Wrote file.
ct/src/model/product_selection_paged_query_response.rs: Wrote file.
ct/src/model/product_selection_product_paged_query_response.rs: Wrote file.
ct/src/model/product_selection_reference.rs: Wrote file.
ct/src/model/product_selection_resource_identifier.rs: Wrote file.
ct/src/model/product_selection_setting.rs: Wrote file.
ct/src/model/product_selection_setting_draft.rs: Wrote file.
ct/src/model/product_selection_update_action.rs: Wrote file.
ct/src/model/product_type.rs: Wrote file.
ct/src/model/product_type_paged_query_response.rs: Wrote file.
ct/src/model/product_type_reference.rs: Wrote file.
ct/src/model/product_type_resource_identifier.rs: Wrote file.
ct/src/model/product_type_update_action.rs: Wrote file.
ct/src/model/product_update_action.rs: Wrote file.
ct/src/model/product_variant.rs: Wrote file.
ct/src/model/product_variant_availability.rs: Wrote file.
ct/src/model/product_variant_channel_availability_map.rs: Wrote file.
ct/src/model/product_variant_draft.rs: Wrote file.
ct/src/model/product_variant_exclusion.rs: Wrote file.
ct/src/model/product_variant_import_draft.rs: Wrote file.
ct/src/model/product_variant_selection.rs: Wrote file.
ct/src/model/products_in_store_paged_query_response.rs: Wrote file.
ct/src/model/project.rs: Wrote file.
ct/src/model/project_update_action.rs: Wrote file.
ct/src/model/query_price.rs: Wrote file.
ct/src/model/quote.rs: Wrote file.
ct/src/model/quote_paged_query_response.rs: Wrote file.
ct/src/model/quote_reference.rs: Wrote file.
ct/src/model/quote_request.rs: Wrote file.
ct/src/model/quote_request_paged_query_response.rs: Wrote file.
ct/src/model/quote_request_reference.rs: Wrote file.
ct/src/model/quote_request_resource_identifier.rs: Wrote file.
ct/src/model/quote_request_update_action.rs: Wrote file.
ct/src/model/quote_resource_identifier.rs: Wrote file.
ct/src/model/quote_update_action.rs: Wrote file.
ct/src/model/reference.rs: Wrote file.
ct/src/model/resource_identifier.rs: Wrote file.
ct/src/model/return_info.rs: Wrote file.
ct/src/model/return_item.rs: Wrote file.
ct/src/model/return_item_draft.rs: Wrote file.
ct/src/model/review.rs: Wrote file.
ct/src/model/review_paged_query_response.rs: Wrote file.
ct/src/model/review_rating_statistics.rs: Wrote file.
ct/src/model/review_update_action.rs: Wrote file.
ct/src/model/rule_approver.rs: Wrote file.
ct/src/model/rule_approver_draft.rs: Wrote file.
ct/src/model/rule_requester.rs: Wrote file.
ct/src/model/rule_requester_draft.rs: Wrote file.
ct/src/model/scoped_price.rs: Wrote file.
ct/src/model/search_indexing_configuration.rs: Wrote file.
ct/src/model/search_indexing_configuration_values.rs: Wrote file.
ct/src/model/search_keywords.rs: Wrote file.
ct/src/model/shipping.rs: Wrote file.
ct/src/model/shipping_draft.rs: Wrote file.
ct/src/model/shipping_info.rs: Wrote file.
ct/src/model/shipping_info_import_draft.rs: Wrote file.
ct/src/model/shipping_method.rs: Wrote file.
ct/src/model/shipping_method_paged_query_response.rs: Wrote file.
ct/src/model/shipping_method_reference.rs: Wrote file.
ct/src/model/shipping_method_resource_identifier.rs: Wrote file.
ct/src/model/shipping_method_update_action.rs: Wrote file.
ct/src/model/shipping_rate.rs: Wrote file.
ct/src/model/shipping_rate_draft.rs: Wrote file.
ct/src/model/shipping_rate_input.rs: Wrote file.
ct/src/model/shipping_rate_input_draft.rs: Wrote file.
ct/src/model/shipping_rate_input_type.rs: Wrote file.
ct/src/model/shipping_rate_price_tier.rs: Wrote file.
ct/src/model/shopping_list.rs: Wrote file.
ct/src/model/shopping_list_line_item.rs: Wrote file.
ct/src/model/shopping_list_line_item_draft.rs: Wrote file.
ct/src/model/shopping_list_paged_query_response.rs: Wrote file.
ct/src/model/shopping_list_update_action.rs: Wrote file.
ct/src/model/shopping_lists_configuration.rs: Wrote file.
ct/src/model/staged_order_update_action.rs: Wrote file.
ct/src/model/staged_price_draft.rs: Wrote file.
ct/src/model/staged_quote.rs: Wrote file.
ct/src/model/staged_quote_paged_query_response.rs: Wrote file.
ct/src/model/staged_quote_reference.rs: Wrote file.
ct/src/model/staged_quote_resource_identifier.rs: Wrote file.
ct/src/model/staged_quote_update_action.rs: Wrote file.
ct/src/model/staged_standalone_price.rs: Wrote file.
ct/src/model/standalone_price.rs: Wrote file.
ct/src/model/standalone_price_paged_query_response.rs: Wrote file.
ct/src/model/standalone_price_update_action.rs: Wrote file.
ct/src/model/state.rs: Wrote file.
ct/src/model/state_paged_query_response.rs: Wrote file.
ct/src/model/state_reference.rs: Wrote file.
ct/src/model/state_resource_identifier.rs: Wrote file.
ct/src/model/state_update_action.rs: Wrote file.
ct/src/model/store.rs: Wrote file.
ct/src/model/store_country.rs: Wrote file.
ct/src/model/store_key_reference.rs: Wrote file.
ct/src/model/store_paged_query_response.rs: Wrote file.
ct/src/model/store_resource_identifier.rs: Wrote file.
ct/src/model/store_update_action.rs: Wrote file.
ct/src/model/sub_rate.rs: Wrote file.
ct/src/model/subscription.rs: Wrote file.
ct/src/model/subscription_paged_query_response.rs: Wrote file.
ct/src/model/subscription_update_action.rs: Wrote file.
ct/src/model/suggestion_result.rs: Wrote file.
ct/src/model/sync_info.rs: Wrote file.
ct/src/model/tax_category.rs: Wrote file.
ct/src/model/tax_category_paged_query_response.rs: Wrote file.
ct/src/model/tax_category_reference.rs: Wrote file.
ct/src/model/tax_category_resource_identifier.rs: Wrote file.
ct/src/model/tax_category_update_action.rs: Wrote file.
ct/src/model/tax_portion.rs: Wrote file.
ct/src/model/tax_portion_draft.rs: Wrote file.
ct/src/model/tax_rate.rs: Wrote file.
ct/src/model/tax_rate_draft.rs: Wrote file.
ct/src/model/taxed_item_price.rs: Wrote file.
ct/src/model/taxed_price.rs: Wrote file.
ct/src/model/taxed_price_draft.rs: Wrote file.
ct/src/model/text_line_item.rs: Wrote file.
ct/src/model/text_line_item_draft.rs: Wrote file.
ct/src/model/tracking_data.rs: Wrote file.
ct/src/model/transaction.rs: Wrote file.
ct/src/model/transaction_draft.rs: Wrote file.
ct/src/model/type_.rs: Wrote file.
ct/src/model/type_paged_query_response.rs: Wrote file.
ct/src/model/type_reference.rs: Wrote file.
ct/src/model/type_resource_identifier.rs: Wrote file.
ct/src/model/type_update_action.rs: Wrote file.
ct/src/model/typed_money.rs: Wrote file.
ct/src/model/typed_money_draft.rs: Wrote file.
ct/src/model/user_provided_identifiers.rs: Wrote file.
ct/src/model/zone.rs: Wrote file.
ct/src/model/zone_paged_query_response.rs: Wrote file.
ct/src/model/zone_rate.rs: Wrote file.
ct/src/model/zone_rate_draft.rs: Wrote file.
ct/src/model/zone_reference.rs: Wrote file.
ct/src/model/zone_resource_identifier.rs: Wrote file.
ct/src/model/zone_update_action.rs: Wrote file.
ct/src/request/by_project_key_get.rs: Wrote file.
ct/src/request/by_project_key_post.rs: Wrote file.
ct/src/request/by_project_key_head.rs: Wrote file.
thread 'main' panicked at mir/src/lib.rs:304:23:
"^var[_][a_z_a_z0_9]$" is not a valid Ident
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@kurtbuilds
Copy link
Owner

That's a pretty sane error message. Basically, you have a query param in operation ByProjectKeyApiClientsGet with name: /^var[.][a-zA-Z0-9]+$/. libninja fails because it's too difficult to make a valid identifier from that name.

I'd recommend changing the openapi spec (I think Readme has notes on doing that as a pipeline instead of a one-off if you need it). However, let me know if you have other suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants