Repository navigation
chore(codegen): generate the public API from the upstream docs - #3240
Merged
Pavel Feldman (pavelfeldman) merged 1 commit intoOct 12, 2026
Merged
Conversation
- scripts/codegen/generate_api.js builds async_api/_generated.py and sync_api/_generated.py from docs/src/api with the upstream doc parser, instead of introspecting playwright/_impl. - scripts/codegen/python_rules.js records the Python facts that the docs do not contain. - scripts/codegen/legacy_order.json and the code marked TEMPORARY keep the old order and formatting, so that the generated diff shows only real changes. Follow-up changes remove them. - Removes the old generator scripts.
Dmitry Gozman (dgozman)
approved these changes
Oct 12, 2026
| return mapping.from_impl( | ||
| self._impl_obj.locator( | ||
| selectorOrLocator=selector_or_locator, | ||
| selectorOrLocator=mapping.to_impl(selector_or_locator), |
Contributor
There was a problem hiding this comment.
Behavior change!
|
|
||
| // Arguments whose Python name differs from the docs. | ||
| argNames: { | ||
| // The docs header says `name`, the type line says `description`; Python shipped `name`. |
| 'predicate', | ||
| ], | ||
|
|
||
| // Struct (TypedDict) names. The docs name a struct with `* alias:`; these |
Contributor
There was a problem hiding this comment.
This differs from what we do for java/.net and we should align them all I guess.
| // No docs alias. | ||
| '*.*.recordVideoSize': 'ViewportSize', | ||
| // No docs alias. | ||
| 'Page.setViewportSize.viewportSize': 'ViewportSize', |
Contributor
There was a problem hiding this comment.
I can't believe this one does not have an alias. We should add it :) Probably true for many others.
Member
Author
There was a problem hiding this comment.
My plan is to update aliases once this lands, to burn this delta down
| return mapping.from_impl( | ||
| self._impl_obj.locator( | ||
| selectorOrLocator=selector_or_locator, | ||
| selectorOrLocator=mapping.to_impl(selector_or_locator), |
Contributor
There was a problem hiding this comment.
One more behavior change!
| return mapping.from_impl( | ||
| self._impl_obj.locator( | ||
| selectorOrLocator=selector_or_locator, | ||
| selectorOrLocator=mapping.to_impl(selector_or_locator), |
Contributor
There was a problem hiding this comment.
And again.
| timeout=to_milliseconds(timeout), | ||
| storageState=storage_state, | ||
| clientCertificates=client_certificates, | ||
| clientCertificates=mapping.to_impl(client_certificates), |
Contributor
There was a problem hiding this comment.
And some more!
Pavel Feldman (pavelfeldman)
merged commit Oct 12, 2026
b93d8b9
into
microsoft:main
29 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
async_api/_generated.pyandsync_api/_generated.pyfrom the upstream docs (docs/src/api) with the upstream doc parser, instead of introspectingplaywright/_impl. Generator:scripts/codegen/generate_api.js; Python-only facts:scripts/codegen/python_rules.js.scripts/codegen/legacy_order.jsonand the code markedTEMPORARYkeep the old order and formatting, so the_generated.pydiff shows only real changes (mostly docstring fixes). The next PRs in the stack remove them.playwright/_implor tests. Stack: 1/3.