Skip to content

fix emitter for ADP #1659

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

Merged
merged 7 commits into from
Jan 9, 2023
Merged

fix emitter for ADP #1659

merged 7 commits into from
Jan 9, 2023

Conversation

changlong-liu
Copy link
Member

@changlong-liu changlong-liu commented Jan 9, 2023

@@ -247,15 +242,16 @@ function getEffectiveSchemaType(program: Program, type: Model): Model {
function getType(program: Program, type: EmitterType): any {
// don't cache simple type(string, int, etc) since decorators may change the result
const enableCache = !isSimpleType(program, type);
const effectiveModel = type.kind === "Model" ? getEffectiveSchemaType(program, type) : type;
Copy link
Member Author

@changlong-liu changlong-liu Jan 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are using effective type in emitModel (

const modelName = getName(program, type) || getEffectiveSchemaType(program, type).name;
), so we need changes here for caching by effective type to avoid emit two times for effective model.

@@ -1256,7 +1278,8 @@ function getNamespaces(context: DpgContext): Set<string> {

function emitCodeModel(context: EmitContext<EmitterOptions>) {
const dpgContext = createDpgContext(context);
const clientNamespaceString = getClientNamespaceString(dpgContext);
let clientNamespaceString = getClientNamespaceString(dpgContext);
if (clientNamespaceString) clientNamespaceString = clientNamespaceString.toLowerCase();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix the comparation at

if (namespace === clientNamespaceString) {
, since our namespaces are low cases (
return getClientNamespaceString(context)!.toLowerCase();
)

@iscai-msft iscai-msft marked this pull request as ready for review January 9, 2023 22:38
@iscai-msft iscai-msft merged commit dcb3fe9 into autorestv3 Jan 9, 2023
@iscai-msft iscai-msft deleted the 20230109-adp-0.38 branch January 9, 2023 23:10
iscai-msft added a commit that referenced this pull request Mar 10, 2023
…into cadl_ranch_branch

* 'autorestv3' of https://github.com/Azure/autorest.python: (53 commits)
  Fix publish (#1667)
  pip dev(deps-dev): bump pylint in /packages/autorest.python (#1664)
  Update package.json
  Update ChangeLog.md
  Update package.json
  Update CHANGELOG.md
  fix emitter for ADP (#1659)
  pip dev(deps-dev): bump pyright from 1.1.274 to 1.1.287 in /packages/autorest.python (#1653)
  have pipelines fail on regeneration failure (#1663)
  clean up cadl code with tim (#1657)
  Update CHANGELOG.md
  Update package.json
  Update ChangeLog.md
  use """ pair presenting enum item docs (#1655)
  [WIP] flatten JSONModelType body properties as operation parameters (#1623)
  [cadl-python] fix import and _vendor.py for subclient (#1649)
  pip prod(deps): bump m2r2 from 0.3.2 to 0.3.3 in /packages/autorest.python (#1644)
  pip prod(deps): bump platformdirs in /packages/autorest.python (#1641)
  pip prod(deps): bump pathspec in /packages/autorest.python (#1642)
  pip prod(deps): bump json-rpc in /packages/autorest.python (#1638)
  ...
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.

ADP: spread models aren't generated
2 participants