-
Notifications
You must be signed in to change notification settings - Fork 176
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
[DNM, Dupe] fix(cli): namespacing no longer breaks when objects conflict across namespaces #4596
Conversation
const declarationFile = getDeclarationFileForSchema(schema); | ||
const typeDeclaration = buildTypeDeclaration({ schema, context, declarationFile }); | ||
const declarationFile = getDeclarationFileForSchema(schema); | ||
const typeDeclaration = buildTypeDeclaration({ schema, context, declarationFile, namespace }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really only nesting the for loop into another for loop, the only actual change is passing in namespace here
x-fern-type-name: Pets | ||
Error: | ||
x-fern-type-name: Error | ||
__no_namespace__: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not positive what would cause this
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
import { Namespace, SdkGroupName, EndpointSdkName } from "@fern-api/openapi-ir-sdk"; | ||
|
||
export function getNamespaceFromGroup(groupName: SdkGroupName): string | undefined { | ||
return groupName.find((group): group is Namespace => typeof group !== "string" && group.type === "namespace")?.name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this would be easier to read if we refactored the type guard outside of the lambda
The schemas are organized by namespace and schema name. | ||
The schema name is the key in the inner map. | ||
Note that this also includes un-namespaced schemas with a static sentinel key of `__no_namespace__`, | ||
as even when namespacing we allow for root, unnamespaced APIs, and this allows for the most flexibility. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
c4fde91
to
7b4ae37
Compare
For now, this just adds a repro of the namespace break, you can see in the ETE test,
trains
imports fromneopets
(a different namespace) when the objects share the same name