Skip to content

Feature/funpayparsers 080 sync#34

Open
Flummy1 wants to merge 3 commits intodevfrom
feature/funpayparsers-080-sync
Open

Feature/funpayparsers 080 sync#34
Flummy1 wants to merge 3 commits intodevfrom
feature/funpayparsers-080-sync

Conversation

@Flummy1
Copy link
Copy Markdown
Contributor

@Flummy1 Flummy1 commented Apr 15, 2026

Summary

  • Bumps funpayparsers dependency from >=0.7.0,<0.8.0 to >=0.8.0,<0.9.0
  • Adds new types introduced in funpayparsers 0.8.0 to funpaybotengine.types

Changes

New module — types/subcategory_structure.py

Re-exports three new types from funpayparsers.types.subcategory_structure:

  • FieldCondition — visibility condition for a subcategory field (field_id + set of trigger values)
  • SubcategoryFieldDef — full definition of a single subcategory field (id, type, label, conditions, options)
  • SubcategoryStructure — derived structure for O(1) lookup by field ID, with label_map and lower_label_map (case-insensitive)

Note: SubcategoryFieldType enum is already available via enums.py (re-exported from funpayparsers).

OfferFields — two new members

  • field_schema: list[SubcategoryFieldDef] — populated by OfferFieldsParser from the data-fields JSON attribute; empty list for chips offers
  • subcategory_structure property — builds a SubcategoryStructure from field_schema on demand

Breaking changes

None. All additions are backwards-compatible (field_schema defaults to [])

nh2tm and others added 2 commits April 15, 2026 23:48
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ypes

Re-export FieldCondition, SubcategoryFieldDef, SubcategoryStructure from
funpayparsers.types.subcategory_structure via a new types module.

Add field_schema: list[SubcategoryFieldDef] field to OfferFields and a
subcategory_structure property that builds a SubcategoryStructure on demand.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Flummy1 Flummy1 requested a review from qvvonk as a code owner April 15, 2026 20:58
FieldCondition, SubcategoryFieldDef and SubcategoryStructure are now
proper Pydantic models inheriting from FunPayObject instead of
re-exporting the funpayparsers dataclasses directly.

Each class owns its _add_raw_source validator:
- FieldCondition/SubcategoryStructure: no raw_source on the parser side,
  generate a stable JSON identifier on construction
- SubcategoryFieldDef: raw_source already present on the parser dataclass,
  let from_attributes carry it through; fallback for dict construction

SubcategoryStructure.from_offer_fields is added as a classmethod and used
by OfferFields.subcategory_structure property. OfferFields.field_schema now
stores engine SubcategoryFieldDef instances.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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

Successfully merging this pull request may close these issues.

2 participants