Skip to content

Improve topology map widget documentation#3755

Open
api-clients-generation-pipeline[bot] wants to merge 2 commits into
masterfrom
datadog-api-spec/generated/5974
Open

Improve topology map widget documentation#3755
api-clients-generation-pipeline[bot] wants to merge 2 commits into
masterfrom
datadog-api-spec/generated/5974

Conversation

@api-clients-generation-pipeline

@api-clients-generation-pipeline api-clients-generation-pipeline Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

See DataDog/datadog-api-spec#5974 Test branch datadog-api-spec/test/adam.hooper/topology-widget-freshen-2

Behavior change

Solved two small parsing bugs:

oneOf matched both branches

Now, TopologyMapWidgetDefinitionDataStreams has an attribute requests with each child a TopologyRequestDataStreams. And TopologyMapWidgetDefinitionServiceMap has an attribute requests with each child TopologyRequestServiceMap.

When parsing a service-map widget, we test both branches:

  • TopologyMapWidgetDefinitionServiceMap => succeeds, because its requests contains a valid TopologyRequestServiceMap
  • TopologyMapWidgetDefinitionDataStreams => succeeds in error, because its requests contains an invalid TopologyRequestDataStreams but that _unparsed wasn't propagated to the list.

Fix: propagate _unparsed so the list is marked unparsed.

Formula Events group-by lists failed to parse

#3230 (March 2026) introduced a regression: Formula Events group-by lists failed to parse.

What we wanted:

query.get_oneof_instance()          # -> FormulaAndFunctionEventQueryDefinition
query._unparsed                     # -> False

gb = query.get_oneof_instance().group_by
type(gb)                            # -> list
gb[0].facet                         # -> '@geo.country_iso_code'
gb[0].sort.order.value              # -> 'desc'

What we shipped:

query = <FormulaAndFunctionQueryDefinition>
query.get_oneof_instance()      # -> UnparsedObject   (not the real variant!)
query._unparsed                 # -> True             (but never surfaced)

gb = query.get_oneof_instance().group_by
type(gb)                        # -> list
gb                              # -> [{'facet': ..., 'limit': 250, 'sort': {...}}]  # raw dicts
gb[0].facet                     # -> AttributeError: 'dict' object has no attribute 'facet'

This is because the parser wouldn't accept oneOf where one branch is a list.

But we didn't see this error because we weren't propagating _unparsed correctly.

Fix: deserialize_model(): accept a list as a valid oneOf child.

@api-clients-generation-pipeline api-clients-generation-pipeline Bot force-pushed the datadog-api-spec/generated/5974 branch from 4bff6f6 to 98b2f1b Compare July 9, 2026 19:05
@api-clients-generation-pipeline api-clients-generation-pipeline Bot changed the title Dashboards: document topology_map widget Improve topology map widget documentation Jul 9, 2026
Two related deserialization bugs surfaced when parsing the topology_map
and geomap dashboard widgets:

- ModelNormal.set_attribute only propagated _unparsed from list elements
  that were UnparsedObject instances, missing nested OpenApiModel
  instances that were themselves _unparsed. A topology_map request whose
  query carried a mismatched data_source enum could ambiguously satisfy
  both oneOf variants without being flagged.

- allows_single_value_input skipped list oneOf branches, returning False
  for a ModelComposed such as FormulaAndFunctionEventQueryGroupByConfig
  (oneOf of a group-by list or a flat fields object). deserialize_model
  then splatted a list input into positional args, crashing
  ModelComposed.__init__; the TypeError was swallowed during matching and
  masked the failure once _unparsed propagation was fixed.

Propagate _unparsed from nested models in lists, and treat a list oneOf
branch as allowing single-value input so list inputs route through
get_oneof_instance. Applied to both the generated model_utils.py and the
generator template.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant